summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--distrib/MacOS/GHC-system.pmdoc/index.xml.in2
-rw-r--r--distrib/MacOS/GHC.xcodeproj/project.pbxproj2
-rw-r--r--distrib/MacOS/Makefile131
-rw-r--r--distrib/MacOS/installer-scripts/Uninstaller.in2
-rw-r--r--distrib/MacOS/installer-scripts/create-links.in2
-rw-r--r--distrib/MacOS/mkinstaller105
7 files changed, 110 insertions, 136 deletions
diff --git a/configure.ac b/configure.ac
index a0e0021496..2163f2f969 100644
--- a/configure.ac
+++ b/configure.ac
@@ -874,7 +874,7 @@ if grep ' ' compiler/ghc.cabal.in 2>&1 >/dev/null; then
AC_MSG_ERROR([compiler/ghc.cabal.in contains tab characters; please remove them])
fi
-AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal ghc.spec extra-gcc-opts docs/users_guide/ug-book.xml docs/users_guide/ug-ent.xml docs/index.html libraries/prologue.txt distrib/ghc.iss distrib/configure.ac distrib/MacOS/installer-scripts/create-links distrib/MacOS/installer-scripts/Uninstaller distrib/MacOS/GHC-system.pmdoc/index.xml])
+AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal ghc.spec extra-gcc-opts docs/users_guide/ug-book.xml docs/users_guide/ug-ent.xml docs/index.html libraries/prologue.txt distrib/ghc.iss distrib/configure.ac])
AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])
AC_OUTPUT
diff --git a/distrib/MacOS/GHC-system.pmdoc/index.xml.in b/distrib/MacOS/GHC-system.pmdoc/index.xml.in
index 7255057d7e..d07928b753 100644
--- a/distrib/MacOS/GHC-system.pmdoc/index.xml.in
+++ b/distrib/MacOS/GHC-system.pmdoc/index.xml.in
@@ -28,4 +28,4 @@ in a web browser. More documentation is available online at\
\
To uninstall, execute\
\
- /Library/Frameworks/GHC.framework/Versions/@ProjectVersion@-@TargetArch_CPP@/Tools/Uninstaller}]]></resource></locale></resources><flags/><item type="file">01ghc.xml</item><mod>properties.systemDomain</mod><mod>properties.title</mod><mod>properties.userDomain</mod><mod>properties.anywhereDomain</mod><mod>description</mod></pkmkdoc>
+ /Library/Frameworks/GHC.framework/Versions/@FRAMEWORK_VERSION@/Tools/Uninstaller}]]></resource></locale></resources><flags/><item type="file">01ghc.xml</item><mod>properties.systemDomain</mod><mod>properties.title</mod><mod>properties.userDomain</mod><mod>properties.anywhereDomain</mod><mod>description</mod></pkmkdoc>
diff --git a/distrib/MacOS/GHC.xcodeproj/project.pbxproj b/distrib/MacOS/GHC.xcodeproj/project.pbxproj
index 6cd8658a66..738c68eded 100644
--- a/distrib/MacOS/GHC.xcodeproj/project.pbxproj
+++ b/distrib/MacOS/GHC.xcodeproj/project.pbxproj
@@ -152,7 +152,7 @@
);
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} = build ]; then\n # put explicit --prefix last, in case the extra configure args contain a prefix\n ./configure ${XCODE_EXTRA_CONFIGURE_ARGS} --prefix=${PREFIX} || exit 1\n MAKE_ACTION=\nelse\n MAKE_ACTION=${ACTION}\nfi\n\n# - We must explictly force the creation of a symbol table in .a files on BSD, and not all versions of Cabal\n# do that consistently; hence, the EXTRA_AR_ARGS.\nmake DESTDIR=${DSTROOT} HADDOCK_DOCS=YES EXTRA_AR_ARGS=-s PERL=/usr/bin/perl ${MAKE_ACTION} < /dev/null || exit 1\nmake DESTDIR=${DSTROOT} || exit 1";
+ shellScript = "case \"$ACTION\" in clean) rm -rf \"$GHC_UNPACKS_INTO\" ;; build) tar -jxf \"$BINDIST\" && cd \"$GHC_UNPACKS_INTO\" && ./configure --prefix=\"$INSTALL_PATH/$CONTENTS_FOLDER_PATH/usr\" ;; install) cd \"$GHC_UNPACKS_INTO\" && make install DESTDIR=\"$DSTROOT\" ;; *) echo \"Unknown action $ACTION\" >&2 ; exit 1 ;; esac ";
};
E76B00450D52DFDB00A05A2F /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
diff --git a/distrib/MacOS/Makefile b/distrib/MacOS/Makefile
deleted file mode 100644
index eef566185f..0000000000
--- a/distrib/MacOS/Makefile
+++ /dev/null
@@ -1,131 +0,0 @@
-############################################################################
-#
-# 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); other
-# ./configure arguments are passed through, unless overwritten
-# with XCODE_EXTRA_CONFIGURE_ARGS. A deployment target can
-# be specified by setting the corresponding ./configure
-# argument or by setting MACOSX_DEPLOYMENT_TARGET.
-#
-# 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
-#
-############################################################################
-
-include ../../mk/config.mk
-
-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
-SHORT_VERSION_STRING = $(FRAMEWORK_VERSION)
-
-# Name of the installer package
-PACKAGE_NAME = GHC-$(FRAMEWORK_VERSION).pkg
-
-# Determine arguments that should be passed to ./configure from within Xcode
-#
-# 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.
-export XCODE_EXTRA_CONFIGURE_ARGS
-ifeq "$(XCODE_EXTRA_CONFIGURE_ARGS)" ""
-XCODE_EXTRA_CONFIGURE_ARGS = $(shell echo $(CONFIGURE_ARGS))
-endif
-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/Versions/$(FRAMEWORK_VERSION)/Tools
-
-PACKAGEMAKER=/Developer/usr/bin/packagemaker
-
-# Build and package GHC.framework for /Library/Frameworks
-#
-# * Be careful to clean out Xcode's build product location first, as Xcode
-# sets permissions such that a second install on top of an existing one
-# fails
-# * Make there are no contents component descriptions in the .pmdoc. These are
-# created by the PackageMaker GUI and have per default the wrong ownership
-# 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 -fR u+w $(DSTROOT)
- -$(RM) -rf $(DSTROOT)
- mkdir -p $(TOOLS_SYSTEM)
- cp installer-scripts/Uninstaller $(TOOLS_SYSTEM)
- 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)\
- 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\
- $(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
-# 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 clean 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
- # FIXME: The approach with the binary-dist in the package has the
- # problem that the BOM is wrong and the installer relocation feature
- # isn't sufficient as the layout in the binary-dist and the installed
- # tree is different
diff --git a/distrib/MacOS/installer-scripts/Uninstaller.in b/distrib/MacOS/installer-scripts/Uninstaller.in
index f4e1fad67d..686dbb0803 100644
--- a/distrib/MacOS/installer-scripts/Uninstaller.in
+++ b/distrib/MacOS/installer-scripts/Uninstaller.in
@@ -32,7 +32,7 @@ fi
FRAMEWORK_DIRECTORY="$INSTALL_DEST/GHC.framework"
VERSIONS_DIRECTORY="$FRAMEWORK_DIRECTORY/Versions"
-MY_VERSION=@ProjectVersion@-@TargetArch_CPP@
+MY_VERSION=@FRAMEWORK_VERSION@
MY_DIRECTORY="$VERSIONS_DIRECTORY/$MY_VERSION"
CURRENT_DIRECTORY="$VERSIONS_DIRECTORY/Current"
diff --git a/distrib/MacOS/installer-scripts/create-links.in b/distrib/MacOS/installer-scripts/create-links.in
index c12d90a36c..a341be631f 100644
--- a/distrib/MacOS/installer-scripts/create-links.in
+++ b/distrib/MacOS/installer-scripts/create-links.in
@@ -20,7 +20,7 @@ if [ "$INSTALL_BASE" = / ]; then
INSTALL_BASE=/usr
fi
-VERSION=@ProjectVersion@-@TargetArch_CPP@
+VERSION=@FRAMEWORK_VERSION@
GHC_BASE="$INSTALL_DEST/GHC.framework/Versions/$VERSION"
INSTALL_BIN="$INSTALL_BASE/bin"
diff --git a/distrib/MacOS/mkinstaller b/distrib/MacOS/mkinstaller
new file mode 100644
index 0000000000..feb3db080b
--- /dev/null
+++ b/distrib/MacOS/mkinstaller
@@ -0,0 +1,105 @@
+#!/bin/bash
+
+set -e
+
+die () {
+ echo "Error: $1" >&2
+ exit 1
+}
+
+if ! [ -d installer-scripts ]
+then
+ die "Doesn't look like you are running this script from the right location"
+fi
+
+if [ "$#" -ne 1 ]
+then
+ die "Must be given on argument (the bindist)"
+fi
+
+BINDIST="$1"
+
+GHC_UNPACKS_INTO=`echo "$BINDIST" | sed 's/^\(.*\/\)\{0,1\}\(ghc-\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\(\.\([0-9]\{1,\}\)\)\{0,1\}\)-\([a-z0-9_]\{1,\}\)-apple-darwin\.tar\.bz2$/\2/'`
+GHC_VERSION_DIG1=`echo "$BINDIST" | sed 's/^\(.*\/\)\{0,1\}\(ghc-\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\(\.\([0-9]\{1,\}\)\)\{0,1\}\)-\([a-z0-9_]\{1,\}\)-apple-darwin\.tar\.bz2$/\3/'`
+GHC_VERSION_DIG2=`echo "$BINDIST" | sed 's/^\(.*\/\)\{0,1\}\(ghc-\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\(\.\([0-9]\{1,\}\)\)\{0,1\}\)-\([a-z0-9_]\{1,\}\)-apple-darwin\.tar\.bz2$/\4/'`
+GHC_VERSION_DIG3=`echo "$BINDIST" | sed 's/^\(.*\/\)\{0,1\}\(ghc-\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\(\.\([0-9]\{1,\}\)\)\{0,1\}\)-\([a-z0-9_]\{1,\}\)-apple-darwin\.tar\.bz2$/\5/'`
+GHC_VERSION_DIG4=`echo "$BINDIST" | sed 's/^\(.*\/\)\{0,1\}\(ghc-\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\(\.\([0-9]\{1,\}\)\)\{0,1\}\)-\([a-z0-9_]\{1,\}\)-apple-darwin\.tar\.bz2$/\7/'`
+GHC_ARCHITECTURE=`echo "$BINDIST" | sed 's/^\(.*\/\)\{0,1\}\(ghc-\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\(\.\([0-9]\{1,\}\)\)\{0,1\}\)-\([a-z0-9_]\{1,\}\)-apple-darwin\.tar\.bz2$/\8/'`
+
+if [ "$GHC_ARCHITECTURE" == "$BINDIST" ]
+then
+ die "Bindist filename not in expected format"
+fi
+
+if [ "$(($GHC_VERSION_DIG2 % 2))" -eq 1 ]
+then
+ if [ "$GHC_VERSION_DIG4" == "" ]
+ then
+ FRAMEWORK_VERSION="$GHC_VERSION_DIG1.$GHC_VERSION_DIG2.$GHC_VERSION_DIG3-$GHC_ARCHITECTURE"
+ CURRENT_PROJECT_VERSION=`printf "%02d%02d00.%08d\n" "$GHC_VERSION_DIG1" "$GHC_VERSION_DIG2" "$GHC_VERSION_DIG3"`
+ else
+ die "Huh? 4 component HEAD version?"
+ fi
+else
+ if [ "$GHC_VERSION_DIG4" == "" ]
+ then
+ FRAMEWORK_VERSION="$GHC_VERSION_DIG1.$GHC_VERSION_DIG2.$GHC_VERSION_DIG3-$GHC_ARCHITECTURE"
+ CURRENT_PROJECT_VERSION=`printf "%02d%02d%02d\n" "$GHC_VERSION_DIG1" "$GHC_VERSION_DIG2" "$GHC_VERSION_DIG3"`
+ else
+ FRAMEWORK_VERSION="$GHC_VERSION_DIG1.$GHC_VERSION_DIG2.$GHC_VERSION_DIG3.$GHC_VERSION_DIG4-$GHC_ARCHITECTURE"
+ CURRENT_PROJECT_VERSION=`printf "%02d%02d%02d.%08d\n" "$GHC_VERSION_DIG1" "$GHC_VERSION_DIG2" "$GHC_VERSION_DIG3" "$GHC_VERSION_DIG4"`
+ fi
+fi
+
+# The user-visible CFBundleShortVersionString
+SHORT_VERSION_STRING="$FRAMEWORK_VERSION"
+
+# Name of the installer package
+PACKAGE_NAME="GHC-$FRAMEWORK_VERSION.pkg"
+
+# 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/Versions/$FRAMEWORK_VERSION/Tools"
+
+rm -rf "$DSTROOT"
+mkdir -p "$TOOLS_SYSTEM"
+sed "s/@FRAMEWORK_VERSION@/$FRAMEWORK_VERSION/" \
+ < installer-scripts/Uninstaller.in \
+ > installer-scripts/Uninstaller
+sed "s/@FRAMEWORK_VERSION@/$FRAMEWORK_VERSION/" \
+ < installer-scripts/create-links.in \
+ > installer-scripts/create-links
+sed "s/@FRAMEWORK_VERSION@/$FRAMEWORK_VERSION/" \
+ < GHC-system.pmdoc/index.xml.in \
+ > GHC-system.pmdoc/index.xml
+cp installer-scripts/Uninstaller installer-scripts/create-links "$TOOLS_SYSTEM"
+xcodebuild -target GHC-systemwide clean build install \
+ BINDIST="$BINDIST" \
+ GHC_UNPACKS_INTO="$GHC_UNPACKS_INTO" \
+ 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
+
+/Developer/usr/bin/packagemaker \
+ -v --doc GHC-system.pmdoc \
+ -o $PACKAGE_NAME \
+ -i org.haskell.ghc."$FRAMEWORK_VERSION"
+
+# Clean up
+xcodebuild -target GHC-systemwide clean \
+ 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 -r "$GHC_UNPACKS_INTO"
+rm -r "$DSTROOT"
+rm installer-scripts/Uninstaller installer-scripts/create-links
+rm GHC-system.pmdoc/index.xml
+