Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion dev/build-arrow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,30 @@ SUDO="${SUDO:-""}"
source ${CURRENT_DIR}/build-helper-functions.sh
VELOX_ARROW_BUILD_VERSION=15.0.0
ARROW_PREFIX=$CURRENT_DIR/../ep/_ep/arrow_ep
ARROW_MANAGED_PREFIX="$CURRENT_DIR/../ep/_ep/arrow_ep"
BUILD_TYPE=Release
# When invoked via builddeps-veloxbe.sh, INSTALL_PREFIX is already resolved and
# exported (isolated local prefix on macOS, system on Linux) and is respected
# here. For a standalone run, consult the isolation resolver so we do not
# silently target /usr/local on an isolated platform.
if [ -z "${INSTALL_PREFIX:-}" ] && [ -f "${CURRENT_DIR}/build-isolation.sh" ]; then
source "${CURRENT_DIR}/build-isolation.sh"
# Fatal on resolver rejection (e.g. isolation=on with vcpkg, or an invalid
# mode): falling through would silently target /usr/local and mask the
# misconfiguration. Consistent with the other native build entrypoints.
resolve_build_isolation || exit 1
fi
INSTALL_PREFIX=${INSTALL_PREFIX:-"/usr/local"}

function prepare_arrow_build() {
mkdir -p ${ARROW_PREFIX}/../ && pushd ${ARROW_PREFIX}/../ && ${SUDO} rm -rf arrow_ep/
mkdir -p ${ARROW_PREFIX}/../ && pushd ${ARROW_PREFIX}/../
# Only auto-remove Gluten's managed download dir; never wipe a user-provided
# Arrow source tree pointed to by an overridden ARROW_PREFIX.
if [ "${ARROW_PREFIX}" = "${ARROW_MANAGED_PREFIX}" ]; then
${SUDO} rm -rf arrow_ep/
else
echo "INFO: ARROW_PREFIX=${ARROW_PREFIX} is user-provided; not auto-removing it." >&2
fi
wget_and_untar https://github.com/apache/arrow/archive/refs/tags/apache-arrow-${VELOX_ARROW_BUILD_VERSION}.tar.gz arrow_ep
#wget_and_untar https://archive.apache.org/dist/arrow/arrow-${VELOX_ARROW_BUILD_VERSION}/apache-arrow-${VELOX_ARROW_BUILD_VERSION}.tar.gz arrow_ep
cd arrow_ep
Expand Down
24 changes: 13 additions & 11 deletions dev/build-helper-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,18 @@ function cmake_install {
CPU_TARGET="${CPU_TARGET:-unknown}"
COMPILER_FLAGS=$(get_cxx_flags $CPU_TARGET)

local MACOS_ISOLATION_FLAGS=""
if [[ "$(uname)" == "Darwin" ]]; then
if [[ "${INSTALL_PREFIX:-}" == "/usr/local" || "${INSTALL_PREFIX:-}" == /usr/local/* ]]; then
echo "INFO: INSTALL_PREFIX=${INSTALL_PREFIX} is under /usr/local; keeping /usr/local visible to CMake." >&2
else
MACOS_ISOLATION_FLAGS="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON \
-DCMAKE_IGNORE_PREFIX_PATH=/usr/local \
-DCMAKE_IGNORE_PATH=/usr/local;/usr/local/include;/usr/local/lib;/usr/local/lib/cmake \
-DCMAKE_SYSTEM_IGNORE_PATH=/usr/local;/usr/local/include;/usr/local/lib;/usr/local/lib/cmake"
fi
# Component isolation: a single resolver computes the ignore/prefix policy for
# both macOS and Linux (dev/build-isolation.sh). macOS default reproduces the
# previous /usr/local ignore flags; Linux default is a no-op; vcpkg disables it.
local _gi="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/build-isolation.sh"
local ISOLATION_FLAGS=""
if [ -f "$_gi" ]; then
source "$_gi"
resolve_build_isolation || exit 1
ISOLATION_FLAGS="${GLUTEN_ISOLATION_CMAKE_FLAGS:-}"
# Demote ignored roots' /include below -I/-isystem so a stale /usr/local
# header can't shadow bundled/deps-install headers (compiler isolation).
COMPILER_FLAGS="$COMPILER_FLAGS ${GLUTEN_ISOLATION_CXXFLAGS:-}"
fi

# CMAKE_POSITION_INDEPENDENT_CODE is required so that Velox can be built into dynamic libraries \
Expand All @@ -197,7 +199,7 @@ function cmake_install {
"${INSTALL_PREFIX+-DCMAKE_INSTALL_PREFIX=}${INSTALL_PREFIX-}" \
-DCMAKE_CXX_FLAGS="$COMPILER_FLAGS" \
-DBUILD_TESTING=OFF \
$MACOS_ISOLATION_FLAGS \
$ISOLATION_FLAGS \
"$@"

cmake --build "${BINARY_DIR}"
Expand Down
Loading
Loading