11#! /bin/bash
22set -e -x
33
4+ function install_openssl {
5+ # Compile and parallel-install a newer OpenSSL version so that curl can
6+ # download from the rust servers
7+ pushd /usr/src
8+ wget -q ftp://ftp.openssl.org/source/openssl-${1} .tar.gz
9+ tar xf openssl-${1} .tar.gz
10+ cd openssl-${1}
11+ ./config --prefix=/opt/openssl shared > /dev/null
12+ make > /dev/null
13+ make install > /dev/null
14+ export LD_LIBRARY_PATH=/opt/openssl/lib:$LD_LIBRARY_PATH
15+ popd
16+ }
17+
18+ function install_curl {
19+ pushd /usr/src
20+ # Compile an up-to-date curl version that links to our own OpenSSL installation
21+ wget -q --no-check-certificate http://curl.haxx.se/download/curl-${1} .tar.gz
22+ tar xf curl-${1} .tar.gz
23+ cd curl-${1}
24+ ./configure --with-ssl=/opt/openssl --prefix=/opt/curl > /dev/null
25+ make > /dev/null
26+ make install > /dev/null
27+ export PATH=/opt/curl/bin:$PATH
28+ popd
29+ }
30+
31+ function install_rust {
32+ curl https://static.rust-lang.org/rustup.sh > /tmp/rustup.sh
33+ chmod +x /tmp/rustup.sh
34+ /tmp/rustup.sh -y --disable-sudo --channel=$1
35+ }
36+
37+ function update_certificates {
38+ # Update the Root CA bundle
39+ wget -q --no-check-certificate \
40+ -O /etc/pki/tls/certs/ca-bundle.crt \
41+ http://curl.haxx.se/ca/cacert.pem
42+ }
43+
44+ function clean_project {
45+ # Remove compiled files that might cause conflicts
46+ pushd /io/
47+ rm -rf .cache .eggs rust_fst/_ffi.py build * .egg-info
48+ find ./ -name " __pycache__" -type d -print0 | xargs rm -rf --
49+ find ./ -name " *.pyc" -type f -print0 | xargs rm -rf --
50+ popd
51+ }
52+
453OPENSSL_VERSION=1.0.2h
554CURL_VERSION=7.49.0
655RUST_CHANNEL=nightly
756
57+ # Clean build files
58+ clean_project
59+
60+ install_openssl $OPENSSL_VERSION
61+ install_curl $CURL_VERSION
62+ install_rust $RUST_CHANNEL
63+
864# Remove old wheels
965rm -rf /io/wheelhouse/* || echo " No old wheels to delete"
1066
1167# We don't support Python 2.6
1268rm -rf /opt/python/cp26*
1369
14- # Override PATH and LD_LIBRARY so that our curl and openssl installations
15- # get precedence over the included versions
16- PATH=/opt/curl/bin:$PATH
17- LD_LIBRARY_PATH=/opt/openssl/lib:$LD_LIBRARY_PATH
18-
1970# Install libraries needed for compiling the extension
20- yum -y install libffi-devel
21-
22- # Update the Root CA bundle
23- wget --no-check-certificate \
24- -O /etc/pki/tls/certs/ca-bundle.crt \
25- http://curl.haxx.se/ca/cacert.pem
26-
27- # Compile and parallel-install a newer OpenSSL version so that curl can
28- # download from the rust servers
29- # Note that we cannot download from the official OpenSSL servers, since they
30- # require HTTPS, which does not work with the CentOS5 SSL version...
31- cd /usr/src
32- wget http://ftp.vim.org/security/openssl/openssl-${OPENSSL_VERSION} .tar.gz
33- tar xf openssl-${OPENSSL_VERSION} .tar.gz
34- cd openssl-${OPENSSL_VERSION}
35- ./config --prefix=/opt/openssl shared
36- make
37- make install
38- cd ..
39-
40- # Compile an up-to-date curl version that links to our own OpenSSL installation
41- wget --no-check-certificate http://curl.haxx.se/download/curl-${CURL_VERSION} .tar.gz
42- tar xf curl-${CURL_VERSION} .tar.gz
43- cd curl-${CURL_VERSION}
44- ./configure --with-ssl=/opt/openssl --prefix=/opt/curl
45- make
46- make install
47- cd $HOME
48-
49- # Install rust
50- curl https://static.rust-lang.org/rustup.sh > /tmp/rustup.sh
51- chmod +x /tmp/rustup.sh
52- /tmp/rustup.sh -y --disable-sudo --channel=$RUST_CHANNEL
71+ yum -q -y install libffi-devel
5372
5473# Compile wheels
5574for PYBIN in /opt/python/* /bin; do
56- ${PYBIN} /python -m pip install pytest
57- ${PYBIN} /python -m pip wheel /io/ -w wheelhouse/
75+ ${PYBIN} /python -m pip wheel /io/ -w /wheelhouse/
76+ clean_project
5877done
5978
6079# Move pure wheels to output wheelhouse
6180mkdir -p /io/wheelhouse/
62- mv wheelhouse/* any.whl /io/wheelhouse/ || echo " No pure wheels found."
81+ mv / wheelhouse/* any.whl /io/wheelhouse/ || echo " No pure wheels found."
6382
6483# Bundle external shared libraries into the wheels
65- for whl in wheelhouse/* .whl; do
84+ for whl in / wheelhouse/* .whl; do
6685 auditwheel repair $whl -w /io/wheelhouse/
6786done
6887
@@ -71,9 +90,8 @@ chmod -R a+rw /io/wheelhouse
7190
7291# Install packages and test
7392for PYBIN in /opt/python/* /bin/; do
93+ ${PYBIN} /python -m pip install pytest
7494 ${PYBIN} /python -m pip install rust_fst --no-index -f /io/wheelhouse
7595 ${PYBIN} /python -m pytest --verbose /io/tests
76- rm -f /io/rust_fst/_ffi.py
77- find /io -name " __pycache__" -type d -print0 | xargs rm -rf --
78- find /io -name " *.pyc" -type f -print0 | xargs rm -rf --
96+ clean_project
7997done
0 commit comments