From 402a730430c98f08a29a09a9a9b569bed36e0a4c Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Sat, 22 Nov 2003 13:28:28 +0000 Subject: Add Borland compiler support. (Vincent Risi) --- bin/files | 3 ++ doc/man/scons.1 | 3 ++ src/CHANGES.txt | 4 +++ src/engine/MANIFEST.in | 3 ++ src/engine/SCons/Tool/__init__.py | 8 ++--- src/engine/SCons/Tool/bcc32.py | 76 +++++++++++++++++++++++++++++++++++++++ src/engine/SCons/Tool/ilink32.py | 51 ++++++++++++++++++++++++++ src/engine/SCons/Tool/tlib.py | 44 +++++++++++++++++++++++ test/import.py | 3 ++ 9 files changed, 191 insertions(+), 4 deletions(-) create mode 100644 src/engine/SCons/Tool/bcc32.py create mode 100644 src/engine/SCons/Tool/ilink32.py create mode 100644 src/engine/SCons/Tool/tlib.py diff --git a/bin/files b/bin/files index cc8bf10..3365f4c 100644 --- a/bin/files +++ b/bin/files @@ -43,6 +43,7 @@ ./SCons/Tool/aixlink.py ./SCons/Tool/ar.py ./SCons/Tool/as.py +./SCons/Tool/bcc32.py ./SCons/Tool/c++.py ./SCons/Tool/cc.py ./SCons/Tool/default.py @@ -61,6 +62,7 @@ ./SCons/Tool/icl.py ./SCons/Tool/ifl.py ./SCons/Tool/ilink.py +./SCons/Tool/ilink32.py ./SCons/Tool/jar.py ./SCons/Tool/javac.py ./SCons/Tool/JavaCommon.py @@ -92,6 +94,7 @@ ./SCons/Tool/swig.py ./SCons/Tool/tar.py ./SCons/Tool/tex.py +./SCons/Tool/tlib.py ./SCons/Tool/yacc.py ./SCons/Util.py ./SCons/Warnings.py diff --git a/doc/man/scons.1 b/doc/man/scons.1 index 67b1b9e..262f670 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -900,6 +900,7 @@ aixf77 aixlink ar as +bcc32 c++ cc dvipdf @@ -918,6 +919,7 @@ icc icl ifl ilink +ilink32 jar javac javah @@ -949,6 +951,7 @@ sunlink swig tar tex +tlib yacc zip .EE diff --git a/src/CHANGES.txt b/src/CHANGES.txt index a6965c6..0d6b43d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -51,6 +51,10 @@ RELEASE 0.95 - XXX - Allow the LIBS construction variable to be a single string or File node, not a list, when only one library is needed. + From Vincent Risi: + + - Add support for the bcc32, ilink32 and tlib Borland tools. + From Anthony Roach: - Supply an error message if the user tries to configure a BuildDir diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index c5fe7a3..e939790 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -51,6 +51,7 @@ SCons/Tool/aixf77.py SCons/Tool/aixlink.py SCons/Tool/ar.py SCons/Tool/as.py +SCons/Tool/bcc32.py SCons/Tool/BitKeeper.py SCons/Tool/c++.py SCons/Tool/cc.py @@ -76,6 +77,7 @@ SCons/Tool/icc.py SCons/Tool/icl.py SCons/Tool/ifl.py SCons/Tool/ilink.py +SCons/Tool/ilink32.py SCons/Tool/latex.py SCons/Tool/lex.py SCons/Tool/link.py @@ -109,6 +111,7 @@ SCons/Tool/Subversion.py SCons/Tool/swig.py SCons/Tool/tar.py SCons/Tool/tex.py +SCons/Tool/tlib.py SCons/Tool/yacc.py SCons/Tool/zip.py SCons/Util.py diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index b71b08b..a58ac6d 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -230,12 +230,12 @@ def tool_list(platform, env): # change these search orders, update the man page as well. if str(platform) == 'win32': "prefer Microsoft tools on Windows" - linkers = ['mslink', 'gnulink', 'ilink', 'linkloc' ] - c_compilers = ['msvc', 'mingw', 'gcc', 'icl', 'icc', 'cc' ] - cxx_compilers = ['msvc', 'icc', 'g++', 'c++'] + linkers = ['mslink', 'gnulink', 'ilink', 'linkloc', 'ilink32' ] + c_compilers = ['msvc', 'mingw', 'gcc', 'icl', 'icc', 'cc', 'bcc32' ] + cxx_compilers = ['msvc', 'icc', 'g++', 'c++', 'bcc32' ] assemblers = ['masm', 'nasm', 'gas', '386asm' ] fortran_compilers = ['g77', 'ifl'] - ars = ['mslib', 'ar'] + ars = ['mslib', 'ar', 'tlib'] elif str(platform) == 'os2': "prefer IBM tools on OS/2" linkers = ['ilink', 'gnulink', 'mslink'] diff --git a/src/engine/SCons/Tool/bcc32.py b/src/engine/SCons/Tool/bcc32.py new file mode 100644 index 0000000..6f63525 --- /dev/null +++ b/src/engine/SCons/Tool/bcc32.py @@ -0,0 +1,76 @@ +"""SCons.Tool.bcc32 + +XXX + +""" + +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import os +import os.path +import string + +import SCons.Defaults +import SCons.Tool +import SCons.Util + +def findIt(program, env): + # First search in the SCons path and then the OS path: + borwin = env.WhereIs(program) or SCons.Util.WhereIs(program) + if borwin: + dir = os.path.dirname(borwin) + path = env['ENV'].get('PATH', []) + if not path: + path = [] + if SCons.Util.is_String(path): + path = string.split(path, os.pathsep) + env['ENV']['PATH'] = string.join([dir]+path, os.pathsep) + return borwin + +def generate(env): + findIt('bcc32', env) + """Add Builders and construction variables for bcc to an + Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + for suffix in ['.c', '.cpp']: + static_obj.add_action(suffix, SCons.Defaults.CAction) + shared_obj.add_action(suffix, SCons.Defaults.ShCAction) + env['CC'] = 'bcc32' + env['CCFLAGS'] = '' + env['CCCOM'] = '$CC -q $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + env['SHCC'] = '$CC' + env['SHCCFLAGS'] = '$CCFLAGS' + env['SHCCCOM'] = '$SHCC -WD $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + env['CPPDEFPREFIX'] = '-D' + env['CPPDEFSUFFIX'] = '' + env['INCPREFIX'] = '-I' + env['INCSUFFIX'] = '' + env['SHOBJSUFFIX'] = '.dll' + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 + env['CFILESUFFIX'] = '.cpp' + +def exists(env): + return findIt('bcc32', env) diff --git a/src/engine/SCons/Tool/ilink32.py b/src/engine/SCons/Tool/ilink32.py new file mode 100644 index 0000000..35d1a66 --- /dev/null +++ b/src/engine/SCons/Tool/ilink32.py @@ -0,0 +1,51 @@ +"""SCons.Tool.ilink32 + +XXX + +""" + +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import SCons.Tool +import SCons.Tool.bcc32 + +def generate(env): + """Add Builders and construction variables for ilink to an + Environment.""" + SCons.Tool.createProgBuilder(env) + + env['LINK'] = '$CC' + env['LINKFLAGS'] = '' + env['LINKCOM'] = '$LINK -q $LINKFLAGS $SOURCES $LIBS' + env['LIBDIRPREFIX']='' + env['LIBDIRSUFFIX']='' + env['LIBLINKPREFIX']='' + env['LIBLINKSUFFIX']='$LIBSUFFIX' + +def exists(env): + # Uses bcc32 to do linking as it generally knows where the standard + # LIBS are and set up the linking correctly + return SCons.Tool.bcc32.findIt('bcc32', env) diff --git a/src/engine/SCons/Tool/tlib.py b/src/engine/SCons/Tool/tlib.py new file mode 100644 index 0000000..6ce1bf4 --- /dev/null +++ b/src/engine/SCons/Tool/tlib.py @@ -0,0 +1,44 @@ +"""SCons.Tool.tlib + +XXX + +""" + +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import SCons.Tool +import SCons.Tool.bcc32 + +def generate(env): + SCons.Tool.bcc32.findIt('tlib', env) + """Add Builders and construction variables for ar to an Environment.""" + SCons.Tool.createStaticLibBuilder(env) + env['AR'] = 'tlib' + env['ARFLAGS'] = '' + env['ARCOM'] = '$AR $TARGET $ARFLAGS /a $SOURCES' + +def exists(env): + return SCons.Tool.bcc32.findIt('tlib', env) diff --git a/test/import.py b/test/import.py index d30328b..ff7200c 100644 --- a/test/import.py +++ b/test/import.py @@ -51,6 +51,7 @@ tools = [ 'aixlink', 'ar', 'as', + 'bcc32', 'BitKeeper', 'c++', 'cc', @@ -72,6 +73,7 @@ tools = [ 'icl', 'ifl', 'ilink', + 'ilink32', 'jar', 'javac', 'javah', @@ -107,6 +109,7 @@ tools = [ 'swig', 'tar', 'tex', + 'tlib', 'yacc', 'zip', ] -- cgit v0.12