From: g0dil Date: Wed, 26 Aug 2009 11:50:57 +0000 (+0000) Subject: Change default install to build tar-able and complete 'dist' folder X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=38209f46f0add1b02ed39454072b38a6b9729d31;p=senf.git Change default install to build tar-able and complete 'dist' folder git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1339 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/.gitignore b/.gitignore index 3f110ea..f5aa1f7 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ doc/ .test.bin .test.stamp /libsenf_g.a +/TODO +/dist/ diff --git a/SConstruct b/SConstruct index 291a94e..6459465 100644 --- a/SConstruct +++ b/SConstruct @@ -17,6 +17,7 @@ env.Tool('CopyToDir') env.Tool('Boost') env.Tool('CombinedObject') env.Tool('PhonyTarget') +env.Tool('InstallDir') env.Help(""" Additional top-level build targets: @@ -27,13 +28,22 @@ examples Build all examples all_tests Build and run unit tests for all modules all_docs Build documentation for all modules all Build everything -install_all Install SENF into $PREFIX +install_all Install SENF into $$PREFIX deb Build debian source and binary package debsrc Build debian source package debbin Build debian binary package linklint Check links of doxygen documentation with 'linklint' fixlinks Fix broken links in doxygen documentation valgrind Run all tests under valgrind/memcheck + +Build parameters: + +final=1 Build optimized library without debug symbols +debug=1 Link all binaries with debug symbols (slow!) +syslayout=1 Install into system layout directories ($$PREFIX/lib, $$PREFIX/include etc) + +additionally, any construction environment variable may be set from the scons +command line (see SConstruct file and SCons documentation for a list of variables). """) class BuildTypeOptions: @@ -61,10 +71,11 @@ env.Append( PREFIX = '#/dist', LIBINSTALLDIR = '$PREFIX${syslayout and "/lib" or ""}', - BININSTALLDIR = '$PREFIX${syslayout and "/bin" or ""', + BININSTALLDIR = '$PREFIX${syslayout and "/bin" or ""}', INCLUDEINSTALLDIR = '$PREFIX${syslayout and "/include" or ""}', - OBJINSTALLDIR = '$LIBINSTALLDIR${syslayout and "/$LIBINSTALLDIR/senf" or ""', - DOCINSTALLDIR = '$PREFIX/docs', + OBJINSTALLDIR = '${syslayout and "$LIBINSTALLDIR/senf" or "$PREFIX"}', + DOCINSTALLDIR = '$PREFIX/manual', + SCONSINSTALLDIR = '${syslayout and "$LIBINSTALLDIR/senf" or "$PREFIX"}', CPP_INCLUDE_EXTENSIONS = [ '.h', '.hh', '.ih', '.mpp', '.cci', '.ct', '.cti' ], CPP_EXCLUDE_EXTENSIONS = [ '.test.hh' ], @@ -142,6 +153,8 @@ env.Default(libsenf) env.Install('$LIBINSTALLDIR', libsenf) #### install_all, default, all_tests, all +env.Install('${SCONSINSTALLDIR}', 'site_scons') + env.Alias('install_all', env.FindInstalledFiles()) env.Alias('default', DEFAULT_TARGETS) env.Alias('all_tests', env.FindAllBoostUnitTests()) diff --git a/debian/libsenf.install b/debian/libsenf.install index 029c17b..2adc8ef 100644 --- a/debian/libsenf.install +++ b/debian/libsenf.install @@ -1,4 +1,4 @@ debian/tmp/usr/lib/libsenf.a -debian/tmp/usr/lib/senf/*.o +debian/tmp/usr/lib/senf/final/*.o usr/lib/senf README usr/share/doc/libsenf debian/README.Debian usr/share/doc/libsenf diff --git a/debian/rules b/debian/rules index a7d1b80..3df60cc 100755 --- a/debian/rules +++ b/debian/rules @@ -45,16 +45,16 @@ build-arch: build-arch-debug build-arch-final build-arch-final: build-arch-final-stamp build-arch-final-stamp: configure-stamp # Add here commands to compile the arch part of the package. - scons -j $(CONCURRENCY_LEVEL) default final=1 - scons $(destdir)/usr/lib $(destdir)/usr/bin final=1 syslayout=1 \ - PREFIX='$(destdir)/usr' OBJINSTALLDIR='$$PREFIX/lib/senf' + scons -j $(CONCURRENCY_LEVEL) $(destdir)/usr/lib $(destdir)/usr/bin \ + final=1 syslayout=1 \ + PREFIX='$(destdir)/usr' OBJINSTALLDIR='$$PREFIX/lib/senf/final' touch $@ build-arch-debug: build-arch-debug-stamp build-arch-debug-stamp: configure-stamp # Add here commands to compile the arch part of the package. - scons -j $(CONCURRENCY_LEVEL) default LIBADDSUFFIX=_g OBJADDSUFFIX=_g - scons $(destdir)/usr/lib syslayout=1 LIBADDSUFFIX=_g OBJADDSUFFIX=_g \ + scons -j $(CONCURRENCY_LEVEL) $(destdir)/usr/lib \ + LIBADDSUFFIX=_g OBJADDSUFFIX=_g syslayout=1 \ PREFIX='$(destdir)/usr' OBJINSTALLDIR='$$PREFIX/lib/senf/debug' touch $@ @@ -62,15 +62,11 @@ build-indep: build-indep-stamp build-indep-stamp: configure-stamp # Add here commands to compile the indep part of the package. scons -j $(CONCURRENCY_LEVEL) all_docs - scons all_docs scons linklint scons fixlinks - scons $(destdir)/usr/include $(destdir)/usr/share/doc syslayout=1 \ - PREFIX='$(destdir)/usr' \ + scons $(destdir)/usr/include $(destdir)/usr/share/doc \ + syslayout=1 PREFIX='$(destdir)/usr' \ DOCINSTALLDIR='$$PREFIX/share/doc/libsenf-doc/html' -# Remove all the files not really needed from the documentation directories - find $(destdir)/usr/share/doc/libsenf-doc/html \ - -type f ! -regex '.*\.\(html\|css\|png\|php\|idx\|tag\)' | xargs rm -f # We need to install the example sourcecode find Examples \( -name "*.hh" -o -name "*.cc" \) -printf "%P\n" | \ while read src; do \ diff --git a/doclib/SConscript b/doclib/SConscript index b709529..7831200 100644 --- a/doclib/SConscript +++ b/doclib/SConscript @@ -316,3 +316,5 @@ env.Alias('install_all', env.Clean('all', 'doxy-header.html') # I should not need this but I do ... env.Clean('all_docs', 'doxy-header.html') # I should not need this but I do ... + +env.Install('${DOCINSTALLDIR}', 'index.html') diff --git a/debian/index.html b/doclib/index.html similarity index 71% rename from debian/index.html rename to doclib/index.html index 6260acf..fcf4f9e 100644 --- a/debian/index.html +++ b/doclib/index.html @@ -2,13 +2,13 @@ - + SENF - Simple and Extensible Network Framework

SENF - Simple and Extensible Network Framework

- SENF Manual + SENF Manual

diff --git a/site_scons/SENFSCons.py b/site_scons/SENFSCons.py index aed6649..c51cda0 100644 --- a/site_scons/SENFSCons.py +++ b/site_scons/SENFSCons.py @@ -73,7 +73,8 @@ def Doxygen(env, doxyfile = "Doxyfile", extra_sources = []): env.Depends(doc, env.CopyToDir(doc[0].dir, extra_sources)) # Install documentation into DOCINSTALLDIR - env.Install(env.Dir('$DOCINSTALLDIR').Dir(doc[0].dir.dir.get_path(env.Dir('#'))), doc[0].dir) + env.InstallDir(env.Dir('$DOCINSTALLDIR').Dir(doc[0].dir.dir.get_path(env.Dir('#'))), doc[0].dir, + FILTER_SUFFIXES=['.html','.css','.png','.php','.idx']) # Useful aliases env.Alias('all_docs', doc) diff --git a/site_scons/site_tools/InstallDir.py b/site_scons/site_tools/InstallDir.py new file mode 100644 index 0000000..75a649d --- /dev/null +++ b/site_scons/site_tools/InstallDir.py @@ -0,0 +1,48 @@ +import os.path, os +import SCons.Action, SCons.Builder, SCons.Node.FS + +def installDirFilter(target, source, env): + install = env['INSTALL'] + suffixes = env.get('FILTER_SUFFIXES',[]) + + for t,s in zip(target,source): + for path, dirs, files in os.walk(s.get_path()): + sdir = env.Dir(path) + tdir = t.Dir(sdir.get_path(s)) + if not os.path.exists(tdir.get_path()): + os.makedirs(tdir.get_path()) + for f in files: + sfile = sdir.File(f) + if suffixes and sfile.suffix not in suffixes : continue + tfile = tdir.File(sfile.name) + if install(tfile.get_path(), sfile.get_path(), env): + return 1 + return 0 + +def installDirFilterStr(target, source, env): + suffixes = env.get('FILTER_SUFFIXES') + if suffixes : suffixes = " (only %s)" % " ".join(suffixes) + return 'Install directory: "%s" as "%s"%s' % (str(source[0]), str(target[0]), suffixes) + +InstallDirAction = SCons.Action.Action(installDirFilter, installDirFilterStr) + +InstallDirBuilder = SCons.Builder.Builder( + action = InstallDirAction, + target_factory = SCons.Node.FS.Dir, + source_factory = SCons.Node.FS.Dir, + emitter = [ SCons.Tool.install.add_targets_to_INSTALLED_FILES, ]) + +def InstallDirWrapper(env, target=None, source=None, **kw): + target = env.arg2nodes(target, env.fs.Dir) + source = env.arg2nodes(source, env.fs.Dir) + builds = [] + for t in target: + for s in source: + builds.extend(InstallDirBuilder(env, t.Dir(s.name), s, **kw)) + return builds + +def generate(env): + env['BUILDERS']['InstallDir'] = InstallDirWrapper + +def exists(env): + return True