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 ############################################################################
23 include ../../mk/config.mk
25 ifeq "$(ProjectVersion)" ""
26 $(error Please run ./configure first)
29 include ../../mk/custom-settings.mk
31 # The framework version is a string like
33 # for an i386 build of GHC 7.0.1. It's used for the subdirectory of
34 # /Library/Frameworks/GHC.framework/Versions/
35 FRAMEWORK_VERSION = $(ProjectVersion)-$(TargetArch_CPP)
37 # Xcode requires CURRENT_PROJECT_VERSION to be an int or float. We use this
38 # only as the build version (aka CFBundleVersion).
39 CURRENT_PROJECT_VERSION = $(ProjectVersionInt).$(ProjectPatchLevel)
41 # The user-visible CFBundleShortVersionString
42 SHORT_VERSION_STRING = $(FRAMEWORK_VERSION)
44 # Name of the installer package
45 PACKAGE_NAME = GHC-$(FRAMEWORK_VERSION).pkg
47 # Determine arguments that should be passed to ./configure from within Xcode
49 # By default, we pass whatever was used when the present tree was configured.
50 # The user can override this by setting XCODE_EXTRA_CONFIGURE_ARGS. If
51 # MACOSX_DEPLOYMENT_TARGET is set, the target is added to whatever arguments
53 export XCODE_EXTRA_CONFIGURE_ARGS
54 ifeq "$(XCODE_EXTRA_CONFIGURE_ARGS)" ""
55 XCODE_EXTRA_CONFIGURE_ARGS = $(shell echo $(CONFIGURE_ARGS))
57 ifneq "$(MACOSX_DEPLOYMENT_TARGET)" ""
58 XCODE_EXTRA_CONFIGURE_ARGS += --with-macosx-deployment-target=$(MACOSX_DEPLOYMENT_TARGET)
61 # Determine whether we need to pass a "-target" option to packagemaker
63 # If a deployment target has been set, we use the same target for packagemaker.
64 ifneq "$(MACOSX_DEPLOYMENT_TARGET)" ""
65 PACKAGEMAKER_TARGET = -target $(MACOSX_DEPLOYMENT_TARGET)
68 # Xcode's installation build product location (this is where the GHC.framework
72 # Tools directory for a system volume install
73 TOOLS_SYSTEM=$(DSTROOT)/Library/Frameworks/GHC.framework/Versions/$(FRAMEWORK_VERSION)/Tools
75 PACKAGEMAKER=/Developer/usr/bin/packagemaker
77 # Build and package GHC.framework for /Library/Frameworks
79 # * Be careful to clean out Xcode's build product location first, as Xcode
80 # sets permissions such that a second install on top of an existing one
82 # * Make there are no contents component descriptions in the .pmdoc. These are
83 # created by the PackageMaker GUI and have per default the wrong ownership
84 # and permissions for all files (as well as prevent correct setting of those
85 # for files that are not in the content list).
87 -chmod -fR u+w $(DSTROOT)
89 mkdir -p $(TOOLS_SYSTEM)
90 cp installer-scripts/Uninstaller $(TOOLS_SYSTEM)
91 cp installer-scripts/create-links $(TOOLS_SYSTEM)
92 xcodebuild -target GHC-systemwide clean build\
93 CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\
94 SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\
95 FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\
96 CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION)\
98 xcodebuild -target GHC-systemwide install\
99 CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\
100 SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\
101 FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\
102 CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION)\
103 COMMAND_MODE=unix2003
104 -$(RM) -f GHC-system.pmdoc/*-contents.xml
105 $(PACKAGEMAKER) -v --doc GHC-system.pmdoc\
106 $(PACKAGEMAKER_TARGET) -o $(TOP)/$(PACKAGE_NAME)\
107 -i org.haskell.ghc.$(FRAMEWORK_VERSION)
109 # If we don't specify COMMAND_MODE=unix2003 then xcodebuild defaults
110 # to setting it to legacy, which means that ar builds archives
111 # without a table of contents. That makes the build fail later on.
115 # Instead of making 'binary-dist' a Makefile dependency, we let xcodebuild call
116 # 'make binary-dist'. This has the advantage that xcode knows the framework
117 # path into which the distribution should be installed and can instruct
118 # binary-dist to put it directly into the right place without copying the whole
119 # tree yet another time.
121 framework-binary-dist:
122 xcodebuild -target GHC-relocatable clean build\
123 CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\
124 SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\
125 FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\
126 CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION)
127 @echo "FIXME: call the packager"; exit 1
128 # FIXME: The approach with the binary-dist in the package has the
129 # problem that the BOM is wrong and the installer relocation feature
130 # isn't sufficient as the layout in the binary-dist and the installed