|
| 1 | +#!/usr/bin/env bash |
| 2 | +# |
| 3 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 4 | +# or more contributor license agreements. See the NOTICE file |
| 5 | +# distributed with this work for additional information |
| 6 | +# regarding copyright ownership. The ASF licenses this file |
| 7 | +# to you under the Apache License, Version 2.0 (the |
| 8 | +# "License"); you may not use this file except in compliance |
| 9 | +# with the License. You may obtain a copy of the License at |
| 10 | +# |
| 11 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +# |
| 13 | +# Unless required by applicable law or agreed to in writing, |
| 14 | +# software distributed under the License is distributed on an |
| 15 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | +# KIND, either express or implied. See the License for the |
| 17 | +# specific language governing permissions and limitations |
| 18 | +# under the License. |
| 19 | +# |
| 20 | + |
| 21 | +set -e -x |
| 22 | + |
| 23 | +ROOT_DIR=$(git rev-parse --show-toplevel) |
| 24 | +cd $ROOT_DIR |
| 25 | + |
| 26 | +CACHE_DIR=~/.pulsar-python-deps |
| 27 | +if [[ $# -le 1 ]]; then |
| 28 | + CACHE_DIR=$(mkdir -p $1 && cd $1 && pwd) |
| 29 | +fi |
| 30 | +PREFIX=$CACHE_DIR/install |
| 31 | +echo "Use $CACHE_DIR to cache dependencies" |
| 32 | + |
| 33 | +python3 -m pip install pyyaml |
| 34 | + |
| 35 | +BOOST_VERSION=$(./build-support/dep-version.py boost) |
| 36 | +mkdir -p $CACHE_DIR |
| 37 | +cd $CACHE_DIR |
| 38 | + |
| 39 | +download() { |
| 40 | + URL=$1 |
| 41 | + BASENAME=$(basename $URL) |
| 42 | + if [[ ! -f $BASENAME ]]; then |
| 43 | + echo "curl -O -L $URL" |
| 44 | + curl -O -L $URL |
| 45 | + fi |
| 46 | + tar xfz $BASENAME |
| 47 | +} |
| 48 | + |
| 49 | +# Install Boost |
| 50 | +BOOST_VERSION_=${BOOST_VERSION//./_} |
| 51 | +DIR=boost_$BOOST_VERSION_ |
| 52 | +if [[ ! -f $DIR/.done ]]; then |
| 53 | + echo "Building Boost $BOOST_VERSION" |
| 54 | + download https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_}.tar.gz |
| 55 | + mkdir -p $PREFIX/include |
| 56 | + pushd $DIR |
| 57 | + ./bootstrap.sh --with-libraries=python --with-python=python3 --prefix=$PREFIX 2>&1 >/dev/null |
| 58 | + ./b2 address-model=64 cxxflags="-fPIC" link=static threading=multi -j8 install 2>&1 >/dev/null |
| 59 | + touch .done |
| 60 | + popd |
| 61 | +else |
| 62 | + echo "Using cached Boost $BOOST_VERSION" |
| 63 | +fi |
0 commit comments