Add a prototype os2 Platform() module.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 8 Jul 2002 23:49:25 +0000 (23:49 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 8 Jul 2002 23:49:25 +0000 (23:49 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@406 fdb21ef1-2011-0410-befe-b5e4ea1792b1

HOWTO/new-platform.txt [new file with mode: 0644]
doc/man/scons.1
rpm/scons.spec
src/CHANGES.txt
src/engine/MANIFEST.in
src/engine/SCons/Platform/PlatformTests.py
src/engine/SCons/Platform/__init__.py
src/engine/SCons/Platform/os2.py [new file with mode: 0644]
test/Platform.py

diff --git a/HOWTO/new-platform.txt b/HOWTO/new-platform.txt
new file mode 100644 (file)
index 0000000..7e2fce8
--- /dev/null
@@ -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.
index e6f6d0c3e963b2cadf434eb07971a79ce7dbd673..7cd58842632d009bdf3a32b3f9a08812b9595a19 100644 (file)
@@ -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.
 
index 999605012439e8cebe70b859f2eeda0a6da5ef52..e40a16f87de3a5f5833c0d3caec1bec52ed19125 100644 (file)
@@ -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
index 69e706373988e7eeb30e21b38a4849c25668bc19..157cb11270747a8aa93a7b652c987cbda1ead404 100644 (file)
@@ -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.
index 0f81470be5203df296cfde80f03d749d5bafad42..d5be87822b5a596d114cc4c0a787db16ddfc4ff7 100644 (file)
@@ -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
index e3f5966ae15bfd5f61f53b0b0623c081230f0cc2..b4b67bb7a2a01c614e64180796fc64f614c0737b 100644 (file)
@@ -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 = {}
index 8a56b09961996e7d404a42729314d6fa3df7cbd4..d8fefbd23dc85a8ee9b37e66094a787edd1383e6 100644 (file)
@@ -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 (file)
index 0000000..e757c35
--- /dev/null
@@ -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' ]
index f4b470cc82808b3be97b3cec4a50743c11820dcc..6eaa5dcb4dc070d5bcf3a150c6668ddfac0c05ce 100644 (file)
@@ -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'
 """