From 7b38b9f305a2549a095efc207c7e5aa7600b4abb Mon Sep 17 00:00:00 2001
From: Stefan Roiser <Stefan.Roiser@cern.ch>
Date: Sun, 17 Sep 2006 22:01:11 +0000
Subject: [PATCH] scons configuration (replacing autotools) .cvsignore changes
 for new configuration

git-svn-id: http://root.cern.ch/svn/root/trunk@16288 27541ba8-7e3a-0410-8455-c3a389f83636
---
 reflex/.cvsignore                     |  4 ++
 reflex/SConstruct                     | 22 +++++++++
 reflex/inc/Reflex/.cvsignore          |  1 +
 reflex/inc/Reflex/Builder/.cvsignore  |  1 +
 reflex/inc/Reflex/internal/.cvsignore |  1 +
 reflex/inc/SConscript                 |  9 ++++
 reflex/python/.cvsignore              |  1 +
 reflex/python/SConscript              | 70 +++++++++++++++++++++++++++
 reflex/python/genreflex/.cvsignore    |  1 +
 reflex/src/.cvsignore                 |  2 +
 reflex/src/SConscript                 | 10 ++++
 reflex/test/.cvsignore                |  1 +
 reflex/test/SConscript                | 45 +++++++++++++++++
 reflex/test/testDict1/.cvsignore      |  4 +-
 reflex/test/testDict2/.cvsignore      |  4 +-
 15 files changed, 174 insertions(+), 2 deletions(-)
 create mode 100644 reflex/SConstruct
 create mode 100644 reflex/inc/Reflex/.cvsignore
 create mode 100644 reflex/inc/Reflex/Builder/.cvsignore
 create mode 100644 reflex/inc/Reflex/internal/.cvsignore
 create mode 100644 reflex/inc/SConscript
 create mode 100644 reflex/python/.cvsignore
 create mode 100644 reflex/python/SConscript
 create mode 100644 reflex/src/.cvsignore
 create mode 100644 reflex/src/SConscript
 create mode 100644 reflex/test/SConscript

diff --git a/reflex/.cvsignore b/reflex/.cvsignore
index 4be9e01ab79..cd3a2a04a62 100644
--- a/reflex/.cvsignore
+++ b/reflex/.cvsignore
@@ -2,3 +2,7 @@
 *.xcodeproj
 *.xcclassmodel
 include
+lib
+bin
+.scons*
+.sconf*
\ No newline at end of file
diff --git a/reflex/SConstruct b/reflex/SConstruct
new file mode 100644
index 00000000000..e1fe11e23d8
--- /dev/null
+++ b/reflex/SConstruct
@@ -0,0 +1,22 @@
+from os import curdir
+from os.path import realpath
+
+opts = Options('custom.py')
+
+opts.Add(BoolOption   ('test',    'Set to 1 if tests shall be compiled', 0))
+opts.Add(PathOption   ('prefix',  'The installation directory of Reflex', realpath(curdir)))
+opts.Add(PackageOption('gccxml',  'The >binary< directory of gccxml',     'no'))
+opts.Add(PackageOption('cppunit', 'The >root< directory of CppUnit',      'no'))
+
+env = Environment(options=opts)
+Export('env')
+
+Help(opts.GenerateHelpText(env))
+
+SConscript(['src/SConscript',
+            'inc/SConscript',
+            'python/SConscript'])
+
+if env['test'] : SConscript('test/SConscript')
+
+env.Alias('install', env['prefix'])
diff --git a/reflex/inc/Reflex/.cvsignore b/reflex/inc/Reflex/.cvsignore
new file mode 100644
index 00000000000..90d7e11d2a8
--- /dev/null
+++ b/reflex/inc/Reflex/.cvsignore
@@ -0,0 +1 @@
+.scons*
\ No newline at end of file
diff --git a/reflex/inc/Reflex/Builder/.cvsignore b/reflex/inc/Reflex/Builder/.cvsignore
new file mode 100644
index 00000000000..90d7e11d2a8
--- /dev/null
+++ b/reflex/inc/Reflex/Builder/.cvsignore
@@ -0,0 +1 @@
+.scons*
\ No newline at end of file
diff --git a/reflex/inc/Reflex/internal/.cvsignore b/reflex/inc/Reflex/internal/.cvsignore
new file mode 100644
index 00000000000..90d7e11d2a8
--- /dev/null
+++ b/reflex/inc/Reflex/internal/.cvsignore
@@ -0,0 +1 @@
+.scons*
\ No newline at end of file
diff --git a/reflex/inc/SConscript b/reflex/inc/SConscript
new file mode 100644
index 00000000000..f8df825f358
--- /dev/null
+++ b/reflex/inc/SConscript
@@ -0,0 +1,9 @@
+from glob import glob
+from os import sep, walk
+
+Import('env')
+
+dest_dir = env['prefix']+sep+'include'
+
+for root,d,f in walk('.'): map( lambda x: env.Install(dest_dir+sep+root, x), glob(root+sep+'*.h'))
+
diff --git a/reflex/python/.cvsignore b/reflex/python/.cvsignore
new file mode 100644
index 00000000000..90d7e11d2a8
--- /dev/null
+++ b/reflex/python/.cvsignore
@@ -0,0 +1 @@
+.scons*
\ No newline at end of file
diff --git a/reflex/python/SConscript b/reflex/python/SConscript
new file mode 100644
index 00000000000..386f6b988ea
--- /dev/null
+++ b/reflex/python/SConscript
@@ -0,0 +1,70 @@
+from sys import platform
+from os import walk, curdir, sep, chmod
+from os.path import dirname, join
+from glob import glob
+from py_compile import compile
+
+Import('env')
+
+dest_dir = env['prefix']+sep+'lib'+sep+'python'+sep
+
+# move the source to the target and empty the source list
+def exchg(target, source, env):
+  target = source
+  source = []
+  return target,source
+
+# custom builder for the gccxmlpath.py file
+def build_gccxmlpath_py(target, source, env):
+  f = open(target[0].get_abspath() ,'w')
+  f.write("gccxmlpath='%s'\n" % env['gccxml'])
+  f.close()
+
+# custom builder for byte compilation
+def py_compile(target, source, env):
+  compile(source[0].get_abspath())
+
+# custom builder for the genreflex wrapper script
+def build_genreflex_exe(target, source, env):
+  f = open(target[0].get_abspath(),'w')
+  if platform == 'win32' :
+    f.write('@echo off\n')
+    f.write('python %s\lib\python\genreflex\genreflex.py \%*\n' % env['prefix'])
+  else :
+    f.write('#!/bin/sh\n')
+    f.write('eval "python %s/lib/python/genreflex/genreflex.py $*"\n' % env['prefix'])
+  f.close()
+  chmod(target[0].get_abspath(),0755)
+
+# attach the builders to the environment
+env['BUILDERS']['GccxmlpathPy'] = Builder(action=build_gccxmlpath_py, emitter=exchg)
+env['BUILDERS']['GenreflexExe'] = Builder(action=build_genreflex_exe, emitter=exchg)
+env['BUILDERS']['PyCompile'] = Builder(action=py_compile, suffix='.pyc', src_suffix='.py')
+
+#
+# Building starts here
+#
+
+# generate the genreflex wrapper script
+genreflexe = env['prefix']+sep+'bin'+sep+'genreflex'
+if platform == 'win32' : genreflexe += '.bat'
+env.GenreflexExe(genreflexe)
+
+#produce a list of all python files in the python tree
+py_files = []
+for root,d,f in walk('.') : py_files += glob(root+sep+'*.py')
+
+# remove not necessary files from the list
+py_files.remove('./genreflex/genreflex-rootcint.py')
+
+# install all python files found 
+map( lambda x: env.Install(dest_dir+sep+dirname(x), x), py_files)
+
+# if the gccxml option was give, produce the gccxmlpath.py file
+if env['gccxml'] : py_files.append(curdir+sep+env.GccxmlpathPy(dest_dir+sep+'genreflex'+sep+'gccxmlpath.py')[0].get_abspath()[len(dest_dir):])
+
+# compile the python files
+map( lambda x : env.PyCompile(x), [join(dest_dir,x) for x in py_files])
+
+
+#i,o,e = popen3('python setup.py install --home=%s' % env['prefix'])
diff --git a/reflex/python/genreflex/.cvsignore b/reflex/python/genreflex/.cvsignore
index 0d20b6487c6..35b1f74752a 100644
--- a/reflex/python/genreflex/.cvsignore
+++ b/reflex/python/genreflex/.cvsignore
@@ -1 +1,2 @@
 *.pyc
+.scons*
\ No newline at end of file
diff --git a/reflex/src/.cvsignore b/reflex/src/.cvsignore
new file mode 100644
index 00000000000..f6adf806ac8
--- /dev/null
+++ b/reflex/src/.cvsignore
@@ -0,0 +1,2 @@
+*.os
+.scons*
\ No newline at end of file
diff --git a/reflex/src/SConscript b/reflex/src/SConscript
new file mode 100644
index 00000000000..dc1268dbb29
--- /dev/null
+++ b/reflex/src/SConscript
@@ -0,0 +1,10 @@
+from os import sep
+from glob import glob
+
+Import('env')
+
+dest_dir = env['prefix']+sep+'lib'
+
+sl = env.SharedLibrary('Reflex', glob('*.cxx'), CPPPATH=env['prefix']+'/include')
+
+env.Install(dest_dir, sl)
diff --git a/reflex/test/.cvsignore b/reflex/test/.cvsignore
index e86d771df3a..d0ca3b938ef 100644
--- a/reflex/test/.cvsignore
+++ b/reflex/test/.cvsignore
@@ -5,3 +5,4 @@ test_Reflex_simple1
 test_Reflex_simple2
 *_rflx.cpp
 local_*
+.scons*
\ No newline at end of file
diff --git a/reflex/test/SConscript b/reflex/test/SConscript
new file mode 100644
index 00000000000..8b5dbc65a16
--- /dev/null
+++ b/reflex/test/SConscript
@@ -0,0 +1,45 @@
+from os import environ, pathsep, sep, system
+from os.path import dirname
+from sys import platform
+
+Import('env')
+
+def genreflex(target, source, env):
+  system(env['prefix']+sep+'bin'+sep+'genreflex ' +
+         source[0].get_abspath() +
+         ' -s' + dirname(source[0].get_abspath()) + sep + 'selection.xml' +
+         ' -o' + target[0].get_abspath() +
+         ' --quiet' +
+         ' -I' + env['prefix']+sep+'include')
+
+env['BUILDERS']['Genreflex'] = Builder(action=genreflex, suffix='_rflx.cpp', src_suffix='.h')
+
+Program('test_Reflex_generate.cxx', CPPPATH=[env['prefix']+sep+'inc'], LIBS=['Reflex'], LIBPATH=[env['prefix']+sep+'lib'])
+
+if env['cppunit'] :
+  
+  incd = [ env['prefix']+sep+'include', env['cppunit']+sep+'include' ]
+  libd = [ env['prefix']+sep+'lib',     env['cppunit']+sep+'lib' ]
+  libs = ['Reflex', 'cppunit']
+
+  Program('test_Reflex_unit.cxx'       , CPPPATH=incd+['..'], LIBS=libs, LIBPATH=libd)
+  Program('test_ReflexBuilder_unit.cxx', CPPPATH=incd, LIBS=libs, LIBPATH=libd)
+  Program('test_Reflex_simple1.cxx'    , CPPPATH=incd, LIBS=libs, LIBPATH=libd)
+  Program('test_Reflex_simple2.cxx'    , CPPPATH=incd, LIBS=libs, LIBPATH=libd)
+
+else :
+
+  print 'scons: WARNING: CppUnit library not found, no CppUnit tests will be compiled'
+
+if env['gccxml'] :
+
+  env.SharedLibrary('test_ReflexRflx', env.Genreflex('testDict1/Reflex.h'), CPPPATH=[env['prefix']+sep+'include'], LIBS=['Reflex'], LIBPATH=[env['prefix']+sep+'lib'], SHLINKFLAGS='$LINKFLAGS -bundle')
+
+  env.SharedLibrary('test_Class2DictRflx', env.Genreflex('testDict2/Class2Dict'), CPPPATH=[env['prefix']+sep+'include'], LIBS=['Reflex'], LIBPATH=[env['prefix']+sep+'lib'], SHLINKFLAGS='$LINKFLAGS -bundle')
+  
+
+else :
+
+  print 'scons: WARNING: No gccxml executable found, either pass option "gccxml" to scons invocation or put gccxml into you PATH'
+  print 'scons: WARNING: No dictionary libraries can be created without gccxml, some tests will fail to run without dictionaries'
+
diff --git a/reflex/test/testDict1/.cvsignore b/reflex/test/testDict1/.cvsignore
index 6d5ac9616bf..f7bff7c7750 100644
--- a/reflex/test/testDict1/.cvsignore
+++ b/reflex/test/testDict1/.cvsignore
@@ -1,2 +1,4 @@
 *_rflx.cpp
-Reflex.xml
\ No newline at end of file
+Reflex.xml
+.scons*
+*.os
\ No newline at end of file
diff --git a/reflex/test/testDict2/.cvsignore b/reflex/test/testDict2/.cvsignore
index c9002655262..1200662073a 100644
--- a/reflex/test/testDict2/.cvsignore
+++ b/reflex/test/testDict2/.cvsignore
@@ -1,2 +1,4 @@
 *_rflx.cpp
-Class2Dict.xml
\ No newline at end of file
+Class2Dict.xml
+.scons*
+*.os
\ No newline at end of file
-- 
GitLab