Mac installer: add comprehensive licencing information
[ghc-hetmet.git] / distrib / MacOS / Makefile
1 ############################################################################
2 #
3 #               This is the GHC Makefile for MacOS X-specific targets
4 #
5 # Targets: 
6 #
7 #       framework-pkg  [MacOS only]
8 #               Builds /Library/Frameworks/GHC.framework wrapped into a Mac
9 #               installer package; must be executed in a ./configure'd tree
10 #               (--prefix doesn't matter as it will be overridden)
11 #
12 #       framework-binary-dist  [MacOS only]
13 #               Builds GHC.framework encapsulating a binary distribution
14 #               (to give a relocatable framework); must be used in a fully
15 #               built tree
16 #
17 ############################################################################
18
19 TOP=../..
20 include $(TOP)/mk/boilerplate.mk
21
22 # The ProjectVersionInt is GHC's idea of an API version and hence determines
23 # the framework version.
24 FRAMEWORK_VERSION = $(ProjectVersionInt)
25
26 # Xcode requires CURRENT_PROJECT_VERSION to be an int or float.  We use this
27 # only as the build version (aka CFBundleVersion).
28 CURRENT_PROJECT_VERSION = $(ProjectVersionInt).$(ProjectPatchLevel)
29
30 # The user-visible CFBundleShortVersionString is set to the standard GHC 
31 # version number.
32 SHORT_VERSION_STRING = $(ProjectVersion)
33
34 # Name of the installer package
35 PACKAGE_NAME = GHC-$(ProjectVersion)-$(TargetArch_CPP).pkg
36
37 # Xcode's installation build product location (this is where the GHC.framework
38 # is assembled)
39 DSTROOT=/tmp/GHC.dst
40
41 # Tools directory for a system volume install
42 TOOLS_SYSTEM=$(DSTROOT)/Library/Frameworks/GHC.framework/Tools
43
44 PACKAGEMAKER=/Developer/usr/bin/packagemaker
45
46 # Build and package GHC.framework for /Library/Frameworks
47 #
48 # * Be careful to clean out Xcode's build product location first, as Xcode
49 #   sets permissions such that a second install on top of an existing one
50 #   fails
51 # * Make there are no contents component descriptions in the .pmdoc.  These are
52 #   created by the PackageMaker GUI and have per default the wrong ownership
53 #   and permissions for all files (as well as prevent correct setting of those
54 #   for files that are not in the content list).
55 framework-pkg:
56         -chmod -R u+w $(DSTROOT)
57         -$(RM) -rf $(DSTROOT)
58         mkdir -p $(TOOLS_SYSTEM)
59         cp installer-scripts/Uninstaller $(TOOLS_SYSTEM)
60         xcodebuild -target GHC-systemwide clean build install\
61                    CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\
62                    SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\
63                    FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\
64                    CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION)
65         -$(RM) -f GHC-system.pmdoc/*-contents.xml
66         $(PACKAGEMAKER) -v --doc GHC-system.pmdoc -o $(TOP)/$(PACKAGE_NAME)
67
68 # Instead of making 'binary-dist' a Makefile dependency, we let xcodebuild call
69 # 'make binary-dist'.  This has the advantage that xcode knows the framework
70 # path into which the distribution should be installed and can instruct 
71 # binary-dist to put it directly into the right place without copying the whole
72 # tree yet another time.
73 #
74 framework-binary-dist:
75         xcodebuild -target GHC-relocatable clean build\
76                    CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\
77                    SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\
78                    FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\
79                    CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION)
80         @echo "FIXME: call the packager"; exit 1
81         # FIXME: The approach with the binary-dist in the package has the
82         # problem that the BOM is wrong and the installer relocation feature
83         # isn't sufficient as the layout in the binary-dist and the installed
84         # tree is different