.test.bin
.test.stamp
/libsenf_g.a
+/TODO
+/dist/
env.Tool('Boost')
env.Tool('CombinedObject')
env.Tool('PhonyTarget')
+env.Tool('InstallDir')
env.Help("""
Additional top-level build targets:
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:
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' ],
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())
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
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 $@
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 \
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')
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta http-equiv="refresh" content="0; URL=html/doc/html/index.html">
+ <meta http-equiv="refresh" content="0; URL=doc/html/index.html">
<title>SENF - Simple and Extensible Network Framework</title>
</head>
<body>
<h2>SENF - Simple and Extensible Network Framework</h2>
<p>
- <a href="html/doc/html/index.html">SENF Manual</a>
+ <a href="doc/html/index.html">SENF Manual</a>
</p>
</body>
</html>
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)
--- /dev/null
+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