diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix index bd5a72f9603..c0593cd781e 100644 --- a/pkgs/development/compilers/gcc/common/platform-flags.nix +++ b/pkgs/development/compilers/gcc/common/platform-flags.nix @@ -1,7 +1,8 @@ { lib, targetPlatform }: let - p = targetPlatform.gcc or {} + gcc = targetPlatform.gcc or {}; + p = gcc // targetPlatform.parsed.abi; in lib.concatLists [ (lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64 @@ -10,7 +11,18 @@ in lib.concatLists [ (lib.optional (p ? fpu) "--with-fpu=${p.fpu}") (lib.optional (p ? float) "--with-float=${p.float}") (lib.optional (p ? mode) "--with-mode=${p.mode}") - (lib.optional - (let tp = targetPlatform; in tp.isPower && tp.libc == "glibc" && tp.is64bit) - "--with-long-double-128") + (lib.optionals targetPlatform.isPower64 + # musl explicitly rejects 128-bit long double on + # powerpc64; see musl/arch/powerpc64/bits/float.h + (lib.optionals + (!targetPlatform.isMusl + && (targetPlatform.isLittleEndian || + # "... --with-long-double-format is only supported if the default cpu is power7 or newer" + # https://github.com/NixOS/nixpkgs/pull/170215#issuecomment-1202164709 + (lib.lists.elem + (lib.strings.substring 0 6 (p.cpu or "")) + [ "power7" "power8" "power9" "power1"/*0, 11, etc*/ ]))) [ + "--with-long-double-128" + "--with-long-double-format=${gcc.long-double-format or "ieee"}" + ])) ] diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix index 81f7abc90a3..5443f1eeac0 100644 --- a/pkgs/development/libraries/gettext/default.nix +++ b/pkgs/development/libraries/gettext/default.nix @@ -1,4 +1,6 @@ -{ stdenv, lib, fetchurl, fetchpatch, libiconv, xz, bash }: +{ stdenv, lib, fetchurl, fetchpatch, libiconv, xz, bash +, gnulib +}: # Note: this package is used for bootstrapping fetchurl, and thus # cannot use fetchpatch! All mutable patches (generated by GitHub or @@ -45,6 +47,14 @@ stdenv.mkDerivation rec { '' + lib.optionalString stdenv.hostPlatform.isCygwin '' sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in + '' + + # This change to gettext's vendored copy of gnulib is already + # merged upstream; we can drop this patch on the next version + # bump. It must be applied twice because gettext vendors gnulib + # not once, but twice! + '' + patch -p2 -d gettext-tools/gnulib-lib/ < ${gnulib.passthru.longdouble-redirect-patch} + patch -p2 -d gettext-tools/libgrep/ < ${gnulib.passthru.longdouble-redirect-patch} ''; strictDeps = true; diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix index 8ad9c90ff7a..1c0c1b09e15 100644 --- a/pkgs/development/libraries/glibc/default.nix +++ b/pkgs/development/libraries/glibc/default.nix @@ -63,6 +63,13 @@ in # Same for musl: https://github.com/NixOS/nixpkgs/issues/78805 "-Wno-error=missing-attributes" ]) + (lib.optionals (stdenv.hostPlatform.isPower64) [ + # Do not complain about the Processor Specific ABI (i.e. the + # choice to use IEEE-standard `long double`). We pass this + # flag in order to mute a `-Werror=psabi` passed by glibc; + # hopefully future glibc releases will not pass that flag. + "-Wno-error=psabi" + ]) ]); }; diff --git a/pkgs/development/libraries/goffice/default.nix b/pkgs/development/libraries/goffice/default.nix index 36a9c79ea68..ece0f168ec5 100644 --- a/pkgs/development/libraries/goffice/default.nix +++ b/pkgs/development/libraries/goffice/default.nix @@ -27,7 +27,6 @@ stdenv.mkDerivation rec { buildInputs = [ libxslt librsvg ]; enableParallelBuilding = true; - doCheck = !stdenv.hostPlatform.isPower64; passthru = { updateScript = gnome.updateScript { diff --git a/pkgs/development/libraries/mpfr/default.nix b/pkgs/development/libraries/mpfr/default.nix index e0a33e27c12..aba3a413a66 100644 --- a/pkgs/development/libraries/mpfr/default.nix +++ b/pkgs/development/libraries/mpfr/default.nix @@ -28,9 +28,13 @@ stdenv.mkDerivation rec { # mpfr.h requires gmp.h propagatedBuildInputs = [ gmp ]; - configureFlags = - lib.optional stdenv.hostPlatform.isSunOS "--disable-thread-safe" ++ - lib.optional stdenv.hostPlatform.is64bit "--with-pic"; + configureFlags = lib.optional stdenv.hostPlatform.isSunOS "--disable-thread-safe" + ++ lib.optional stdenv.hostPlatform.is64bit "--with-pic" + ++ lib.optional stdenv.hostPlatform.isPower64 [ + # Without this, the `tget_set_d128` test experiences a link + # error due to missing `__dpd_trunctdkf`. + "--disable-decimal-float" + ]; doCheck = true; # not cross; diff --git a/pkgs/development/tools/gnulib/default.nix b/pkgs/development/tools/gnulib/default.nix index afc91cb6030..a55589c5a63 100644 --- a/pkgs/development/tools/gnulib/default.nix +++ b/pkgs/development/tools/gnulib/default.nix @@ -26,6 +26,17 @@ stdenv.mkDerivation { # do not change headers to not update all vendored build files dontFixup = true; + passthru = { + # This patch is used by multiple other packages (currently: + # gnused, gettext) which contain vendored copies of gnulib. + # Without it, compilation will fail with error messages about + # "__LDBL_REDIR1_DECL" or similar on platforms with longdouble + # redirects (currently powerpc64). Once all of those other + # packages make a release with a newer gnulib we can drop this + # patch. + longdouble-redirect-patch = ./gnulib-longdouble-redirect.patch; + }; + meta = with lib; { description = "Central location for code to be shared among GNU packages"; homepage = "https://www.gnu.org/software/gnulib/"; diff --git a/pkgs/development/tools/gnulib/gnulib-longdouble-redirect.patch b/pkgs/development/tools/gnulib/gnulib-longdouble-redirect.patch new file mode 100644 index 00000000000..f684292dc8b --- /dev/null +++ b/pkgs/development/tools/gnulib/gnulib-longdouble-redirect.patch @@ -0,0 +1,72 @@ + +Below is the subset of gnulib commit +776af40e09b476a41073131a90022572f448c189 which deals with long double +redirects. The rest of that commit has been removed. + +diff --git a/lib/cdefs.h b/lib/cdefs.h +index fd72b7b..4383e70 100644 +--- a/lib/cdefs.h ++++ b/lib/cdefs.h +@@ -483,7 +493,37 @@ + # include + #endif + +-#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH ++#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 ++# ifdef __REDIRECT ++ ++/* Alias name defined automatically. */ ++# define __LDBL_REDIR(name, proto) ... unused__ldbl_redir ++# define __LDBL_REDIR_DECL(name) \ ++ extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128")); ++ ++/* Alias name defined automatically, with leading underscores. */ ++# define __LDBL_REDIR2_DECL(name) \ ++ extern __typeof (__##name) __##name \ ++ __asm (__ASMNAME ("__" #name "ieee128")); ++ ++/* Alias name defined manually. */ ++# define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1 ++# define __LDBL_REDIR1_DECL(name, alias) \ ++ extern __typeof (name) name __asm (__ASMNAME (#alias)); ++ ++# define __LDBL_REDIR1_NTH(name, proto, alias) \ ++ __REDIRECT_NTH (name, proto, alias) ++# define __REDIRECT_NTH_LDBL(name, proto, alias) \ ++ __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128) ++ ++/* Unused. */ ++# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl ++# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth ++ ++# else ++_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform"); ++# endif ++#elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH + # define __LDBL_COMPAT 1 + # ifdef __REDIRECT + # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) +@@ -492,6 +532,8 @@ + # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) + # define __LDBL_REDIR_NTH(name, proto) \ + __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) ++# define __LDBL_REDIR2_DECL(name) \ ++ extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name)); + # define __LDBL_REDIR1_DECL(name, alias) \ + extern __typeof (name) name __asm (__ASMNAME (#alias)); + # define __LDBL_REDIR_DECL(name) \ +@@ -502,11 +544,13 @@ + __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) + # endif + #endif +-#if !defined __LDBL_COMPAT || !defined __REDIRECT ++#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \ ++ || !defined __REDIRECT + # define __LDBL_REDIR1(name, proto, alias) name proto + # define __LDBL_REDIR(name, proto) name proto + # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW + # define __LDBL_REDIR_NTH(name, proto) name proto __THROW ++# define __LDBL_REDIR2_DECL(name) + # define __LDBL_REDIR_DECL(name) + # ifdef __REDIRECT + # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) diff --git a/pkgs/development/tools/misc/texinfo/common.nix b/pkgs/development/tools/misc/texinfo/common.nix index af0d26fe1f3..51df8c555e6 100644 --- a/pkgs/development/tools/misc/texinfo/common.nix +++ b/pkgs/development/tools/misc/texinfo/common.nix @@ -1,6 +1,7 @@ { version, sha256, patches ? [] }: { lib, stdenv, buildPackages, fetchurl, perl, xz, libintl, bash +, gnulib # we are a dependency of gcc, this simplifies bootstraping , interactive ? false, ncurses, procps @@ -30,6 +31,12 @@ stdenv.mkDerivation { postPatch = '' patchShebangs tp/maintain + '' + # This patch is needed for IEEE-standard long doubles on + # powerpc64; it does not apply cleanly to texinfo 5.x or + # earlier. It is merged upstream in texinfo 6.8. + + lib.optionalString (with lib.strings; versionAtLeast version "6.0" && versionOlder version "6.8") '' + patch -p1 -d gnulib < ${gnulib.passthru.longdouble-redirect-patch} ''; # ncurses is required to build `makedoc' @@ -82,6 +89,8 @@ stdenv.mkDerivation { license = licenses.gpl3Plus; platforms = platforms.all; maintainers = with maintainers; [ vrthra oxij ]; + # see comment above in patches section + broken = stdenv.hostPlatform.isPower64 && lib.strings.versionOlder version "6.0"; longDescription = '' Texinfo is the official documentation format of the GNU project.