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()
56 logname = os.environ.get('LOGNAME')
58 logname = pwd.getpwuid(os.getuid()).pw_name
62 LIBS = [ 'iberty', '$BOOSTREGEXLIB' ],
63 DOXY_XREF_TYPES = [ 'bug', 'fixme', 'todo', 'idea' ],
64 DOXY_HTML_XSL = '#/doclib/html-munge.xsl',
65 ENV = { 'TODAY' : str(datetime.date.today()),
67 'LOGNAME' : logname, # needed by the debian build scripts
68 'CONCURRENCY_LEVEL' : env.GetOption('num_jobs') or "1"
74 # Create Doxyfile.local if not cleaning and the file does not exist
75 # otherwise doxygen will barf on this non-existent file
76 if not env.GetOption('clean') and not os.path.exists("Doxyfile.local"):
77 Execute(Touch("Doxyfile.local"))
79 ###########################################################################
80 # Define build targets
82 SConscript(glob.glob("*/SConscript"))
84 SENFSCons.StandardTargets(env)
85 SENFSCons.GlobalTargets(env)
86 SENFSCons.Doxygen(env)
87 SENFSCons.DoxyXRef(env,
88 HTML_HEADER = '#/doclib/doxy-header-overview.html',
89 HTML_FOOTER = '#/doclib/doxy-footer.html')
91 # Build combined library 'libsenf'
92 libsenf = env.Library(
93 SENFSCons.LibPath('senf'),
94 Flatten([ env.File(SENFSCons.LibPath(lib)).sources for lib in env['ALLLIBS'] ]))
96 env.Alias('install_all', env.Install('$LIBINSTALLDIR', libsenf))
99 env.Alias('deb', [], [ updateRevision,
100 "dpkg-buildpackage -us -uc -rfakeroot -I.svn" ]))
103 env.Alias('debsrc', [], [ updateRevision,
104 "dpkg-buildpackage -us -uc -rfakeroot -S -I.svn" ]))
107 env.Alias('debbin', [], [ updateRevision,
108 "dpkg-buildpackage -us -uc -rfakeroot -nc" ]))