diff options
author | Bastian Köcher <git@kchr.de> | 2019-12-30 14:19:40 +0100 |
---|---|---|
committer | Frederik Rietdijk <freddyrietdijk@fridh.nl> | 2020-01-15 09:44:10 +0100 |
commit | 320a4c15265d6afb7eb6e28fcc1f72a80367ccc1 (patch) | |
tree | e6d26335848d5360732292e4716f354a07110870 /pkgs/tools/misc/coreutils | |
parent | 155fad6625b9e9d7419e578a50d1cede9ea4b29d (diff) |
coreutils: Fix cross compilation for Android
Diffstat (limited to 'pkgs/tools/misc/coreutils')
-rw-r--r-- | pkgs/tools/misc/coreutils/coreutils-8.31-android-cross.patch | 51 | ||||
-rw-r--r-- | pkgs/tools/misc/coreutils/default.nix | 11 |
2 files changed, 58 insertions, 4 deletions
diff --git a/pkgs/tools/misc/coreutils/coreutils-8.31-android-cross.patch b/pkgs/tools/misc/coreutils/coreutils-8.31-android-cross.patch new file mode 100644 index 0000000000000..97d95d1c5b195 --- /dev/null +++ b/pkgs/tools/misc/coreutils/coreutils-8.31-android-cross.patch @@ -0,0 +1,51 @@ +From 3bd82a82cf4ba693d2c31c7b95aaec4e56dc92a4 Mon Sep 17 00:00:00 2001 +From: Paul Eggert <eggert@cs.ucla.edu> +Date: Mon, 11 Mar 2019 16:40:29 -0700 +Subject: [PATCH 1/1] strtod: fix clash with strtold + +Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817). +* lib/strtod.c (compute_minus_zero, minus_zero): +Simplify by remving the macro / external variable, +and having just a function. User changed. This avoids +the need for an external variable that might clash. +--- + ChangeLog | 9 +++++++++ + lib/strtod.c | 11 +++++------ + 2 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/lib/strtod.c b/lib/strtod.c +index b9eaa51..69b1564 100644 +--- a/lib/strtod.c ++++ b/lib/strtod.c +@@ -294,16 +294,15 @@ parse_number (const char *nptr, + ICC 10.0 has a bug when optimizing the expression -zero. + The expression -MIN * MIN does not work when cross-compiling + to PowerPC on Mac OS X 10.5. */ +-#if defined __hpux || defined __sgi || defined __ICC + static DOUBLE +-compute_minus_zero (void) ++minus_zero (void) + { ++#if defined __hpux || defined __sgi || defined __ICC + return -MIN * MIN; +-} +-# define minus_zero compute_minus_zero () + #else +-DOUBLE minus_zero = -0.0; ++ return -0.0; + #endif ++} + + /* Convert NPTR to a DOUBLE. If ENDPTR is not NULL, a pointer to the + character after the last one used in the number is put in *ENDPTR. */ +@@ -479,6 +478,6 @@ STRTOD (const char *nptr, char **endptr) + /* Special case -0.0, since at least ICC miscompiles negation. We + can't use copysign(), as that drags in -lm on some platforms. */ + if (!num && negative) +- return minus_zero; ++ return minus_zero (); + return negative ? -num : num; + } +-- +1.9.1 + diff --git a/pkgs/tools/misc/coreutils/default.nix b/pkgs/tools/misc/coreutils/default.nix index cbe97dda9e5ab..519a33c60d693 100644 --- a/pkgs/tools/misc/coreutils/default.nix +++ b/pkgs/tools/misc/coreutils/default.nix @@ -15,7 +15,7 @@ assert selinuxSupport -> libselinux != null && libsepol != null; with lib; -stdenv.mkDerivation rec { +stdenv.mkDerivation (rec { pname = "coreutils"; version = "8.31"; @@ -29,7 +29,9 @@ stdenv.mkDerivation rec { # To be removed in coreutils-8.32. ++ optional stdenv.hostPlatform.isMusl ./avoid-false-positive-in-date-debug-test.patch # Fix compilation in musl-cross environments. To be removed in coreutils-8.32. - ++ optional stdenv.hostPlatform.isMusl ./coreutils-8.31-musl-cross.patch; + ++ optional stdenv.hostPlatform.isMusl ./coreutils-8.31-musl-cross.patch + # Fix compilation in android-cross environments. To be removed in coreutils-8.32. + ++ [ ./coreutils-8.31-android-cross.patch ]; postPatch = '' # The test tends to fail on btrfs,f2fs and maybe other unusual filesystems. @@ -143,8 +145,9 @@ stdenv.mkDerivation rec { maintainers = [ maintainers.eelco ]; }; - } // optionalAttrs stdenv.hostPlatform.isMusl { # Work around a bogus warning in conjunction with musl. NIX_CFLAGS_COMPILE = "-Wno-error"; -} +} // stdenv.lib.optionalAttrs stdenv.hostPlatform.isAndroid { + NIX_CFLAGS_COMPILE = "-D__USE_FORTIFY_LEVEL=0"; +}) |