From 286d4a73c144735959428265a26a27ec8f46dae5 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Wed, 29 Jan 2003 11:44:58 +0000 Subject: Add IRIX and MIPSPro support. (Chad Austin) --- bin/files | 5 ++ src/CHANGES.txt | 4 ++ src/engine/MANIFEST.in | 5 ++ src/engine/SCons/Platform/PlatformTests.py | 8 ++++ src/engine/SCons/Platform/__init__.py | 6 ++- src/engine/SCons/Platform/irix.py | 38 +++++++++++++++ src/engine/SCons/Tool/__init__.py | 10 +++- src/engine/SCons/Tool/gas.py | 2 +- src/engine/SCons/Tool/sgias.py | 63 ++++++++++++++++++++++++ src/engine/SCons/Tool/sgicc.py | 77 ++++++++++++++++++++++++++++++ src/engine/SCons/Tool/sgif77.py | 69 ++++++++++++++++++++++++++ src/engine/SCons/Tool/sgilink.py | 60 +++++++++++++++++++++++ 12 files changed, 344 insertions(+), 3 deletions(-) create mode 100644 src/engine/SCons/Platform/irix.py create mode 100644 src/engine/SCons/Tool/sgias.py create mode 100644 src/engine/SCons/Tool/sgicc.py create mode 100644 src/engine/SCons/Tool/sgif77.py create mode 100644 src/engine/SCons/Tool/sgilink.py diff --git a/bin/files b/bin/files index d4ec77a..d824a3f 100644 --- a/bin/files +++ b/bin/files @@ -10,6 +10,7 @@ ./SCons/Options.py ./SCons/Platform/__init__.py ./SCons/Platform/cygwin.py +./SCons/Platform/irix.py ./SCons/Platform/os2.py ./SCons/Platform/posix.py ./SCons/Platform/win32.py @@ -46,6 +47,10 @@ ./SCons/Tool/nasm.py ./SCons/Tool/pdflatex.py ./SCons/Tool/pdftex.py +./SCons/Tool/sgias.py +./SCons/Tool/sgicc.py +./SCons/Tool/sgif77.py +./SCons/Tool/sgilink.py ./SCons/Tool/tar.py ./SCons/Tool/tex.py ./SCons/Tool/yacc.py diff --git a/src/CHANGES.txt b/src/CHANGES.txt index ce88f01..4e8fcee 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -10,6 +10,10 @@ RELEASE 0.11 - XXX + From Chad Austin: + + - Add support for IRIX and the SGI MIPSPro tool chain. + From Charles Crain: - Added new AddPreAction() and AddPostAction() functions that support diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index a51277b..cde966f 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -16,6 +16,7 @@ SCons/Optik/option_parser.py SCons/Options.py SCons/Platform/__init__.py SCons/Platform/cygwin.py +SCons/Platform/irix.py SCons/Platform/os2.py SCons/Platform/posix.py SCons/Platform/win32.py @@ -55,6 +56,10 @@ SCons/Tool/nasm.py SCons/Tool/pdflatex.py SCons/Tool/pdftex.py SCons/Tool/PharLapCommon.py +SCons/Tool/sgias.py +SCons/Tool/sgicc.py +SCons/Tool/sgif77.py +SCons/Tool/sgilink.py SCons/Tool/tar.py SCons/Tool/tex.py SCons/Tool/yacc.py diff --git a/src/engine/SCons/Platform/PlatformTests.py b/src/engine/SCons/Platform/PlatformTests.py index e000103..63152f0 100644 --- a/src/engine/SCons/Platform/PlatformTests.py +++ b/src/engine/SCons/Platform/PlatformTests.py @@ -60,6 +60,14 @@ class PlatformTestCase(unittest.TestCase): assert env['LIBSUFFIX'] == '.a', env assert env['SHELL'] == 'sh', env + p = SCons.Platform.Platform('irix') + assert str(p) == 'irix', p + env = Environment() + p(env) + assert env['PROGSUFFIX'] == '', env + assert env['LIBSUFFIX'] == '.a', env + assert env['SHELL'] == 'sh', env + p = SCons.Platform.Platform('win32') assert str(p) == 'win32', p env = Environment() diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index e75a024..90bb27c 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -46,6 +46,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import imp import os +import string import sys import SCons.Errors @@ -63,7 +64,10 @@ def platform_default(): if osname == 'posix': if sys.platform == 'cygwin': return 'cygwin' - return 'posix' + elif string.find(sys.platform, 'irix') != -1: + return 'irix' + else: + return 'posix' elif os.name == 'os2': return 'os2' else: diff --git a/src/engine/SCons/Platform/irix.py b/src/engine/SCons/Platform/irix.py new file mode 100644 index 0000000..861ecac --- /dev/null +++ b/src/engine/SCons/Platform/irix.py @@ -0,0 +1,38 @@ +"""SCons.Platform.irix + +Platform-specific initialization for SGI IRIX systems. + +There normally shouldn't be any need to import this module directly. It +will usually be imported through the generic SCons.Platform.Platform() +selection method. +""" + +# +# __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 posix + +def generate(env): + posix.generate(env) diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index 50ab456..ca591f6 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -157,6 +157,13 @@ def tool_list(platform, env): assemblers = ['nasm', 'masm', 'gas'] fortran_compilers = ['ifl', 'g77'] ars = ['ar', 'mslib'] + elif str(platform) == 'irix': + "prefer MIPSPro on IRIX" + linkers = ['sgilink', 'gnulink'] + c_compilers = ['sgicc', 'gcc'] + assemblers = ['sgias', 'gas'] + fortran_compilers = ['sgif77', 'g77'] + ars = ['ar'] else: "prefer GNU tools on all other platforms" linkers = ['gnulink', 'mslink', 'ilink'] @@ -184,7 +191,8 @@ def tool_list(platform, env): ar = FindTool(ars, env) or ars[0] # Don't use g++ if the C compiler has built-in C++ support: - if c_compiler and (c_compiler == 'msvc' or c_compiler == 'icc'): + if c_compiler and (c_compiler == 'msvc' or c_compiler == 'icc' or + c_compiler == 'sgicc'): cxx_compiler = None else: cxx_compiler = FindTool(['g++'], env) diff --git a/src/engine/SCons/Tool/gas.py b/src/engine/SCons/Tool/gas.py index c402716..08f0e5b 100644 --- a/src/engine/SCons/Tool/gas.py +++ b/src/engine/SCons/Tool/gas.py @@ -1,4 +1,4 @@ -"""SCons.Tool.as +"""SCons.Tool.gas Tool-specific initialization for as, the Gnu assembler. diff --git a/src/engine/SCons/Tool/sgias.py b/src/engine/SCons/Tool/sgias.py new file mode 100644 index 0000000..fea4a6f --- /dev/null +++ b/src/engine/SCons/Tool/sgias.py @@ -0,0 +1,63 @@ +"""SCons.Tool.sgias + +Tool-specific initialization for as, the SGI assembler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# __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.path + +import SCons.Defaults +import SCons.Tool +import SCons.Util + +assemblers = ['as'] + +ASSuffixes = ['.s', '.asm', '.ASM'] +ASPPSuffixes = ['.spp', '.SPP'] + +def generate(env, platform): + """Add Builders and construction variables for as to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in ASSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASAction) + + for suffix in ASPPSuffixes: + static_obj.add_action(suffix, SCons.Defaults.ASPPAction) + + env['AS'] = env.Detect(assemblers) or 'as' + env['ASFLAGS'] = '' + env['ASCOM'] = '$AS $ASFLAGS -o $TARGET $SOURCES' + env['ASPPCOM'] = '$CC $ASFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + +def exists(env): + return env.Detect(assemblers) diff --git a/src/engine/SCons/Tool/sgicc.py b/src/engine/SCons/Tool/sgicc.py new file mode 100644 index 0000000..d323303 --- /dev/null +++ b/src/engine/SCons/Tool/sgicc.py @@ -0,0 +1,77 @@ +"""SCons.Tool.sgicc + +Tool-specific initialization for MIPSPro CC and cc. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# __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.path + +import SCons.Tool +import SCons.Defaults +import SCons.Util + +CSuffixes = ['.c'] +CXXSuffixes = ['.C', '.cpp', '.cc', '.cxx'] + +def generate(env, platform): + """Add Builders and construction variables for gcc to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in CSuffixes: + static_obj.add_action(suffix, SCons.Defaults.CAction) + shared_obj.add_action(suffix, SCons.Defaults.ShCAction) + for suffix in CXXSuffixes: + static_obj.add_action(suffix, SCons.Defaults.CXXAction) + shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction) + + env['CC'] = 'cc' + env['CCFLAGS'] = '' + env['CCCOM'] = '$CC $CCFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + env['SHCC'] = '$CC' + env['SHCCFLAGS'] = '$CCFLAGS' + env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + + env['CXX'] = 'CC' + env['CXXFLAGS'] = ['$CCFLAGS', '-LANG:std'] + env['CXXCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + env['SHCXX'] = '$CXX' + env['SHCXXFLAGS'] = '$CXXFLAGS' + env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CPPFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES' + + env['INCPREFIX'] = '-I' + env['INCSUFFIX'] = '' + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 + + env['CFILESUFFIX'] = '.c' + +def exists(env): + return env.Detect('CC') diff --git a/src/engine/SCons/Tool/sgif77.py b/src/engine/SCons/Tool/sgif77.py new file mode 100644 index 0000000..435dc4d --- /dev/null +++ b/src/engine/SCons/Tool/sgif77.py @@ -0,0 +1,69 @@ +"""engine.SCons.Tool.sgif77 + +Tool-specific initialization for SGI f77 Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# __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.path + +import SCons.Defaults +import SCons.Tool +import SCons.Util + +compilers = ['f77'] + +F77Suffixes = ['.f', '.for', '.FOR'] +F77PPSuffixes = ['.fpp', '.FPP'] + +def generate(env, platform): + """Add Builders and construction variables for g77 to an Environment.""" + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in F77Suffixes: + static_obj.add_action(suffix, SCons.Defaults.F77Action) + shared_obj.add_action(suffix, SCons.Defaults.ShF77Action) + + for suffix in F77PPSuffixes: + static_obj.add_action(suffix, SCons.Defaults.F77PPAction) + shared_obj.add_action(suffix, SCons.Defaults.ShF77PPAction) + + env['F77'] = env.Detect(compilers) or 'f77' + env['F77FLAGS'] = '' + env['F77COM'] = '$F77 $F77FLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' + env['F77PPCOM'] = '$F77 $F77FLAGS $CPPFLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' + env['SHF77'] = '$F77' + env['SHF77FLAGS'] = '$F77FLAGS -fPIC' + env['SHF77COM'] = '$SHF77 $SHF77FLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' + env['SHF77PPCOM'] = '$SHF77 $SHF77FLAGS $CPPFLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' + +def exists(env): + return env.Detect(compilers) diff --git a/src/engine/SCons/Tool/sgilink.py b/src/engine/SCons/Tool/sgilink.py new file mode 100644 index 0000000..6d04ec2 --- /dev/null +++ b/src/engine/SCons/Tool/sgilink.py @@ -0,0 +1,60 @@ +"""SCons.Tool.sgilink + +Tool-specific initialization for the SGI MIPSPro linker. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# __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.Defaults +import SCons.Util + +linkers = ['CC', 'cc'] + +def generate(env, platform): + """Add Builders and construction variables for MIPSPro to an Environment.""" + env['BUILDERS']['SharedLibrary'] = SCons.Defaults.SharedLibrary + env['BUILDERS']['Program'] = SCons.Defaults.Program + + env['SHLINK'] = '$LINK' + env['SHLINKFLAGS'] = '$LINKFLAGS -shared' + env['SHLINKCOM'] = '$SHLINK $SHLINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + env['SHLIBEMITTER']= None + env['LINK'] = env.Detect(linkers) or 'cc' + env['LINKFLAGS'] = '-LANG:std' + env['LINKCOM'] = '$LINK $LINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + env['LIBDIRPREFIX']='-L' + env['LIBDIRSUFFIX']='' + env['_LIBFLAGS']='${_stripixes(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, locals(), globals(), LIBPREFIX, LIBSUFFIX)}' + env['LIBLINKPREFIX']='-l' + env['LIBLINKSUFFIX']='' + +def exists(env): + return env.Detect(linkers) -- cgit v0.12