2018-06-25 01:11:07 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2018-07-05 03:17:57 +00:00
|
|
|
here=$(dirname "${BASH_SOURCE[0]}")
|
|
|
|
here=$(readlink -f "$here")
|
|
|
|
prebuilt="$here"/build/linux/prebuilt
|
|
|
|
ubuntu="$(lsb_release -s -r)"
|
|
|
|
libs=(libarrow.a libboost_filesystem.a libboost_regex.a libboost_system.a libbrotlicommon.a libbrotlidec.a \
|
|
|
|
libbrotlienc.a libicudata.a libicui18n.a libicuuc.a liblz4.a libparquet.a libsnappy.a libthrift.a libzstd.a)
|
|
|
|
lib_locs=()
|
|
|
|
|
|
|
|
setup_directories() {
|
|
|
|
cd "$here"
|
|
|
|
mkdir -p build/linux
|
|
|
|
mkdir -p "$prebuilt"
|
|
|
|
cp -f build/Makefile.linux build/linux/Makefile
|
|
|
|
cd build/linux
|
|
|
|
}
|
|
|
|
|
|
|
|
install_prerequisites() {
|
|
|
|
# Install prereqs based on https://github.com/apache/parquet-cpp#linux
|
|
|
|
sudo apt-get install libboost-dev g++ libboost-filesystem-dev \
|
|
|
|
libboost-program-options-dev libboost-regex-dev \
|
|
|
|
libboost-system-dev libboost-test-dev \
|
2019-11-27 20:26:54 +00:00
|
|
|
libssl-dev libtool bison flex pkg-config libreadline-dev libncurses-dev
|
2018-07-05 03:17:57 +00:00
|
|
|
|
|
|
|
# Install prereqs based on https://github.com/apache/arrow/tree/master/cpp
|
|
|
|
sudo apt-get install cmake \
|
|
|
|
libboost-dev \
|
|
|
|
libboost-filesystem-dev \
|
|
|
|
libboost-system-dev
|
|
|
|
}
|
|
|
|
|
|
|
|
build_sqlite() {
|
|
|
|
if [ ! -e ../../sqlite/sqlite3 ]; then
|
2018-07-06 03:36:30 +00:00
|
|
|
( cd "../.." && ./build-sqlite )
|
2018-07-05 03:17:57 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
set_icu_version() {
|
|
|
|
case "$ubuntu" in
|
|
|
|
14.04)
|
2020-08-04 23:58:16 +00:00
|
|
|
export ICU_VERSION=52-1
|
2018-07-05 03:17:57 +00:00
|
|
|
;;
|
|
|
|
16.04)
|
2020-08-04 23:58:16 +00:00
|
|
|
export ICU_VERSION=55-1
|
2018-07-05 03:17:57 +00:00
|
|
|
;;
|
|
|
|
18.04)
|
2020-08-04 23:58:16 +00:00
|
|
|
export ICU_VERSION=60-2
|
2018-07-05 03:17:57 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "unsure what libicu version to use" >&2
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
2020-08-05 00:23:48 +00:00
|
|
|
export ICU_VERSION_U=${ICU_VERSION//-/_}
|
2018-07-05 03:17:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
add_prebuilt_lib() {
|
|
|
|
lib_locs+=("$1=$prebuilt/$2.a")
|
|
|
|
}
|
|
|
|
|
|
|
|
fetch_prebuilt_libs() {
|
2018-07-06 03:36:30 +00:00
|
|
|
if [ ! -e "$prebuilt"/complete ]; then
|
|
|
|
(
|
|
|
|
cd "$prebuilt"
|
|
|
|
curl "https://s3.amazonaws.com/cldellow/public/libparquet/$ubuntu/libs.tar.xz" > libs.tar.xz
|
|
|
|
tar xf libs.tar.xz --xform 's#.*/##'
|
|
|
|
touch "$prebuilt"/complete
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -e "$here"/sqlite/sqlite3 ]; then
|
|
|
|
ln -s "$prebuilt"/sqlite3 "$here"/sqlite/sqlite3
|
|
|
|
fi
|
2018-07-05 03:17:57 +00:00
|
|
|
|
|
|
|
add_prebuilt_lib "PARQUET_CPP_LIB" libparquet
|
|
|
|
add_prebuilt_lib "LZ4_LIB" liblz4
|
|
|
|
add_prebuilt_lib "ZSTD_LIB" libzstd
|
|
|
|
add_prebuilt_lib "THRIFT_LIB" libthrift
|
|
|
|
add_prebuilt_lib "SNAPPY_LIB" libsnappy
|
|
|
|
add_prebuilt_lib "ARROW_LIB" libarrow
|
|
|
|
add_prebuilt_lib "ICU_I18N_LIB" libicui18n
|
|
|
|
add_prebuilt_lib "ICU_UC_LIB" libicuuc
|
|
|
|
add_prebuilt_lib "ICU_DATA_LIB" libicudata
|
|
|
|
add_prebuilt_lib "BROTLI_ENC_LIB" libbrotlienc
|
|
|
|
add_prebuilt_lib "BROTLI_COMMON_LIB" libbrotlicommon
|
|
|
|
add_prebuilt_lib "BROTLI_DEC_LIB" libbrotlidec
|
|
|
|
add_prebuilt_lib "BOOST_REGEX_LIB" libboost_regex
|
|
|
|
add_prebuilt_lib "BOOST_SYSTEM_LIB" libboost_system
|
|
|
|
add_prebuilt_lib "BOOST_FILESYSTEM_LIB" libboost_filesystem
|
2018-07-06 03:36:30 +00:00
|
|
|
|
2018-07-05 03:17:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
|
|
|
setup_directories
|
|
|
|
install_prerequisites
|
|
|
|
build_sqlite
|
|
|
|
set_icu_version
|
|
|
|
|
|
|
|
if [ -v PREBUILT ]; then
|
|
|
|
fetch_prebuilt_libs
|
|
|
|
fi
|
2018-07-05 22:47:33 +00:00
|
|
|
|
|
|
|
optimizations="-O3"
|
|
|
|
if [ -v COVERAGE ]; then
|
|
|
|
optimizations="-fprofile-arcs -ftest-coverage"
|
|
|
|
fi
|
|
|
|
|
|
|
|
make ${lib_locs[@]-} "$@" OPTIMIZATIONS="$optimizations"
|
2018-07-05 03:17:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|