Skip to content

Commit 545787d

Browse files
author
Mișu Moldovan
committed
[#2920] Fix Solaris 11 builds.
1 parent 644fddb commit 545787d

File tree

7 files changed

+62
-31
lines changed

7 files changed

+62
-31
lines changed

chevah_build

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ export CC='gcc'
6767
# when not using gcc, and thus silence the associated configure warning.
6868
# However, we set $CPPFLAGS later for linking to statically-compiled libs.
6969
export CXX='g++'
70-
# Use PIC (Position Independent Code) with GCC on 64-bit arches.
71-
if [ "$CC" = 'gcc' -a ${ARCH%%64} != "$ARCH" ]; then
72-
export CFLAGS="${CFLAGS} -fPIC"
73-
fi
7470

7571
LOCAL_PYTHON_BINARY_DIST="$PYTHON_VERSION-$OS-$ARCH"
7672
INSTALL_FOLDER=$PWD/${BUILD_FOLDER}/$LOCAL_PYTHON_BINARY_DIST
@@ -112,16 +108,17 @@ case $OS in
112108
# By default, we use Sun's Studio compiler. Comment these two for GCC.
113109
export CC="cc"
114110
export CXX="CC"
111+
export MAKE="gmake"
115112
# Here's where the system-included GCC is to be found.
116113
if [ "${CC}" = "gcc" ]; then
117114
export PATH="$PATH:/usr/sfw/bin/"
118115
fi
119-
# And this is where the GNU libs are in Solaris 10, including OpenSSL.
116+
# The location for GNU libs in Solaris, including OpenSSL in Solaris 10.
120117
if [ "${ARCH%64}" = "$ARCH" ]; then
121118
export LDFLAGS="$LDFLAGS -L/usr/sfw/lib -R/usr/sfw/lib"
122119
else
123120
export LDFLAGS="$LDFLAGS -m64 -L/usr/sfw/lib/64 -R/usr/sfw/lib/64"
124-
export CFLAGS="$CFLAGS -m64 -xcode=abs64"
121+
export CFLAGS="$CFLAGS -m64"
125122
fi
126123
if [ "$OS" = "solaris10" ]; then
127124
# Solaris 10 has OpenSSL 0.9.7, but Python 2 versions starting with
@@ -148,6 +145,19 @@ case $OS in
148145
;;
149146
esac
150147

148+
# Compiler-dependent flags. At this moment we should know what compiler is used.
149+
if [ "$CC" = 'gcc' -a ${ARCH%%64} != "$ARCH" ]; then
150+
# Use PIC (Position Independent Code) with GCC on 64-bit arches.
151+
export CFLAGS="${CFLAGS} -fPIC"
152+
elif [ "${OS%solaris*}" = "" ]; then
153+
if [ ${ARCH} = "sparc64" ]; then
154+
# Required for compiling GMP on Solaris for SPARC with Sun Studio.
155+
export CFLAGS="$CFLAGS -xcode=abs64"
156+
elif [ ${ARCH} = "x64" ]; then
157+
# Required for linking to libedit, which has a simpler configure setup.
158+
export CFLAGS="$CFLAGS -xcode=pic32"
159+
fi
160+
fi
151161

152162
#
153163
# Install OS package required to build Python.
@@ -290,7 +300,7 @@ command_build() {
290300
# support without linking to the GPL'ed readline.
291301
# $CPPFLAGS and $LDFLAGS already point to these 'include' and 'lib' dirs.
292302
case $OS in
293-
ubuntu*|rhel*|sles*|linux)
303+
ubuntu*|rhel*|sles*|linux|solaris*)
294304
build 'libedit' "libedit-$LIBEDIT_VERSION" ${PYTHON_BUILD_FOLDER}
295305
cp -r $INSTALL_FOLDER/tmp/libedit/{editline/,*.h} \
296306
$INSTALL_FOLDER/include/
@@ -398,27 +408,25 @@ initialize_python_module(){
398408
# Copy special link steps in local folder.
399409
mkdir -p Modules
400410
cp $INSTALL_FOLDER/lib/$PYTHON_VERSION/config/* Modules
401-
;;
411+
;;
402412
solaris*)
403413
# Copy special link steps in local folder.
404414
mkdir -p Modules
405415
cp $INSTALL_FOLDER/lib/$PYTHON_VERSION/config/* Modules
416+
extra_args=""
406417
if [ "$OS" = "solaris10" ]; then
418+
extra_args="$extra_args -I/usr/sfw/include"
407419
# Needed to build pyOpenSSL and pysqlite in Solaris 10.
408420
# Make sure the headers for OpenSSL and sqlite3 are present
409421
# in /usr/sfw/include (only one location allowed, it seems).
410422
if [ "${ARCH%64}" = "$ARCH" ]; then
411-
execute $PYTHON_BIN setup.py build_ext \
412-
-I/usr/sfw/include \
413-
-L/usr/sfw/lib -L/usr/lib/mps
423+
extra_args="$extra_args -L/usr/sfw/lib -L/usr/lib/mps"
414424
else
415-
execute $PYTHON_BIN setup.py build_ext \
416-
-I/usr/sfw/include \
417-
-L/usr/sfw/lib/64 -L/usr/lib/mps/64
418-
425+
extra_args="$extra_args -L/usr/sfw/lib/64 -L/usr/lib/mps/64"
419426
fi
420427
fi
421-
;;
428+
execute $PYTHON_BIN setup.py build_ext $extra_args
429+
;;
422430
esac
423431
execute popd
424432
}

python-modules/chevah-python-test/test_python_binary_dist.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def get_allowed_deps():
111111
'libmp.so.2',
112112
'libnsl.so.1',
113113
'libsocket.so.1',
114-
'libsqlite3.so',
115114
'libz.so.1',
116115
]
117116
if platform.processor() == 'sparc':
@@ -128,10 +127,12 @@ def get_allowed_deps():
128127
'libcrypt_i.so.1',
129128
'libcrypto.so.0.9.7',
130129
'libcrypto_extra.so.0.9.7',
130+
'libcurses.so.1',
131131
'libdoor.so.1',
132132
'libgen.so.1',
133133
'librt.so.1',
134134
'libscf.so.1',
135+
'libsqlite3.so',
135136
'libssl.so.0.9.7',
136137
'libssl_extra.so.0.9.7',
137138
'libthread.so.1',
@@ -144,7 +145,9 @@ def get_allowed_deps():
144145
'libcrypto.so.1.0.0',
145146
'libcryptoutil.so.1',
146147
'libelf.so.1',
148+
'libncurses.so.5',
147149
'libsoftcrypto.so.1',
150+
'libsqlite3.so.0',
148151
'libssl.so.1.0.0',
149152
])
150153
elif platform_system == 'darwin':
@@ -307,10 +310,10 @@ def main():
307310
exit_code = 12
308311

309312
# We compile the readline module using libedit only on selected platforms.
310-
if platform_system == 'linux':
313+
if ( platform_system == 'linux' ) or ( platform_system == 'sunos' ):
311314
try:
312315
import readline
313-
readline.clear_history()
316+
readline.get_history_length()
314317
except:
315318
sys.stderr.write('"readline" missing.\n')
316319
exit_code = 13

src/libedit/chevahbs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ chevahbs_configure() {
1111
# Support for Unicode (wide-char/UTF-8) is added with "--enable-widec".
1212
CONF_OPTS="--disable-shared --enable-static --enable-widec"
1313
execute mkdir m4
14-
# RHEL 5 has an older autoconf, and we can't auto-reconfigure.
14+
# RHEL 4 and 5 have an older autoconf, and we can't auto-reconfigure.
1515
case $OS in
16-
rhel5)
16+
rhel4|rhel5)
1717
# This redirects the echo output to stderr.
18-
>&2 echo "This seems to be a RHEL 5 system, skipping autoreconf..."
19-
;;
18+
>&2 echo "This seems to be a RHEL 4/5 system, skipping autoreconf!"
19+
;;
2020
*)
2121
execute autoreconf --install --force
22-
;;
22+
;;
2323
esac
2424
execute ./configure --prefix="" $CONF_OPTS
2525
}

src/libedit/libedit-20150325-3.1/configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/ioctl.h sys/pa
8282

8383
AC_CHECK_HEADER([termios.h], [], [AC_MSG_ERROR([termios.h is required!])],[])
8484

85+
# Solaris 10 doesn't have it.
86+
AC_CHECK_HEADERS([err.h])
87+
8588
## include curses.h to prevent "Present But Cannot Be Compiled"
8689
AC_CHECK_HEADERS([term.h],,,
8790
[[#if HAVE_CURSES_H

src/libedit/libedit-20150325-3.1/examples/wtc1.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <string.h>
33
#include <signal.h>
44
#include <sys/wait.h>
5-
#include <err.h>
65
#include <ctype.h>
76
#include <stdlib.h>
87
#include <unistd.h>
@@ -12,6 +11,25 @@
1211

1312
#include <histedit.h>
1413

14+
#ifdef HAVE_CONFIG_H
15+
#include "config.h"
16+
#endif
17+
18+
/* On Solaris 10, you can't simply include err.h */
19+
#ifdef HAVE_ERR_H
20+
#include <err.h>
21+
#else
22+
# include <errno.h>
23+
# include <string.h>
24+
# define err(exitcode, format, args...) \
25+
errx(exitcode, format ": %s", ## args, strerror(errno))
26+
# define errx(exitcode, format, args...) \
27+
{ warnx(format, ## args); exit(exitcode); }
28+
# define warn(format, args...) \
29+
warnx(format ": %s", ## args, strerror(errno))
30+
# define warnx(format, args...) \
31+
fprintf(stderr, format "\n", ## args)
32+
#endif
1533

1634
static int continuation;
1735
volatile sig_atomic_t gotsig;

src/python/Python-2.7.8/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def get_platform():
4646
]
4747

4848
# Compile the readline module only on platforms whitelisted below.
49-
if host_platform not in ('linux2'):
49+
if host_platform not in ('linux2', 'sunos5' ):
5050
disabled_module_list.append('readline')
5151

5252
def add_dir_to_list(dirlist, dir):

src/python/chevahbs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,18 @@ chevahbs_configure() {
5454
--with-system-ffi \
5555
"
5656
;;
57-
solaris*)
58-
# In Solaris the default OpenSSL installation lives in /usr/sfw/.
57+
solaris10)
58+
# In Solaris 10, the default OpenSSL is installed in /usr/sfw/.
5959
# Both include options are needed to match both the native Sun
6060
# Studio compiler and GCC.
6161
if [ "${ARCH%64}" = "$ARCH" ]; then
6262
echo "_ssl _ssl.c -I/usr/sfw/include" \
6363
"-I/usr/sfw/include/openssl -L/usr/sfw/lib" \
64-
" -R/usr/sfw/lib -lssl -lcrypto" >> Modules/Setup.local
64+
"-R/usr/sfw/lib -lssl -lcrypto" >> Modules/Setup.local
6565
else
66-
CONFIG_ARGS="${CONFIG_ARGS} CFLAGS=-m64 LDFLAGS=-m64"
6766
echo "_ssl _ssl.c -I/usr/sfw/include" \
6867
"-I/usr/sfw/include/openssl -L/usr/sfw/lib/64" \
69-
" -R/usr/sfw/lib/64 -lssl -lcrypto" >> Modules/Setup.local
68+
"-R/usr/sfw/lib/64 -lssl -lcrypto" >> Modules/Setup.local
7069
fi
7170
;;
7271
esac

0 commit comments

Comments
 (0)