Changes between Version 19 and Version 20 of Building/CrossCompiling/iOS


Ignore:
Timestamp:
Aug 29, 2013 1:20:24 AM (8 months ago)
Author:
StephenBlackheath
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Building/CrossCompiling/iOS

    v19 v20  
    6464=== 6. Make sure your Cabal and cabal-install are new enough === 
    6565 
    66 Some recent changes are needed for the cross-compiling stuff to work right. Type {{{cabal --version}}} to find out what you have. Cabal-1.17.0 is new enough. 
    67  
    68 The easiest way to install the right version is to do this inside your ghc build directory: 
    69  
    70 {{{ 
    71 cd libraries/Cabal/Cabal/ 
    72 cabal install 
    73 cd - 
    74 cd libraries/Cabal/cabal-install/ 
    75 cabal install 
    76 }}} 
     66We had to patch Cabal again. Use this version for now: [https://github.com/the-real-blackh/cabal] 
    7767 
    7868The ghc-ios-scripts directory you checked out earlier contains two wrappers called {{{arm-apple-darwin10-cabal}}} and {{{i386-apple-darwin11-cabal}}}. These will pass the right arguments to cabal, so you can do, for example: 
     
    8272}}} 
    8373 
    84 === 7. Create an Xcode project === 
     74=== 7. Make sure hsc2hs is new enough === 
     75 
     76The easiest way to do this is as follows, in the ghc build directory: 
     77 
     78{{{ 
     79cd utils/hsc2hs 
     80cabal install 
     81}}} 
     82 
     83=== 8. Create an Xcode project === 
    8584 
    8685Create a new skeleton Xcode project using the wizard, and make sure it runs on your device. 
    8786 
    88 === 8. Compile your Haskell code === 
     87=== 9. Compile your Haskell code === 
    8988 
    9089Open a terminal and add {{{/usr/local/ghc-ios/bin:/usr/local/ghc-ios-sim/bin}}} to your {{{PATH}}} environment variable. 
     
    131130This will create (in this example) '''haskell.a'''. 
    132131 
    133 === 9. Set up your Xcode project for Haskell === 
     132=== 10. Set up your Xcode project for Haskell === 
    134133 
    135134Now configure it as follows: 
     
    141140 * When you've compiled your Haskell code to a .a (e.g. '''haskell.a''') file, add it to the project anywhere in the hierarchy with '''Add files to (project)''' in the right-mouse button menu. 
    142141 
    143 === 10. Build and run === 
     142=== 11. Build and run === 
    144143 
    145144Run the project again as usual, and Xcode will pick up the haskell.a file and your Haskell code should now run on your iOS device. Anything printed with putStrLn will appear in the Xcode runtime console.