From 3de3284918acb0add37b818400c1a7309a3316ff Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Mon, 8 Jul 2002 23:49:25 +0000 Subject: Add a prototype os2 Platform() module. --- HOWTO/new-platform.txt | 72 ++++++++++++++++++++++++++++++ doc/man/scons.1 | 23 +++++++++- rpm/scons.spec | 2 + src/CHANGES.txt | 2 + src/engine/MANIFEST.in | 1 + src/engine/SCons/Platform/PlatformTests.py | 7 +++ src/engine/SCons/Platform/__init__.py | 4 +- src/engine/SCons/Platform/os2.py | 58 ++++++++++++++++++++++++ test/Platform.py | 6 +++ 9 files changed, 173 insertions(+), 2 deletions(-) create mode 100644 HOWTO/new-platform.txt create mode 100644 src/engine/SCons/Platform/os2.py diff --git a/HOWTO/new-platform.txt b/HOWTO/new-platform.txt new file mode 100644 index 0000000..7e2fce8 --- /dev/null +++ b/HOWTO/new-platform.txt @@ -0,0 +1,72 @@ +Adding a new Platform to the SCons distribution: + + -- Add the following files (aenf): + + src/engine/SCons/Platform/xxx.py + + Use one of the other Platform files as a template. + + The tool_list() function should return the list of tools + that will be available through the default construction + Environment. + + The generate() function should set construction variables: + + ENV + OBJPREFIX + OBJSUFFIX + PROGPREFIX + PROGSUFFIX + LIBPREFIX + LIBSUFFIX + SHLIBPREFIX + SHLIBSUFFIX + LIBPREFIXES + LIBSUFFIXES + + -- Modify the following files (aecp): + + doc/man/scons.1 + + Add the new platform to the example of the platform + keyword when instantiating an Environment. + + Add the list of default tools returned by tool_list() + for this platform. + + rpm/scons.spec + + Add to the list at the bottom of the file: + + /usr/lib/scons/SCons/Platform/xxx.py + /usr/lib/scons/SCons/Platform/xxx.pyc + + [THIS LIST SHOULD BE GENERATED FROM MANIFEST.in, + AND WILL BE SOME DAY.] + + src/CHANGES.txt + + Add mention of the new Platform specification. + + src/engine/MANIFEST.in + + Add to the list: + + SCons/Platform/xxx.py + + src/engine/SCons/Platform/Platform/PlatformTests.py + + Copy and paste one of the other platform tests to verify + the ability to initialize an environment through a call + to the object returned by Platform('xxx') + + src/engine/SCons/Platform/__init__.py + + Add logic to platform_default() (if necessary) to return + the appropriate platform string. + + test/Platform.py + + Add the new platform to the SConstruct and SConscript + files. Add the expected output to the "expect" + variable. diff --git a/doc/man/scons.1 b/doc/man/scons.1 index e6f6d0c..7cd5884 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -655,6 +655,7 @@ be initialized for a different platform: .ES env = Environment(platform = 'cygwin') +env = Environment(platform = 'os2') env = Environment(platform = 'posix') env = Environment(platform = 'win32') .EE @@ -723,7 +724,24 @@ tex yacc .EE -and supports the following tool specifications out of the box on +SCons supports the following tool specifications out of the box on +.B os2 +platforms: + +.ES +dvipdf +dvips +g77 +latex +lex +nasm +pdflatex +pdftex +tex +yacc +.EE + +SCons supports the following tool specifications out of the box on .B win32 platforms: @@ -1835,6 +1853,9 @@ The command line used to call the tar archiver. .IP TARFLAGS General options passed to the tar archiver. +.IP TARSUFFIX +The suffix used for tar file names. + .IP TEX The TeX formatter and typesetter. diff --git a/rpm/scons.spec b/rpm/scons.spec index 9996050..e40a16f 100644 --- a/rpm/scons.spec +++ b/rpm/scons.spec @@ -70,6 +70,8 @@ rm -rf $RPM_BUILD_ROOT /usr/lib/scons/SCons/Node/__init__.pyc /usr/lib/scons/SCons/Platform/cygwin.py /usr/lib/scons/SCons/Platform/cygwin.pyc +/usr/lib/scons/SCons/Platform/os2.py +/usr/lib/scons/SCons/Platform/os2.pyc /usr/lib/scons/SCons/Platform/posix.py /usr/lib/scons/SCons/Platform/posix.pyc /usr/lib/scons/SCons/Platform/win32.py diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 69e7063..157cb11 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -77,6 +77,8 @@ RELEASE 0.08 - - Add a tar archive builder. + - Add preliminary support for OS/2. + From Jeff Petkau: - Fix --implicit-cache if the scanner returns an empty list. diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index 0f81470..d5be878 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -11,6 +11,7 @@ SCons/Node/Alias.py SCons/Node/FS.py SCons/Platform/__init__.py SCons/Platform/cygwin.py +SCons/Platform/os2.py SCons/Platform/posix.py SCons/Platform/win32.py SCons/Scanner/__init__.py diff --git a/src/engine/SCons/Platform/PlatformTests.py b/src/engine/SCons/Platform/PlatformTests.py index e3f5966..b4b67bb 100644 --- a/src/engine/SCons/Platform/PlatformTests.py +++ b/src/engine/SCons/Platform/PlatformTests.py @@ -39,6 +39,13 @@ class PlatformTestCase(unittest.TestCase): assert env['PROGSUFFIX'] == '.exe', env assert env['LIBSUFFIX'] == '.a', env + p = SCons.Platform.Platform('os2') + assert str(p) == 'os2', p + env = {} + p(env) + assert env['PROGSUFFIX'] == '.exe', env + assert env['LIBSUFFIX'] == '.lib', env + p = SCons.Platform.Platform('posix') assert str(p) == 'posix', p env = {} diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index 8a56b09..d8fefbd 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -60,7 +60,9 @@ def platform_default(): if os.name == 'posix': if sys.platform == 'cygwin': return 'cygwin' - return 'posix' + return 'posix' + elif os.name == 'os2': + return 'os2' else: return sys.platform diff --git a/src/engine/SCons/Platform/os2.py b/src/engine/SCons/Platform/os2.py new file mode 100644 index 0000000..e757c35 --- /dev/null +++ b/src/engine/SCons/Platform/os2.py @@ -0,0 +1,58 @@ +"""SCons.Platform.os2 + +Platform-specific initialization for OS/2 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 (c) 2001, 2002 Steven Knight +# +# 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.Util + +def tool_list(): + list = ['dvipdf', 'dvips', 'g77', + 'latex', 'lex', + 'pdflatex', 'pdftex', 'tex', 'yacc'] + if SCons.Util.WhereIs('nasm'): + list.append('nasm') + return list + +def generate(env): + if not env.has_key('ENV'): + env['ENV'] = {} + #env['ENV']['PATHEXT'] = '.COM;.EXE;.BAT;.CMD' + env['OBJPREFIX'] = '' + env['OBJSUFFIX'] = '.obj' + env['PROGPREFIX'] = '' + env['PROGSUFFIX'] = '.exe' + env['LIBPREFIX'] = '' + env['LIBSUFFIX'] = '.lib' + env['SHLIBPREFIX'] = '' + env['SHLIBSUFFIX'] = '.dll' + env['LIBPREFIXES'] = '$LIBPREFIX' + env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ] diff --git a/test/Platform.py b/test/Platform.py index f4b470c..6eaa5dc 100644 --- a/test/Platform.py +++ b/test/Platform.py @@ -32,6 +32,8 @@ test.write('SConstruct', """ env = {} Platform('cygwin')(env) print "'%s'" % env['PROGSUFFIX'] +Platform('os2')(env) +print "'%s'" % env['PROGSUFFIX'] Platform('posix')(env) print "'%s'" % env['PROGSUFFIX'] Platform('win32')(env) @@ -43,6 +45,8 @@ test.write('SConscript', """ env = {} Platform('cygwin')(env) print "'%s'" % env['LIBSUFFIX'] +Platform('os2')(env) +print "'%s'" % env['LIBSUFFIX'] Platform('posix')(env) print "'%s'" % env['LIBSUFFIX'] Platform('win32')(env) @@ -50,9 +54,11 @@ print "'%s'" % env['LIBSUFFIX'] """) expect = """'.exe' +'.exe' '' '.exe' '.a' +'.lib' '.a' '.lib' """ -- cgit v0.12