Skip to content

Commit

Permalink
Add default INSTALL_PREFIX and DEPENDENCY_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
majetideepak committed Sep 4, 2024
1 parent 5bafa2f commit 949f30d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ projects/*
!projects/*.*
!projects/Makefile
.venv
deps-install
deps-download

#==============================================================================#
# Autotools artifacts
Expand Down
15 changes: 14 additions & 1 deletion scripts/setup-helper-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,29 +156,41 @@ function get_cxx_flags {
function wget_and_untar {
local URL=$1
local DIR=$2
local DWLD_DIR=$(pwd)
if [ -d "${DEPENDENCY_DIR}" ]; then
DWLD_DIR=${DEPENDENCY_DIR}
fi
pushd "${DWLD_DIR}"
mkdir -p "${DIR}"
pushd "${DIR}"
curl -L "${URL}" > $2.tar.gz
tar -xz --strip-components=1 -f $2.tar.gz
popd
popd
}

function cmake_install {
local DWLD_DIR=$(pwd)
if [ -d "${DEPENDENCY_DIR}" ]; then
DWLD_DIR=${DEPENDENCY_DIR}
fi
pushd "${DWLD_DIR}"
if [ -d "$1" ]; then
DIR="$1"
shift
else
DIR=$(pwd)
fi
local NAME=$(basename "$(pwd)")
local BINARY_DIR=_build
SUDO="${SUDO:-""}"
pushd "${DIR}"
local NAME=$(basename "$(pwd)")
if [ -d "${BINARY_DIR}" ] && prompt "Do you want to rebuild ${NAME}?"; then
${SUDO} rm -rf "${BINARY_DIR}"
fi
mkdir -p "${BINARY_DIR}"
COMPILER_FLAGS=$(get_cxx_flags)
COMPILER_FLAGS+=${CXXFLAGS}

# CMAKE_POSITION_INDEPENDENT_CODE is required so that Velox can be built into dynamic libraries \
cmake -Wno-dev -B"${BINARY_DIR}" \
Expand All @@ -194,5 +206,6 @@ function cmake_install {
cmake --build "${BINARY_DIR}" || { echo 'build failed' ; exit 1; }
${SUDO} cmake --install "${BINARY_DIR}"
popd
popd
}

6 changes: 4 additions & 2 deletions scripts/setup-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ set -e # Exit on error.
set -x # Print commands that are executed.

SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
INSTALL_PREFIX=${INSTALL_PREFIX:-"$(pwd)/deps-install"}
source $SCRIPTDIR/setup-helper-functions.sh
PYTHON_VENV=${PYHTON_VENV:-"${SCRIPTDIR}/../.venv"}

export CXXFLAGS=" -isystem $(brew --prefix)/include"
NPROC=$(getconf _NPROCESSORS_ONLN)

DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)}
DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)/deps-download}
mkdir -p ${DEPENDENCY_DIR}
MACOS_VELOX_DEPS="bison flex gflags glog googletest icu4c libevent libsodium lz4 lzo openssl protobuf@21 snappy xz zstd"
MACOS_BUILD_DEPS="ninja cmake ccache"
FB_OS_VERSION="v2024.05.20.00"
Expand Down

0 comments on commit 949f30d

Please sign in to comment.