2018-07-01 12:14:55 +00:00
|
|
|
#!/bin/bash
|
2018-02-13 19:49:39 +00:00
|
|
|
|
2019-01-05 19:19:28 +00:00
|
|
|
# Checks if directory exists, otherwise asks to install package.
|
|
|
|
function check_dir_exists() {
|
|
|
|
local path=$1
|
|
|
|
local package=$2
|
|
|
|
|
|
|
|
if [ ! -d "$path" ]; then
|
|
|
|
echo "Please install $package"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-08-20 17:08:03 +00:00
|
|
|
if [ ! "$BARRIER_BUILD_ENV" ]; then
|
2019-01-05 19:19:28 +00:00
|
|
|
check_dir_exists '/Applications/Xcode.app' 'Xcode'
|
2018-02-13 19:49:39 +00:00
|
|
|
|
2018-10-19 17:17:04 +00:00
|
|
|
printf "Modifying environment for Barrier build...\n"
|
2018-02-13 19:49:39 +00:00
|
|
|
|
2018-07-02 17:50:28 +00:00
|
|
|
if command -v port; then
|
2018-10-19 17:17:04 +00:00
|
|
|
printf "Detected Macports\n"
|
2018-07-02 17:50:28 +00:00
|
|
|
|
2019-01-05 19:19:28 +00:00
|
|
|
check_dir_exists '/opt/local/lib/cmake/Qt5' 'qt5-qtbase port'
|
|
|
|
|
2018-07-02 17:50:28 +00:00
|
|
|
export BARRIER_BUILD_MACPORTS=1
|
|
|
|
export CMAKE_PREFIX_PATH="/opt/local/lib/cmake/Qt5:$CMAKE_PREFIX_PATH"
|
|
|
|
export LD_LIBRARY_PATH="/opt/local/lib:$LD_LIBRARY_PATH"
|
|
|
|
export CPATH="/opt/local/include:$CPATH"
|
|
|
|
export PKG_CONFIG_PATH="/opt/local/libexec/qt5/lib/pkgconfig:$PKG_CONFIG_PATH"
|
|
|
|
|
|
|
|
elif command -v brew; then
|
2018-10-19 17:17:04 +00:00
|
|
|
printf "Detected Homebrew\n"
|
2018-07-01 12:14:55 +00:00
|
|
|
QT_PATH=$(brew --prefix qt)
|
|
|
|
OPENSSL_PATH=$(brew --prefix openssl)
|
|
|
|
|
2019-01-05 19:19:28 +00:00
|
|
|
check_dir_exists "$QT_PATH" 'qt'
|
|
|
|
check_dir_exists "$OPENSSL_PATH" 'openssl'
|
|
|
|
|
2018-07-02 17:50:28 +00:00
|
|
|
export BARRIER_BUILD_BREW=1
|
2018-07-01 12:14:55 +00:00
|
|
|
export CMAKE_PREFIX_PATH="$QT_PATH:$CMAKE_PREFIX_PATH"
|
|
|
|
export LD_LIBRARY_PATH="$OPENSSL_PATH/lib:$LD_LIBRARY_PATH"
|
|
|
|
export CPATH="$OPENSSL_PATH/include:$CPATH"
|
|
|
|
export PKG_CONFIG_PATH="$OPENSSL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH"
|
|
|
|
|
|
|
|
else
|
2018-10-19 17:17:04 +00:00
|
|
|
printf "Neither Homebrew nor Macports is installed. Can't get dependency paths\n"
|
2018-07-01 12:14:55 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2018-02-13 19:49:39 +00:00
|
|
|
|
|
|
|
export BARRIER_BUILD_ENV=1
|
|
|
|
|
|
|
|
printf "done\n"
|
|
|
|
fi
|