components/python/python27/patches/13-pic-compile.patch
author John Beck <John.Beck@Oracle.COM>
Thu, 18 Dec 2014 16:14:01 -0800
branchs11u2-sru
changeset 3611 e09fa6c4472b
parent 3379 e99da14b537a
permissions -rw-r--r--
20230129 update Python 2.7 line to version 2.7.9 20207552 problem in UTILITY/PYTHON
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3379
e99da14b537a PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents: 756
diff changeset
     1
This patch is a Solaris-specific hack; it will not be submitted upstream.
e99da14b537a PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents: 756
diff changeset
     2
3611
e09fa6c4472b 20230129 update Python 2.7 line to version 2.7.9
John Beck <John.Beck@Oracle.COM>
parents: 3379
diff changeset
     3
--- Python-2.7.9/Lib/distutils/sysconfig.py.~1~	2014-12-10 07:59:34.000000000 -0800
e09fa6c4472b 20230129 update Python 2.7 line to version 2.7.9
John Beck <John.Beck@Oracle.COM>
parents: 3379
diff changeset
     4
+++ Python-2.7.9/Lib/distutils/sysconfig.py	2014-12-11 09:28:01.439349129 -0800
e09fa6c4472b 20230129 update Python 2.7 line to version 2.7.9
John Beck <John.Beck@Oracle.COM>
parents: 3379
diff changeset
     5
@@ -209,6 +209,15 @@
3379
e99da14b537a PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents: 756
diff changeset
     6
         else:
e99da14b537a PSARC 2014/183 Python 2.7.6
John Beck <John.Beck@Oracle.COM>
parents: 756
diff changeset
     7
             archiver = ar + ' ' + ar_flags
756
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     8
 
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     9
+        # 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
    10
+        # 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
    11
+        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
    12
+        out_string = out.read()
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    13
+        out.close()
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    14
+        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
    15
+        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
    16
+        cflags += ' ' + kpic_flags
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    17
+
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    18
         cc_cmd = cc + ' ' + cflags
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    19
         compiler.set_executables(
3602fbc18c59 7155361 python 2.7 should always build modules pic.
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    20
             preprocessor=cpp,