@@ -1,42 +1,53 @@
1−# Xcode support script. Intended to be added to and called from "Run Script" build phase.
1+# Xcode support script. Intended to be used with an "External Build System" target.
5−echo "CONFIGURATION =" "$CONFIGURATION"
5+if [[ "$ACTION" == "clean" ]] ; then
6−echo "ARCHITECTURES =" "$ARCHS"
6+ echo "Cleaning all PureScript products..."
8−IS_DEBUG="$PROJECT_TEMP_DIR/is_debug"
9−IS_RELEASE="$PROJECT_TEMP_DIR/is_release"
11−if [[ "$CONFIGURATION" == "Debug" ]] ; then
12− if [ ! -f "$IS_DEBUG" ] ; then
16− rm "$IS_RELEASE" > /dev/null 2>&1 || true
19− if [ ! -f "$IS_RELEASE" ] ; then
10+ echo "CONFIGURATION =" "$CONFIGURATION"
20− make clean
11+ echo "ARCHITECTURES =" "$ARCHS"
23− rm "$IS_DEBUG" > /dev/null 2>&1 || true
27−## Create compiler switches for architectures
13+ IS_DEBUG="$PROJECT_TEMP_DIR/is_debug"
28−#
14+ IS_RELEASE="$PROJECT_TEMP_DIR/is_release"
29−for arch_ in $ARCHS ; do
15+
30− ARCH_OPTS+="-arch $arch_ "
16+ if [[ "$CONFIGURATION" == "Debug" ]] ; then
31− if ! file output/bin/purescript.o | grep -q $arch_; then
17+ if [ ! -f "$IS_DEBUG" ] ; then
32− make clean
18+ make clean
33− fi
19+ touch "$IS_DEBUG"
34− # TODO: make this more future-proof
20+ fi
35− # Note: -flto optimization causes problems with the source-level
21+ rm "$IS_RELEASE" > /dev/null 2>&1 || true
36− # debugger. Disable bitcode temporarily if necessary.
22+ OBJECT_TYPE=debug
37− if [[ $ENABLE_BITCODE == YES && $arch == arm64 ]] ; then
23+ else
38− FLTO="-flto"
24+ if [ ! -f "$IS_RELEASE" ] ; then
28+ rm "$IS_DEBUG" > /dev/null 2>&1 || true
32+ ## Create compiler switches for architectures
34+ for arch_ in $ARCHS ; do
35+ ARCH_OPTS+="-arch $arch_ "
36+ if ! file output/bin/purescript.o | grep -q $arch_; then
39+ # TODO: make this more future-proof
40+ # Note: -flto optimization causes problems with the source-level
41+ # debugger. Disable bitcode temporarily if necessary.
42+ if [[ $ENABLE_BITCODE == YES && $arch == arm64 ]] ; then
48+ PCCFLAGS=--brief-errors \
42−make $OBJECT_TYPE CXXFLAGS="$ARCH_OPTS $FLTO -isysroot $SDKROOT" LDFLAGS="-r -nostdlib $ARCH_OPTS" BIN=purescript.o -j`sysctl -n hw.ncpu`
49+ CXXFLAGS="$ARCH_OPTS $FLTO -isysroot $SDKROOT" \
50+ LDFLAGS="-r -nostdlib $ARCH_OPTS" \
52+ -j`sysctl -n hw.ncpu`