# -*- python -*-
-import sys, glob, os.path, datetime, pwd, time
+import sys, glob, os.path, datetime, pwd, time, fnmatch
sys.path.append('senfscons')
import SENFSCons
'date': time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()) }
file('debian/changelog','w').write(changelog)
+def nonemptyFile(f):
+ try: return os.stat(f).st_size > 0
+ except OSError: return False
+
+def checkLocalConf(target, source, env):
+ if nonemptyFile('SConfig') or nonemptyFile('Doxyfile.local'):
+ print
+ print "You have made local modifications to 'SConfig' and/or 'Doxyfile.local'."
+ print "Building a debian package would remove those files."
+ print
+ print "To continue, remove the offending file(s) and try again. Alternatively,"
+ print "build a source package using 'scons debsrc' and may then build debian"
+ print "binary packages from this source-package without disrupting your print local"
+ print "configuration."
+ print
+ return 1
###########################################################################
# Load utilities and setup libraries and configure build
'LOGNAME' : logname, # needed by the debian build scripts
'CONCURRENCY_LEVEL' : env.GetOption('num_jobs') or "1"
},
+ CLEAN_PATTERNS = [ '*.pyc', 'semantic.cache', '.sconsign', '.sconsign.dblite' ],
+ BUILDPACKAGE_COMMAND = "dpkg-buildpackage -us -uc -rfakeroot -I.svn -IDoxyfile.local -ISConfig",
)
Export('env')
env.Alias('install_all', env.Install('$LIBINSTALLDIR', libsenf))
env.AlwaysBuild(
- env.Alias('deb', [], [ updateRevision,
- "dpkg-buildpackage -us -uc -rfakeroot -I.svn" ]))
+ env.Alias('deb', [], [ checkLocalConf,
+ updateRevision,
+ "$BUILDPACKAGE_COMMAND" ]))
env.AlwaysBuild(
env.Alias('debsrc', [], [ updateRevision,
- "dpkg-buildpackage -us -uc -rfakeroot -S -I.svn" ]))
+ "$BUILDPACKAGE_COMMAND -S" ]))
env.AlwaysBuild(
- env.Alias('debbin', [], [ updateRevision,
- "dpkg-buildpackage -us -uc -rfakeroot -nc" ]))
+ env.Alias('debbin', [], [ checkLocalConf,
+ updateRevision,
+ "$BUILDPACKAGE_COMMAND -nc" ]))
+
+env.Clean('all', [ os.path.join(path,f)
+ for path, subdirs, files in os.walk('.')
+ for pattern in env['CLEAN_PATTERNS']
+ for f in fnmatch.filter(files,pattern) ])
endif
# shared library versions, option 1
-version=2.0.5
-major=2
+#version=2.0.5
+#major=2
# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
#version=`ls src/.libs/lib*.so.* | \
# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
configure-stamp:
dh_testdir
# # Add here commands to configure the package.
+ rm -f Doxyfile.local SConfig
+# If needed, we could create new 'Doxyfile.local' and/or 'SConfig' files here.
+# We don't remove them in 'clean' to allow building a source package from an
+# individually configured svn working copy.
touch configure-stamp
-
build: build-stamp
build-stamp: configure-stamp
dh_testdir
# # Add here commands to compile the package.
- scons -j $(CONCURRENCY_LEVEL) all final=1
+ scons -j $(CONCURRENCY_LEVEL) final=1
+ scons -j $(CONCURRENCY_LEVEL) all_docs final=1
touch $@
clean:
rm -f build-stamp configure-stamp
# # Add here commands to clean up after the build process.
-scons -c all
- dh_clean
+ dh_clean
install: build
dh_testdir
dh_clean -k
dh_installdirs
# # Add here commands to install the package into debian/tmp
- scons install_all final=1\
+ scons -j $(CONCURRENCY_LEVEL) install_all final=1\
PREFIX='$(destdir)/usr' \
DOCINSTALLDIR='$$PREFIX/share/doc/libsenf-doc'
# We need to install the example sourcecode