diff options
-rw-r--r-- | Makefile | 62 | ||||
-rw-r--r-- | compiler/main/SysTools.lhs | 8 | ||||
-rw-r--r-- | distrib/MacOS/GHC.xcodeproj/project.pbxproj | 114 | ||||
-rw-r--r-- | distrib/MacOS/Makefile | 54 |
4 files changed, 198 insertions, 40 deletions
@@ -37,6 +37,14 @@ # binary-dist # Builds a binary distribution # +# framework-pkg [MacOS only] +# Builds /Library/Frameworks/GHC.framework wrapped into a Mac +# installer package +# +# framework-binary-dist [MacOS only] +# Builds GHC.framework encapsulating a binary distribution +# (to give a relocatable framework) +# # hc-file-bundle # Builds an HC-file bundle, for bootstrapping # @@ -227,7 +235,7 @@ install-docs :: # ----------------------------------------------------------------------------- # Making a binary distribution # -# `dist' `binary-dist' `binary-dist-macos' +# `dist' `binary-dist' # Create a distribution tar file for this program. The tar file # should be set up so that the file names in the tar file start with # a subdirectory name which is the name of the package it is a @@ -244,9 +252,7 @@ install-docs :: # that are in the distribution, to make sure they are up to date in # the distribution. See Making Releases. # -# binary-dist is a GHC addition for binary distributions and -# binary-dist-macos is the Mac OS X-specific variant creating an -# installer package for GHC.framework. +# binary-dist is a GHC addition for binary distributions # binary-dist:: @@ -301,7 +307,7 @@ ifeq "$(darwin_TARGET_OS)" "1" BIN_DIST_TOP+=mk/fix_install_names.sh endif -.PHONY: binary-dist-pre% binary-dist binary-dist-macos +.PHONY: binary-dist-pre% binary-dist binary-dist:: binary-dist-pre @@ -419,36 +425,26 @@ publish-binary-dist :: binary-dist:: @echo "Mechanical and super-natty! Inspect the result and *if* happy; freeze, sell and get some sleep!" +# ----------------------------------------------------------------------------- +# Building MacOS installer packages +# +# 'framework-pkg' +# Create an installer package for /Library/Frameworks/GHC.framework +# +# 'framework-binary-dist' +# Create an installer package for GHC.framework encapsulating a +# binary-dist to make it relocatable +# FIXME: This is only partially implemented so far + ifeq "$(darwin_TARGET_OS)" "1" -# Wrap a binary dist as a MacOS framework and put it into an installer package. - -# The ProjectVersionInt is GHC's idea of an API version and hence determines -# the framework version. -FRAMEWORK_VERSION = $(ProjectVersionInt) - -# 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) - -# Instead of making 'binary-dist' a Makefile dependency, we let xcodebuild call -# 'make binary-dist'. This has the advantage that xcode knows the framework -# path into which the distribution should be installed and can instruct -# binary-dist to put it into the right place without copying the whole tree yet -# another time. -# -binary-dist-macos: - (cd distrib/MacOS; \ - xcodebuild CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\ - SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\ - FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\ - CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION)) - (cd distrib/MacOS; \ - !!!Call the packager!!! ) +.PHONY: framework-pkg, framework-binary-dist + +framework-pkg: + $(MAKE) -C distrib/MacOS framework-pkg + +framework-binary-dist: + $(MAKE) -C distrib/MacOS framework-binary-dist endif diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs index 2df9a72407..6aa04b1459 100644 --- a/compiler/main/SysTools.lhs +++ b/compiler/main/SysTools.lhs @@ -174,7 +174,13 @@ initSysTools mbMinusB dflags ; let installed, installed_bin :: FilePath -> FilePath installed_bin pgm = top_dir </> pgm installed file = top_dir </> file - inplace dir pgm = top_dir </> cPROJECT_DIR </> dir </> pgm + inplace dir pgm = top_dir </> +#ifndef darwin_TARGET_OS +-- Not sure where cPROJECT_DIR makes sense, on Mac OS, building with +-- xcodebuild, it surely is a *bad* idea! -=chak + cPROJECT_DIR </> +#endif + dir </> pgm ; let pkgconfig_path | am_installed = installed "package.conf" diff --git a/distrib/MacOS/GHC.xcodeproj/project.pbxproj b/distrib/MacOS/GHC.xcodeproj/project.pbxproj index b5d5cc0968..442ce82736 100644 --- a/distrib/MacOS/GHC.xcodeproj/project.pbxproj +++ b/distrib/MacOS/GHC.xcodeproj/project.pbxproj @@ -8,12 +8,15 @@ /* Begin PBXBuildFile section */ 8D07F2C00486CC7A007CD1D0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; + E72A15E90D54ADB90059C234 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 8D07F2C70486CC7A007CD1D0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 8D07F2C80486CC7A007CD1D0 /* GHC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GHC.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E72A15EE0D54ADB90059C234 /* GHC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GHC.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E72A15EF0D54ADB90059C234 /* Info copy.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info copy.plist"; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ @@ -21,6 +24,7 @@ isa = PBXGroup; children = ( 8D07F2C80486CC7A007CD1D0 /* GHC.framework */, + E72A15EE0D54ADB90059C234 /* GHC.framework */, ); name = Products; sourceTree = "<group>"; @@ -48,6 +52,7 @@ children = ( 8D07F2C70486CC7A007CD1D0 /* Info.plist */, 089C1666FE841158C02AAC07 /* InfoPlist.strings */, + E72A15EF0D54ADB90059C234 /* Info copy.plist */, ); name = Resources; sourceTree = "<group>"; @@ -62,24 +67,42 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 8D07F2BC0486CC7A007CD1D0 /* GHC */ = { + 8D07F2BC0486CC7A007CD1D0 /* GHC-relocatable */ = { isa = PBXNativeTarget; - buildConfigurationList = 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "GHC" */; + buildConfigurationList = 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "GHC-relocatable" */; buildPhases = ( 8D07F2BF0486CC7A007CD1D0 /* Resources */, E76B00450D52DFDB00A05A2F /* ShellScript */, ); buildRules = ( ); - comments = "This project creates a Mac OS X framework that encapsulates a (relocatable) binary GHC distribution."; + comments = "Supported targets: build\n\nPrecondition: Fully compiled tree (i.e., \"sh boot; ./configure; make\" was already executed)\n\nThis project creates a Mac OS X framework that encapsulates a *relocatable* *binary* GHC distribution.\n\n* The framework is versioned using GHC's ProjectVersionInt. and we call the current version directory in the following CONTENTS_FOLDER_BUILD.\n\n* This target installs into CONTENTS_FOLDER_BUILD/ghc/ the same contents that is in a binary-dist tar ball.\n\n* The idea is that at framework installation time, a post install script will perform \n\n ./configure --prefix=CONTENTS_FOLDER_INSTALL/usr; make install \n\n in that ghc/ directory, where CONTENTS_FOLDER_INSTALL is the path that CONTENTS_FOLDER_BUILD has after the package containing the framework was installed by the package installer. This effectively rellocates the ghc installation to its final destination."; dependencies = ( ); - name = GHC; + name = "GHC-relocatable"; productInstallPath = "$(HOME)/Library/Frameworks"; productName = GHC; productReference = 8D07F2C80486CC7A007CD1D0 /* GHC.framework */; productType = "com.apple.product-type.framework"; }; + E72A15E70D54ADB90059C234 /* GHC-systemwide */ = { + isa = PBXNativeTarget; + buildConfigurationList = E72A15EB0D54ADB90059C234 /* Build configuration list for PBXNativeTarget "GHC-systemwide" */; + buildPhases = ( + E72A15E80D54ADB90059C234 /* Resources */, + E72A15EA0D54ADB90059C234 /* ShellScript */, + ); + buildRules = ( + ); + comments = "Supported targets: build, install, clean\n\nPrecondition: We are in a distribution tree, not a vanilla tree from darcs - i.e., \"sh boot\" was already executed.\n\nThis project creates a Mac OS X framework at /Library/Frameworks.\n\n* The framework is versioned using GHC's ProjectVersionInt.\n\n* The target configures the tree for the deployment location and builds the tree.\n\n* This target installs the framework not into its final destination, but into a build directory using the DESTDIR feature of GHC build system (unless the deployment flag in the build rules is set).\n\n* The idea is that the framework at the build location is being turned into a package and the package installer eventually puts its at its final destination. \n\nTODO: build and install documentation"; + dependencies = ( + ); + name = "GHC-systemwide"; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = GHC; + productReference = E72A15EE0D54ADB90059C234 /* GHC.framework */; + productType = "com.apple.product-type.framework"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -93,7 +116,8 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 8D07F2BC0486CC7A007CD1D0 /* GHC */, + E72A15E70D54ADB90059C234 /* GHC-systemwide */, + 8D07F2BC0486CC7A007CD1D0 /* GHC-relocatable */, ); }; /* End PBXProject section */ @@ -107,9 +131,31 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + E72A15E80D54ADB90059C234 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E72A15E90D54ADB90059C234 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + E72A15EA0D54ADB90059C234 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + comments = "Perform a DESTDIR install unless the build settings have DEPLOYMENT_LOCATION=1.\n\nNB: Why use a run script build phase instead of an external target (with a dependency)? Because we need to be underneath the GHC target to get the right build settings."; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# We need to be at the top of the ghc tree\ncd ../..\n\nPREFIX=${INSTALL_PATH}/${CONTENTS_FOLDER_PATH}/usr\n\nif [ ${ACTION} = installsrc ]; then\n echo \"xcodebuild action 'installsrc' not supported\"\n exit 0\nfi\n\nif [ ${ACTION} = build ]; then\n ./configure --prefix=${PREFIX}\n MAKE_ACTION=\nelse\n MAKE_ACTION=${ACTION}\nfi\n\nmake DESTDIR=${DSTROOT} ${MAKE_ACTION}\n"; + }; E76B00450D52DFDB00A05A2F /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -207,10 +253,57 @@ }; name = Release; }; + E72A15EC0D54ADB90059C234 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = GHC_Prefix.pch; + INFOPLIST_FILE = "/Users/chak/Code/ghc/distrib/MacOS/Info copy.plist"; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; + PRODUCT_NAME = GHC; + WRAPPER_EXTENSION = framework; + ZERO_LINK = YES; + }; + name = Debug; + }; + E72A15ED0D54ADB90059C234 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = GHC_Prefix.pch; + INFOPLIST_FILE = "/Users/chak/Code/ghc/distrib/MacOS/Info copy.plist"; + INSTALL_PATH = /Library/Frameworks; + LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; + PRODUCT_NAME = GHC; + VERSIONING_SYSTEM = ""; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "GHC" */ = { + 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "GHC-relocatable" */ = { isa = XCConfigurationList; buildConfigurations = ( 4FADC24308B4156D00ABE55E /* Debug */, @@ -228,6 +321,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + E72A15EB0D54ADB90059C234 /* Build configuration list for PBXNativeTarget "GHC-systemwide" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E72A15EC0D54ADB90059C234 /* Debug */, + E72A15ED0D54ADB90059C234 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 0867D690FE84028FC02AAC07 /* Project object */; diff --git a/distrib/MacOS/Makefile b/distrib/MacOS/Makefile new file mode 100644 index 0000000000..9f71141915 --- /dev/null +++ b/distrib/MacOS/Makefile @@ -0,0 +1,54 @@ +############################################################################ +# +# This is the GHC Makefile for MacOS X-specific targets +# +# Targets: +# +# framework-pkg [MacOS only] +# Builds /Library/Frameworks/GHC.framework wrapped into a Mac +# installer package; must be executed in a ./configure'd tree +# (--prefix doesn't matter as it will be overridden) +# +# framework-binary-dist [MacOS only] +# Builds GHC.framework encapsulating a binary distribution +# (to give a relocatable framework); must be used in a fully +# built tree +# +############################################################################ + +TOP=../.. +include $(TOP)/mk/boilerplate.mk + +# The ProjectVersionInt is GHC's idea of an API version and hence determines +# the framework version. +FRAMEWORK_VERSION = $(ProjectVersionInt) + +# 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) + +framework-pkg: + 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) + @echo "FIXME: call the packager"; exit 1 + +# Instead of making 'binary-dist' a Makefile dependency, we let xcodebuild call +# 'make binary-dist'. This has the advantage that xcode knows the framework +# path into which the distribution should be installed and can instruct +# binary-dist to put it directly into the right place without copying the whole +# tree yet another time. +# +framework-binary-dist: + xcodebuild -target GHC-relocatable build\ + CURRENT_PROJECT_VERSION=$(CURRENT_PROJECT_VERSION)\ + SHORT_VERSION_STRING=$(SHORT_VERSION_STRING)\ + FRAMEWORK_VERSION=$(FRAMEWORK_VERSION)\ + CURRENT_LIBRARY_VERSION=$(FRAMEWORK_VERSION) + @echo "FIXME: call the packager"; exit 1 |