mas/script/install
2018-10-17 17:18:55 -06:00

37 lines
845 B
Bash
Executable file

#!/bin/bash -e
PREFIX=/usr/local
INSTALL_TEMPORARY_FOLDER=/tmp/mas-cli.dst
FRAMEWORK_NAME=MasKit.framework
BINARY_NAME=mas
# Override default prefix path with optional 1st arg
if test -n "$1"; then
PREFIX="$1"
fi
echo "==> 📲 Installing mas to $PREFIX"
xcodebuild install
ditto -v \
"$INSTALL_TEMPORARY_FOLDER/Frameworks" \
"$PREFIX/Frameworks"
ditto -v \
"$INSTALL_TEMPORARY_FOLDER/bin" \
"$PREFIX/bin"
echo "==> 🔗 Update dylib load paths"
install_name_tool \
-rpath \
"/usr/local/Frameworks" \
"@executable_path/../Frameworks" \
"$PREFIX/bin/$BINARY_NAME"
install_name_tool \
-rpath \
"/usr/local/Frameworks/$FRAMEWORK_NAME/Versions/Current/Frameworks" \
"@executable_path/../Frameworks/$FRAMEWORK_NAME/Versions/Current/Frameworks" \
"$PREFIX/bin/$BINARY_NAME"