git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge remote-tracking branch 'pure11/pure11' into native
5743043Andy Arvanitis
pcc/Main.hs+19−16
@@ -31,6 +31,7 @@ import qualified Data.ByteString.Lazy as B
31import qualified Data.ByteString.UTF8 as BU8
31import qualified Data.ByteString.UTF8 as BU8
32import Data.Char (isSpace)
32import Data.Char (isSpace)
33import qualified Data.Map as M
33import qualified Data.Map as M
34+import Data.Maybe (maybe)
34import Data.Text (Text)
35import Data.Text (Text)
35import Data.Version (showVersion)
36import Data.Version (showVersion)
36
37
@@ -97,28 +98,30 @@ printWarningsAndErrors verbose BriefErrors warnings errors = do
97 either (const exitFailure) (const (return ())) errors
98 either (const exitFailure) (const (return ())) errors
98
99
99briefFormat :: JSONResult -> [String]
100briefFormat :: JSONResult -> [String]
100−briefFormat (JSONResult warnings errors) = concat $
101+briefFormat (JSONResult warnings errors) =
101 (renderError Error <$> errors) <> (renderError Warning <$> warnings)
102 (renderError Error <$> errors) <> (renderError Warning <$> warnings)
102 where
103 where
103− renderError :: BriefType -> JSONError -> [String]
104+ renderError :: BriefType -> JSONError -> String
104− renderError t (JSONError pos msg _ lnk file _ suggest) =
105+ renderError t (JSONError (Just pos) msg _ lnk (Just file) _ _) =
105 printf
106 printf
106 "%s:%d:%d: %s: %s"
107 "%s:%d:%d: %s: %s"
107− (concat file)
108+ file
108− (maybe 0 startLine pos)
109+ (startLine pos)
109− (maybe 0 startColumn pos)
110+ (startColumn pos)
110 (show t)
111 (show t)
111− (dropWhile isSpace message) :
112+ (combine msg lnk)
112− notes
113+ renderError t (JSONError _ msg _ lnk _ module' _) =
114+ printf
115+ "%s: in module %s - %s"
116+ (show t)
117+ (maybe "?" (printf "\"%s\"") module')
118+ (combine msg lnk)
119+ combine :: String -> String -> String
120+ combine msg lnk
121+ | null lnk = msg'
122+ | otherwise = printf "%s\nSee %s for more information\n" msg' lnk
113 where
123 where
114− message
124+ msg' = dropWhile isSpace msg
115− | null lnk = msg
116− | otherwise = printf "%s\nSee %s for more information\n" msg lnk
117− notes
118− | Error <- t,
119− Just (ErrorSuggestion s@(_:_) r) <- suggest =
120− renderError Note (JSONError (r <|> pos) s [] [] file Nothing Nothing)
121− | otherwise = []
122
125
123compile :: PCCMakeOptions -> IO ()
126compile :: PCCMakeOptions -> IO ()
124compile PCCMakeOptions{..} = do
127compile PCCMakeOptions{..} = do
pcc/support/psc-xcode.sh+45−34
@@ -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.
2#
2#
3#!/bin/sh
3#!/bin/sh
4
4
5−echo "CONFIGURATION =" "$CONFIGURATION"
5+if [[ "$ACTION" == "clean" ]] ; then
6−echo "ARCHITECTURES =" "$ARCHS"
6+ echo "Cleaning all PureScript products..."
7+ make clean
7
8
8−IS_DEBUG="$PROJECT_TEMP_DIR/is_debug"
9−IS_RELEASE="$PROJECT_TEMP_DIR/is_release"
10−
11−if [[ "$CONFIGURATION" == "Debug" ]] ; then
12− if [ ! -f "$IS_DEBUG" ] ; then
13− make clean
14− touch "$IS_DEBUG"
15− fi
16− rm "$IS_RELEASE" > /dev/null 2>&1 || true
17− OBJECT_TYPE=debug
18else
9else
19− if [ ! -f "$IS_RELEASE" ] ; then
10+ echo "CONFIGURATION =" "$CONFIGURATION"
20− make clean
11+ echo "ARCHITECTURES =" "$ARCHS"
21− touch "$IS_RELEASE"
22− fi
23− rm "$IS_DEBUG" > /dev/null 2>&1 || true
24− OBJECT_TYPE=release
25−fi
26
12
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
25+ make clean
26+ touch "$IS_RELEASE"
27+ fi
28+ rm "$IS_DEBUG" > /dev/null 2>&1 || true
29+ OBJECT_TYPE=release
39 fi
30 fi
40−done
41
31
32+ ## Create compiler switches for architectures
33+ #
34+ for arch_ in $ARCHS ; do
35+ ARCH_OPTS+="-arch $arch_ "
36+ if ! file output/bin/purescript.o | grep -q $arch_; then
37+ make clean
38+ fi
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
43+ FLTO="-flto"
44+ fi
45+ done
46+
47+ make $OBJECT_TYPE \
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" \
51+ BIN=purescript.o \
52+ -j`sysctl -n hw.ncpu`
53+fi