forked from rrcarlosr/Jetpack
47 lines
1.1 KiB
Bash
Executable File
47 lines
1.1 KiB
Bash
Executable File
#
|
|
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
|
|
#
|
|
|
|
# Function to check if variable is defined.
|
|
function check_vars {
|
|
variables=${@}
|
|
for variable in ${variables} ; do
|
|
if [ -z "${!variable}" ]; then
|
|
echo "Error: Env variable ${variable} is not set!!"
|
|
exit 1
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Function to check build environment
|
|
function check_env_common {
|
|
if [ "${IS_CROSS_COMPILATION}" -eq 1 ]; then
|
|
check_vars "CROSS_COMPILE_AARCH64_PATH"
|
|
CROSS_COMPILE_AARCH64="${CROSS_COMPILE_AARCH64_PATH}/bin/aarch64-linux-gnu-"
|
|
if [ ! -f "${CROSS_COMPILE_AARCH64}gcc" ]; then
|
|
echo "Error: Path ${CROSS_COMPILE_AARCH64}gcc does not exist."
|
|
exit 1
|
|
fi
|
|
fi
|
|
if [ "${MAKE_BIN}" != "make" ] && \
|
|
( [ ! -f "${MAKE_BIN}" ] || \
|
|
[ ! -f $(basename "${MAKE_BIN}") ] ); then
|
|
echo "Error: ${MAKE_BIN} does not exist !!"
|
|
echo "Set MAKE_BIN env variable to "make" binary"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
|
|
NPROC=$(nproc)
|
|
MAKE_BIN="${MAKE_BIN:-make}"
|
|
BUILD_DIR="${BUILD_DIR:-$(pwd)/build_nv_sources}"
|
|
|
|
MACHINE=$(uname -m)
|
|
|
|
IS_CROSS_COMPILATION=0
|
|
if [[ "${MACHINE}" =~ "x86" ]]; then
|
|
IS_CROSS_COMPILATION=1
|
|
fi
|
|
check_env_common
|