Print this page
Python2.7 needs to be aware we're a 32-and-64-bit Python.
| Split |
Close |
| Expand all |
| Collapse all |
--- old/build/python27/build.sh
+++ new/build/python27/build.sh
1 1 #!/usr/bin/bash
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License, Version 1.0 only
7 7 # (the "License"). You may not use this file except in compliance
8 8 # with the License.
9 9 #
10 10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 11 # or http://www.opensolaris.org/os/licensing.
12 12 # See the License for the specific language governing permissions
13 13 # and limitations under the License.
14 14 #
15 15 # When distributing Covered Code, include this CDDL HEADER in each
16 16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 17 # If applicable, add the following below this CDDL HEADER, with the
18 18 # fields enclosed by brackets "[]" replaced with your own identifying
19 19 # information: Portions Copyright [yyyy] [name of copyright owner]
20 20 #
21 21 # CDDL HEADER END
22 22 #
23 23 #
24 24 # Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
25 25 # Use is subject to license terms.
26 26 #
27 27 # Load support functions
28 28 . ../../lib/functions.sh
29 29
30 30 CC=gcc
31 31 CXX=g++
32 32
33 33 PROG=Python
34 34 VER=2.7.11
35 35 PKG=runtime/python-27
36 36 SUMMARY="$PROG"
37 37 DESC="$SUMMARY"
38 38
39 39 BUILD_DEPENDS_IPS="developer/build/autoconf"
40 40 DEPENDS_IPS="system/library/gcc-5-runtime library/zlib library/libffi@$FFIVERS
41 41 library/readline database/sqlite-3 compress/bzip2 library/libxml2
42 42 library/ncurses library/security/openssl"
43 43
44 44 export CCSHARED="-fPIC"
45 45 CFLAGS="$CFLAGS -std=c99"
46 46 LDFLAGS32="-L/usr/gnu/lib -R/usr/gnu/lib"
47 47 LDFLAGS64="-L/usr/gnu/lib/amd64 -R/usr/gnu/lib/amd64"
48 48 CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses -D_LARGEFILE64_SOURCE"
49 49 CPPFLAGS32="-I/usr/lib/libffi-$FFIVERS/include"
50 50 CPPFLAGS64="-I/usr/lib/amd64/libffi-$FFIVERS/include"
51 51 CONFIGURE_OPTS="--enable-shared
52 52 --with-system-ffi
53 53 ac_cv_opt_olimit_ok=no
54 54 ac_cv_olimit_ok=no"
55 55
56 56 preprep_build() {
57 57 pushd $TMPDIR/$BUILDDIR > /dev/null || logerr "Cannot change to build directory"
58 58 /usr/bin/autoheader || logerr "autoheaer failed"
59 59 /usr/bin/autoconf || logerr "autoreconf failed"
60 60 popd > /dev/null
61 61 }
62 62
63 63 post_config() {
64 64 pushd $TMPDIR/$BUILDDIR > /dev/null || logerr "Cannot change to build directory"
65 65 perl -pi -e 's/(^\#define _POSIX_C_SOURCE.*)/\/* $$1 *\//' pyconfig.h
66 66 perl -pi -e 's/^(\#define _XOPEN_SOURCE.*)/\/* $$1 *\//' pyconfig.h
67 67 perl -pi -e 's/^(\#define _XOPEN_SOURCE_EXTENDED.*)/\/* $$1 *\//' pyconfig.h
68 68 popd > /dev/null
69 69 }
70 70
71 71 configure64() {
72 72 logmsg "--- configure (64-bit)"
73 73 CFLAGS="$CFLAGS $CFLAGS64" \
74 74 CXXFLAGS="$CXXFLAGS $CXXFLAGS64" \
75 75 CPPFLAGS="$CPPFLAGS $CPPFLAGS64" \
76 76 LDFLAGS="$LDFLAGS $LDFLAGS64" \
77 77 CC="$CC -m64" CXX=$CXX \
78 78 logcmd $CONFIGURE_CMD $CONFIGURE_OPTS_64 \
79 79 $CONFIGURE_OPTS || \
80 80 logerr "--- Configure failed"
81 81 }
82 82
83 83 make_prog32() {
84 84 post_config
85 85 [[ -n $NO_PARALLEL_MAKE ]] && MAKE_JOBS=""
86 86 logmsg "--- make"
87 87 logcmd $MAKE $MAKE_JOBS DFLAGS=-32 || \
88 88 logerr "--- Make failed"
89 89 }
90 90
91 91 make_prog64() {
|
↓ open down ↓ |
91 lines elided |
↑ open up ↑ |
92 92 post_config
93 93 [[ -n $NO_PARALLEL_MAKE ]] && MAKE_JOBS=""
94 94 logmsg "--- make"
95 95 logcmd $MAKE $MAKE_JOBS DFLAGS=-64 DESTSHARED=/usr/lib/python2.7/lib-dynload || \
96 96 logerr "--- Make failed"
97 97 }
98 98
99 99 make_install32() {
100 100 make_install
101 101 rm $DESTDIR/usr/bin/i386/python || logerr "--- cannot remove arch hardlink"
102 - # mv $DESTDIR/usr/lib/python2.7/config/Makefile $DESTDIR/usr/lib/python2.7/config/Makefile.32 || logerr "--- Makefile backup (32)"
102 + # Copy off _sysconfigdata.py
103 + sed 's/^/ /g' < $DESTDIR/usr/lib/python2.7/_sysconfigdata.py > \
104 + /tmp/_sysconfigdata-32-$$.py
105 +
106 +
107 + # Move pyconfig.h header to 32-bit-specific version.
108 + mv $DESTDIR/usr/include/python2.7/pyconfig.h \
109 + $DESTDIR/usr/include/python2.7/pyconfig-32.h
103 110 }
104 111 make_install64() {
105 112 logmsg "--- make install"
106 113 logcmd $MAKE DESTDIR=${DESTDIR} install DESTSHARED=/usr/lib/python2.7/lib-dynload || \
107 114 logerr "--- Make install failed"
108 115 rm $DESTDIR/usr/bin/amd64/python || logerr "--- cannot remove arch hardlink"
109 116 rm $DESTDIR/usr/lib/python2.7/config/libpython2.7.a || logerr "--- cannot remove static lib"
110 117 # XXX KEBE SAYS Uncomment me eventually...
111 118 # (cd $DESTDIR/usr/bin && ln -s python2.7 python) || logerr "--- could not setup python softlink"
112 - # XXX KEBE SAYS Python2.7 appears to honor $LIB/amd64 for 64-bit python...
113 - # mv $DESTDIR/usr/lib/python2.7/config/Makefile $DESTDIR/usr/lib/python2.7/config/Makefile.64 || logerr "--- Makefile backup (64)"
114 - # mv $DESTDIR/usr/lib/python2.7/config/Makefile.32 $DESTDIR/usr/lib/python2.7/config/Makefile || logerr "--- Makefile restore (32)"
119 + # Copy off _sysconfigdata.py
120 + sed 's/^/ /g' < $DESTDIR/usr/lib/python2.7/_sysconfigdata.py > \
121 + /tmp/_sysconfigdata-64-$$.py
122 + # Generate 32/64-bit agile _sysconfigdata.py
123 + echo "import sys" > $DESTDIR/usr/lib/python2.7/_sysconfigdata.py
124 + echo "" >> $DESTDIR/usr/lib/python2.7/_sysconfigdata.py
125 + echo "if sys.maxsize > 2**32:" >> \
126 + $DESTDIR/usr/lib/python2.7/_sysconfigdata.py
127 + cat /tmp/_sysconfigdata-64-$$.py \
128 + >> $DESTDIR/usr/lib/python2.7/_sysconfigdata.py
129 + echo "else:" >> $DESTDIR/usr/lib/python2.7/_sysconfigdata.py
130 + cat /tmp/_sysconfigdata-32-$$.py \
131 + >> $DESTDIR/usr/lib/python2.7/_sysconfigdata.py
132 + # Clean up the 32/64 stragglers.
133 + rm -f /tmp/_sysconfigdata-*-$$.py
134 + # Postprocessing steps in either IPS or the omnios-build system create
135 + # the .pyo and .pyc files.
136 +
137 + # Move pyconfig.h header to 64-bit-specific version.
138 + mv $DESTDIR/usr/include/python2.7/pyconfig.h \
139 + $DESTDIR/usr/include/python2.7/pyconfig-64.h
140 +
141 + logcmd cp $SRCDIR/files/pyconfig.h $DESTDIR/usr/include/python2.7/pyconfig.h
115 142 }
116 143
117 144 install_license(){
118 145 logcmd cp $TMPDIR/$BUILDDIR/LICENSE $DESTDIR/license
119 146 }
120 147
121 148 init
122 149 download_source $PROG $PROG $VER
123 150 patch_source
124 151 preprep_build
125 152 prep_build
126 153 build
127 154 make_isa_stub
128 155 strip_install -x
129 156 install_license
130 157 make_package
131 158 clean_up
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX