Skip to content

Commit cc46adb

Browse files
authored
build(native): Refactor setup scripts (#26406)
## Description A recent change in Velox changed what the current directory is after github_checkout. This breaks building the PrestoC++ dependencies. The refactor removes github cloning and instead pulls released tar.gz images of the source code. This also increases the download speed. This is a companion PR to #26385 ``` == NO RELEASE NOTE == ```
1 parent d7b8fa0 commit cc46adb

File tree

4 files changed

+32
-43
lines changed

4 files changed

+32
-43
lines changed

presto-native-execution/scripts/setup-adapters.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
# Propagate errors and improve debugging.
1515
set -eufx -o pipefail
1616

17+
JWT_VERSION="v0.6.0"
18+
PROMETHEUS_VERSION="v1.2.4"
19+
1720
SCRIPT_DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
1821
if [ -f "${SCRIPT_DIR}/setup-common.sh" ]
1922
then
@@ -31,15 +34,13 @@ else
3134
fi
3235

3336
function install_jwt_cpp {
34-
github_checkout Thalhammer/jwt-cpp v0.6.0 --depth 1
35-
cmake_install -DBUILD_TESTS=OFF -DJWT_BUILD_EXAMPLES=OFF -DJWT_DISABLE_PICOJSON=ON -DJWT_CMAKE_FILES_INSTALL_DIR="${DEPENDENCY_DIR}/jwt-cpp"
37+
wget_and_untar https://github.com/Thalhammer/jwt-cpp/archive/refs/tags/${JWT_VERSION}.tar.gz jwt-cpp
38+
cmake_install_dir jwt-cpp -DBUILD_TESTS=OFF -DJWT_BUILD_EXAMPLES=OFF -DJWT_DISABLE_PICOJSON=ON -DJWT_CMAKE_FILES_INSTALL_DIR="${INSTALL_PREFIX}/jwt-cpp"
3639
}
3740

3841
function install_prometheus_cpp {
39-
github_checkout jupp0r/prometheus-cpp v1.2.4 --depth 1
40-
git submodule init
41-
git submodule update
42-
cmake_install -DBUILD_SHARED_LIBS=ON -DENABLE_PUSH=OFF -DENABLE_COMPRESSION=OFF
42+
wget_and_untar https://github.com/jupp0r/prometheus-cpp/releases/download/${PROMETHEUS_VERSION}/prometheus-cpp-with-submodules.tar.gz prometheus-cpp
43+
cmake_install_dir prometheus-cpp -DBUILD_SHARED_LIBS=ON -DENABLE_PUSH=OFF -DENABLE_COMPRESSION=OFF
4344
}
4445

4546
function install_arrow_flight {

presto-native-execution/scripts/setup-centos.sh

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set -x
1717
export CC=/opt/rh/gcc-toolset-12/root/bin/gcc
1818
export CXX=/opt/rh/gcc-toolset-12/root/bin/g++
1919

20-
WGET_OPTIONS=${WGET_OPTIONS:-""}
20+
GPERF_VERSION="3.1"
2121

2222
CPU_TARGET="${CPU_TARGET:-avx}"
2323
SCRIPT_DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
@@ -38,28 +38,26 @@ function install_presto_deps_from_package_managers {
3838
}
3939

4040
function install_gperf {
41-
wget ${WGET_OPTIONS} https://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz ||
42-
wget ${WGET_OPTIONS} https://mirrors.ocf.berkeley.edu/gnu/gperf/gperf-3.1.tar.gz &&
43-
tar -xzf gperf-3.1.tar.gz &&
44-
cd gperf-3.1 &&
45-
./configure --prefix=/usr/local/gperf/3_1 &&
46-
make "-j${NPROC}" &&
47-
make install
48-
if [ -f /usr/local/bin/gperf ]; then
49-
echo "Did not create '/usr/local/bin/gperf' symlink as file already exists."
50-
else
51-
ln -s /usr/local/gperf/3_1/bin/gperf /usr/local/bin/
52-
fi
41+
wget_and_untar https://mirrors.ocf.berkeley.edu/gnu/gperf/gperf-${GPERF_VERSION}.tar.gz gperf
42+
(
43+
cd ${DEPENDENCY_DIR}/gperf || exit &&
44+
./configure --prefix=/usr/local/gperf/3_1 &&
45+
make "-j${NPROC}" &&
46+
make install
47+
if [ -f /usr/local/bin/gperf ]; then
48+
echo "Did not create '/usr/local/bin/gperf' symlink as file already exists."
49+
else
50+
ln -s /usr/local/gperf/3_1/bin/gperf /usr/local/bin/
51+
fi
52+
)
5353
}
5454

5555
function install_proxygen {
56-
git clone https://github.com/facebook/proxygen
57-
cd proxygen
58-
git checkout $FB_OS_VERSION
56+
wget_and_untar https://github.com/facebook/proxygen/archive/refs/tags/${FB_OS_VERSION}.tar.gz proxygen
5957
# Folly Portability.h being used to decide whether or not support coroutines
6058
# causes issues (build, lin) if the selection is not consistent across users of folly.
6159
EXTRA_PKG_CXXFLAGS=" -DFOLLY_CFG_NO_COROUTINES"
62-
cmake_install -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON
60+
cmake_install_dir proxygen -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON
6361
}
6462

6563
function install_presto_deps {

presto-native-execution/scripts/setup-macos.sh

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,20 @@ source "$(dirname "${BASH_SOURCE}")/../velox/scripts/setup-macos.sh"
2626
GPERF_VERSION="3.1"
2727

2828
function install_proxygen {
29-
github_checkout facebook/proxygen "${FB_OS_VERSION}" --depth 1
29+
wget_and_untar https://github.com/facebook/proxygen/archive/refs/tags/${FB_OS_VERSION}.tar.gz proxygen
3030
# Folly Portability.h being used to decide whether or not support coroutines
3131
# causes issues (build, lin) if the selection is not consistent across users of folly.
3232
EXTRA_PKG_CXXFLAGS=" -DFOLLY_CFG_NO_COROUTINES"
33-
cmake_install -DBUILD_TESTS=OFF
33+
cmake_install_dir proxygen -DBUILD_TESTS=OFF
3434
}
3535

3636
function install_gperf {
37-
mkdir -p "${DEPENDENCY_DIR}"
38-
cd "${DEPENDENCY_DIR}"
39-
if [ -d gperf ]; then
40-
if prompt "gperf already exists. Delete?"; then
41-
${SUDO} rm -rf gperf
42-
else
43-
return
44-
fi
45-
fi
46-
(curl ${CURL_OPTIONS:+${CURL_OPTIONS}} -L https://ftp.gnu.org/pub/gnu/gperf/gperf-${GPERF_VERSION}.tar.gz -o gperf-${GPERF_VERSION}.tar.gz ||
47-
curl ${CURL_OPTIONS:+${CURL_OPTIONS}} -L https://mirrors.ocf.berkeley.edu/gnu/gperf/gperf-${GPERF_VERSION}.tar.gz -o gperf-${GPERF_VERSION}.tar.gz) &&
48-
mkdir -p gperf &&
49-
tar -xz --strip-components=1 --no-same-owner -f gperf-${GPERF_VERSION}.tar.gz -C gperf &&
50-
cd gperf &&
51-
./configure --prefix=${INSTALL_PREFIX} &&
52-
make install
37+
wget_and_untar https://mirrors.ocf.berkeley.edu/gnu/gperf/gperf-${GPERF_VERSION}.tar.gz gperf
38+
(
39+
cd ${DEPENDENCY_DIR}/gperf || exit &&
40+
./configure --prefix=${INSTALL_PREFIX} &&
41+
make install
42+
)
5343
}
5444

5545
function install_presto_deps {

presto-native-execution/scripts/setup-ubuntu.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ function install_proxygen {
2424
# proxygen requires python and gperf
2525
${SUDO} apt update
2626
${SUDO} apt install -y gperf python3
27-
github_checkout facebook/proxygen "${FB_OS_VERSION}" --depth 1
27+
wget_and_untar https://github.com/facebook/proxygen/archive/refs/tags/${FB_OS_VERSION}.tar.gz proxygen
2828
# Folly Portability.h being used to decide whether or not support coroutines
2929
# causes issues (build, lin) if the selection is not consistent across users of folly.
3030
EXTRA_PKG_CXXFLAGS=" -DFOLLY_CFG_NO_COROUTINES"
31-
cmake_install -DBUILD_TESTS=OFF
31+
cmake_install_dir proxygen -DBUILD_TESTS=OFF
3232
}
3333

3434
function install_presto_deps {

0 commit comments

Comments
 (0)