git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge remote-tracking branch 'pure11/pure11' into native
commit5743043e669f3bc57eda878d1d3a446c0383057c authorAndy Arvanitis <andyarvanitis@gmail.com> dateTue 13 Dec 2016, 17:16 (10 years ago) parent22b0277149c8ce
2 files changed+64−50
pcc/Main.hs+19−16 pcc/support/psc-xcode.sh+45−34
pcc/Main.hs+19−16
@@ -31,6 +31,7 @@ import qualified Data.ByteString.Lazy as B
3131import qualified Data.ByteString.UTF8 as BU8
3232import Data.Char (isSpace)
3333import qualified Data.Map as M
34+import Data.Maybe (maybe)
3435import Data.Text (Text)
3536import Data.Version (showVersion)
3637
@@ -97,28 +98,30 @@ printWarningsAndErrors verbose BriefErrors warnings errors = do
9798 either (const exitFailure) (const (return ())) errors
9899
99100briefFormat :: JSONResult -> [String]
100−briefFormat (JSONResult warnings errors) = concat $
101+briefFormat (JSONResult warnings errors) =
101102 (renderError Error <$> errors) <> (renderError Warning <$> warnings)
102103 where
103− renderError :: BriefType -> JSONError -> [String]
104− renderError t (JSONError pos msg _ lnk file _ suggest) =
104+ renderError :: BriefType -> JSONError -> String
105+ renderError t (JSONError (Just pos) msg _ lnk (Just file) _ _) =
105106 printf
106107 "%s:%d:%d: %s: %s"
107− (concat file)
108− (maybe 0 startLine pos)
109− (maybe 0 startColumn pos)
108+ file
109+ (startLine pos)
110+ (startColumn pos)
110111 (show t)
111− (dropWhile isSpace message) :
112− notes
112+ (combine msg lnk)
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
113123 where
114− message
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 = []
124+ msg' = dropWhile isSpace msg
122125
123126compile :: PCCMakeOptions -> IO ()
124127compile 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.
22#
33#!/bin/sh
44
5−echo "CONFIGURATION =" "$CONFIGURATION"
6−echo "ARCHITECTURES =" "$ARCHS"
5+if [[ "$ACTION" == "clean" ]] ; then
6+ echo "Cleaning all PureScript products..."
7+ make clean
78
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
189else
19− if [ ! -f "$IS_RELEASE" ] ; then
20− make clean
21− touch "$IS_RELEASE"
22− fi
23− rm "$IS_DEBUG" > /dev/null 2>&1 || true
24− OBJECT_TYPE=release
25−fi
10+ echo "CONFIGURATION =" "$CONFIGURATION"
11+ echo "ARCHITECTURES =" "$ARCHS"
2612
27−## Create compiler switches for architectures
28−#
29−for arch_ in $ARCHS ; do
30− ARCH_OPTS+="-arch $arch_ "
31− if ! file output/bin/purescript.o | grep -q $arch_; then
32− make clean
33− fi
34− # TODO: make this more future-proof
35− # Note: -flto optimization causes problems with the source-level
36− # debugger. Disable bitcode temporarily if necessary.
37− if [[ $ENABLE_BITCODE == YES && $arch == arm64 ]] ; then
38− FLTO="-flto"
13+ IS_DEBUG="$PROJECT_TEMP_DIR/is_debug"
14+ IS_RELEASE="$PROJECT_TEMP_DIR/is_release"
15+
16+ if [[ "$CONFIGURATION" == "Debug" ]] ; then
17+ if [ ! -f "$IS_DEBUG" ] ; then
18+ make clean
19+ touch "$IS_DEBUG"
20+ fi
21+ rm "$IS_RELEASE" > /dev/null 2>&1 || true
22+ OBJECT_TYPE=debug
23+ else
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
3930 fi
40−done
4131
42−make $OBJECT_TYPE CXXFLAGS="$ARCH_OPTS $FLTO -isysroot $SDKROOT" LDFLAGS="-r -nostdlib $ARCH_OPTS" BIN=purescript.o -j`sysctl -n hw.ncpu`
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 \
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