1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-05-02 19:30:14 +00:00
QB64-PE/setup_osx.command
Matthew Kilgore 37f2ecd4ce Fix setup_osx.command script when run from a different directory
I broke this by accident in 5031de2, likely by misreading the $0.  What
the line was intended to do was change to the directory the script is
located in when the script starts, this allows the script to be started
from any location.

Typically this isn't necessary functionality, but for Mac OS it's
important because if you double-click the script (the typical way to run
it) it is started from the user's home directory. Due to this I also
updated the Mac OS distribution test to run the script in this way so
that it's closer to how a user will run it.

Fixes: #218
2022-10-27 23:26:07 -04:00

47 lines
1,008 B
Bash
Executable file

# Argument 1: If not blank, qb64pe will not be started after compiltaion
cd "$(dirname "$0")"
dont_run="$1"
Pause()
{
OLDCONFIG=`stty -g`
stty -icanon -echo min 1 time 0
dd count=1 2>/dev/null
stty $OLDCONFIG
}
echo "QB64-PE Setup"
echo ""
find . -name "*.command" -exec chmod +x {} \;
if [ -z "$(which clang++)" ]; then
echo "Apple's C++ compiler not found."
echo "Attempting to install Apple's Command Line Tools for Xcode..."
echo "After installation is finished, run this setup script again."
xcode-select --install
[ -z "$dont_run" ] && Pause
exit 1
fi
echo "Building 'QB64-PE'"
make OS=osx clean
make OS=osx BUILD_QB64=y -j3
echo ""
if [ -f ./qb64pe ]; then
if [ -z "$dont_run" ]; then
echo "Launching 'QB64-PE'"
./qb64pe
fi
echo ""
echo "Note: 'qb64pe' is located in same folder as this setup program."
echo "Press any key to continue..."
[ -z "$dont_run" ] && Pause
exit 0
else
echo "Compilation of QB64-PE failed!"
[ -z "$dont_run" ] && Pause
exit 1
fi