Skip to content

Commit

Permalink
gmp-4.3.2 is compilable with forced x86_64 architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
wavewave committed Jan 9, 2014
1 parent 58f5dff commit f5a7212
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
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/" ""
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

1 comment on commit f5a7212

@peti
Copy link
Member

@peti peti commented on f5a7212 Jan 17, 2014

Choose a reason for hiding this comment

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

Patching configure feels like a very intrusive change to modify the result of the platform recognition test. Is there no way to pass that "please build for x86_64" bit to configure on the command line?

Please sign in to comment.