Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 1.56 KB

Steps.org

File metadata and controls

24 lines (18 loc) · 1.56 KB

Steps to compile an iOS cabal project without Template Haskell support on an Intel Macbook.

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.