X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=distrib%2FMacOS%2FMakefile;h=eef566185f7b27c426d2a6e5f42474add9affa6a;hb=9142c238bd014c45e30fc79eee69fa6ab3f469d8;hp=f1031849654b32f3f96656cb6b6cf782deeb1599;hpb=8173d83139bfe52da4cef5a23f514869c3830e8d;p=ghc-hetmet.git diff --git a/distrib/MacOS/Makefile b/distrib/MacOS/Makefile index f103184..eef5661 100644 --- a/distrib/MacOS/Makefile +++ b/distrib/MacOS/Makefile @@ -20,27 +20,33 @@ # ############################################################################ -TOP=../.. -include $(TOP)/mk/boilerplate.mk +include ../../mk/config.mk -# The ProjectVersionInt is GHC's idea of an API version and hence determines -# the framework version. -FRAMEWORK_VERSION = $(ProjectVersionInt) +ifeq "$(ProjectVersion)" "" +$(error Please run ./configure first) +endif + +include ../../mk/custom-settings.mk + +# The framework version is a string like +# 7.0.1-i386 +# for an i386 build of GHC 7.0.1. It's used for the subdirectory of +# /Library/Frameworks/GHC.framework/Versions/ +FRAMEWORK_VERSION = $(ProjectVersion)-$(TargetArch_CPP) # Xcode requires CURRENT_PROJECT_VERSION to be an int or float. We use this # only as the build version (aka CFBundleVersion). CURRENT_PROJECT_VERSION = $(ProjectVersionInt).$(ProjectPatchLevel) -# The user-visible CFBundleShortVersionString is set to the standard GHC -# version number. -SHORT_VERSION_STRING = $(ProjectVersion) +# The user-visible CFBundleShortVersionString +SHORT_VERSION_STRING = $(FRAMEWORK_VERSION) # Name of the installer package -PACKAGE_NAME = GHC-$(ProjectVersion)-$(TargetArch_CPP).pkg +PACKAGE_NAME = GHC-$(FRAMEWORK_VERSION).pkg # Determine arguments that should be passed to ./configure from within Xcode # -# By default, we pass whatever was used whne the present tree was configured. +# By default, we pass whatever was used when the present tree was configured. # The user can override this by setting XCODE_EXTRA_CONFIGURE_ARGS. If # MACOSX_DEPLOYMENT_TARGET is set, the target is added to whatever arguments # are passed. @@ -52,12 +58,19 @@ ifneq "$(MACOSX_DEPLOYMENT_TARGET)" "" XCODE_EXTRA_CONFIGURE_ARGS += --with-macosx-deployment-target=$(MACOSX_DEPLOYMENT_TARGET) endif +# Determine whether we need to pass a "-target" option to packagemaker +# +# If a deployment target has been set, we use the same target for packagemaker. +ifneq "$(MACOSX_DEPLOYMENT_TARGET)" "" +PACKAGEMAKER_TARGET = -target $(MACOSX_DEPLOYMENT_TARGET) +endif + # Xcode's installation build product location (this is where the GHC.framework # is assembled) DSTROOT=/tmp/GHC.dst # Tools directory for a system volume install -TOOLS_SYSTEM=$(DSTROOT)/Library/Frameworks/GHC.framework/Tools +TOOLS_SYSTEM=$(DSTROOT)/Library/Frameworks/GHC.framework/Versions/$(FRAMEWORK_VERSION)/Tools PACKAGEMAKER=/Developer/usr/bin/packagemaker @@ -71,17 +84,33 @@ PACKAGEMAKER=/Developer/usr/bin/packagemaker # and permissions for all files (as well as prevent correct setting of those # for files that are not in the content list). framework-pkg: - -chmod -R u+w $(DSTROOT) + -chmod -fR u+w $(DSTROOT) -$(RM) -rf $(DSTROOT) mkdir -p $(TOOLS_SYSTEM) cp installer-scripts/Uninstaller $(TOOLS_SYSTEM) - xcodebuild -target GHC-systemwide clean build install\ + cp installer-scripts/create-links $(TOOLS_SYSTEM) + xcodebuild -target GHC-systemwide clean build\ CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\ SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\ FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\ - CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION) + CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION)\ + COMMAND_MODE=unix2003 + xcodebuild -target GHC-systemwide install\ + CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\ + SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\ + FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\ + CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION)\ + COMMAND_MODE=unix2003 -$(RM) -f GHC-system.pmdoc/*-contents.xml - $(PACKAGEMAKER) -v --doc GHC-system.pmdoc -o $(TOP)/$(PACKAGE_NAME) + $(PACKAGEMAKER) -v --doc GHC-system.pmdoc\ + $(PACKAGEMAKER_TARGET) -o $(TOP)/$(PACKAGE_NAME)\ + -i org.haskell.ghc.$(FRAMEWORK_VERSION) + +# If we don't specify COMMAND_MODE=unix2003 then xcodebuild defaults +# to setting it to legacy, which means that ar builds archives +# without a table of contents. That makes the build fail later on. + + # Instead of making 'binary-dist' a Makefile dependency, we let xcodebuild call # 'make binary-dist'. This has the advantage that xcode knows the framework