1 diff --git Python-2.6.4/Makefile.pre.in Python-2.6.4/Makefile.pre.in
2 --- Python-2.6.4/Makefile.pre.in.orig Sun Feb 13 21:00:17 2011
3 +++ Python-2.6.4/Makefile.pre.in Sun Feb 13 21:02:35 2011
4 @@ -663,6 +663,8 @@
5
6 $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
7
8 +install-pycc: $(srcdir)/pycc
9 + $(INSTALL_SCRIPT) $< $(DESTDIR)$(BINLIBDEST)
10
11 ######################################################################
12
13 @@ -728,7 +728,7 @@
14 $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
15
16 # Install everything
17 -install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
18 +install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@ install-pycc
19
20 # Install almost everything without disturbing previous versions
21 altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
22
23 diff --git Python-2.6.4/pycc Python-2.6.4/pycc
24 new file mode 100644
25 --- /dev/null
26 +++ Python-2.6.4/pycc
27 @@ -0,0 +1,168 @@
28 +#!/bin/ksh
29 +#
30 +# Script for running the C/C++ compiler when building python modules
31 +#
32 +# CDDL HEADER START
33 +#
34 +# The contents of this file are subject to the terms of the
35 +# Common Development and Distribution License, Version 1.0 only
36 +# (the "License"). You may not use this file except in compliance
37 +# with the License.
38 +#
39 +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
40 +# or http://www.opensolaris.org/os/licensing.
41 +# See the License for the specific language governing permissions
42 +# and limitations under the License.
43 +#
44 +# When distributing Covered Code, include this CDDL HEADER in each
45 +# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
46 +# If applicable, add the following below this CDDL HEADER, with the
47 +# fields enclosed by brackets "[]" replaced with your own identifying
48 +# information: Portions Copyright [yyyy] [name of copyright owner]
49 +#
50 +# CDDL HEADER END
51 +#
52 +#
53 +# Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
54 +# Use is subject to license terms.
55 +#
56 +
57 +MYNAME=`basename $0`
58 +
59 +# name of the compiler executable
60 +CCEXE='cc'
61 +# name of the GNU compiler executable
62 +GCCEXE='gcc'
63 +# name of the programming language
64 +CLANG='C'
65 +# name of the env variable for setting the compiler path
66 +CVAR='CC'
67 +
68 +if [ "x$PYCC_CC" != x ]; then
69 + CC="$PYCC_CC"
70 +fi
71 +
72 +if [ "x$MYNAME" = xpyCC ]; then
73 + CCEXE='CC'
74 + GCCEXE='g++'
75 + CLANG='C++'
76 + CC="$CXX"
77 + CVAR='CXX'
78 + if [ "x$PYCC_CXX" != x ]; then
79 + CC="$PYCC_CXX"
80 + fi
81 +fi
82 +
83 +SAVED_IFS="$IFS"
84 +IFS=:
85 +
86 +# check if the CC env variable is set
87 +if [ "x$CC" != x ]; then
88 + # verify that it doesn't point to this script
89 + if /usr/bin/cmp -s "$CC" $0; then
90 + echo "WARNING: "$CVAR" is set to this script; ignoring this value to avoid an infinite loop"
91 + CC=
92 + fi
93 +fi
94 +
95 +# check again if the CC env variable is set
96 +if [ "x$CC" != x ]; then
97 + case "$CC" in
98 + /* )
99 + # $CC is an absolute path name
100 + # check if $CC exists
101 + if [ ! -e "$CC" ]; then
102 + echo "WARNING: pycc: $CC not found" 1>&2
103 + CC=
104 + else
105 + # check if $CC is an executable
106 + if [ ! -x "$CC" -o ! -f "$CC" ]; then
107 + echo "WARNING: pycc: $CC is not an executable" 1>&2
108 + CC=
109 + fi
110 + fi
111 + ;;
112 + * )
113 + # try to find $CC in the PATH
114 + NEW_CC=
115 + for dir in $PATH; do
116 + if [ -x "$dir/$CC" ]; then
117 + NEW_CC="$dir/$CC"
118 + break
119 + fi
120 + done
121 + if [ "x$NEW_CC" = x ]; then
122 + echo "WARNING: pycc: $CC not found" 1>&2
123 + CC=
124 + else
125 + CC="$NEW_CC"
126 + fi
127 + ;;
128 + esac
129 +fi
130 +
131 +if [ "x$CC" = x ]; then
132 + # Look for the Sun Studio compiler in the PATH
133 + for dir in $PATH; do
134 + if [ -x "$dir/$CCEXE" ]; then
135 + CC="$dir/$CCEXE"
136 + break
137 + fi
138 + done
139 +fi
140 +
141 +if [ "x$CC" = x ]; then
142 + # Look for gcc in the PATH
143 + for dir in $PATH; do
144 + if [ -x "$dir/$GCCEXE" ]; then
145 + CC="$dir/$GCCEXE"
146 + break
147 + fi
148 + done
149 +fi
150 +
151 +if [ "x$CC" = x ]; then
152 + # Check for Sun Studio in /opt/SUNWspro (default install location)
153 + if [ -x /opt/SUNWspro/bin/$CCEXE ]; then
154 + CC=/opt/SUNWspro/bin/$CCEXE
155 + fi
156 +fi
157 +
158 +if [ "x$CC" = x ]; then
159 + # Check for the GNU compiler in /usr/sfw/bin
160 + if [ -x /usr/sfw/bin/$GCCEXE ]; then
161 + CC=/usr/sfw/bin/$GCCEXE
162 + fi
163 +fi
164 +
165 +if [ "x$CC" = x ]; then
166 + # Cannot continue without a C compiler
167 + echo "ERROR: no $CLANG compiler not found; update your PATH or set the $CVAR env variable" 1>&2
168 + exit 1
169 +fi
170 +
171 +IFS="$SAVED_IFS"
172 +
173 +# We need to make some modifications to adapt correctly to compiler options
174 +# that differ between GCC and Studio.
175 +
176 +extra_flags=
177 +
178 +is_gcc=no
179 +
180 +$CC --version >/dev/null 2>&1 && is_gcc=yes
181 +
182 +if [ "$is_gcc" = yes ]; then
183 + for flag in "${@}"; do
184 + # need -shared to link shared objects properly
185 + if [ "$flag" = "-G" ]; then
186 + extra_flags="$extra_flags -shared"
187 + fi
188 + done
189 + # force PIC compilation
190 + extra_flags="$extra_flags -fPIC -DPIC"
191 +else
192 + extra_flags="$extra_flags -KPIC"
193 +fi
194 +
195 +exec "$CC" $extra_flags "${@}"