The resources used to create these steps and templates are detailed in CrossCompilationBlogTutorial/RelevantLinks.org
- You will require cabal-install and also libgmp which can be downloaded via brew install gmp
Scripts to download the ghc cross compiler and dependencies are available in the CrossCompilationBlogTutorial directory:
cd ./CrossCompilationBlogTutorial
source ./darwin_x86_download_binaries.sh # Download dependencies, cross compilers, and wrappers
source ./darwin_x86_export_paths.sh # Setup paths for the shell session
A minimal cabal project is provided in the iOSProjectCabal/hs/ directory. The compile.sh script compiles for both x86 and arm and combines the libraries together into one as the iOS simulator requires it. The ‘lipo’ tool will be needed for this.
cd ./iOSProjectCabal/hs/ # Example cabal project.
source compile.sh # This will compile the cabal project and create a liba.a in the ../lib folder, which is ready to be used in the xcode iOS simulator.
- Open the iOSProjectCabal project with xcode and then start the iOS program.
- XCode knows about the libraries to link against as the project has been set up that way.
- To see how to set up the project from scratch, steps are available CrossCompilationBlogTutorial/iOSProject/xcode_setup_images/
- In the images, the library that is being linked against is libhs.a, in this example the library is called liba.a.
- To see how to set up the project from scratch, steps are available CrossCompilationBlogTutorial/iOSProject/xcode_setup_images/
- XCode knows about the libraries to link against as the project has been set up that way.