wiki:Building/MacOSX/Installer

Version 1 (modified by chak, 6 years ago) (diff)

--

Mac OS X Installer Packages

Building a package

In a GHC build tree, after having run ./configure (if the tree came straight out of darcs, also sh boot), issue

make framework-pkg

The result will be a file GHC-<version>-<arch>.pkg, where <version> is the full version string and <arch> is i386 or ppc. The build process uses xcodebuild and packagemaker and has only been tested with Xcode 3.0.

The command make framework-pkg runs ./configure again to ensure that GHC is compiled for installation under /Library/Frameworks. If you need to specify extra arguments to ./configure (e.g., to use a version of the readline library installed in a non-standard location), set the environment variable XCODE_EXTRA_CONFIGURE_ARGS.

To create a package that links against readline statically, you can use the following trick. Create a private library directory, say /Users/chak/lib, from which you symbolically link the static readline and ncurses libraries. For example, if the latter were installed (e.g., via MacPorts) under /opt/local/lib execute

cd /Users/chak
mkdir lib
cd lib
ln -s /opt/local/lib/readline.a .
ln -s /opt/local/lib/ncurses.a .

Now, build the package with

cd <LOCATION_OF_MY_GHC_TREE>
env CFLAGS=-Wl,-search_paths_first\
    XCODE_EXTRA_CONFIGURE_ARGS="--with-readline-includes=/opt/local/include --with-readline-libraries=/Users/chak/lib"\
    make framework-pkg

(Don't forget to replace /Users/chak/lib by your private library directory.) Note that simply removing (or renaming) the dynamic libraries of readline will not work, as this will lead the configure script of the readline package to assume that readline isn't installed at all. As a result, you will get a GHC without readline support.