3 import sys, glob, os.path, datetime, pwd, time
4 sys.path.append('senfscons')
7 ###########################################################################
9 def updateRevision(target, source, env):
10 rev = env['ENV']['REVISION'][1:]
13 print "Working copy not clean. Run 'svn update'"
16 if 'm' in rev and not ARGUMENTS.get('force_deb'):
18 print "Working copy contains local changes. Commit first"
25 changelog = file('debian/changelog.template').read() % {
27 'user': pwd.getpwuid(os.getuid()).pw_gecos.split(',')[0].strip(),
28 'date': time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()) }
29 file('debian/changelog','w').write(changelog)
32 ###########################################################################
33 # Load utilities and setup libraries and configure build
36 SENFSCons.UseSTLPort()
37 env = SENFSCons.MakeEnvironment()
40 Additional top-level build targets:
42 all_tests Build and run unit tests for all modules
43 all_docs Build documentation for all modules
45 install_all Install SENF into $PREFIX
46 deb Build debian source and binary package
47 debsrc Build debian source package
48 debbin Build debian binary package
51 if os.environ.get('debian_build'):
52 rev = os.popen("dpkg-parsechangelog | awk '/^Version:/{print $2}'").read().strip()
54 rev = 'r' + os.popen("svnversion").read().strip().lower()
58 LIBS = [ 'iberty', '$BOOSTREGEXLIB' ],
59 DOXY_XREF_TYPES = [ 'bug', 'fixme', 'todo', 'idea' ],
60 DOXY_HTML_XSL = '#/doclib/html-munge.xsl',
61 ENV = { 'TODAY' : str(datetime.date.today()),
63 'LOGNAME' : os.environ['LOGNAME'], # needed by the debian build scripts
64 'CONCURRENCY_LEVEL' : env.GetOption('num_jobs') or "1"
70 # Create Doxyfile.local if not cleaning and the file does not exist
71 # otherwise doxygen will barf on this non-existent file
72 if not env.GetOption('clean') and not os.path.exists("Doxyfile.local"):
73 Execute(Touch("Doxyfile.local"))
75 ###########################################################################
76 # Define build targets
78 SConscript(glob.glob("*/SConscript"))
80 SENFSCons.StandardTargets(env)
81 SENFSCons.GlobalTargets(env)
82 SENFSCons.Doxygen(env)
83 SENFSCons.DoxyXRef(env,
84 HTML_HEADER = '#/doclib/doxy-header-overview.html',
85 HTML_FOOTER = '#/doclib/doxy-footer.html')
87 # Build combined library 'libsenf'
88 libsenf = env.Library(
89 SENFSCons.LibPath('senf'),
90 Flatten([ env.File(SENFSCons.LibPath(lib)).sources for lib in env['ALLLIBS'] ]))
92 env.Alias('install_all', env.Install('$LIBINSTALLDIR', libsenf))
95 env.Alias('deb', [], [ updateRevision,
96 "dpkg-buildpackage -us -uc -rfakeroot -I.svn" ]))
99 env.Alias('debsrc', [], [ updateRevision,
100 "dpkg-buildpackage -us -uc -rfakeroot -S -I.svn" ]))
103 env.Alias('debbin', [], [ updateRevision,
104 "dpkg-buildpackage -us -uc -rfakeroot -nc" ]))