This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
/
spkg-install
executable file
·107 lines (92 loc) · 3.19 KB
/
spkg-install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env bash
if [ -z "$SAGE_LOCAL" ]; then
echo >&2 "Error: SAGE_LOCAL undefined ... exiting"
echo >&2 "Maybe run 'sage --sh'?"
exit 1
fi
cd src
# Apply patches. See SPKG.txt for information about what each patch
# does.
for patch in ../patches/*.patch; do
[ -r "$patch" ] || continue # Skip non-existing or non-readable patches
patch -p1 <"$patch"
if [ $? -ne 0 ]; then
echo >&2 "Error applying '$patch'"
exit 1
fi
done
# Use newer version of config.guess and config.sub (see Trac #19757)
cp "$SAGE_ROOT"/config/config.* build-aux
export CFLAGS="-g -O2 -fPIC $CFLAGS"
export CXXFLAGS="-g -O2 -fPIC $CXXFLAGS"
# GCC 4.9 <= 4.9.2 is broken, cf. https://trac.sagemath.org/ticket/17635#comment:178 ff.:
case `$CXX -dumpversion 2>/dev/null` in
4.9.[0-2])
CXXFLAGS+=" -fpermissive"
;;
4.9) # some distros' GCCs omit the patch level
if $CXX --version 2>/dev/null | head -n 1 | grep '4.9.[0-2]' >/dev/null; then
CXXFLAGS+=" -fpermissive"
fi
esac
if [ "$SAGE64" = "yes" ]; then
echo "64 bit build"
CFLAGS="-m64 $CFLAGS "; export CFLAGS
CXXFLAGS="-m64 $CXXFLAGS "; export CXXFLAGS
CPPFLAGS="-m64 $CPPFLAGS "; export CPPFLAGS
LDFLAGS="-m64 $LDFLAGS"; export LDFLAGS
fi
if [ "$LINBOX_BLAS" != "" ]; then
echo "Using environment variable LINBOX_BLAS=$LINBOX_BLAS"
elif [ "$UNAME" = "CYGWIN" ]; then
# TODO: we should install a suitable blas.pc on Cygwin
echo "Using system-wide Cygwin LAPACK BLAS."
if [ ! -f "/usr/lib/libblas.a" ]; then
echo >&2 "*************************************************"
echo >&2 "*"
echo >&2 "* Error: On Cygwin you must install the standard LAPACK Cygwin package"
echo >&2 "* via the Cygwin setup.exe program in the 'Math' category."
echo >&2 "*"
echo >&2 "*************************************************"
exit 1
fi
LINBOX_BLAS="-lblas"
LINBOX_BLAS_CFLAGS=""
else
LINBOX_BLAS="$(pkg-config --libs cblas)"
BLAS_CFLAGS="$(pkg-config --cflags cblas)"
if [ "$BLAS_CFLAGS" != "" ]; then
LINBOX_BLAS_CFLAGS="--with-blas-cflags=$BLAS_CFLAGS"
else
LINBOX_BLAS_CFLAGS=""
fi
fi
echo "*************************************************"
echo " Using --with-blas=$LINBOX_BLAS $LINBOX_BLAS_CFLAGS"
echo "*************************************************"
# If SAGE_FAT_BINARY is set, disable all processor-specific optimizations
if [ "$SAGE_FAT_BINARY" = yes ]; then
FFLAS_FFPACK_CONFIGURE="--disable-sse --disable-avx $FFLAS_FFPACK_CONFIGURE"
fi
# We disable openmp because of build failures, see
# http://trac.sagemath.org/ticket/17635#comment:67
./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" \
--with-default="$SAGE_LOCAL" \
--with-blas-libs="$LINBOX_BLAS" \
"$LINBOX_BLAS_CFLAGS" \
--enable-optimization --disable-static --enable-precompilation \
--disable-openmp $FFLAS_FFPACK_CONFIGURE
if [ $? -ne 0 ]; then
echo >&2 "Error configuring fflas-ffpack"
exit 1
fi
$MAKE
if [ $? -ne 0 ]; then
echo >&2 "Error building fflas-ffpack"
exit 1
fi
$SAGE_SUDO $MAKE install
if [ $? -ne 0 ]; then
echo >&2 "Error installing fflas-ffpack"
exit 1
fi