|
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. See accompanying LICENSE file. |
| 14 | +# |
| 15 | +# Usage: |
| 16 | +# docker run --rm -v $PWD:/io arrow-base-x86_64 /io/build_arrow.sh |
| 17 | +# or with Parquet support |
| 18 | +# docker run --rm -v $PWD:/io parquet_arrow-base-x86_64 /io/build_arrow.sh |
| 19 | + |
| 20 | +# Build upon the scripts in https://github.com/matthew-brett/manylinux-builds |
| 21 | +# * Copyright (c) 2013-2016, Matt Terry and Matthew Brett (BSD 2-clause) |
| 22 | + |
| 23 | +PYTHON_VERSIONS="${PYTHON_VERSIONS:-2.7 3.4 3.5}" |
| 24 | + |
| 25 | +# Package index with only manylinux1 builds |
| 26 | +MANYLINUX_URL=https://nipy.bic.berkeley.edu/manylinux |
| 27 | + |
| 28 | +source /multibuild/manylinux_utils.sh |
| 29 | + |
| 30 | +cd /arrow/python |
| 31 | + |
| 32 | +# PyArrow build configuration |
| 33 | +export PYARROW_CMAKE_OPTIONS='-DCMAKE_BUILD_TYPE=Release' |
| 34 | +# Need as otherwise arrow_io is sometimes not linked |
| 35 | +export LDFLAGS="-Wl,--no-as-needed" |
| 36 | +export ARROW_HOME="/usr" |
| 37 | + |
| 38 | +# Ensure the target directory exists |
| 39 | +mkdir -p /io/dist |
| 40 | +# Temporary directory to store the wheels that should be sent through auditwheel |
| 41 | +rm_mkdir unfixed_wheels |
| 42 | + |
| 43 | +PY35_BIN=/opt/python/cp35-cp35m/bin |
| 44 | +$PY35_BIN/pip install 'pyelftools<0.24' |
| 45 | +$PY35_BIN/pip install 'git+https://github.com/xhochy/auditwheel.git@pyarrow-fixes' |
| 46 | + |
| 47 | +# Override repair_wheelhouse function |
| 48 | +function repair_wheelhouse { |
| 49 | + local in_dir=$1 |
| 50 | + local out_dir=$2 |
| 51 | + for whl in $in_dir/*.whl; do |
| 52 | + if [[ $whl == *none-any.whl ]]; then |
| 53 | + cp $whl $out_dir |
| 54 | + else |
| 55 | + # Store libraries directly in . not .libs to fix problems with libpyarrow.so linkage. |
| 56 | + auditwheel -v repair -L . $whl -w $out_dir/ |
| 57 | + fi |
| 58 | + done |
| 59 | + chmod -R a+rwX $out_dir |
| 60 | +} |
| 61 | + |
| 62 | +for PYTHON in ${PYTHON_VERSIONS}; do |
| 63 | + PYTHON_INTERPRETER="$(cpython_path $PYTHON)/bin/python" |
| 64 | + PIP="$(cpython_path $PYTHON)/bin/pip" |
| 65 | + PIPI_IO="$PIP install -f $MANYLINUX_URL" |
| 66 | + PATH="$PATH:$(cpython_path $PYTHON)" |
| 67 | + |
| 68 | + $PIPI_IO "numpy==1.9.0" |
| 69 | + $PIPI_IO "cython==0.24" |
| 70 | + |
| 71 | + PATH="$PATH:$(cpython_path $PYTHON)/bin" $PYTHON_INTERPRETER setup.py bdist_wheel |
| 72 | + |
| 73 | + rm_mkdir fixed_wheels |
| 74 | + repair_wheelhouse dist /io/dist |
| 75 | +done |
| 76 | + |
0 commit comments