barrier/osx_environment.sh

50 lines
1.5 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
2018-02-13 22:49:39 +03:00
# Checks if directory exists, otherwise asks to install package.
2021-09-23 00:46:52 +03:00
check_dir_exists() {
local path=$1
local package=$2
if [ ! -d "$path" ]; then
echo "Please install $package"
exit 1
fi
}
2021-09-23 00:46:52 +03:00
if [ -z "$BARRIER_BUILD_ENV" ]; then
check_dir_exists '/Applications/Xcode.app' 'Xcode'
2018-02-13 22:49:39 +03:00
printf "Modifying environment for Barrier build...\n"
2018-02-13 22:49:39 +03:00
if command -v port; then
printf "Detected Macports\n"
check_dir_exists '/opt/local/lib/cmake/Qt5' 'qt5-qtbase port'
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
printf "Detected Homebrew\n"
2021-06-22 17:24:36 +03:00
QT_PATH=$(brew --prefix qt@5)
2021-05-13 18:41:29 +03:00
check_dir_exists "$QT_PATH" 'qt5'
export BARRIER_BUILD_BREW=1
2021-05-13 18:41:29 +03:00
export CMAKE_PREFIX_PATH="/opt/procursus:$QT_PATH:$CMAKE_PREFIX_PATH"
export LD_LIBRARY_PATH="/opt/procursus/lib:$LD_LIBRARY_PATH"
export CPATH="/opt/procursus/include:$CPATH"
export PKG_CONFIG_PATH="/opt/procursus/lib/pkgconfig:$PKG_CONFIG_PATH"
else
printf "Neither Homebrew nor Macports is installed. Can't get dependency paths\n"
exit 1
fi
2018-02-13 22:49:39 +03:00
export BARRIER_BUILD_ENV=1
printf "done\n"
fi