forked from matthew-brett/manylinux-builds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_netcdfs.sh
executable file
·84 lines (65 loc) · 2.19 KB
/
build_netcdfs.sh
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
#!/bin/bash
set -e
# Manylinux, openblas version, lex_ver
source /io/common_vars.sh
NAME="netCDF4"
if [ -z "$VERSIONS" ]; then
VERSIONS="1.2.3.1"
fi
LIBNETCDF_VERSION="4.4.0"
HDF5_VERSION="1.8.16"
CYTHON_VERSION=0.23.4
if ! exists $LIBRARIES/hdf5-${HDF5_VERSION}* ; then
echo "Please run build_hdf5s.sh first"
exit 1
fi
# Install blas
#get_blas
# Install NetCDF
function build_netcdf() {
ARCHIVE=netcdf-${LIBNETCDF_VERSION}.tar.gz
if ! exists ${LIBRARIES}/netcdf-${LIBNETCDF_VERSION}.tgz ; then
curl -LO ftp://ftp.unidata.ucar.edu/pub/netcdf/${ARCHIVE}
BUILD_TO="/tmp/netcdf_build/usr/local"
rm -rf ${BUILD_TO}
mkdir -p ${BUILD_TO}
# Install HDF5 headers
(cd / && tar xf $LIBRARIES/hdf5-${HDF5_VERSION}.tgz)
tar xf ${ARCHIVE}
(cd netcdf-${LIBNETCDF_VERSION} && ./configure --prefix=${BUILD_TO} && make && make install)
(cd netcdf-${LIBNETCDF_VERSION} && make install)
(cd ${BUILD_TO}/../.. && \
tar zcf ${LIBRARIES}/netcdf-${LIBNETCDF_VERSION}.tgz ./* )
else
echo "Using existing libnetcdf build"
fi
}
build_netcdf
(cd / && tar xf $LIBRARIES/netcdf-$LIBNETCDF_VERSION.tgz )
# Directory to store wheels
rm_mkdir unfixed_wheels
export PATH=/usr/local/bin:${PATH}
# Compile wheels
for PYTHON in ${PYTHON_VERSIONS}; do
PIP="$(cpython_path $PYTHON)/bin/pip"
for VERSION in ${VERSIONS}; do
if [ $(lex_ver $PYTHON) -ge $(lex_ver 3.5) ] ; then
NUMPY_VERSION=1.9.1
elif [ $(lex_ver $PYTHON) -ge $(lex_ver 3) ] ; then
NUMPY_VERSION=1.7.2
else
NUMPY_VERSION=1.6.1
fi
echo "Building $NAME $VERSION for Python $PYTHON"
# Put numpy into the wheelhouse to avoid rebuilding
$PIP wheel -f $WHEELHOUSE -f $MANYLINUX_URL -w tmp \
"numpy==$NUMPY_VERSION" "cython==$CYTHON_VERSION"
$PIP install -f tmp "numpy==$NUMPY_VERSION" "cython==$CYTHON_VERSION"
# Add numpy to requirements to avoid upgrading
$PIP wheel -f tmp -w unfixed_wheels \
"numpy==$NUMPY_VERSION" "cython==$CYTHON_VERSION" \
"$NAME==$VERSION"
done
done
# Bundle external shared libraries into the wheels
repair_wheelhouse unfixed_wheels $WHEELHOUSE