diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/cpp/app_templates/kscons_kxt/SConstruct | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/cpp/app_templates/kscons_kxt/SConstruct')
-rw-r--r-- | languages/cpp/app_templates/kscons_kxt/SConstruct | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/languages/cpp/app_templates/kscons_kxt/SConstruct b/languages/cpp/app_templates/kscons_kxt/SConstruct new file mode 100644 index 00000000..b82de4e1 --- /dev/null +++ b/languages/cpp/app_templates/kscons_kxt/SConstruct @@ -0,0 +1,112 @@ +#! /usr/bin/env python + +""" +help -> scons -h +compile -> scons +clean -> scons -c +install -> scons install +uninstall -> scons -c install +configure -> scons configure prefix=/tmp/ita debug=full extraincludes=/usr/local/include:/tmp/include prefix=/usr/local + +Run from a subdirectory -> scons -u +The variables are saved automatically after the first run (look at cache/kde.cache.py, ..) +""" + +################################################################### +# LOAD THE ENVIRONMENT AND SET UP THE TOOLS +################################################################### + +## Load the builders in config +env = Environment( tools=['default', 'generic', 'kde'], toolpath=['./', './admin']) +#env = Environment( tools=['default', 'generic', 'kde', 'othertool'], toolpath=['./', './admin']) + +env.KDEuse("environ rpath") +#env.KDEuse("environ rpath lang_qt thread nohelp") + +################################################################### +# SCRIPTS FOR BUILDING THE TARGETS +################################################################### + +dirs=""" +src +doc +""" +env.subdirs(dirs) + +## Process the translations in the po/ directory +env.KDElang('po/', '%{APPNAMELC}') + +################################################################### +# CONVENIENCE FUNCTIONS TO EMULATE 'make dist' and 'make distclean' +################################################################### + +### To make a tarball of your masterpiece, use 'scons dist' +if 'dist' in COMMAND_LINE_TARGETS: + + ## The target scons dist requires the python module shutil which is in 2.3 + env.EnsurePythonVersion(2, 3) + + import os + APPNAME = 'bksys' + VERSION = os.popen("cat VERSION").read().rstrip() + FOLDER = APPNAME+'-'+VERSION + ARCHIVE = FOLDER+'.tar.bz2' + + ## If your app name and version number are defined in 'version.h', use this instead: + ## (contributed by Dennis Schridde devurandom@gmx@net) + #import re + #INFO = dict( re.findall( '(?m)^#define\s+(\w+)\s+(.*)(?<=\S)', open(r"version.h","rb").read() ) ) + #APPNAME = INFO['APPNAME'] + #VERSION = INFO['VERSION'] + + import shutil + import glob + + ## check if the temporary directory already exists + if os.path.isdir(FOLDER): + shutil.rmtree(FOLDER) + if os.path.isfile(ARCHIVE): + os.remove(ARCHIVE) + + ## create a temporary directory + startdir = os.getcwd() + shutil.copytree(startdir, FOLDER) + + ## remove our object files first + os.popen("find "+FOLDER+" -name \"*cache*\" | xargs rm -rf") + os.popen("find "+FOLDER+" -name \"*.pyc\" | xargs rm -f") + #os.popen("pushd %s && scons -c " % FOLDER) # TODO + + ## CVS cleanup + os.popen("find "+FOLDER+" -name \"CVS\" | xargs rm -rf") + os.popen("find "+FOLDER+" -name \".cvsignore\" | xargs rm -rf") + + ## Subversion cleanup + os.popen("find %s -name .svn -type d | xargs rm -rf" % FOLDER) + + ## GNU Arch cleanup + os.popen("find "+FOLDER+" -name \"{arch}\" | xargs rm -rf") + os.popen("find "+FOLDER+" -name \".arch-i*\" | xargs rm -rf") + + ## Create the tarball (coloured output) + print "\033[92m"+"Writing archive "+ARCHIVE+"\033[0m" + os.popen("tar cjf "+ARCHIVE+" "+FOLDER) + + ## Remove the temporary directory + if os.path.isdir(FOLDER): + shutil.rmtree(FOLDER) + + env.Default(None) + env.Exit(0) + +### Emulate "make distclean" +if 'distclean' in COMMAND_LINE_TARGETS: + ## Remove the cache directory + import os, shutil + if os.path.isdir(env['CACHEDIR']): + shutil.rmtree(env['CACHEDIR']) + os.popen("find . -name \"*.pyc\" | xargs rm -rf") + + env.Default(None) + env.Exit(0) + |