From 37a38f976dbb198c6a32ff843bae5d804f140c04 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 30 Jun 2007 04:41:52 +0200 Subject: [PATCH 1/4] SCons driven build system: Skeleton To find out if SCons is suitable for Cinelerra's build system, I'll try to write a protorype, including platform configuration support, installing and support for packaging. --- Buildhelper.py | 29 ++++++++++++++++++ SConstruct | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 Buildhelper.py create mode 100644 SConstruct diff --git a/Buildhelper.py b/Buildhelper.py new file mode 100644 index 000000000..de44dce4b --- /dev/null +++ b/Buildhelper.py @@ -0,0 +1,29 @@ +# -*- python -*- +## +## Buildhelper.py - helpers, custom builders, for SConstruct +## + +# Copyright (C) CinelerraCV +# 2007, Hermann Vosseler +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +##################################################################### + + +# +# Common Helper Functions +# +def isCleanupOperation(env): + return env.GetOption('clean') diff --git a/SConstruct b/SConstruct new file mode 100644 index 000000000..58b8a30d4 --- /dev/null +++ b/SConstruct @@ -0,0 +1,81 @@ +# -*- python -*- +## +## SConstruct - SCons based build-sytem for Cinelerra +## + +# Copyright (C) CinelerraCV +# 2007, Hermann Vosseler +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +##################################################################### + +from Buildhelper import * + + +# NOTE: the following code /defines/ what and how to build +# it doesn't "do" the build. SCons will do the "doing" + +env = setupBasicEnvironment() + +if not isCleanupOperation(env): + configurePlatform(env) + +artifacts = {} +# the various things we build. +# Each entry actually is a SCons-Node list. +# Passing these entries to other builders defines dependencies. +# 'cinelerra' : the App +# 'plugins' : plugin shared lib +# 'tools' : small tool applications (e.g mpegtoc) +# 'src,tar' : source tree as tarball (without doc) +# 'devdoc.tar' : uml model, wiki, dev docu (no src) + +definePackagingTargets(env, artifacts) +defineBuildTargets(env, artifacts) +defineInstallTargets(env, artifacts) + + +##################################################################### + +def setupBasicEnvironment(): + ''' define cmdline options, decide build type + ''' + + +def configurePlatform(env): + ''' locate required libs. + setup platform specific options. + Abort build in case of failure. + ''' + + +def definePackagingTargets(env, artifacts): + ''' build operations and targets to be done /before/ compiling. + things like creating a source tarball or preparing a version header. + ''' + + +def defineBuildTargets(env, artifacts): + ''' define the source file/dirs comprising each artifact to be built. + setup sub-environments with special build options if necessary + ''' + + +def defineInstallTargets(env, artifacts): + ''' define install locations and cleanup after the build. + define alias targets to trigger the installing. + ''' + + From 7719c710ae81ba446cdeddf2573958c197278276 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 2 Jul 2007 05:27:20 +0200 Subject: [PATCH 2/4] finished basic implementation of SCons build system --- Buildhelper.py | 42 +++++++++ SConstruct | 209 ++++++++++++++++++++++++++++++++++++-------- src/tool/DIR_INFO | 1 + src/tool/SConscript | 10 +++ src/tool/hello.c | 12 +++ 5 files changed, 239 insertions(+), 35 deletions(-) create mode 100644 src/tool/DIR_INFO create mode 100644 src/tool/SConscript create mode 100644 src/tool/hello.c diff --git a/Buildhelper.py b/Buildhelper.py index de44dce4b..31e04452a 100644 --- a/Buildhelper.py +++ b/Buildhelper.py @@ -2,6 +2,7 @@ ## ## Buildhelper.py - helpers, custom builders, for SConstruct ## +from fnmatch import fnmatch # Copyright (C) CinelerraCV # 2007, Hermann Vosseler @@ -21,9 +22,50 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ##################################################################### +import os +import sys +import fnmatch # # Common Helper Functions # def isCleanupOperation(env): return env.GetOption('clean') + +def isHelpRequest(): + ''' this is a hack: SCons does all configure tests even if only + the helpmessage is requested. SCons doesn't export the + help option for retrieval by env.GetOption(), + so we scan the commandline directly. + ''' + return '-h' in sys.argv or '--help' in sys.argv + + + +def srcSubtree(env,tree,isShared=False, **args): + ''' convienience wrapper: scans the given subtree, which is + to be located within $SRCDIR, find all source files and + declare them as Static or SharedObjects for compilation + ''' + root = env.subst('$SRCDIR/%s' % tree) # expand $SRCDIR + if isShared: + builder = lambda f: env.SharedObject(f, **args) + else: + builder = lambda f: env.Object(f, **args) + + return [builder(f) for f in scanSrcSubtree(root)] + + + +SRCPATTERNS = ['*.c','*.Cpp','*.cc'] + +def scanSrcSubtree(root): + ''' scan the given subtree for source filesnames + (python generator function) + ''' + for (dir,_,files) in os.walk(root): + if dir.startswith('./'): + dir = dir[2:] + for p in SRCPATTERNS: + for f in fnmatch.filter(files, p): + yield os.path.join(dir,f) diff --git a/SConstruct b/SConstruct index 58b8a30d4..fc05fe595 100644 --- a/SConstruct +++ b/SConstruct @@ -21,16 +21,188 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ##################################################################### +import os +import re + from Buildhelper import * +#-----------------------------------Configuration +OPTIONSCACHEFILE = 'optcache' +CUSTOPTIONSFILE = 'custom-options' +SRCDIR = 'src' +BINDIR = 'src/bin' +VERSION = '3.alpha.1' +#-----------------------------------Configuration + + + + + +##################################################################### + +def setupBasicEnvironment(): + ''' define cmdline options, build type decisions + ''' + opts = defineCmdlineOptions() + + env = Environment( options=opts + , CPPDEFINES={'DEBUG': '${DEBUG}' + ,'USE_OPENGL': '${OPENGL}' + } + ) + env.Replace( VERSION=VERSION + , SRCDIR=SRCDIR + , BINDIR=BINDIR + , CPPPATH=SRCDIR # used to find includes + ) + prepareOptionsHelp(opts,env) + opts.Save(OPTIONSCACHEFILE, env) + return env + + +def defineCmdlineOptions(): + ''' current options will be persisted in a options cache file. + you may define custom options in a separate file. + Commandline will override both. + ''' + opts = Options([OPTIONSCACHEFILE, CUSTOPTIONSFILE]) + opts.AddOptions( + ('ARCHFLAGS', 'Set architecture-specific compilation flags (passed literally to gcc)','') + ,BoolOption('DEBUG', 'Build with debugging information and no optimizations', False) + ,BoolOption('OPTIMIZE', 'Build with strong optimization (-O3)', False) + ,BoolOption('OPENGL', 'Include support for OpenGL preview rendering', False) +# ,EnumOption('DIST_TARGET', 'Build target architecture', 'auto', +# allowed_values=('auto', 'i386', 'i686', 'x86_64' ), ignorecase=2) + ,PathOption('DESTDIR', 'Installation dir prefix', '/usr/local') + ,PackageOption('TARSRC', 'Create source tarball prior to compiling', '.') + ,PackageOption('TARDOC', 'Create tarball with dev documentaion, wiki and uml model', '.') + ) + + return opts + + +def prepareOptionsHelp(opts,env): + prelude = ''' +USAGE: scons [-c] [OPTS] [TARGETS] + Build and optionally install Cinelerra. + Without specifying any target, just the (re)build target will run. + Add -c to the commandline to clean up anything a given target would produce + +Configuration Options: +''' + Help(prelude + opts.GenerateHelpText(env)) + + + +def configurePlatform(env): + ''' locate required libs. + setup platform specific options. + Abort build in case of failure. + ''' + conf = Configure(env) + # run all configuration checks in the current env + + # Checks for prerequisites ------------ + if not conf.CheckLibWithHeader('m', 'math.h','C'): + print 'Did not find math.h / libm, exiting.' + Exit(1) + + if not conf.CheckCXXHeader('boost/config.hpp'): + print 'We need the C++ boost-lib.' + Exit(1) + + if not conf.CheckCXXHeader('boost/shared_ptr.hpp'): + print 'We need boost::shared_ptr (shared_ptr.hpp).' + Exit(1) + + # create new env containing the finished configuration + return conf.Finish() + + + +def definePackagingTargets(env, artifacts): + ''' build operations and targets to be done /before/ compiling. + things like creating a source tarball or preparing a version header. + ''' + env.SetDefault(TARFLAGS = '-c -z', TARSUFFIX = '') + if env['TARSRC']: + # define the Tar as a target and make it default, + # i.e. buid it if scons is called without targets + t=env.Tar(getTarName(env['TARSRC']),SRCDIR) + env.Default(t) + if env['TARDOC']: + t=env.Tar(getTarName(env['TARDOC']), 'admin doc wiki uml tests') + env.Default(t) + +def getTarName(spec): + (head,tail) = os.path.split( os.path.abspath(spec)) + if not os.path.isdir(head): + print 'Target dir "%s" for Tar doesn\'t exist.' % head + Exit(1) + mat = re.match(r'([\w\.\-])\.((tar)|(tar\.gz)|(tgz))', tail) + if mat: + name = mat.group(1) + ext = '.'+mat.group(2) + else: + ext = '.tar.gz' + if os.path.isdir(tail): + name = 'cinelerra$VERSION' + else: + name = tail + return os.path.join(head,name+ext) + + + +def defineBuildTargets(env, artifacts): + ''' define the source file/dirs comprising each artifact to be built. + setup sub-environments with special build options if necessary + ''' + cinobj = ( srcSubtree(env,'backend') + + srcSubtree(env,'proc') + + env.Object('$SRCDIR/main.cpp') + ) + plugobj = srcSubtree(env,'plugin', isShared=True) + + artifacts['cinelerra'] = env.Program('$BINDIR/cinelerra', cinobj) + artifacts['plugins'] = env.SharedLibrary('$BINDIR/cinelerra-plugin', plugobj) + + # call subdir SConscript(s) + SConscript(dirs=[SRCDIR+'/tool'], exports='env artifacts') + + + +def defineInstallTargets(env, artifacts): + ''' define install locations and cleanup after the build. + define alias targets to trigger the installing. + ''' + env.Install(dir = '$DESTDIR/bin', source=artifacts['cinelerra']) + env.Install(dir = '$DESTDIR/lib', source=artifacts['plugins']) + env.Install(dir = '$DESTDIR/bin', source=artifacts['tools']) + + ib = env.Alias('install-bin', '$DESTDIR/bin') + il = env.Alias('install-lib', '$DESTDIR/lib') + env.Alias('install', [ib, il]) + + env.Alias('build', '$DESTDIR') + env.Default('build') + # additional files to be cleaned when cleaning 'build' + env.Clean ('build', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log']) + +##################################################################### + + + + + +### === MAIN === #################################################### # NOTE: the following code /defines/ what and how to build # it doesn't "do" the build. SCons will do the "doing" env = setupBasicEnvironment() -if not isCleanupOperation(env): - configurePlatform(env) +if not (isCleanupOperation(env) or isHelpRequest()): + env = configurePlatform(env) artifacts = {} # the various things we build. @@ -46,36 +218,3 @@ definePackagingTargets(env, artifacts) defineBuildTargets(env, artifacts) defineInstallTargets(env, artifacts) - -##################################################################### - -def setupBasicEnvironment(): - ''' define cmdline options, decide build type - ''' - - -def configurePlatform(env): - ''' locate required libs. - setup platform specific options. - Abort build in case of failure. - ''' - - -def definePackagingTargets(env, artifacts): - ''' build operations and targets to be done /before/ compiling. - things like creating a source tarball or preparing a version header. - ''' - - -def defineBuildTargets(env, artifacts): - ''' define the source file/dirs comprising each artifact to be built. - setup sub-environments with special build options if necessary - ''' - - -def defineInstallTargets(env, artifacts): - ''' define install locations and cleanup after the build. - define alias targets to trigger the installing. - ''' - - diff --git a/src/tool/DIR_INFO b/src/tool/DIR_INFO new file mode 100644 index 000000000..76e84db53 --- /dev/null +++ b/src/tool/DIR_INFO @@ -0,0 +1 @@ +source code of supplementary tools to be built alongside with Cinelerra diff --git a/src/tool/SConscript b/src/tool/SConscript new file mode 100644 index 000000000..e4c744190 --- /dev/null +++ b/src/tool/SConscript @@ -0,0 +1,10 @@ +# -*- python -*- +## +## SConscript - SCons buildscript for tool subdirectory (called by SConstruct) +## + +Import('env','artifacts') + +# build the ubiquitous Hello World application (note: C source) +artifacts['tools'] = env.Program('$BINDIR/hello-world','hello.c') + diff --git a/src/tool/hello.c b/src/tool/hello.c new file mode 100644 index 000000000..62a033f4e --- /dev/null +++ b/src/tool/hello.c @@ -0,0 +1,12 @@ +/* + * hello.c - demonstrates how to build a standalone tool (C source) + * integrated into the SCons based build system of Cinelerra + */ + +#include + +int main(int argc, char* argv[]) + { + printf("hello cinelerra world"); + return 0; + } From c79d3c906a85a93c408e259e7fe9aebaaaab493c Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 2 Jul 2007 11:38:46 +0200 Subject: [PATCH 3/4] implemented additional functions like creating a tarball --- Buildhelper.py | 81 +++++++++++++++++++++++++++++++++++++++++++++ SConstruct | 77 +++++++++++++++++++++--------------------- src/tool/SConscript | 2 +- 3 files changed, 121 insertions(+), 39 deletions(-) diff --git a/Buildhelper.py b/Buildhelper.py index 31e04452a..d4c1a3a52 100644 --- a/Buildhelper.py +++ b/Buildhelper.py @@ -25,6 +25,9 @@ from fnmatch import fnmatch import os import sys import fnmatch +import re +import tarfile + # # Common Helper Functions @@ -69,3 +72,81 @@ def scanSrcSubtree(root): for p in SRCPATTERNS: for f in fnmatch.filter(files, p): yield os.path.join(dir,f) + + + + +def Tarball(env,location,dirs,suffix=''): + ''' Custom Command: create Tarball of some subdirs + location: where to create the tar (optionally incl. filename.tar.gz) + suffix: (optional) suffix to include in the tar name + dirs: directories to include in the tar + + This is a bit of a hack, because we want to be able to include arbitrary dirctories, + without creating new dependencies on those dirs. Esp. we want to tar the source tree + prior to compiling. Solution is + - use the Command-Builder, but pass all target specifications as custom build vars + - create a pseudo-target located in the parent directory (not built by default) + ''' + targetID = '../extern-tar%s' % suffix + versionID = env['VERSION'] + defaultName = 'cinelerra%s_%s' % (suffix, versionID) + nameprefix = 'cinelerra-%s/' % (versionID) + location = env.subst(location) + dirs = env.subst(dirs) + return env.Command(targetID,None, createTarball, + location=location, defaultName=defaultName, dirs=dirs, nameprefix=nameprefix) + + +def createTarball(target,source,env): + ''' helper, builds the tar using the python2.3 tarfil lib. + This allows us to prefix all paths, thus moving the tree + into a virtual subdirectory containing the Version number, + as needed by common packaging systems. + ''' + name = getTarName( location = env['location'] + , defaultName = env['defaultName']) + targetspec = env['dirs'] + nameprefix = env['nameprefix'] or '' + print 'Running: tar -czf %s %s ...' % (name,targetspec) + if os.path.isfile(name): + os.remove(name) + tar = tarfile.open(name,'w:gz') + for name in targetspec.split(): + tar.add(name,nameprefix+name) + tar.close() +# +# old version using shell command: +# +# cmd = 'tar -czf %s %s' % (name,targetspec) +# print 'running ', cmd, ' ... ' +# pipe = os.popen (cmd) +# return pipe.close () + + + + +def getTarName(location, defaultName): + ''' create a suitable name for the tarball. + - if location contains a name (*.tar.gz) then use this + - otherwise append the defaultName to the specified dir + ''' + spec = os.path.abspath(location) + (head,tail) = os.path.split(spec) + if not os.path.isdir(head): + print 'Target dir "%s" for Tar doesn\'t exist.' % head + Exit(1) + mat = re.match(r'([\w\.\-])\.((tar)|(tar\.gz)|(tgz))', tail) + if mat: + name = mat.group(1) + ext = '.'+mat.group(2) + else: + ext = '.tar.gz' + if os.path.isdir(spec): + head = spec + name = defaultName + else: + name = tail + return os.path.join(head,name+ext) + + diff --git a/SConstruct b/SConstruct index fc05fe595..a9609ce49 100644 --- a/SConstruct +++ b/SConstruct @@ -22,7 +22,6 @@ ##################################################################### import os -import re from Buildhelper import * @@ -44,21 +43,31 @@ def setupBasicEnvironment(): ''' define cmdline options, build type decisions ''' opts = defineCmdlineOptions() - - env = Environment( options=opts - , CPPDEFINES={'DEBUG': '${DEBUG}' - ,'USE_OPENGL': '${OPENGL}' - } - ) + + env = Environment(options=opts) env.Replace( VERSION=VERSION , SRCDIR=SRCDIR , BINDIR=BINDIR , CPPPATH=SRCDIR # used to find includes ) + appendCppDefine(env,'DEBUG','DEBUG') + appendCppDefine(env,'OPENGL','USE_OPENGL') + appendVal(env,'ARCHFLAGS', 'CPPFLAGS') # for both C and C++ + appendVal(env,'OPTIMIZE', 'CPPFLAGS', val=' -O3') + prepareOptionsHelp(opts,env) opts.Save(OPTIONSCACHEFILE, env) return env +def appendCppDefine(env,var,cppVar): + if env[var]: + env.Append(CPPDEFINES={cppVar: env[var]}) + +def appendVal(env,var,targetVar,val=None): + if env[var]: + env.Append(**{targetVar: val or env[var]}) + + def defineCmdlineOptions(): ''' current options will be persisted in a options cache file. @@ -74,26 +83,35 @@ def defineCmdlineOptions(): # ,EnumOption('DIST_TARGET', 'Build target architecture', 'auto', # allowed_values=('auto', 'i386', 'i686', 'x86_64' ), ignorecase=2) ,PathOption('DESTDIR', 'Installation dir prefix', '/usr/local') - ,PackageOption('TARSRC', 'Create source tarball prior to compiling', '.') - ,PackageOption('TARDOC', 'Create tarball with dev documentaion, wiki and uml model', '.') + ,PathOption('SRCTAR', 'Create source tarball prior to compiling', '..', PathOption.PathAccept) + ,PathOption('DOCTAR', 'Create tarball with dev documentaionl', '..', PathOption.PathAccept) ) return opts + def prepareOptionsHelp(opts,env): prelude = ''' -USAGE: scons [-c] [OPTS] [TARGETS] +USAGE: scons [-c] [OPTS] [key=val,...] [TARGETS] Build and optionally install Cinelerra. Without specifying any target, just the (re)build target will run. Add -c to the commandline to clean up anything a given target would produce +Special Targets: + build : just compile and link + install : install created artifacts at PREFIX + src.tar : create source tarball + doc.tar : create developer doc tarball + tar : create all tarballs + Configuration Options: ''' Help(prelude + opts.GenerateHelpText(env)) + def configurePlatform(env): ''' locate required libs. setup platform specific options. @@ -124,33 +142,16 @@ def definePackagingTargets(env, artifacts): ''' build operations and targets to be done /before/ compiling. things like creating a source tarball or preparing a version header. ''' - env.SetDefault(TARFLAGS = '-c -z', TARSUFFIX = '') - if env['TARSRC']: - # define the Tar as a target and make it default, - # i.e. buid it if scons is called without targets - t=env.Tar(getTarName(env['TARSRC']),SRCDIR) - env.Default(t) - if env['TARDOC']: - t=env.Tar(getTarName(env['TARDOC']), 'admin doc wiki uml tests') - env.Default(t) + t = Tarball(env,location='$SRCTAR',dirs='$SRCDIR') + artifacts['src.tar'] = t + env.Alias('src.tar', t) + env.Alias('tar', t) + + t = Tarball(env,location='$DOCTAR',suffix='-doc',dirs='admin doc wiki uml tests') + artifacts['doc.tar'] = t + env.Alias('doc.tar', t) + env.Alias('tar', t) -def getTarName(spec): - (head,tail) = os.path.split( os.path.abspath(spec)) - if not os.path.isdir(head): - print 'Target dir "%s" for Tar doesn\'t exist.' % head - Exit(1) - mat = re.match(r'([\w\.\-])\.((tar)|(tar\.gz)|(tgz))', tail) - if mat: - name = mat.group(1) - ext = '.'+mat.group(2) - else: - ext = '.tar.gz' - if os.path.isdir(tail): - name = 'cinelerra$VERSION' - else: - name = tail - return os.path.join(head,name+ext) - def defineBuildTargets(env, artifacts): @@ -183,7 +184,7 @@ def defineInstallTargets(env, artifacts): il = env.Alias('install-lib', '$DESTDIR/lib') env.Alias('install', [ib, il]) - env.Alias('build', '$DESTDIR') + env.Alias('build', '$BINDIR') env.Default('build') # additional files to be cleaned when cleaning 'build' env.Clean ('build', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log']) @@ -212,7 +213,7 @@ artifacts = {} # 'plugins' : plugin shared lib # 'tools' : small tool applications (e.g mpegtoc) # 'src,tar' : source tree as tarball (without doc) -# 'devdoc.tar' : uml model, wiki, dev docu (no src) +# 'doc.tar' : uml model, wiki, dev docu (no src) definePackagingTargets(env, artifacts) defineBuildTargets(env, artifacts) diff --git a/src/tool/SConscript b/src/tool/SConscript index e4c744190..f3a3abf76 100644 --- a/src/tool/SConscript +++ b/src/tool/SConscript @@ -6,5 +6,5 @@ Import('env','artifacts') # build the ubiquitous Hello World application (note: C source) -artifacts['tools'] = env.Program('$BINDIR/hello-world','hello.c') +artifacts['tools'] = env.Program('#$BINDIR/hello-world','hello.c') From 0a9c2599dd49990b8ccf779a44abdaba626bdd86 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 3 Jul 2007 00:13:12 +0200 Subject: [PATCH 4/4] some cleanup. Set Version=3+alpha.01, add a helloworld-main to make it compile --- .gitignore | 15 ++++++--------- Buildhelper.py | 4 ++-- SConstruct | 21 +++++++++++++-------- src/main.cpp | 31 +++++++++++++++++++++++++++++++ src/plugin/helloplugin.c | 12 ++++++++++++ 5 files changed, 64 insertions(+), 19 deletions(-) create mode 100644 src/main.cpp create mode 100644 src/plugin/helloplugin.c diff --git a/.gitignore b/.gitignore index 13ccda24c..ed690f89c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,9 @@ /wiki/backups/* *~ -a.out -semantic.cache -aclocal.m4 -Makefile -Makefile.in -autom4te* -config.* -configure *.tar.* -build/* +.sconf_temp +.sconf_temp/* +.sconsign.dblite +Buildhelper.pyc +optcache + diff --git a/Buildhelper.py b/Buildhelper.py index d4c1a3a52..282fdb6dc 100644 --- a/Buildhelper.py +++ b/Buildhelper.py @@ -2,7 +2,6 @@ ## ## Buildhelper.py - helpers, custom builders, for SConstruct ## -from fnmatch import fnmatch # Copyright (C) CinelerraCV # 2007, Hermann Vosseler @@ -29,6 +28,7 @@ import re import tarfile + # # Common Helper Functions # @@ -136,7 +136,7 @@ def getTarName(location, defaultName): if not os.path.isdir(head): print 'Target dir "%s" for Tar doesn\'t exist.' % head Exit(1) - mat = re.match(r'([\w\.\-])\.((tar)|(tar\.gz)|(tgz))', tail) + mat = re.match(r'([\w\.\-\+:\~]+)\.((tar)|(tar\.gz)|(tgz))', tail) if mat: name = mat.group(1) ext = '.'+mat.group(2) diff --git a/SConstruct b/SConstruct index a9609ce49..f5447b317 100644 --- a/SConstruct +++ b/SConstruct @@ -22,7 +22,6 @@ ##################################################################### import os - from Buildhelper import * #-----------------------------------Configuration @@ -30,9 +29,13 @@ OPTIONSCACHEFILE = 'optcache' CUSTOPTIONSFILE = 'custom-options' SRCDIR = 'src' BINDIR = 'src/bin' -VERSION = '3.alpha.1' +VERSION = '3+alpha.01' #-----------------------------------Configuration +# NOTE: scons -h for help. +# Read more about the SCons build system at: http://www.scons.org +# Basically, this script just /defines/ the components and how they +# fit together. SCons will derive the necessary build steps. @@ -42,6 +45,9 @@ VERSION = '3.alpha.1' def setupBasicEnvironment(): ''' define cmdline options, build type decisions ''' + EnsurePythonVersion(2,3) + EnsureSConsVersion(0,96,90) + opts = defineCmdlineOptions() env = Environment(options=opts) @@ -61,11 +67,11 @@ def setupBasicEnvironment(): def appendCppDefine(env,var,cppVar): if env[var]: - env.Append(CPPDEFINES={cppVar: env[var]}) + env.Append(CPPDEFINES = {cppVar: env[var]}) def appendVal(env,var,targetVar,val=None): if env[var]: - env.Append(**{targetVar: val or env[var]}) + env.Append( **{targetVar: val or env[var]}) @@ -156,7 +162,8 @@ def definePackagingTargets(env, artifacts): def defineBuildTargets(env, artifacts): ''' define the source file/dirs comprising each artifact to be built. - setup sub-environments with special build options if necessary + setup sub-environments with special build options if necessary. + We use a custom function to declare a whole tree of srcfiles. ''' cinobj = ( srcSubtree(env,'backend') + srcSubtree(env,'proc') @@ -167,7 +174,7 @@ def defineBuildTargets(env, artifacts): artifacts['cinelerra'] = env.Program('$BINDIR/cinelerra', cinobj) artifacts['plugins'] = env.SharedLibrary('$BINDIR/cinelerra-plugin', plugobj) - # call subdir SConscript(s) + # call subdir SConscript(s) for independent components SConscript(dirs=[SRCDIR+'/tool'], exports='env artifacts') @@ -197,8 +204,6 @@ def defineInstallTargets(env, artifacts): ### === MAIN === #################################################### -# NOTE: the following code /defines/ what and how to build -# it doesn't "do" the build. SCons will do the "doing" env = setupBasicEnvironment() diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 000000000..382a2e953 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,31 @@ +/* + main.cpp - start the Cinelerra Application + + Copyright (C) CinelerraCV + 2007, Christian Thaeter + Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + + +#include + +int main(int argc, char* argv[]) + { + printf("hello cinelerra again\n"); + return 0; + } diff --git a/src/plugin/helloplugin.c b/src/plugin/helloplugin.c new file mode 100644 index 000000000..62a033f4e --- /dev/null +++ b/src/plugin/helloplugin.c @@ -0,0 +1,12 @@ +/* + * hello.c - demonstrates how to build a standalone tool (C source) + * integrated into the SCons based build system of Cinelerra + */ + +#include + +int main(int argc, char* argv[]) + { + printf("hello cinelerra world"); + return 0; + }