From bea6a2a3c0203d087c2fae4fb625018fa280ae4d Mon Sep 17 00:00:00 2001 From: duanmeng Date: Tue, 7 Nov 2023 23:32:44 +0800 Subject: [PATCH] add antlr4 --- scripts/setup-centos8.sh | 12 ++++++++++++ scripts/setup-circleci.sh | 12 ++++++++++++ scripts/setup-macos.sh | 8 ++++++++ scripts/setup-ubuntu.sh | 13 +++++++++++++ 4 files changed, 45 insertions(+) diff --git a/scripts/setup-centos8.sh b/scripts/setup-centos8.sh index fe6042301d8f..acc2c0ed9132 100755 --- a/scripts/setup-centos8.sh +++ b/scripts/setup-centos8.sh @@ -44,6 +44,9 @@ dnf_install curl-devel c-ares-devel dnf_install conda +# Required for Antlr4 +dnf install -y libuuid-devel + # Activate gcc9; enable errors on unset variables afterwards. source /opt/rh/gcc-toolset-9/enable || exit 1 set -u @@ -86,6 +89,15 @@ wait # For cmake and source downloads to complete. ./b2 "-j$(nproc)" -d0 install threading=multi ) +( + wget https://www.antlr.org/download/antlr4-cpp-runtime-4.9.3-source.zip && + mkdir antlr4-cpp-runtime-4.9.3-source && + cd antlr4-cpp-runtime-4.9.3-source && + unzip ../antlr4-cpp-runtime-4.9.3-source.zip && + cmake_install_deps antlr4 -DBUILD_SHARED_LIBS=ON + ldconfig +) + cmake_install_deps gflags -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_gflags_LIB=ON -DLIB_SUFFIX=64 -DCMAKE_INSTALL_PREFIX:PATH=/usr cmake_install_deps glog -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr cmake_install_deps snappy -DSNAPPY_BUILD_TESTS=OFF diff --git a/scripts/setup-circleci.sh b/scripts/setup-circleci.sh index bd275f48869e..5d8b621cf19c 100755 --- a/scripts/setup-circleci.sh +++ b/scripts/setup-circleci.sh @@ -41,6 +41,9 @@ dnf_install autoconf automake libtool bison flex python3 libsodium-devel dnf_install conda +# Required for Antlr4 +dnf install -y libuuid-devel + # install sphinx for doc gen pip3 install sphinx sphinx-tabs breathe sphinx_rtd_theme @@ -108,6 +111,15 @@ cp -a hadoop /usr/local/ ldconfig ) +( + wget https://www.antlr.org/download/antlr4-cpp-runtime-4.9.3-source.zip && + mkdir antlr4-cpp-runtime-4.9.3-source && + cd antlr4-cpp-runtime-4.9.3-source && + unzip ../antlr4-cpp-runtime-4.9.3-source.zip && + cmake_install antlr4 -DBUILD_SHARED_LIBS=ON + ldconfig +) + cmake_install gflags -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_gflags_LIB=ON -DLIB_SUFFIX=64 -DCMAKE_INSTALL_PREFIX:PATH=/usr cmake_install glog -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr cmake_install snappy -DSNAPPY_BUILD_TESTS=OFF diff --git a/scripts/setup-macos.sh b/scripts/setup-macos.sh index 83d8990603ea..7fe4cd7c6527 100755 --- a/scripts/setup-macos.sh +++ b/scripts/setup-macos.sh @@ -113,6 +113,12 @@ function install_re2 { cmake_install -DRE2_BUILD_TESTING=OFF } +function install_antlr { + github_checkout antlr/antlr4 "4.9.3" + cd runtime/Cpp + cmake_install -DBUILD_TESTS=OFF +} + function install_velox_deps { if [ "${INSTALL_PREREQUISITES:-Y}" == "Y" ]; then run_and_time install_build_prerequisites @@ -121,6 +127,8 @@ function install_velox_deps { run_and_time install_fmt run_and_time install_double_conversion run_and_time install_re2 + run_and_time install_antlr + } (return 2> /dev/null) && return # If script was sourced, don't run commands. diff --git a/scripts/setup-ubuntu.sh b/scripts/setup-ubuntu.sh index 42054e593092..68faee5e748a 100755 --- a/scripts/setup-ubuntu.sh +++ b/scripts/setup-ubuntu.sh @@ -117,6 +117,18 @@ function install_conda { bash Miniconda3-latest-Linux-x86_64.sh -b -p $MINICONDA_PATH } +function install_antlr4 { + cd "${DEPENDENCY_DIR}" + if [ -d "antlr4-cpp-runtime-4.9.3-source" ]; then + rm -rf antlr4-cpp-runtime-4.9.3-source + fi + wget https://www.antlr.org/download/antlr4-cpp-runtime-4.9.3-source.zip -O antlr4-cpp-runtime-4.9.3-source.zip + mkdir antlr4-cpp-runtime-4.9.3-source && cd antlr4-cpp-runtime-4.9.3-source + unzip ../antlr4-cpp-runtime-4.9.3-source.zip + mkdir build && mkdir run && cd build + cmake .. && make "-j${NPROC}" install +} + function install_velox_deps { run_and_time install_fmt run_and_time install_folly @@ -124,6 +136,7 @@ function install_velox_deps { run_and_time install_wangle run_and_time install_fbthrift run_and_time install_conda + run_and_time install_antlr4 } (return 2> /dev/null) && return # If script was sourced, don't run commands.