Skip to content
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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkgs/development/compilers/ghc/7.6.3.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
url = "http://haskell.org/ghc/dist/${version}/${name}-src.tar.bz2";
sha256 = "1669m8k9q72rpd2mzs0bh2q6lcwqiwd1ax3vrard1dgn64yq4hxx";
};

patches = [ ./fixMACOSXplatform763.patch ];
Copy link
Member

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).

buildInputs = [ ghc perl gmp ncurses ];

enableParallelBuilding = true;
Expand All @@ -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}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the setting export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" hurt the GHC build in any way? If it does not, then I'd rather have it set (even though it's not necessary) to avoid complicating the build expression.

''
else ''
echo "${buildMK}" > mk/build.mk
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
'';

configureFlags = "--with-gcc=${stdenv.gcc}/bin/gcc";
Expand Down
16 changes: 16 additions & 0 deletions pkgs/development/compilers/ghc/fixMACOSXplatform763.patch
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really necessary to patch the ./configure script? I would assume that setting

export MACOSX_DEPLOYMENT_VERSION=10.9
export FP_MACOSX_DEPLOYMENT_TARGET=10.9
export MACOSX_DEPLOYMENT_SDK=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${MACOSX_DEPLOYMENT_VERSION}.sdk

in the preConfigure hook -- i.e. before ./configure is run -- would have the same effect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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



11 changes: 9 additions & 2 deletions pkgs/development/libraries/gmp/4.3.2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/" ""
Copy link
Member

Choose a reason for hiding this comment

The 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";

Expand Down
19 changes: 19 additions & 0 deletions pkgs/development/libraries/gmp/darwinPlatform432.patch
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
3 changes: 3 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ pythonPackages = modules // import ./python-packages-generated.nix {
ipython = import ../shells/ipython {
inherit (pkgs) stdenv fetchurl sip pyqt4;
inherit buildPythonPackage pythonPackages;
qtconsoleSupport = !pkgs.stdenv.isDarwin; # qt is not supported on darwin
pylabQtSupport = !pkgs.stdenv.isDarwin;
pylabSupport = !pkgs.stdenv.isDarwin; # cups is not supported on darwin
};

ipythonLight = lowPrio (import ../shells/ipython {
Expand Down