3 import sys, glob, os.path, datetime, pwd, time
4 sys.path.append('senfscons')
7 ###########################################################################
9 # Load utilities and setup libraries
11 SENFSCons.UseSTLPort()
12 env = SENFSCons.MakeEnvironment()
15 Additional top-level build targets:
17 all_tests Build and run unit tests for all modules
18 all_docs Build documentation for all modules
20 install_all Install SENF into $PREFIX
21 deb Build debian source and binary package
22 debsrc Build debian source package
23 debbin Build debian binary package
26 if os.environ.get('debian_build'):
27 rev = os.popen("dpkg-parsechangelog | awk '/^Version:/{print $2}'").read().strip()
29 rev = 'r' + os.popen("svnversion").read().strip().lower()
34 LIBS = [ 'iberty', '$BOOSTREGEXLIB' ],
35 DOXY_XREF_TYPES = [ 'bug', 'fixme', 'todo', 'idea' ],
36 DOXY_HTML_XSL = '#/doclib/html-munge.xsl',
37 ENV = { 'TODAY' : str(datetime.date.today()),
39 'LOGNAME' : os.environ['LOGNAME'], # needed by the debian build scripts
40 'CONCURRENCY_LEVEL' : env.GetOption('num_jobs') or "1"
46 # Build modules (that is, instruct to build ... the build happens later)
47 SConscript(glob.glob("*/SConscript"))
49 SENFSCons.StandardTargets(env)
50 SENFSCons.GlobalTargets(env)
51 SENFSCons.Doxygen(env)
53 SENFSCons.DoxyXRef(env,
54 HTML_HEADER = '#/doclib/doxy-header-overview.html',
55 HTML_FOOTER = '#/doclib/doxy-footer.html')
57 def updateRevision(target, source, env):
58 rev = env['ENV']['REVISION'][1:]
61 print "Working copy not clean. Run 'svn update'"
64 if 'm' in rev and not ARGUMENTS.get('force_deb'):
66 print "Working copy contains local changes. Commit first"
73 changelog = file('debian/changelog.template').read() % {
75 'user': pwd.getpwuid(os.getuid()).pw_gecos.split(',')[0].strip(),
76 'date': time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()) }
77 file('debian/changelog','w').write(changelog)
79 if not os.environ.get('debian_build'):
81 env.Alias('deb', [], [ updateRevision,
82 "dpkg-buildpackage -us -uc -rfakeroot -I.svn" ]))
85 env.Alias('debsrc', [], [ updateRevision,
86 "dpkg-buildpackage -us -uc -rfakeroot -S -I.svn" ]))
89 env.Alias('debbin', [], [ updateRevision,
90 "dpkg-buildpackage -us -uc -rfakeroot -nc" ]))
92 # Create Doxyfile.local if not cleaning and the file does not exist
93 # otherwise doxygen will barf on this non-existent file
94 if not env.GetOption('clean') and not os.path.exists("Doxyfile.local"):
95 Execute(Touch("Doxyfile.local"))