-
-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ghc is buildable on darwin by hard-fixing darwin platform to 10.9. #1552
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec { | |
url = "http://haskell.org/ghc/dist/${version}/${name}-src.tar.bz2"; | ||
sha256 = "1669m8k9q72rpd2mzs0bh2q6lcwqiwd1ax3vrard1dgn64yq4hxx"; | ||
}; | ||
|
||
patches = [ ./fixMACOSXplatform763.patch ]; | ||
buildInputs = [ ghc perl gmp ncurses ]; | ||
|
||
enableParallelBuilding = true; | ||
|
@@ -19,10 +19,14 @@ stdenv.mkDerivation rec { | |
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" | ||
''; | ||
|
||
preConfigure = '' | ||
preConfigure = if !stdenv.isDarwin then '' | ||
echo "${buildMK}" > mk/build.mk | ||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure | ||
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the setting |
||
'' | ||
else '' | ||
echo "${buildMK}" > mk/build.mk | ||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure | ||
''; | ||
|
||
configureFlags = "--with-gcc=${stdenv.gcc}/bin/gcc"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff -Naur a/configure b/configure | ||
--- a/configure 2013-04-19 00:47:00.000000000 +0200 | ||
+++ b/configure 2014-01-10 11:50:13.000000000 +0100 | ||
@@ -4840,9 +4840,9 @@ | ||
fi | ||
fi | ||
|
||
- | ||
- | ||
- | ||
+MACOSX_DEPLOYMENT_VERSION=10.9 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it really necessary to patch the
in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I vaguely remembered that I tried that and it didn't work since configure script overwrote the env variables after its own detection method (and detection fails since some system-wide executables (such as xcodebuild) are not exposed. ) But not 100% sure now. |
||
+FP_MACOSX_DEPLOYMENT_TARGET=10.9 | ||
+MACOSX_DEPLOYMENT_SDK=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${MACOSX_DEPLOYMENT_VERSION}.sdk | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec { | |
url = "mirror://gnu/gmp/${name}.tar.bz2"; | ||
sha256 = "0x8prpqi9amfcmi7r4zrza609ai9529pjaq0h4aw51i867064qck"; | ||
}; | ||
|
||
patches = [ ./darwinPlatform432.patch ]; | ||
nativeBuildInputs = [ m4 ]; | ||
|
||
# Prevent the build system from using sub-architecture-specific | ||
|
@@ -16,10 +16,17 @@ stdenv.mkDerivation rec { | |
# This is not a problem for Apple machines, which are all alike. In | ||
# addition, `configfsf.guess' would return `i386-apple-darwin10.2.0' on | ||
# `x86_64-darwin', leading to a 32-bit ABI build, which is undesirable. | ||
patchPlatformBuild = if !stdenv.isDarwin then "$ac_cv_build" else ''"x86_64-apple-darwin13.0.0"''; | ||
patchPlatformHost = if !stdenv.isDarwin then "$ac_cv_host" else ''"x86_64-apple-darwin13.0.0"''; | ||
|
||
preConfigure = | ||
if !stdenv.isDarwin | ||
then "ln -sf configfsf.guess config.guess" | ||
else ''echo "Darwin host is `./config.guess`."''; | ||
else '' | ||
substituteInPlace configure --replace "/usr/bin/" "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this command Darwin specific? /usr/bin shouldn't be used on other platforms either. |
||
substituteInPlace configure --subst-var patchPlatformBuild --subst-var patchPlatformHost | ||
echo "Darwin host is `./config.guess`."''; | ||
|
||
|
||
configureFlags = if cxx then "--enable-cxx" else "--disable-cxx"; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
diff -rupN a/configure b/configure | ||
--- a/configure 2010-01-07 21:09:40.000000000 +0100 | ||
+++ b/configure 2014-01-09 22:19:37.000000000 +0100 | ||
@@ -2140,6 +2140,7 @@ echo "$as_me: error: $SHELL $ac_aux_dir/ | ||
fi | ||
{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 | ||
echo "${ECHO_T}$ac_cv_build" >&6; } | ||
+ac_cv_build = @patchPlatformBuild@ | ||
case $ac_cv_build in | ||
*-*-*) ;; | ||
*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 | ||
@@ -2177,6 +2178,7 @@ fi | ||
fi | ||
{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 | ||
echo "${ECHO_T}$ac_cv_host" >&6; } | ||
+ac_cv_host=@patchPlatformHost@ | ||
case $ac_cv_host in | ||
*-*-*) ;; | ||
*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be
stdenv.lib.optional stdenv.isDarwin ./fixMACOSXplatform763.patch
to avoid enabling that patch on non-Darwin platforms. Or even better: maybe we can avoid the patch altogether (see comment below).