Version 2 (modified by chak, 9 years ago) (diff)


Mac OS X Installer Packages

Roll your own

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

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.

What's inside?

GHC is packaged as a framework bundle, which uses GHC's integer version number, consisting of the major and minor version component only, to assign framework versions - ie, package of the 6.8 branch install framework version 608. This is in line with Apple's recommendation to use version numbers that signify API changes for frameworks.

Currently, GHC only supports building systemwide frameworks installed at /Library/Frameworks. Relocatable frameworks would be desirable, but are much more messy as GHC (once installed) is currently not easily relocatable. (The GHC Xcode project under distrib/MacOS/GHC.xcodeproj, which builds GHC frameworks, includes a partially completed target to build a relocatable package if anybody is interested to get their hands dirty.) A hybrid installer that let's users choose between a systemwide and a non-admin install is AFAIK currently not feasible due to limitations of Apple's PackageMaker software (without including two separate distributions in one package).