├── .gitignore ├── HaskelliOS.xcconfig ├── README.md ├── aarch64-apple-darwin14-ar ├── aarch64-apple-darwin14-cabal ├── aarch64-apple-darwin14-cabal-custom ├── aarch64-apple-darwin14-clang ├── aarch64-apple-darwin14-ld ├── aarch64-apple-darwin14-nm ├── aarch64-apple-darwin14-ranlib ├── arm-apple-darwin10-ar ├── arm-apple-darwin10-cabal ├── arm-apple-darwin10-cabal-custom ├── arm-apple-darwin10-clang ├── arm-apple-darwin10-ld ├── arm-apple-darwin10-nm ├── arm-apple-darwin10-ranlib ├── cabal-all ├── cabal-ios ├── common-cross-cabal ├── ghc-ios ├── hello.c ├── i386-apple-darwin11-ar ├── i386-apple-darwin11-cabal ├── i386-apple-darwin11-cabal-custom ├── i386-apple-darwin11-clang ├── i386-apple-darwin11-ld ├── i386-apple-darwin11-nm ├── i386-apple-darwin11-ranlib ├── installGHCiOS.sh ├── libtool-quiet ├── x86_64-apple-darwin14-ar ├── x86_64-apple-darwin14-cabal ├── x86_64-apple-darwin14-cabal-custom ├── x86_64-apple-darwin14-clang ├── x86_64-apple-darwin14-ld ├── x86_64-apple-darwin14-nm └── x86_64-apple-darwin14-ranlib /.gitignore: -------------------------------------------------------------------------------- 1 | clang-xcode5-wrapper 2 | *.o 3 | *.hi -------------------------------------------------------------------------------- /HaskelliOS.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // HaskelliOS.xcconfig 3 | // Haskell iOS 4 | // 5 | // Created by Luke Iannini on 5/14/14. 6 | // 7 | 8 | // We don't support 64bit architectures yet. 9 | VALID_ARCHS = armv7 armv7s 10 | 11 | //This may be necessary if XCode complains 12 | //ARCHS = "$(ARCHS_STANDARD_32_BIT)" 13 | 14 | // Avoids stripping out critical GHC runtime code (Simon Marlow has mentioned there may be around needing this) 15 | DEAD_CODE_STRIPPING = NO 16 | 17 | 18 | 19 | // Be sure to include $(inherited) if you override any of the following: 20 | 21 | // Required by the Haskell runtime 22 | OTHER_LDFLAGS = -liconv 23 | 24 | // You can use this instead to ignore the annoying 25 | // "could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog" 26 | // error, which is harmless. But it masks all warnings, so be careful. 27 | // OTHER_LDFLAGS = -liconv -w 28 | 29 | // Configure this to match your installed GHC 30 | HEADER_SEARCH_PATHS = /usr/local/lib/ghc-7.8.3/include 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Installing GHC iOS 2 | 3 | * Prerequisites: 4 | * Install Xcode http://itunes.apple.com/us/app/xcode/id497799835 5 | * Update Cabal with ```cabal update && cabal install cabal-install``` 6 | * Remove **jobs: $ncpus** from *~/.cabal/config* if it's there 7 | * Download these scripts and place them in your PATH. For example: 8 | ``` 9 | git clone git@github.com:ghc-ios/ghc-ios-scripts.git ~/bin/ghc-ios-scripts 10 | echo -e "\nPATH=~/bin/ghc-ios-scripts:"'$PATH' >> ~/.profile 11 | PATH=~/bin/ghc-ios-scripts:$PATH 12 | ``` 13 | 14 | * Run the installer script. GHC iOS will politely live alongside your existing native GHC installation. 15 | ``` 16 | installGHCiOS.sh 17 | ``` 18 | 19 | # Using GHC iOS 20 | 21 | * Create or open an Xcode project (the Single View Application template is simple for testing) 22 | * Use this repository's HaskelliOS.xcconfig 23 | * From the File menu, click "Add Files to..." Select HaskelliOS.xcconfig. It doesn't need to be added to any targets. 24 | * Click on your project at the top of the Xcode navigator sidebar. 25 | * Within the editing window, make sure your project is selected, not the target. (The selector is located to the left of the tabs.) 26 | * In the "Info" tab, under "Configuration", expand each configuration and choose HaskelliOS. 27 | * You may need to edit HaskelliOS.xcconfig and adjust HEADER_SEARCH_PATHS to match your installed GHC. 28 | * Compile your Haskell code with ghc-ios. For example, if you had a file named Counter.hs: 29 | ```haskell 30 | {-# LANGUAGE ForeignFunctionInterface #-} 31 | module Counter where 32 | import Control.Concurrent 33 | import Control.Monad 34 | foreign export ccall startCounter :: Int -> IO () 35 | startCounter :: Int -> IO () 36 | startCounter = void . forkIO . void . loop 37 | where loop i = do 38 | putStrLn (replicate i 'o') 39 | threadDelay (10^6) 40 | loop (i + 1) 41 | ``` 42 | * Compile this like so to get Counter.a and Counter_stub.h: 43 | ``` 44 | ghc-ios Counter.hs 45 | ``` 46 | (Counter.a will be a fat binary that works with both devices and the simulator.) 47 | 48 | 49 | * Drag Counter.a and Counter_stub.h to the project's sidebar. Make sure "Add to Targets:" has a check next to your app. 50 | 51 | * In main.m ```#import "HsFFI.h"``` and add ```hs_init(NULL, NULL);``` to the top of ```main()``` 52 | 53 | * In your app's AppDelegate.m: 54 | ``` 55 | #import "Counter_stub.h" 56 | ``` 57 | * and at the top of *application:didFinishLaunchingWithOptions:*, add: 58 | ``` 59 | startCounter(3); 60 | ``` 61 | 62 | * Run your app! You should see a growing triangle of 'o's. 63 | 64 | * To automatically rebuild your Haskell file each time you rebuild your project: 65 | * Click your project at the top of the Xcode sidebar, then click on your app under Targets on the left. 66 | * Click the "Build Phases" tab, then click the + at the top left and choose "New Run Script Build phase" 67 | * Drag the new Run Script build phase to the top of the list. 68 | * Enter: 69 | ``` 70 | source ~/.profile # or ~/.bash_profile, whichever you use 71 | ghc-ios Counter 72 | ``` 73 | Xcode will now run these commands each time it builds your project. 74 | 75 | # Using GHC iOS with Cabal 76 | 77 | * You'll need a very recent version of Cabal: ```cabal install cabal-install``` 78 | * You'll also need to check that the option **jobs: $ncpus** does not appear in your *~/.cabal/config* file, as it triggers a mode that does not support cross-compilation. 79 | * To install a package for the device and simulator, use cabal-ios (included in ghc-ios-scripts) like: 80 | ``` 81 | cabal-ios install random 82 | ``` 83 | * You should now be able to use the package in a file compiled with ghc-ios. The package will be statically linked into the .a library. 84 | 85 | # Troubleshooting 86 | 87 | * If you run into ```Illegal instruction: 4``` while running ```make install```, please see this discussion https://github.com/ghc-ios/ghc-ios-scripts/issues/4 — we're not sure what causes it yet but the thread contains a working solution. 88 | 89 | * Some packages need a flag to make them use integer-simple rather than trying to use integer-gmp, for example 90 | ``` 91 | cabal-ios install -finteger-simple text 92 | ``` 93 | and 94 | ``` 95 | cabal-ios install -f-integer-gmp hashable 96 | ``` 97 | * Similarly, some packages need to have Template Haskell disabled, such as 98 | ``` 99 | cabal-ios install -f-templateHaskell QuickCheck 100 | ``` 101 | and 102 | ``` 103 | cabal-ios install distributed-process --flags=-th 104 | ``` 105 | 106 | You can check the .cabal file to find the appropriate option. 107 | 108 | * For packages that use executables, there's not yet a flag to give to Cabal to keep it from trying and failing to build them (for example, Crypto and pretty-show). Until that flag is implemented, you'll have to use ```cabal get``` and manually comment out the executables section in the .cabal file, then ```cabal install```'ing the edited copy. You can use this strategy to get rid of Template Haskell in packages that don't provide a flag to do so, such as aeson. But consider submitting a patch to the developers : ) 109 | -------------------------------------------------------------------------------- /aarch64-apple-darwin14-ar: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphoneos 4 | ARCH=aarch64 5 | 6 | exec xcrun --sdk ${SDK} ar "$@" 7 | -------------------------------------------------------------------------------- /aarch64-apple-darwin14-cabal: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export COMMON=--builddir=dist/aarch64 3 | export COMPILE="--with-ghc=aarch64-apple-darwin14-ghc 4 | --with-ghc-pkg=aarch64-apple-darwin14-ghc-pkg 5 | --with-gcc=aarch64-apple-darwin14-clang 6 | --with-ld=aarch64-apple-darwin14-ld 7 | --hsc2hs-options=--cross-compile" 8 | export CONFIG="--configure-option=--host=aarch64-apple-darwin14 --disable-shared" 9 | exec "`dirname $0`/common-cross-cabal" "$@" 10 | -------------------------------------------------------------------------------- /aarch64-apple-darwin14-cabal-custom: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ ! -f Setup ]; then 3 | if [ -f Setup.hs -o -f Setup.lhs ]; then 4 | ghc --make Setup.?hs 5 | fi 6 | if [ ! -f Setup ]; then 7 | echo Could not find 'Setup or Setup.(l)hs' 8 | exit 1 9 | fi 10 | fi 11 | cp Setup dist/aarch64/setup/setup 12 | if [ $# -lt 1 ]; then 13 | echo "Usage: $(basename $0) clean|configure|build|install" 14 | exit 1 15 | fi 16 | 17 | 18 | export COMMON=--builddir=dist/aarch64 19 | export COMPILE="--with-ghc=aarch64-apple-darwin14-ghc 20 | --with-ghc-pkg=aarch64-apple-darwin14-ghc-pkg 21 | --with-gcc=aarch64-apple-darwin14-clang 22 | --with-ld=aarch64-apple-darwin14-ld 23 | --hsc2hs-options=--cross-compile" 24 | export CONFIG="--configure-option=--host=aarch64-apple-darwin14 --disable-shared" 25 | exec "`dirname $0`/common-cross-cabal" "$@" 26 | -------------------------------------------------------------------------------- /aarch64-apple-darwin14-clang: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphoneos 4 | ARCH=arm64 5 | 6 | exec xcrun --sdk ${SDK} clang -arch ${ARCH} -miphoneos-version-min=7.0 "$@" 7 | -------------------------------------------------------------------------------- /aarch64-apple-darwin14-ld: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphoneos 4 | ARCH=arm64 5 | 6 | exec xcrun --sdk ${SDK} ld -arch ${ARCH} "$@" 7 | -------------------------------------------------------------------------------- /aarch64-apple-darwin14-nm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphoneos 4 | ARCH=aarch64 5 | 6 | exec xcrun --sdk ${SDK} nm-classic "$@" 7 | -------------------------------------------------------------------------------- /aarch64-apple-darwin14-ranlib: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphoneos 4 | ARCH=aarch64 5 | 6 | exec xcrun --sdk ${SDK} ranlib $@ 7 | -------------------------------------------------------------------------------- /arm-apple-darwin10-ar: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphoneos 4 | ARCH=armv7 5 | 6 | exec xcrun --sdk ${SDK} ar "$@" 7 | -------------------------------------------------------------------------------- /arm-apple-darwin10-cabal: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export COMMON=--builddir=dist/arm 3 | export COMPILE="--with-ghc=arm-apple-darwin10-ghc 4 | --with-ghc-pkg=arm-apple-darwin10-ghc-pkg 5 | --with-gcc=arm-apple-darwin10-clang 6 | --with-ld=arm-apple-darwin10-ld 7 | --hsc2hs-options=--cross-compile" 8 | export CONFIG="--configure-option=--host=arm-apple-darwin10 --disable-shared" 9 | exec "`dirname $0`/common-cross-cabal" "$@" 10 | -------------------------------------------------------------------------------- /arm-apple-darwin10-cabal-custom: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ ! -f Setup ]; then 3 | if [ -f Setup.hs -o -f Setup.lhs ]; then 4 | ghc --make Setup.?hs 5 | fi 6 | if [ ! -f Setup ]; then 7 | echo Could not find 'Setup or Setup.(l)hs' 8 | exit 1 9 | fi 10 | fi 11 | cp Setup dist/arm/setup/setup 12 | if [ $# -lt 1 ]; then 13 | echo "Usage: $(basename $0) clean|configure|build|install" 14 | exit 1 15 | fi 16 | export COMMON=--builddir=dist/arm 17 | export COMPILE="--with-ghc=arm-apple-darwin10-ghc 18 | --with-ghc-pkg=arm-apple-darwin10-ghc-pkg 19 | --with-gcc=arm-apple-darwin10-clang 20 | --with-ld=arm-apple-darwin10-ld 21 | --hsc2hs-options=--cross-compile" 22 | export CONFIG="--configure-option=--host=arm-apple-darwin10 --disable-shared" 23 | exec "`dirname $0`/common-cross-cabal" "$@" 24 | -------------------------------------------------------------------------------- /arm-apple-darwin10-clang: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphoneos 4 | ARCH=armv7 5 | 6 | exec xcrun --sdk ${SDK} clang -arch ${ARCH} -miphoneos-version-min=7.0 "$@" 7 | -------------------------------------------------------------------------------- /arm-apple-darwin10-ld: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphoneos 4 | ARCH=armv7 5 | 6 | exec xcrun --sdk ${SDK} ld -arch ${ARCH} "$@" 7 | -------------------------------------------------------------------------------- /arm-apple-darwin10-nm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphoneos 4 | ARCH=armv7 5 | 6 | exec xcrun --sdk ${SDK} nm-classic "$@" 7 | -------------------------------------------------------------------------------- /arm-apple-darwin10-ranlib: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphoneos 4 | ARCH=armv7 5 | 6 | exec xcrun --sdk ${SDK} ranlib $@ 7 | -------------------------------------------------------------------------------- /cabal-all: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Simply multiplexes arguments over both local platform and ios cabals 4 | 5 | cabal $@ 6 | cabal-ios $@ 7 | -------------------------------------------------------------------------------- /cabal-ios: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # Simply multiplexes arguments over both simulator and device cabals 6 | 7 | i386-apple-darwin11-cabal $@ 8 | arm-apple-darwin10-cabal $@ 9 | x86_64-apple-darwin14-cabal $@ 10 | aarch64-apple-darwin14-cabal $@ 11 | -------------------------------------------------------------------------------- /common-cross-cabal: -------------------------------------------------------------------------------- 1 | # Some extra options, depending on what command was invoked. 2 | case $1 in 3 | configure|install) OPTIONS="$COMMON $COMPILE $CONFIG" ;; 4 | build) OPTIONS="$COMMON $COMPILE" ;; 5 | list|info|update) OPTIONS="" ;; 6 | "") OPTIONS="" ;; 7 | *) OPTIONS="$COMMON" ;; 8 | esac 9 | exec cabal $OPTIONS "$@" 10 | -------------------------------------------------------------------------------- /ghc-ios: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Works roughly like regular ghc command. Can add ghc arguments before final filename. 4 | # Example: 5 | # $ ghc-ios -v3 -Wall myHaskellFile.hs 6 | 7 | set -e 8 | 9 | # The number of args 10 | arglen=$# 11 | 12 | # The last arg, which is the file name 13 | targetFile=${@:arglen:arglen} 14 | 15 | # Get all the args up to but not including the file name 16 | if test $arglen -gt 1 17 | then 18 | ghcargs=${@:0:arglen} 19 | else 20 | ghcargs="" 21 | fi 22 | 23 | # Remove the .hs extension 24 | baseFileName=$(basename "$targetFile" .hs) 25 | 26 | # GHC complains about the -o path if this isn't here 27 | mkdir -p build/arm 28 | mkdir -p build/i386 29 | mkdir -p build/aarch64 30 | mkdir -p build/x86_64 31 | 32 | # Compile to architecture-specific libraries 33 | arm-apple-darwin10-ghc $ghcargs -threaded -staticlib -outputdir build/arm -o build/arm/$baseFileName -pgmlibtool libtool-quiet $targetFile -stubdir . 34 | i386-apple-darwin11-ghc $ghcargs -threaded -staticlib -outputdir build/i386 -o build/i386/$baseFileName -pgmlibtool libtool-quiet $targetFile -stubdir . 35 | aarch64-apple-darwin14-ghc $ghcargs -threaded -staticlib -outputdir build/aarch64 -o build/aarch64/$baseFileName -pgmlibtool libtool-quiet $targetFile -stubdir . 36 | x86_64-apple-darwin14-ghc $ghcargs -threaded -staticlib -outputdir build/x86_64 -o build/x86_64/$baseFileName -pgmlibtool libtool-quiet $targetFile -stubdir . 37 | 38 | # Combine the two architectures 39 | lipo build/arm/$baseFileName.a \ 40 | build/i386/$baseFileName.a \ 41 | build/aarch64/$baseFileName.a \ 42 | build/x86_64/$baseFileName.a \ 43 | -create -output $baseFileName.a 44 | -------------------------------------------------------------------------------- /hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int 4 | main(int argc, char ** argv) 5 | { 6 | printf("hello world\n"); 7 | } 8 | -------------------------------------------------------------------------------- /i386-apple-darwin11-ar: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphonesimulator 4 | ARCH=i386 5 | 6 | exec xcrun --sdk ${SDK} ar "$@" 7 | -------------------------------------------------------------------------------- /i386-apple-darwin11-cabal: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export COMMON="--builddir=dist/i386" 3 | export COMPILE="--with-ghc=i386-apple-darwin11-ghc 4 | --with-ghc-pkg=i386-apple-darwin11-ghc-pkg 5 | --with-gcc=i386-apple-darwin11-clang 6 | --with-ld=i386-apple-darwin11-ld 7 | --hsc2hs-options=--cross-compile" 8 | export CONFIG="--configure-option=--host=i386-apple-darwin11 --disable-shared" 9 | exec "`dirname $0`/common-cross-cabal" "$@" 10 | -------------------------------------------------------------------------------- /i386-apple-darwin11-cabal-custom: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ ! -f Setup ]; then 3 | if [ -f Setup.hs -o -f Setup.lhs ]; then 4 | ghc --make Setup.?hs 5 | fi 6 | if [ ! -f Setup ]; then 7 | echo Could not find 'Setup or Setup.(l)hs' 8 | exit 1 9 | fi 10 | fi 11 | cp Setup dist/i386/setup/setup 12 | export COMMON="--builddir=dist/i386" 13 | export COMPILE="--with-ghc=i386-apple-darwin11-ghc 14 | --with-ghc-pkg=i386-apple-darwin11-ghc-pkg 15 | --with-gcc=i386-apple-darwin11-clang 16 | --with-ld=i386-apple-darwin11-ld 17 | --hsc2hs-options=--cross-compile" 18 | export CONFIG="--configure-option=--host=i386-apple-darwin11 --disable-shared" 19 | exec "`dirname $0`/common-cross-cabal" "$@" 20 | -------------------------------------------------------------------------------- /i386-apple-darwin11-clang: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphonesimulator 4 | ARCH=i386 5 | 6 | # TARGET_PLATFORM=`xcrun --sdk ${SDK} --show-sdk-path` 7 | # TARGET_GCC=`xcrun --sdk ${SDK} --find clang` 8 | # TARGET_CFLAGS="-isysroot $TARGET_PLATFORM -arch $ARCH" 9 | 10 | exec xcrun --sdk ${SDK} clang -arch ${ARCH} -mios-simulator-version-min=7.0 "$@" 11 | -------------------------------------------------------------------------------- /i386-apple-darwin11-ld: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphonesimulator 4 | ARCH=i386 5 | 6 | exec xcrun --sdk ${SDK} ld -arch ${ARCH} "$@" 7 | -------------------------------------------------------------------------------- /i386-apple-darwin11-nm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphonesimulator 4 | ARCH=i386 5 | 6 | exec xcrun --sdk ${SDK} nm-classic "$@" 7 | -------------------------------------------------------------------------------- /i386-apple-darwin11-ranlib: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphonesimulator 4 | ARCH=i386 5 | 6 | exec xcrun --sdk ${SDK} ranlib $@ 7 | -------------------------------------------------------------------------------- /installGHCiOS.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd /tmp 4 | 5 | if [[ ! -f /usr/local/clang-3.0/bin/llc ]]; then 6 | echo "Downloading LLVM 3.0..." 7 | curl -O http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz 8 | tar xvf clang+llvm-3.0-x86_64-apple-darwin11.tar.gz 9 | mv clang+llvm-3.0-x86_64-apple-darwin11 /usr/local/clang-3.0 10 | rm clang+llvm-3.0-x86_64-apple-darwin11.tar.gz 11 | fi 12 | 13 | 14 | echo "Downloading GHC for iOS devices..." 15 | 16 | curl -L -O https://www.haskell.org/ghc/dist/7.8.3/ghc-7.8.3-arm-apple-ios.tar.xz 17 | tar xvf ghc-7.8.3-arm-apple-ios.tar.xz && mv ghc-7.8.3 ghc-7.8.3-arm 18 | rm ghc-7.8.3-arm-apple-ios.tar.xz 19 | cd ghc-7.8.3-arm 20 | 21 | # Remove befuddling inclusion of my local paths 22 | LC_CTYPE=C 23 | LANG=C 24 | LC_ALL=C 25 | find . -type f -not -name .DS_Store -not -name "*.a" -print0 | xargs -0 sed -i '' 's|/Users/lukexi/Code/ghc-ios-scripts/||g' 26 | 27 | ./configure 28 | # Fix the settings file to point to the right scripts and clang versions 29 | sed -i '' 's|/usr/bin/gcc|arm-apple-darwin10-clang|g' settings 30 | sed -i '' 's|/usr/bin/ld|arm-apple-darwin10-ld|g' settings 31 | sed -i '' 's|"opt"|"/usr/local/clang-3.0/bin/opt"|g' settings 32 | sed -i '' 's|"llc"|"/usr/local/clang-3.0/bin/llc"|g' settings 33 | make install 34 | cd .. 35 | rm -r ghc-7.8.3-arm 36 | 37 | echo "Downloading GHC for the iOS simulator..." 38 | cd /tmp 39 | curl -L -O https://www.haskell.org/ghc/dist/7.8.3/ghc-7.8.3-i386-apple-ios.tar.xz 40 | tar xvf ghc-7.8.3-i386-apple-ios.tar.xz && mv ghc-7.8.3 ghc-7.8.3-i386 41 | rm ghc-7.8.3-i386-apple-ios.tar.xz 42 | cd ghc-7.8.3-i386 43 | 44 | # ditto above 45 | LC_CTYPE=C 46 | LANG=C 47 | LC_ALL=C 48 | find . -type f -not -name .DS_Store -not -name "*.a" -print0 | xargs -0 sed -i '' 's|/Users/lukexi/Code/ghc-ios-scripts/||g' 49 | 50 | ./configure 51 | # Fix the settings file to point to the right scripts and clang versions 52 | sed -i '' 's|/usr/bin/gcc|i386-apple-darwin11-clang|g' settings 53 | sed -i '' 's|/usr/bin/ld|i386-apple-darwin11-ld|g' settings 54 | sed -i '' 's|"opt"|"/usr/local/clang-3.0/bin/opt"|g' settings 55 | sed -i '' 's|"llc"|"/usr/local/clang-3.0/bin/llc"|g' settings 56 | make install 57 | cd .. 58 | rm -r ghc-7.8.3-i386 59 | -------------------------------------------------------------------------------- /libtool-quiet: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Script to suppress annoying warnings from libtool (without suppressing any other interesting output) 4 | libtool $@ 2>&1 | sed -e "/has no symbols/D" | sed -e "/due to use of basename, truncation and blank padding/D" -------------------------------------------------------------------------------- /x86_64-apple-darwin14-ar: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphonesimulator 4 | ARCH=x86_64 5 | 6 | exec xcrun --sdk ${SDK} ar "$@" 7 | -------------------------------------------------------------------------------- /x86_64-apple-darwin14-cabal: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export COMMON=--builddir=dist/x86_64 3 | export COMPILE="--with-ghc=x86_64-apple-darwin14-ghc 4 | --with-ghc-pkg=x86_64-apple-darwin14-ghc-pkg 5 | --with-gcc=x86_64-apple-darwin14-clang 6 | --with-ld=x86_64-apple-darwin14-ld 7 | --hsc2hs-options=--cross-compile" 8 | export CONFIG="--configure-option=--host=x86_64-apple-darwin14 --disable-shared" 9 | exec "`dirname $0`/common-cross-cabal" "$@" 10 | -------------------------------------------------------------------------------- /x86_64-apple-darwin14-cabal-custom: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ ! -f Setup ]; then 3 | if [ -f Setup.hs -o -f Setup.lhs ]; then 4 | ghc --make Setup.?hs 5 | fi 6 | if [ ! -f Setup ]; then 7 | echo Could not find 'Setup or Setup.(l)hs' 8 | exit 1 9 | fi 10 | fi 11 | cp Setup dist/x86_64/setup/setup 12 | if [ $# -lt 1 ]; then 13 | echo "Usage: $(basename $0) clean|configure|build|install" 14 | exit 1 15 | fi 16 | 17 | 18 | export COMMON=--builddir=dist/x86_64 19 | export COMPILE="--with-ghc=x86_64-apple-darwin14-ghc 20 | --with-ghc-pkg=x86_64-apple-darwin14-ghc-pkg 21 | --with-gcc=x86_64-apple-darwin14-clang 22 | --with-ld=x86_64-apple-darwin14-ld 23 | --hsc2hs-options=--cross-compile" 24 | export CONFIG="--configure-option=--host=x86_64-apple-darwin14 --disable-shared" 25 | exec "`dirname $0`/common-cross-cabal" "$@" 26 | -------------------------------------------------------------------------------- /x86_64-apple-darwin14-clang: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphonesimulator 4 | ARCH=x86_64 5 | 6 | exec xcrun --sdk ${SDK} clang -arch ${ARCH} -miphoneos-version-min=7.0 "$@" 7 | -------------------------------------------------------------------------------- /x86_64-apple-darwin14-ld: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphonesimulator 4 | ARCH=x86_64 5 | 6 | exec xcrun --sdk ${SDK} ld -arch ${ARCH} "$@" 7 | -------------------------------------------------------------------------------- /x86_64-apple-darwin14-nm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphonesimulator 4 | ARCH=x86_64 5 | 6 | exec xcrun --sdk ${SDK} nm-classic "$@" 7 | -------------------------------------------------------------------------------- /x86_64-apple-darwin14-ranlib: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SDK=iphonesimulator 4 | ARCH=x86_64 5 | 6 | exec xcrun --sdk ${SDK} ranlib $@ 7 | --------------------------------------------------------------------------------