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
45 # Build modules (that is, instruct to build ... the build happens later)
46 SConscript(glob.glob("*/SConscript"))
48 SENFSCons.StandardTargets(env)
49 SENFSCons.GlobalTargets(env)
50 SENFSCons.Doxygen(env)
52 SENFSCons.DoxyXRef(env,
53 HTML_HEADER = '#/doclib/doxy-header-overview.html',
54 HTML_FOOTER = '#/doclib/doxy-footer.html')
56 def updateRevision(target, source, env):
57 rev = env['ENV']['REVISION'][1:]
60 print "Working copy not clean. Run 'svn update'"
63 if 'm' in rev and not ARGUMENTS.get('force_deb'):
65 print "Working copy contains local changes. Commit first"
72 changelog = file('debian/changelog.template').read() % {
74 'user': pwd.getpwuid(os.getuid()).pw_gecos.split(',')[0].strip(),
75 'date': time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()) }
76 file('debian/changelog','w').write(changelog)
78 if not os.environ.get('debian_build'):
80 env.Alias('deb', [], [ updateRevision,
81 "dpkg-buildpackage -us -uc -rfakeroot -I.svn" ]))
84 env.Alias('debsrc', [], [ updateRevision,
85 "dpkg-buildpackage -us -uc -rfakeroot -S -I.svn" ]))
88 env.Alias('debbin', [], [ updateRevision,
89 "dpkg-buildpackage -us -uc -rfakeroot -nc" ]))
91 # Create Doxyfile.local if not cleaning and the file does not exist
92 # otherwise doxygen will barf on this non-existent file
93 if not env.GetOption('clean') and not os.path.exists("Doxyfile.local"):
94 Execute(Touch("Doxyfile.local"))