about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-04-12 13:44:14 +0000
committerLudovic Courtès <ludo@gnu.org>2012-04-12 13:44:14 +0000
commit054382bbfef87964a167355e3087e1d6dac01c38 (patch)
treea4b7ccd28b3c45d7853b7e7b9f60dce8e5517a0c
parentfcc5136cfc68446410013d02f6265d7d2c238da6 (diff)
GMP 5.0.3: Really fix FreeBSD builds at hydra.nixos.org.
Patch by Eelco Dolstra, backported from `stdenv-updates'.

svn path=/nixpkgs/trunk/; revision=33761
-rw-r--r--pkgs/development/libraries/gmp/5.0.3.nix14
-rw-r--r--pkgs/development/libraries/gmp/ignore-bad-cpuid.patch31
2 files changed, 34 insertions, 11 deletions
diff --git a/pkgs/development/libraries/gmp/5.0.3.nix b/pkgs/development/libraries/gmp/5.0.3.nix
index 9795529794160..962c2c5b74b19 100644
--- a/pkgs/development/libraries/gmp/5.0.3.nix
+++ b/pkgs/development/libraries/gmp/5.0.3.nix
@@ -56,16 +56,8 @@ stdenv.mkDerivation (rec {
 
 (if stdenv.isFreeBSD
  then {
-   # On FreeBSD, GMP's `config.guess' detects the sub-architecture (e.g.,
-   # "k8") and generates code specific to that sub-architecture, in spite of
-   # `--enable-fat', leading to illegal instructions and similar errors on
-   # machines with a different sub-architecture.
-   # See <http://hydra.nixos.org/build/2269915/nixlog/1/raw>, for an example.
-   # Thus, use GNU's standard `config.guess' so that it assumes the generic
-   # architecture (e.g., "x86_64").
-   preConfigure =
-     '' rm config.guess && ln -s configfsf.guess config.guess
-        chmod +x configfsf.guess
-     '';
+   # The FreeBSD boxes at hydra.nixos.org are VMs run in QEMU.  This patch
+   # allows GMP to work correctly in that environment.
+   patches = [ ./ignore-bad-cpuid.patch ];
  }
  else { }))
diff --git a/pkgs/development/libraries/gmp/ignore-bad-cpuid.patch b/pkgs/development/libraries/gmp/ignore-bad-cpuid.patch
new file mode 100644
index 0000000000000..840d530a450bc
--- /dev/null
+++ b/pkgs/development/libraries/gmp/ignore-bad-cpuid.patch
@@ -0,0 +1,31 @@
+Don't abort when seeing the default CPU model/platform returned by
+QEMU.
+
+diff -ru -x '*~' gmp-5.0.4-orig/mpn/x86_64/fat/fat.c gmp-5.0.4/mpn/x86_64/fat/fat.c
+--- gmp-5.0.4-orig/mpn/x86_64/fat/fat.c	2012-02-10 11:23:05.000000000 +0100
++++ gmp-5.0.4/mpn/x86_64/fat/fat.c	2012-04-01 21:38:35.843066724 +0200
+@@ -194,13 +194,16 @@
+     {
+       switch (family)
+ 	{
++#if 0
+ 	case 4:
+ 	case 5:
+ 	  abort ();		/* 32-bit processors */
++#endif
+ 
+ 	case 6:
+ 	  switch (model)
+ 	    {
++#if 0
+ 	    case 0x00:
+ 	    case 0x01:
+ 	    case 0x02:
+@@ -217,6 +220,7 @@
+ 	    case 0x0d:		/* Dothan */
+ 	    case 0x0e:		/* Yonah */
+ 	      abort ();		/* 32-bit processors */
++#endif
+ 
+ 	    case 0x0f:		/* Conroe Merom Kentsfield Allendale */
+ 	    case 0x10: