Merge cumulated changes to the SCONS build system

This commit is contained in:
Fischlurch 2008-02-14 15:57:24 +01:00
commit 93abddaa57
35 changed files with 1116 additions and 484 deletions

16
.gitignore vendored
View file

@ -1,9 +1,17 @@
/wiki/backups/*
*~
*.tar.*
.sconf_temp
.sconf_temp/*
.sconsign.dblite
.[^.]*
*.os
*.gch
,valgrind.log*
Buildhelper.pyc
optcache
Makefile.in
build/*
bin/*
autom4te.cache/*
scripts/*
configure
aclocal.m4
semantic.cache

340
COPYING Normal file
View file

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

6
INSTALL Normal file
View file

@ -0,0 +1,6 @@
Running / Installing Cinelerra-3 Prototype
==========================================
** to be written **

17
LICENSE Normal file
View file

@ -0,0 +1,17 @@
The Cinelerra source code is (C) by the original authors (see AUTHORS)
=======================================================================
Cinelerra is free software -- you may use and redistribute it under the
Terms and conditions of the GNU GENERAL PUBLIC LICENSE (GPL);
either version 2 of the License, or (at your option) any later version.
=======================================================================
For a copy of the GPL Version 2 see the file "COPYING"
In addition to the GPL's warranty stipulation, Cinelerra is distributed WITHOUT
GUARANTEED SUPPORT; without even the guarantee of ADDITIONAL LABOR. Support
that is not guaranteed includes technical support, compiler troubleshooting,
debugging, version matching, updating, among other additional labor which
may or may not be required to meet a user's requirements.

37
README Normal file
View file

@ -0,0 +1,37 @@
======================================
Cinelerra -- the video NLE for Linux
======================================
Cinelerra is a nonlinear video editing and compositing tool.
It understands some of the common multimedia formats
(quicktime, avi, ogg) and audio/video compression
codecs (divx, xvid, mpeg1/2/4, ...)
.
It features non-destructive editing, compositing tools,
a selection of effects plugins, processing in RGB, YUV
and RGB-float colormodels and the ability to mix media
with differing sizes and framerates.
For more information about Cinelerra visit http://cinelerra.org/
------------------------------
"Cinelerra-3" prototype code
------------------------------
**This source tree doesn't contain a working video editing application**
Rather, it contains some design studies and prototype code for improving
some aspects of the Cinelerra Application. This work may eventually
evolve into a new major release of Cinelerra.
As of 7/2007, we start here with some backend and render engine modules
together with some unit tests. You should find a wiki with detailed
design considerations and developer documentation and a UML model
(usable with BOUML 2.29) in the sibling directories.
Build Requirements
------------------
*to be written*

View file

@ -8,7 +8,7 @@
#
# 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
# 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,
@ -21,6 +21,9 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#####################################################################
import sys
sys.path.append("./admin/scons")
import os
from Buildhelper import *
@ -28,7 +31,8 @@ from Buildhelper import *
OPTIONSCACHEFILE = 'optcache'
CUSTOPTIONSFILE = 'custom-options'
SRCDIR = 'src'
BINDIR = 'src/bin'
BINDIR = 'bin'
TESTDIR = 'tests'
VERSION = '3+alpha.01'
#-----------------------------------Configuration
@ -43,46 +47,76 @@ VERSION = '3+alpha.01'
#####################################################################
def setupBasicEnvironment():
''' define cmdline options, build type decisions
'''
""" define cmdline options, build type decisions
"""
EnsurePythonVersion(2,3)
EnsureSConsVersion(0,96,90)
opts = defineCmdlineOptions()
env = Environment(options=opts)
env.Append ( CCCOM=' -std=gnu99') # workaround for a bug: CCCOM currently doesn't honor CFLAGS, only CCFLAGS
env.Replace( VERSION=VERSION
, SRCDIR=SRCDIR
, BINDIR=BINDIR
, CPPPATH=SRCDIR # used to find includes
, CPPPATH=["#"+SRCDIR] # used to find includes, "#" means always absolute to build-root
, CPPDEFINES=['-DCINELERRA_VERSION='+VERSION ] # note: it's a list to append further defines
, CCFLAGS='-Wall ' # -fdiagnostics-show-option
)
appendCppDefine(env,'DEBUG','DEBUG')
appendCppDefine(env,'OPENGL','USE_OPENGL')
appendVal(env,'ARCHFLAGS', 'CPPFLAGS') # for both C and C++
appendVal(env,'OPTIMIZE', 'CPPFLAGS', val=' -O3')
RegisterPrecompiledHeader_Builder(env)
handleNoBugSwitches(env)
appendCppDefine(env,'DEBUG','DEBUG', 'NDEBUG')
appendCppDefine(env,'OPENGL','USE_OPENGL')
appendVal(env,'ARCHFLAGS', 'CCFLAGS') # for both C and C++
appendVal(env,'OPTIMIZE', 'CCFLAGS', val=' -O3')
appendVal(env,'DEBUG', 'CCFLAGS', val=' -ggdb')
prepareOptionsHelp(opts,env)
opts.Save(OPTIONSCACHEFILE, env)
return env
def appendCppDefine(env,var,cppVar):
def appendCppDefine(env,var,cppVar, elseVal=''):
if env[var]:
env.Append(CPPDEFINES = {cppVar: env[var]})
env.Append(CPPDEFINES = cppVar )
elif elseVal:
env.Append(CPPDEFINES = elseVal)
def appendVal(env,var,targetVar,val=None):
if env[var]:
env.Append( **{targetVar: val or env[var]})
def handleNoBugSwitches(env):
""" set the build level for NoBug.
Release builds imply no DEBUG
wheras ALPHA and BETA require DEBUG
"""
level = env['BUILDLEVEL']
if level in ['ALPHA', 'BETA']:
if not env['DEBUG']:
print 'NoBug: ALPHA or BETA builds without DEBUG not possible, exiting.'
Exit(1)
env.Replace( DEBUG = 1 )
env.Append(CPPDEFINES = 'EBUG_'+level)
elif level == 'RELEASE':
env.Replace( DEBUG = 0 )
def defineCmdlineOptions():
''' current options will be persisted in a options cache file.
""" 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)','')
,EnumOption('BUILDLEVEL', 'NoBug build level for debugging', 'ALPHA',
allowed_values=('ALPHA', 'BETA', 'RELEASE'))
,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)
@ -98,31 +132,34 @@ def defineCmdlineOptions():
def prepareOptionsHelp(opts,env):
prelude = '''
USAGE: scons [-c] [OPTS] [key=val,...] [TARGETS]
prelude = """
USAGE: scons [-c] [OPTS] [key=val [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
testcode: additionally compile the Testsuite
check : build and run the Testsuite
doc : generate documetation (Doxygen)
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.
""" locate required libs.
setup platform specific options.
Abort build in case of failure.
'''
"""
conf = Configure(env)
# run all configuration checks in the current env
@ -130,14 +167,45 @@ def configurePlatform(env):
if not conf.CheckLibWithHeader('m', 'math.h','C'):
print 'Did not find math.h / libm, exiting.'
Exit(1)
if not conf.CheckLibWithHeader('dl', 'dlfcn.h', 'C'):
print 'Functions for runtime dynamic loading not available, exiting.'
Exit(1)
if not conf.CheckLibWithHeader('nobugmt', 'nobug.h', 'C'):
print 'Did not find NoBug [http://www.pipapo.org/pipawiki/NoBug], exiting.'
Exit(1)
if not conf.CheckLibWithHeader('pthread', 'pthread.h', 'C'):
print 'Did not find the pthread lib or pthread.h, exiting.'
else:
conf.env.Append(CPPFLAGS = ' -DHAVE_PTHREAD_H')
conf.env.Append(CCFLAGS = ' -pthread')
if conf.CheckCHeader('execinfo.h'):
conf.env.Append(CPPFLAGS = ' -DHAS_EXECINFO_H')
if conf.CheckCHeader('valgrind/valgrind.h'):
conf.env.Append(CPPFLAGS = ' -DHAS_VALGRIND_VALGIND_H')
if not conf.CheckCXXHeader('tr1/memory'):
print 'We rely on the std::tr1 proposed standard extension for shared_ptr.'
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)
else:
if not conf.CheckCXXHeader('boost/shared_ptr.hpp'):
print 'We need boost::shared_ptr (shared_ptr.hpp).'
Exit(1)
if not conf.CheckLibWithHeader('boost_program_options-mt','boost/program_options.hpp','C++'):
print 'We need boost::program_options (including binary lib for linking).'
Exit(1)
if not conf.CheckLibWithHeader('boost_regex-mt','boost/regex.hpp','C++'):
print 'We need the boost regular expression lib (incl. binary lib for linking).'
Exit(1)
# create new env containing the finished configuration
return conf.Finish()
@ -145,9 +213,9 @@ def configurePlatform(env):
def definePackagingTargets(env, artifacts):
''' build operations and targets to be done /before/ compiling.
""" build operations and targets to be done /before/ compiling.
things like creating a source tarball or preparing a version header.
'''
"""
t = Tarball(env,location='$SRCTAR',dirs='$SRCDIR')
artifacts['src.tar'] = t
env.Alias('src.tar', t)
@ -161,40 +229,68 @@ def definePackagingTargets(env, artifacts):
def defineBuildTargets(env, artifacts):
''' define the source file/dirs comprising each artifact to be built.
""" define the source file/dirs comprising each artifact to be built.
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')
+ env.Object('$SRCDIR/main.cpp')
)
plugobj = srcSubtree(env,'plugin', isShared=True)
"""
artifacts['cinelerra'] = env.Program('$BINDIR/cinelerra', cinobj)
cinobj = ( srcSubtree(env,'$SRCDIR/backend')
+ srcSubtree(env,'$SRCDIR/proc')
+ srcSubtree(env,'$SRCDIR/common')
+ srcSubtree(env,'$SRCDIR/lib')
)
plugobj = srcSubtree(env,'$SRCDIR/plugin', isShared=True)
core = env.StaticLibrary('$BINDIR/core.la', cinobj)
#core = cinobj # use this for linking directly
# use PCH to speed up building
precomp = env.PrecompiledHeader('$SRCDIR/pre')
env.Depends(cinobj, precomp)
artifacts['cinelerra'] = env.Program('$BINDIR/cinelerra', ['$SRCDIR/main.cpp']+ core )
artifacts['plugins'] = env.SharedLibrary('$BINDIR/cinelerra-plugin', plugobj)
# call subdir SConscript(s) for independent components
SConscript(dirs=[SRCDIR+'/tool'], exports='env artifacts')
SConscript(dirs=[TESTDIR], exports='env artifacts core')
def defineInstallTargets(env, artifacts):
''' define install locations and cleanup after the build.
def definePostBuildTargets(env, artifacts):
""" define further actions after the core build (e.g. Documentaion).
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', '$BINDIR')
build = env.Alias('build', '$BINDIR')
allbu = env.Alias('allbuild', build+artifacts['testsuite'])
env.Default('build')
# additional files to be cleaned when cleaning 'build'
env.Clean ('build', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log'])
env.Clean ('build', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log' ])
env.Clean ('build', [ '$SRCDIR/pre.gch' ])
# Doxygen documentation
# Note: at the moment we only depend on Doxyfile
# obviousely, we should depend on all sourcefiles
# real Doxygen builder for scons is under developement for 0.97
# so for the moment I prefere not to bother
doxyfile = File('doc/devel/Doxyfile')
env.NoClean(doxyfile)
doxydoc = artifacts['doxydoc'] = [ Dir('doc/devel/html'), Dir('doc/devel/latex') ]
env.Command(doxydoc, doxyfile, "doxygen Doxyfile 2>&1 |tee ,doxylog", chdir='doc/devel')
env.Clean ('doc/devel', doxydoc + ['doc/devel/,doxylog'])
def defineInstallTargets(env, artifacts):
""" define some artifacts to be installed into target locations.
"""
env.Install(dir = '$DESTDIR/bin', source=artifacts['cinelerra'])
env.Install(dir = '$DESTDIR/lib', source=artifacts['plugins'])
env.Install(dir = '$DESTDIR/bin', source=artifacts['tools'])
env.Install(dir = '$DESTDIR/share/doc/cinelerra$VERSION/devel', source=artifacts['doxydoc'])
#####################################################################
@ -222,5 +318,6 @@ artifacts = {}
definePackagingTargets(env, artifacts)
defineBuildTargets(env, artifacts)
definePostBuildTargets(env, artifacts)
defineInstallTargets(env, artifacts)

View file

@ -1,11 +0,0 @@
#!/bin/sh
if test "$1" = "yes"; then
git ls-files -o | xargs rm -f
else
(
echo "'git-mrproper.sh yes'"
echo "would delete following files:"
echo
git ls-files -o | while read file; do echo " $file"; done
) | less
fi

View file

@ -1,3 +0,0 @@
git hook scripts
taken out of .git/hooks since .git is not under revision control itself
if you want to use these, just symlink them

View file

@ -1,15 +0,0 @@
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, make this file executable.
. git-sh-setup
test -x "$GIT_DIR/hooks/commit-msg" &&
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
:

View file

@ -1,21 +0,0 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by git-commit with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, make this file executable.
# Uncomment the below to add a Signed-off-by line to the message.
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}

View file

@ -1,12 +0,0 @@
#!/bin/sh
#
# An example hook script that is called after a successful
# commit is made.
#
# To enable this hook, make this file executable.
# see wiki/index.html#GitNotes%20GitAliases for information
git sign "$(git-symbolic-ref HEAD | cut -d/ -f 3-)_signature"
git publish

View file

@ -1,16 +0,0 @@
#!/bin/sh
#
# An example hook script for the post-receive event
#
# This script is run after receive-pack has accepted a pack and the
# repository has been updated. It is passed arguments in through stdin
# in the form
# <oldrev> <newrev> <refname>
# For example:
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
#
# see contrib/hooks/ for an sample, or uncomment the next line (on debian)
#
#. /usr/share/doc/git-core/contrib/hooks/post-receive-email

View file

@ -1,8 +0,0 @@
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, make this file executable by "chmod +x post-update".
exec git-update-server-info

View file

@ -1,14 +0,0 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, make this file executable.
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
:

View file

@ -1,70 +0,0 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, make this file executable.
# This is slightly modified from Andrew Morton's Perfect Patch.
# Lines you introduce should not have trailing whitespace.
# Also check for an indentation that has SP before a TAB.
if git-rev-parse --verify HEAD 2>/dev/null
then
git-diff-index -p -M --cached HEAD
else
# NEEDSWORK: we should produce a diff with an empty tree here
# if we want to do the same verification for the initial import.
:
fi |
perl -e '
my $found_bad = 0;
my $filename;
my $reported_filename = "";
my $lineno;
sub bad_line {
my ($why, $line) = @_;
if (!$found_bad) {
print STDERR "*\n";
print STDERR "* You have some suspicious patch lines:\n";
print STDERR "*\n";
$found_bad = 1;
}
if ($reported_filename ne $filename) {
print STDERR "* In $filename\n";
$reported_filename = $filename;
}
print STDERR "* $why (line $lineno)\n";
print STDERR "$filename:$lineno:$line\n";
}
while (<>) {
if (m|^diff --git a/(.*) b/\1$|) {
$filename = $1;
next;
}
if (/^@@ -\S+ \+(\d+)/) {
$lineno = $1 - 1;
next;
}
if (/^ /) {
$lineno++;
next;
}
if (s/^\+//) {
$lineno++;
chomp;
if (/\s$/) {
bad_line("trailing whitespace", $_);
}
if (/^\s* /) {
bad_line("indent SP followed by a TAB", $_);
}
if (/^(?:[<>=]){7}/) {
bad_line("unresolved merge conflict", $_);
}
}
}
exit($found_bad);
'

View file

@ -1,150 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2006 Junio C Hamano
#
publish=next
basebranch="$1"
if test "$#" = 2
then
topic="refs/heads/$2"
else
topic=`git symbolic-ref HEAD`
fi
case "$basebranch,$topic" in
master,refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
;;
esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
# Is topic fully merged to master?
not_in_master=`git-rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
exit 1 ;# we could allow it, but there is no point.
fi
# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git-rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git-rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
not_in_topic=`git-rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up-to-date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
fi
else
not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
/^([0-9a-f]+) /;
($1 => 1);
} split(/\n/, $ARGV[1]);
for my $elem (map {
/^([0-9a-f]+) (.*)$/;
[$1 => $2];
} split(/\n/, $ARGV[2])) {
if (!exists $not_in_next{$elem->[0]}) {
if ($msg) {
print STDERR $msg;
undef $msg;
}
print STDERR " $elem->[1]\n";
}
}
' "$topic" "$not_in_next" "$not_in_master"
exit 1
fi
exit 0
################################################################
This sample hook safeguards topic branches that have been
published from being rewound.
The workflow assumed here is:
* Once a topic branch forks from "master", "master" is never
merged into it again (either directly or indirectly).
* Once a topic branch is fully cooked and merged into "master",
it is deleted. If you need to build on top of it to correct
earlier mistakes, a new topic branch is created by forking at
the tip of the "master". This is not strictly necessary, but
it makes it easier to keep your history simple.
* Whenever you need to test or publish your changes to topic
branches, merge them into "next" branch.
The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.
With this workflow, you would want to know:
(1) ... if a topic branch has ever been merged to "next". Young
topic branches can have stupid mistakes you would rather
clean up before publishing, and things that have not been
merged into other branches can be easily rebased without
affecting other people. But once it is published, you would
not want to rewind it.
(2) ... if a topic branch has been fully merged to "master".
Then you can delete it. More importantly, you should not
build on top of it -- other people may already want to
change things related to the topic as patches against your
"master", so if you need further changes, it is better to
fork the topic (perhaps with the same name) afresh from the
tip of "master".
Let's look at this example:
o---o---o---o---o---o---o---o---o---o "next"
/ / / /
/ a---a---b A / /
/ / / /
/ / c---c---c---c B /
/ / / \ /
/ / / b---b C \ /
/ / / / \ /
---o---o---o---o---o---o---o---o---o---o---o "master"
A, B and C are topic branches.
* A has one fix since it was merged up to "next".
* B has finished. It has been fully merged up to "master" and "next",
and is ready to be deleted.
* C has not merged to "next" at all.
We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.
To compute (1):
git-rev-list ^master ^topic next
git-rev-list ^master next
if these match, topic has not merged in next at all.
To compute (2):
git-rev-list master..topic
if this is empty, it is fully merged to "master".

View file

@ -1,78 +0,0 @@
#!/bin/sh
#
# An example hook script to blocks unannotated tags from entering.
# Called by git-receive-pack with arguments: refname sha1-old sha1-new
#
# To enable this hook, make this file executable by "chmod +x update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git-repo-config --bool hooks.allowunannotated)
# check for no description
projectdesc=$(sed -e '1p' "$GIT_DIR/description")
if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file to name it for gitweb" ]; then
echo "*** Project description file hasn't been set" >&2
exit 1
fi
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a branch
if [ -z "${newrev##0*}" ]; then
newrev_type=commit
else
newrev_type=$(git-cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
;;
refs/heads/*,commit)
# branch
;;
refs/remotes/*,commit)
# tracking branch
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0

5
admin/gnu-indent.sh Normal file
View file

@ -0,0 +1,5 @@
#!/bin/sh
#
# gnu-indent -- call the "indent" tool with parameters suitable for GNU coding style
#
indent -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2 -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob $@

View file

@ -8,7 +8,7 @@
#
# 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
# 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,
@ -23,6 +23,7 @@
import os
import sys
import glob
import fnmatch
import re
import tarfile
@ -36,48 +37,80 @@ def isCleanupOperation(env):
return env.GetOption('clean')
def isHelpRequest():
''' this is a hack: SCons does all configure tests even if only
""" 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
def srcSubtree(env,tree,isShared=False,builder=None, **args):
""" convienience wrapper: scans the given subtree, which is
relative to the current SConscript, 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)
"""
root = env.subst(tree) # expand Construction Vars
if not builder:
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']
SRCPATTERNS = ['*.c','*.cpp','*.cc']
def scanSrcSubtree(root):
''' scan the given subtree for source filesnames
def scanSrcSubtree(roots):
""" first expand (possible) wildcards and filter out non-dirs.
Then 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)
"""
for root in globRootdirs(roots):
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)
def globRootdirs(roots):
""" helper: expand shell wildcards and filter the resulting list,
so that it only contains existing directories
"""
filter = lambda f: os.path.isdir(f) and os.path.exists(f)
roots = glob.glob(roots)
return (dir for dir in roots if filter(dir) )
def RegisterPrecompiledHeader_Builder(env):
""" Registeres an Custom Builder for generating a precompiled Header.
Note you should define a dependency to the PCH file
"""
def genCmdline(source, target, env, for_signature):
return '$CXXCOM -x c++-header %s' % source[0]
def fixSourceDependency(target, source, env):
print "precompiled header: %s --> %s" % (source[0],target[0])
return (target, source)
gchBuilder = env.Builder( generator = genCmdline
, emitter = fixSourceDependency
, suffix = '.gch'
, src_suffix = '.hpp'
)
env.Append(BUILDERS = {'PrecompiledHeader' : gchBuilder})
def Tarball(env,location,dirs,suffix=''):
''' Custom Command: create Tarball of some subdirs
""" 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
@ -87,7 +120,7 @@ def Tarball(env,location,dirs,suffix=''):
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)
@ -99,11 +132,11 @@ def Tarball(env,location,dirs,suffix=''):
def createTarball(target,source,env):
''' helper, builds the tar using the python2.3 tarfil lib.
""" 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']
@ -117,7 +150,7 @@ def createTarball(target,source,env):
tar.close()
#
# old version using shell command:
#
#
# cmd = 'tar -czf %s %s' % (name,targetspec)
# print 'running ', cmd, ' ... '
# pipe = os.popen (cmd)
@ -127,10 +160,10 @@ def createTarball(target,source,env):
def getTarName(location, defaultName):
''' create a suitable name for the tarball.
""" 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):

2
admin/scons/DIR_INFO Normal file
View file

@ -0,0 +1,2 @@
python scripts for the scons build system

View file

@ -1,2 +0,0 @@
#!/bin/sh
find -name DIR_INFO -printf '%-40h: ' -exec head -1 {} \; | sort | cut -c 1-92

1
bin/DIR_INFO Normal file
View file

@ -0,0 +1 @@
cinelerra executable(s) and libraries will be built here

1
scripts/DIR_INFO Normal file
View file

@ -0,0 +1 @@
autotools helper scripts

2
src/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
bin/*
plugin/*.os

View file

@ -1 +1 @@
every components source in a own subdir here
root of sourcecode tree

2
src/backend/DIR_INFO Normal file
View file

@ -0,0 +1,2 @@
data and caching backend

2
src/lib/DIR_INFO Normal file
View file

@ -0,0 +1,2 @@
cinelerra support library
This dir contains the code for some tools and library code which will be used in many places

View file

@ -21,11 +21,17 @@
*/
#include <iostream>
#include <stdio.h>
using std::cout;
using std::endl;
int main (int argc, char* argv[])
{
cout << "*** Cinelerra NLE for Linux ***" << endl
<< " hello SCONS build system" << endl;
assert(true);
return 0;
}
int main(int argc, char* argv[])
{
printf("hello SCONS build system\n");
return 0;
}

93
src/nobugcfg.h Normal file
View file

@ -0,0 +1,93 @@
/*
NOBUGCFG.h - global configuration and definitions for NoBug
Copyright (C) CinelerraCV
2007, Christian Thaeter <ct@pipapo.org>
Hermann Vosseler <Ichthyostega@web.de>
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.
*/
/** @file nobugcfg.h
** This header is for including and configuring NoBug.
** The idea is that configuration and some globally used flag
** declarations are to be kept in one central location. Normally,
** this header will be included by appconfig.hpp, which in turn gets
** included by cinelerra.h
** @par Besides the usual guarded declarations, this header contains
** one section with the corresponding <b>definitions</b>. This section
** is to be called by appconfig.cpp only, which deals with application
** wide configuration values contained in the Singleton class Appconfig.
** Incidentally, the constructor of Appconfig issues the NOBUG_INIT call
**
*/
#ifndef NOBUGCFG_H /* ============= Part 1: DECLARATIONS ======== */
#define NOBUGCFG_H
#include <syslog.h>
/* configuration of NoBug goes here... */
#include <nobug.h>
/* declare flags used throughout the code base... */
NOBUG_DECLARE_FLAG(config);
NOBUG_DECLARE_FLAG(oper);
NOBUG_DECLARE_FLAG(test);
NOBUG_DECLARE_FLAG(singleton);
NOBUG_DECLARE_FLAG(assetmem);
NOBUG_DECLARE_FLAG(mobjectmem);
#endif /*NOBUGCFG_H ======= (End) Part 1: DECLARATIONS ======== */
#ifdef NOBUG_INIT_DEFS_ /*========== Part 2: DEFINITIONS ========= */
/* ================================= common C Part ========= */
#ifdef __cplusplus /* ============== C++-Part ============== */
/* flags used throughout the code base... */
NOBUG_CPP_DEFINE_FLAG(config);
NOBUG_CPP_DEFINE_FLAG(oper);
NOBUG_CPP_DEFINE_FLAG(test);
NOBUG_CPP_DEFINE_FLAG_LIMIT(singleton, LOG_WARNING);
NOBUG_CPP_DEFINE_FLAG_LIMIT(assetmem, LOG_WARNING);
NOBUG_CPP_DEFINE_FLAG_LIMIT(mobjectmem, LOG_WARNING);
#include "common/error.hpp"
#endif /* ===================== (End) C++-Part ============= */
#endif /*NOBUG_INIT_DEFS_ ==== (End) Part 2: DEFINITIONS ========= */

2
src/plugin/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.os

View file

@ -5,6 +5,13 @@
Import('env','artifacts')
# build the ubiquitous Hello World application (note: C source)
artifacts['tools'] = env.Program('#$BINDIR/hello-world','hello.c')
# at the moment (8/07), Ichthyo tries to find out how to configure NoBug
# does it help, if we set the NOBUG_LOG to the environment used for building??
env = env.Clone()
env['ENV']['NOBUG_LOG'] = 'ttt:WARNING'
# build the ubiquitous Hello World application (note: C source)
artifacts['tools'] = [ env.Program('#$BINDIR/hello-world','hello.c')
+ env.Program('#$BINDIR/try', 'try.cpp') #### to try out some feature:
]

37
src/tool/try.cpp Normal file
View file

@ -0,0 +1,37 @@
/* try.cpp - for trying out some language features....
* scons will create the binary bin/try
*
*/
// 8/07 - how to control NOBUG??
// execute with NOBUG_LOG='ttt:TRACE' bin/try
// 1/08 - working out a static initialisation problem for Visitor (Tag creation)
// 1/08 - check 64bit longs
#include <nobug.h>
#include <iostream>
#include <limits>
using std::string;
using std::cout;
NOBUG_CPP_DEFINE_FLAG(test);
int main (int argc, char* argv[])
{
NOBUG_INIT;
int64_t lol (1);
cout << sizeof(lol)<< "\n";
cout << "long: "<< std::numeric_limits<long>::max()
<<" 64: " << std::numeric_limits<int64_t>::max()
<<"\n";
return 0;
}

13
tests/00test.tests Normal file
View file

@ -0,0 +1,13 @@
TESTING "test system selftest" cat
TEST "test cat'ing stdin to stdout" <<END
in: foo: bar
out: foo: bar
return: 0
END
TEST "test stderr, cat'ing noonexistant file" ,nonexistent_file <<END
err: cat: ,nonexistent_file: No such file or directory
return: 1
END

95
tests/SConscript Normal file
View file

@ -0,0 +1,95 @@
# -*- python -*-
##
## SConscript - SCons buildscript for the Testsuite (called by SConstruct)
##
from os import path
from Buildhelper import srcSubtree
from Buildhelper import globRootdirs
Import('env','artifacts','core')
def testExecutable(env,tree, exeName=None, obj=None):
""" declare all targets needed to create a standalone
Test executalbe of the given Sub-tree. Note that
each subdir is built in its own Environment.
"""
env = env.Clone()
env.Append(CPPPATH=tree) # add Subdir to Includepath
tree = env.subst(tree) # expand Construction Vars
if obj:
obj = [path.join(tree,name) for name in obj]
else:
obj = srcSubtree(env,tree) # use all sourcefiles found in subtree
if not exeName:
exeName = 'test-%s' % tree
return env.Program('#$BINDIR/'+exeName, obj + core)
def treatPluginTestcase(env):
""" Special case: the test-plugin executable
"""
env = env.Clone()
env.Append(CPPPATH='plugin')
prfx = 'plugin/example_plugin'
oC = env.SharedObject(prfx, prfx+'.c')
oCPP = env.SharedObject(prfx+'_cpp', prfx+'.cpp')
testplugin = ( env.SharedLibrary('#$BINDIR/.libs/example_plugin', oC, SHLIBPREFIX='')
+ env.SharedLibrary('#$BINDIR/.libs/example_plugin_cpp', oCPP, SHLIBPREFIX='')
)
testExe = env.Program('#$BINDIR/test-plugin', ['plugin/plugin_main.c'] + core)
env.Depends(testExe, testplugin)
return testExe
#-- it depentds (at the moment) on a specific isolated test-plugin,
# which is not integrated in the "normal procedure" for building Plugins
# (which is not yet implemented as of 8/07)
# TODO: handle this case automatically
#
# build a Test-Executable out of every subdir...
moduledirs = globRootdirs('*')
# but have to treat some subdirs individually.
specials = ['plugin','locking','library']
artifacts['testsuite'] = ts = ( [ testExecutable(env, dir) for dir in moduledirs if not dir in specials]
+ treatPluginTestcase(env)
+ testExecutable(env, 'locking', obj=['test-locking.c','mutex.c','condition.c'])
+ testExecutable(env, 'library', exeName='test-llist', obj=['test-llist.c'])
+ testExecutable(env, 'library', exeName='test-references', obj=['test-references.c'])
)
#
# actually run the Testsuite
#
# - the product of running the Testsuite is the ",testlog"
# - it depends on all artifacts defined as "ts" above
#
testEnv = env.Clone()
testEnv.Append(ENV = {'VALGRINDFLAGS' : 'DISABLE'})
testDir = env.Dir('#$BINDIR')
runTest = env.File("test.sh").abspath
runTs = testEnv.Command(',testlog', ts, runTest, chdir=testDir)
#
# define Phony targets
# - 'scons testcode' triggers building of the Testsuite
# - 'scons check' triggers building and running
#
env.Alias('testcode', ts )
env.Alias('check', runTs )
# declare tempfiles of test.sh as cleanable
env.Clean ('check', [',testlog.pre',',expect_stdout',',stdout',',stderr',',testtmp','.libs'])

226
tests/test.sh Executable file
View file

@ -0,0 +1,226 @@
#!/bin/bash
# Copyright (C) CinelerraCV
# 2007, Christian Thaeter <ct@pipapo.org>
# Hermann Vosseler <Ichthyostega@web.de>
#
# 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.
# TESTMODE=FULL yet unimplemented
# run all tests, PLANNED which fail count as error
#
# TESTMODE=FAST
# run only tests which recently failed
#
# TESTMODE=FIRSTFAIL
# stop testing on the first failure
export LC_ALL=C
arg0="$0"
srcdir=$(dirname "$arg0")
ulimit -S -t 1 -v 524288
valgrind=""
if [ "$VALGRINDFLAGS" = 'DISABLE' ]; then
echo "valgrind explicit disabled"
else
if [ "$(which valgrind)" ]; then
valgrind="$(which valgrind) --leak-check=yes --show-reachable=yes -q $VALGRINDFLAGS"
ulimit -S -t 10
else
echo "no valgrind found, go without it"
fi
fi
echo
echo ================ ${0##*/} ================
TESTCNT=0
SKIPCNT=0
FAILCNT=0
# the old testlog if existing will be used to check for previous test states
if test -f ,testlog; then
mv ,testlog ,testlog.pre
else
touch ,testlog.pre
fi
date >,testlog
function TEST()
{
name="$1"
shift
rm -f ,send_stdin
rm -f ,expect_stdout
rm -f ,expect_stderr
while read -r line; do
cmd="${line%%:*}"
arg="${line#*: }"
expect_return=0
case $cmd in
'in')
echo "$arg" >>,send_stdin
;;
'out')
echo "$arg" >>,expect_stdout
;;
'err')
echo "$arg" >>,expect_stderr
;;
'return')
expect_return=$arg
;;
*)
echo "UNKOWN TEST COMMAND '$cmd'" 1>&2
exit
;;
esac
done
echo -n "TEST $name: "
echo -en "\nTEST $name: $* " >>,testlog
case $TESTMODE in
*FAST*)
if grep "^TEST $name: .* FAILED" ,testlog.pre >&/dev/null; then
MSGOK=" (fixed)"
MSGFAIL=" (still broken)"
elif grep "^TEST $name: .* \\(SKIPPED (ok)\\|OK\\)" ,testlog.pre >&/dev/null; then
echo ".. SKIPPED (ok)"
echo ".. SKIPPED (ok)" >>,testlog
SKIPCNT=$(($SKIPCNT + 1))
TESTCNT=$(($TESTCNT + 1))
return
else
MSGOK=" (new)"
MSGFAIL=" (new)"
fi
;;
*)
MSGOK=""
MSGFAIL=""
;;
esac
TESTCNT=$(($TESTCNT + 1))
fails=0
if test -f ,send_stdin; then
cat ,send_stdin | $valgrind $TESTBIN "$@" 2>,stderr >,stdout
else
$valgrind $TESTBIN "$@" 2>,stderr >,stdout
fi &>/dev/null
return=$?
echo -n >,testtmp
if test -f ,expect_stdout; then
if ! cmp ,expect_stdout ,stdout &>/dev/null; then
echo "unexpected data on stdout" >>,testtmp
grep -v ': \(TRACE\|INFO\|NOTICE\|WARNING\|ERR\):' <,stdout >,tmp
diff -ua ,expect_stdout ,tmp >>,testtmp
rm ,tmp
((fails+=1))
fi
fi
if test -f ,expect_stderr; then
if ! cmp ,expect_stderr ,stderr &>/dev/null; then
echo "unexpected data on stderr" >>,testtmp
grep -v ': \(TRACE\|INFO\|NOTICE\|WARNING\|ERR\):' <,stderr >,tmp
diff -ua ,expect_stderr ,tmp >>,testtmp
rm ,tmp
((fails+=1))
fi
fi
if test $expect_return != $return; then
echo "unexpected return value $return" >>,testtmp
((fails+=1))
fi
if test $fails -eq 0; then
echo ".. OK$MSGOK"
echo ".. OK$MSGOK" >>,testlog
else
echo ".. FAILED$MSGFAIL";
echo ".. FAILED$MSGFAIL" >>,testlog
cat ,testtmp >>,testlog
rm ,testtmp
echo "stderr was:" >>,testlog
cat ,stderr >>,testlog
echo END >>,testlog
FAILCNT=$(($FAILCNT + 1))
case $TESTMODE in
*FIRSTFAIL*)
break 2
;;
esac
fi
}
function PLANNED()
{
echo -n "PLANNED $1: "
echo -en "\nPLANNED $* " >>,testlog
echo ".. SKIPPED (planned)"
echo ".. SKIPPED (planned)" >>,testlog
SKIPCNT=$(($SKIPCNT + 1))
TESTCNT=$(($TESTCNT + 1))
}
function RUNTESTS()
{
if test \( ! "${TESTSUITES/*,*/}" \) -a "$TESTSUITES"; then
TESTSUITES="{$TESTSUITES}"
fi
for t in $(eval echo $srcdir/*$TESTSUITES*.tests); do
echo "$t"
done | sort | uniq | {
while read i; do
echo $i >&2
if test -f $i; then
source $i
fi
done
echo
if [ $FAILCNT = 0 ]; then
echo " ... PASSED $(($TESTCNT - $SKIPCNT)) TESTS, $SKIPCNT SKIPPED"
#rm ,testlog
else
echo " ... SUCCEDED $(($TESTCNT - $FAILCNT - $SKIPCNT)) TESTS"
echo " ... FAILED $FAILCNT TESTS"
echo " ... SKIPPED $SKIPCNT TESTS"
echo " see ',testlog' for details"
exit 1
fi
}
}
function TESTING()
{
echo
echo "$1"
TESTBIN=$2
}
TESTSUITES="${TESTSUITES}${1:+${TESTSUITES:+,}$1}"
RUNTESTS