components/python/python27/patches/13-pic-compile.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 11 Mar 2013 10:38:09 -0700
branchs11-update
changeset 2520 ceec631e74d1
parent 756 3602fbc18c59
child 1914 00e8dbcb9b1e
child 3367 ed5024e47b53
permissions -rw-r--r--
Close of build 10.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
756
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     1
--- Python-2.7.1/Lib/distutils/sysconfig.py.orig	2012-03-26 09:24:18.614278009 -0700
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     2
+++ Python-2.7.1/Lib/distutils/sysconfig.py	2012-03-27 09:58:03.446132438 -0700
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     3
@@ -173,6 +173,15 @@
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     4
             cflags = cflags + ' ' + os.environ['CPPFLAGS']
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     5
             ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     6
 
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     7
+        # Force PIC compilation. Determine if GNU compiler or otherwise
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     8
+        # and set the PIC flag(s) accordingly. Defaults to Studio compiler.
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     9
+        out = os.popen(cc + ' --version 2>/dev/null', 'r')
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    10
+        out_string = out.read()
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    11
+        out.close()
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    12
+        result = re.search(' (\d+\.\d+(\.\d+)*)', out_string)
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    13
+        kpic_flags = "-fPIC -DPIC" if result else "-KPIC -DPIC"
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    14
+        cflags += ' ' + kpic_flags
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    15
+
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    16
         cc_cmd = cc + ' ' + cflags
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    17
         compiler.set_executables(
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    18
             preprocessor=cpp,