Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLUTEN-6537][BUILD] Support more shell environments beyond Bash in build scripts #6538

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 2 additions & 2 deletions cpp/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ for arg in "$@"; do
done

CURRENT_DIR=$(
cd "$(dirname "$BASH_SOURCE")"
cd "$(dirname $0)"
pwd
)

#gluten cpp will find velox lib from VELOX_HOME
if [ "$VELOX_HOME" == "" ]; then
if [[ "$VELOX_HOME" == "" ]]; then
VELOX_HOME="$CURRENT_DIR/../ep/build-velox/build/velox_ep"
fi

Expand Down
2 changes: 1 addition & 1 deletion dev/build_arrow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

CURRENT_DIR=$(cd "$(dirname "$BASH_SOURCE")"; pwd)
CURRENT_DIR=$(cd "$(dirname $0)"; pwd)
export SUDO=sudo
source ${CURRENT_DIR}/build_helper_functions.sh
VELOX_ARROW_BUILD_VERSION=15.0.0
Expand Down
2 changes: 1 addition & 1 deletion dev/builddeps-veloxbe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
####################################################################################################
set -exu

CURRENT_DIR=$(cd "$(dirname "$BASH_SOURCE")"; pwd)
CURRENT_DIR=$(cd "$(dirname $0)"; pwd)
GLUTEN_DIR="$CURRENT_DIR/.."
BUILD_TYPE=Release
BUILD_TESTS=OFF
Expand Down
2 changes: 1 addition & 1 deletion dev/package-vcpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -ex

CURRENT_DIR=$(cd "$(dirname "$BASH_SOURCE")"; pwd)
CURRENT_DIR=$(cd "$(dirname $0)"; pwd)
GLUTEN_DIR="$CURRENT_DIR/.."

cd "$GLUTEN_DIR"
Expand Down
2 changes: 1 addition & 1 deletion dev/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eux

CURRENT_DIR=$(cd "$(dirname "$BASH_SOURCE")"; pwd)
CURRENT_DIR=$(cd "$(dirname $0)"; pwd)
GLUTEN_DIR="$CURRENT_DIR/.."
THIRDPARTY_LIB="$GLUTEN_DIR/package/target/thirdparty-lib"
LINUX_OS=$(. /etc/os-release && echo ${ID})
Expand Down
26 changes: 22 additions & 4 deletions dev/vcpkg/env.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
#! /bin/bash
#!/bin/sh

if [ -z "${BASH_SOURCE[0]}" ] || [ "$0" == "${BASH_SOURCE[0]}" ]; then
echo "env.sh should only be sourced in bash" >&2
if [ -n "$BASH_VERSION" ]; then
# Replace `$0` with `BASH_SOURCE[0]` in Bash because it returns the shell when using `source`.
SCRIPT_PATH=${BASH_SOURCE[0]}
else
SCRIPT_PATH="$0"
fi

OS=$(uname -s)
if [[ $OS == "Linux" ]]; then
CMD=$(cat /proc/$$/cmdline)
elif [[ $OS == "Darwin" ]]; then
CMD=$(ps -p $$ -o command=)
else
echo "Unsupport kernel: $OS"
exit 1
fi

# source command does not start a new process, so the command would not contains current script name.
if [[ ${CMD} == *"$SCRIPT_PATH"* ]]; then
echo "env.sh should only be sourced" >&2
exit 1
fi

SCRIPT_ROOT="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
SCRIPT_ROOT="$(realpath "$(dirname "$SCRIPT_PATH")")"
init_vcpkg_env=$("${SCRIPT_ROOT}/init.sh")
eval "$init_vcpkg_env"
2 changes: 1 addition & 1 deletion ep/build-velox/src/build_velox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function check_commit {
}

CURRENT_DIR=$(
cd "$(dirname "$BASH_SOURCE")"
cd "$(dirname $0)"
pwd
)

Expand Down
2 changes: 1 addition & 1 deletion ep/build-velox/src/get_velox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ echo "Preparing Velox source code..."
echo "ENABLE_HDFS=${ENABLE_HDFS}"

CURRENT_DIR=$(
cd "$(dirname "$BASH_SOURCE")"
cd "$(dirname $0)"
pwd
)

Expand Down
Loading