diff --git a/scripts/setup-adapters.sh b/scripts/setup-adapters.sh index c5646e0b62ac0..b2b0e5a1170d7 100755 --- a/scripts/setup-adapters.sh +++ b/scripts/setup-adapters.sh @@ -25,6 +25,10 @@ DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)/deps-download} CMAKE_BUILD_TYPE="${BUILD_TYPE:-Release}" MACHINE=$(uname -m) +if [[ "$OSTYPE" == darwin* ]]; then + export INSTALL_PREFIX=${INSTALL_PREFIX:-"$(pwd)/deps-install"} +fi + function install_aws_deps { local AWS_REPO_NAME="aws/aws-sdk-cpp" local AWS_SDK_VERSION="1.11.321" @@ -40,14 +44,16 @@ function install_aws_deps { MINIO_ARCH="amd64" fi local MINIO_BINARY="minio-2022-05-26" - local MINIO_OS="linux" - if [[ "$OSTYPE" == darwin* ]]; then - # minio will have to approved under the Privacy & Security on MacOS on first use. - MINIO_OS="darwin" + if [[! -f /usr/local/bin/${MINIO_BINARY} ]]; then + local MINIO_OS="linux" + if [[ "$OSTYPE" == darwin* ]]; then + # minio will have to approved under the Privacy & Security on MacOS on first use. + MINIO_OS="darwin" + fi + wget https://dl.min.io/server/minio/release/${MINIO_OS}-${MINIO_ARCH}/archive/minio.RELEASE.2022-05-26T05-48-41Z -O ${MINIO_BINARY} + chmod +x ./${MINIO_BINARY} + mv ./${MINIO_BINARY} /usr/local/bin/ fi - wget https://dl.min.io/server/minio/release/${MINIO_OS}-${MINIO_ARCH}/archive/minio.RELEASE.2022-05-26T05-48-41Z -O ${MINIO_BINARY} - chmod +x ./${MINIO_BINARY} - mv ./${MINIO_BINARY} /usr/local/bin/ } function install_gcs-sdk-cpp { @@ -117,16 +123,26 @@ function install_azure-storage-sdk-cpp { sed -i "s/\"version-string\"/\"builtin-baseline\": \"$vcpkg_commit_id\",\"version-string\"/" $azure_core_dir/vcpkg.json sed -i "s/\"version-string\"/\"overrides\": [{ \"name\": \"openssl\", \"version-string\": \"$openssl_version\" }],\"version-string\"/" $azure_core_dir/vcpkg.json fi - cmake_install_dir $azure_core_dir -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF - + ( + cd $azure_core_dir + cmake_install -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF + ) # install azure-storage-common - cmake_install_dir sdk/storage/azure-storage-common -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF + ( + cd sdk/storage/azure-storage-common + cmake_install -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF + ) # install azure-storage-blobs - cmake_install_dir sdk/storage/azure-storage-blobs -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF - + ( + cd sdk/storage/azure-storage-blobs + cmake_install -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF + ) # install azure-storage-files-datalake - cmake_install_dir sdk/storage/azure-storage-files-datalake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF + ( + cd sdk/storage/azure-storage-files-datalake + cmake_install -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_SHARED_LIBS=OFF + ) } function install_hdfs_deps { diff --git a/scripts/setup-centos9.sh b/scripts/setup-centos9.sh index c605da2971821..2b38fd1d4c733 100755 --- a/scripts/setup-centos9.sh +++ b/scripts/setup-centos9.sh @@ -36,6 +36,7 @@ export CFLAGS=${CXXFLAGS//"-std=c++17"/} # Used by LZO. CMAKE_BUILD_TYPE="${BUILD_TYPE:-Release}" BUILD_DUCKDB="${BUILD_DUCKDB:-true}" USE_CLANG="${USE_CLANG:-false}" +export INSTALL_PREFIX=${INSTALL_PREFIX:-"/usr/local"} DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)/deps-download} FB_OS_VERSION="v2024.05.20.00" @@ -98,7 +99,7 @@ function install_lzo { wget_and_untar http://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz lzo ( cd ${DEPENDENCY_DIR}/lzo - ./configure --prefix=/usr --enable-shared --disable-static --docdir=/usr/share/doc/lzo-2.10 + ./configure --prefix=${INSTALL_PREFIX} --enable-shared --disable-static --docdir=/usr/share/doc/lzo-2.10 make "-j$(nproc)" make install ) @@ -109,14 +110,14 @@ function install_boost { ( cd ${DEPENDENCY_DIR}/boost if [[ ${USE_CLANG} != "false" ]]; then - ./bootstrap.sh --prefix=/usr/local --with-toolset="clang-15" + ./bootstrap.sh --prefix=${INSTALL_PREFIX} --with-toolset="clang-15" # Switch the compiler from the clang-15 toolset which doesn't exist (clang-15.jam) to # clang of version 15 when toolset clang-15 is used. # This reconciles the project-config.jam generation with what the b2 build system allows for customization. sed -i 's/using clang-15/using clang : 15/g' project-config.jam ${SUDO} ./b2 "-j$(nproc)" -d0 install threading=multi toolset=clang-15 --without-python else - ./bootstrap.sh --prefix=/usr/local + ./bootstrap.sh --prefix=${INSTALL_PREFIX} ${SUDO} ./b2 "-j$(nproc)" -d0 install threading=multi --without-python fi ) @@ -136,7 +137,7 @@ function install_protobuf { wget_and_untar https://github.com/protocolbuffers/protobuf/releases/download/v21.8/protobuf-all-21.8.tar.gz protobuf ( cd ${DEPENDENCY_DIR}/protobuf - ./configure --prefix=/usr + ./configure --prefix=${INSTALL_PREFIX} make "-j${NPROC}" make install ldconfig @@ -190,7 +191,7 @@ function install_arrow { -DARROW_RUNTIME_SIMD_LEVEL=NONE \ -DARROW_WITH_UTF8PROC=OFF \ -DARROW_TESTING=ON \ - -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \ -DCMAKE_BUILD_TYPE=Release \ -DARROW_BUILD_STATIC=ON \ -DThrift_SOURCE=BUNDLED @@ -198,7 +199,7 @@ function install_arrow { ( # Install thrift. cd ${DEPENDENCY_DIR}/arrow/cpp/_build/thrift_ep-prefix/src/thrift_ep-build - cmake --install ./ --prefix /usr/local/ + cmake --install ./ --prefix ${INSTALL_PREFIX} ) } diff --git a/scripts/setup-helper-functions.sh b/scripts/setup-helper-functions.sh index d6530ffb03e36..4c332bb305f42 100755 --- a/scripts/setup-helper-functions.sh +++ b/scripts/setup-helper-functions.sh @@ -180,6 +180,13 @@ function wget_and_untar { function cmake_install_dir { pushd "${DEPENDENCY_DIR}/$1" + # remove the directory argument + shift + cmake_install $@ + popd +} + +function cmake_install { local NAME=$(basename "$(pwd)") local BINARY_DIR=_build SUDO="${SUDO:-""}" @@ -187,18 +194,10 @@ function cmake_install_dir { if prompt "Do you want to rebuild ${NAME}?"; then ${SUDO} rm -rf "${BINARY_DIR}" else - popd return fi fi - # remove the directory argument - shift - cmake_install $@ - popd -} -function cmake_install { - local BINARY_DIR=_build mkdir -p "${BINARY_DIR}" COMPILER_FLAGS=$(get_cxx_flags) # Add platform specific CXX flags if any diff --git a/scripts/setup-macos.sh b/scripts/setup-macos.sh index cf791c24532fb..13c16686d837e 100755 --- a/scripts/setup-macos.sh +++ b/scripts/setup-macos.sh @@ -174,4 +174,4 @@ function install_velox_deps { ) echo 'To add cmake-format bin to your $PATH, consider adding this to your ~/.profile:' -echo 'export PATH=$HOME/bin:$HOME/Library/Python/3.7/bin:$PATH' +echo 'Please add $INSTALL_PREFIX to your ~/.zshrc' diff --git a/scripts/setup-ubuntu.sh b/scripts/setup-ubuntu.sh index fdfce14755611..b95aabd37b697 100755 --- a/scripts/setup-ubuntu.sh +++ b/scripts/setup-ubuntu.sh @@ -39,6 +39,7 @@ BUILD_DUCKDB="${BUILD_DUCKDB:-true}" export CMAKE_BUILD_TYPE=Release SUDO="${SUDO:-"sudo --preserve-env"}" USE_CLANG="${USE_CLANG:-false}" +export INSTALL_PREFIX=${INSTALL_PREFIX:-"/usr/local"} DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)/deps-download} function install_clang15 { @@ -120,14 +121,14 @@ function install_boost { ( cd ${DEPENDENCY_DIR}/boost if [[ ${USE_CLANG} != "false" ]]; then - ./bootstrap.sh --prefix=/usr/local --with-toolset="clang-15" + ./bootstrap.sh --prefix=${INSTALL_PREFIX} --with-toolset="clang-15" # Switch the compiler from the clang-15 toolset which doesn't exist (clang-15.jam) to # clang of version 15 when toolset clang-15 is used. # This reconciles the project-config.jam generation with what the b2 build system allows for customization. sed -i 's/using clang-15/using clang : 15/g' project-config.jam ${SUDO} ./b2 "-j$(nproc)" -d0 install threading=multi toolset=clang-15 --without-python else - ./bootstrap.sh --prefix=/usr/local + ./bootstrap.sh --prefix=${INSTALL_PREFIX} ${SUDO} ./b2 "-j$(nproc)" -d0 install threading=multi --without-python fi ) @@ -198,7 +199,7 @@ function install_arrow { -DARROW_RUNTIME_SIMD_LEVEL=NONE \ -DARROW_WITH_UTF8PROC=OFF \ -DARROW_TESTING=ON \ - -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \ -DCMAKE_BUILD_TYPE=Release \ -DARROW_BUILD_STATIC=ON \ -DThrift_SOURCE=BUNDLED @@ -206,7 +207,7 @@ function install_arrow { ( # Install thrift. cd ${DEPENDENCY_DIR}/arrow/cpp/_build/thrift_ep-prefix/src/thrift_ep-build - $SUDO cmake --install ./ --prefix /usr/local/ + $SUDO cmake --install ./ --prefix ${INSTALL_PREFIX} ) }