1 ############################################################################
3 # This is the GHC Makefile for MacOS X-specific targets
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); other
11 # ./configure arguments are passed through, unless overwritten
12 # with XCODE_EXTRA_CONFIGURE_ARGS. A deployment target can
13 # be specified by setting the corresponding ./configure
14 # argument or by setting MACOSX_DEPLOYMENT_TARGET.
16 # framework-binary-dist [MacOS only]
17 # Builds GHC.framework encapsulating a binary distribution
18 # (to give a relocatable framework); must be used in a fully
21 ############################################################################
24 include $(TOP)/mk/boilerplate.mk
26 # The ProjectVersionInt is GHC's idea of an API version and hence determines
27 # the framework version.
28 FRAMEWORK_VERSION = $(ProjectVersionInt)
30 # Xcode requires CURRENT_PROJECT_VERSION to be an int or float. We use this
31 # only as the build version (aka CFBundleVersion).
32 CURRENT_PROJECT_VERSION = $(ProjectVersionInt).$(ProjectPatchLevel)
34 # The user-visible CFBundleShortVersionString is set to the standard GHC
36 SHORT_VERSION_STRING = $(ProjectVersion)
38 # Name of the installer package
39 PACKAGE_NAME = GHC-$(ProjectVersion)-$(TargetArch_CPP).pkg
41 # Determine arguments that should be passed to ./configure from within Xcode
43 # By default, we pass whatever was used when the present tree was configured.
44 # The user can override this by setting XCODE_EXTRA_CONFIGURE_ARGS. If
45 # MACOSX_DEPLOYMENT_TARGET is set, the target is added to whatever arguments
47 export XCODE_EXTRA_CONFIGURE_ARGS
48 ifeq "$(XCODE_EXTRA_CONFIGURE_ARGS)" ""
49 XCODE_EXTRA_CONFIGURE_ARGS = $(shell echo $(CONFIGURE_ARGS))
51 ifneq "$(MACOSX_DEPLOYMENT_TARGET)" ""
52 XCODE_EXTRA_CONFIGURE_ARGS += --with-macosx-deployment-target=$(MACOSX_DEPLOYMENT_TARGET)
55 # Determine whether we need to pass a "-target" option to packagemaker
57 # If a deployment target has been set, we use the same target for packagemaker.
58 ifneq "$(MACOSX_DEPLOYMENT_TARGET)" ""
59 PACKAGEMAKER_TARGET = -target $(MACOSX_DEPLOYMENT_TARGET)
62 # Xcode's installation build product location (this is where the GHC.framework
66 # Tools directory for a system volume install
67 TOOLS_SYSTEM=$(DSTROOT)/Library/Frameworks/GHC.framework/Tools
69 PACKAGEMAKER=/Developer/usr/bin/packagemaker
71 # Build and package GHC.framework for /Library/Frameworks
73 # * Be careful to clean out Xcode's build product location first, as Xcode
74 # sets permissions such that a second install on top of an existing one
76 # * Make there are no contents component descriptions in the .pmdoc. These are
77 # created by the PackageMaker GUI and have per default the wrong ownership
78 # and permissions for all files (as well as prevent correct setting of those
79 # for files that are not in the content list).
81 -chmod -fR u+w $(DSTROOT)
83 mkdir -p $(TOOLS_SYSTEM)
84 cp installer-scripts/Uninstaller $(TOOLS_SYSTEM)
85 xcodebuild -target GHC-systemwide clean build\
86 CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\
87 SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\
88 FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\
89 CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION)\
91 xcodebuild -target GHC-systemwide install\
92 CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\
93 SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\
94 FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\
95 CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION)\
97 -$(RM) -f GHC-system.pmdoc/*-contents.xml
98 $(PACKAGEMAKER) -v --doc GHC-system.pmdoc\
99 $(PACKAGEMAKER_TARGET) -o $(TOP)/$(PACKAGE_NAME)
101 # If we don't specify COMMAND_MODE=unix2003 then xcodebuild defaults
102 # to setting it to legacy, which means that ar builds archives
103 # without a table of contents. That makes the build fail later on.
107 # Instead of making 'binary-dist' a Makefile dependency, we let xcodebuild call
108 # 'make binary-dist'. This has the advantage that xcode knows the framework
109 # path into which the distribution should be installed and can instruct
110 # binary-dist to put it directly into the right place without copying the whole
111 # tree yet another time.
113 framework-binary-dist:
114 xcodebuild -target GHC-relocatable clean build\
115 CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\
116 SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\
117 FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\
118 CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION)
119 @echo "FIXME: call the packager"; exit 1
120 # FIXME: The approach with the binary-dist in the package has the
121 # problem that the BOM is wrong and the installer relocation feature
122 # isn't sufficient as the layout in the binary-dist and the installed