···11{ lib, targetPlatform }:
2233let
44- p = targetPlatform.gcc or {}
44+ gcc = targetPlatform.gcc or {};
55+ p = gcc
56 // targetPlatform.parsed.abi;
67in lib.concatLists [
78 (lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64
···1011 (lib.optional (p ? fpu) "--with-fpu=${p.fpu}")
1112 (lib.optional (p ? float) "--with-float=${p.float}")
1213 (lib.optional (p ? mode) "--with-mode=${p.mode}")
1313- (lib.optional
1414- (let tp = targetPlatform; in tp.isPower && tp.libc == "glibc" && tp.is64bit)
1515- "--with-long-double-128")
1414+ (lib.optionals targetPlatform.isPower64
1515+ # musl explicitly rejects 128-bit long double on
1616+ # powerpc64; see musl/arch/powerpc64/bits/float.h
1717+ (lib.optionals
1818+ (!targetPlatform.isMusl
1919+ && (targetPlatform.isLittleEndian ||
2020+ # "... --with-long-double-format is only supported if the default cpu is power7 or newer"
2121+ # https://github.com/NixOS/nixpkgs/pull/170215#issuecomment-1202164709
2222+ (lib.lists.elem
2323+ (lib.strings.substring 0 6 (p.cpu or ""))
2424+ [ "power7" "power8" "power9" "power1"/*0, 11, etc*/ ]))) [
2525+ "--with-long-double-128"
2626+ "--with-long-double-format=${gcc.long-double-format or "ieee"}"
2727+ ]))
1628]
+11-1
pkgs/development/libraries/gettext/default.nix
···11-{ stdenv, lib, fetchurl, fetchpatch, libiconv, xz, bash }:
11+{ stdenv, lib, fetchurl, fetchpatch, libiconv, xz, bash
22+, gnulib
33+}:
2435# Note: this package is used for bootstrapping fetchurl, and thus
46# cannot use fetchpatch! All mutable patches (generated by GitHub or
···4547 '' + lib.optionalString stdenv.hostPlatform.isCygwin ''
4648 sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
4749 sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
5050+ '' +
5151+ # This change to gettext's vendored copy of gnulib is already
5252+ # merged upstream; we can drop this patch on the next version
5353+ # bump. It must be applied twice because gettext vendors gnulib
5454+ # not once, but twice!
5555+ ''
5656+ patch -p2 -d gettext-tools/gnulib-lib/ < ${gnulib.passthru.longdouble-redirect-patch}
5757+ patch -p2 -d gettext-tools/libgrep/ < ${gnulib.passthru.longdouble-redirect-patch}
4858 '';
49595060 strictDeps = true;
+7
pkgs/development/libraries/glibc/default.nix
···6363 # Same for musl: https://github.com/NixOS/nixpkgs/issues/78805
6464 "-Wno-error=missing-attributes"
6565 ])
6666+ (lib.optionals (stdenv.hostPlatform.isPower64) [
6767+ # Do not complain about the Processor Specific ABI (i.e. the
6868+ # choice to use IEEE-standard `long double`). We pass this
6969+ # flag in order to mute a `-Werror=psabi` passed by glibc;
7070+ # hopefully future glibc releases will not pass that flag.
7171+ "-Wno-error=psabi"
7272+ ])
6673 ]);
6774 };
6875
···2828 # mpfr.h requires gmp.h
2929 propagatedBuildInputs = [ gmp ];
30303131- configureFlags =
3232- lib.optional stdenv.hostPlatform.isSunOS "--disable-thread-safe" ++
3333- lib.optional stdenv.hostPlatform.is64bit "--with-pic";
3131+ configureFlags = lib.optional stdenv.hostPlatform.isSunOS "--disable-thread-safe"
3232+ ++ lib.optional stdenv.hostPlatform.is64bit "--with-pic"
3333+ ++ lib.optional stdenv.hostPlatform.isPower64 [
3434+ # Without this, the `tget_set_d128` test experiences a link
3535+ # error due to missing `__dpd_trunctdkf`.
3636+ "--disable-decimal-float"
3737+ ];
34383539 doCheck = true; # not cross;
3640
+11
pkgs/development/tools/gnulib/default.nix
···2626 # do not change headers to not update all vendored build files
2727 dontFixup = true;
28282929+ passthru = {
3030+ # This patch is used by multiple other packages (currently:
3131+ # gnused, gettext) which contain vendored copies of gnulib.
3232+ # Without it, compilation will fail with error messages about
3333+ # "__LDBL_REDIR1_DECL" or similar on platforms with longdouble
3434+ # redirects (currently powerpc64). Once all of those other
3535+ # packages make a release with a newer gnulib we can drop this
3636+ # patch.
3737+ longdouble-redirect-patch = ./gnulib-longdouble-redirect.patch;
3838+ };
3939+2940 meta = with lib; {
3041 description = "Central location for code to be shared among GNU packages";
3142 homepage = "https://www.gnu.org/software/gnulib/";
···11+22+Below is the subset of gnulib commit
33+776af40e09b476a41073131a90022572f448c189 which deals with long double
44+redirects. The rest of that commit has been removed.
55+66+diff --git a/lib/cdefs.h b/lib/cdefs.h
77+index fd72b7b..4383e70 100644
88+--- a/lib/cdefs.h
99++++ b/lib/cdefs.h
1010+@@ -483,7 +493,37 @@
1111+ # include <bits/long-double.h>
1212+ #endif
1313+1414+-#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
1515++#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
1616++# ifdef __REDIRECT
1717++
1818++/* Alias name defined automatically. */
1919++# define __LDBL_REDIR(name, proto) ... unused__ldbl_redir
2020++# define __LDBL_REDIR_DECL(name) \
2121++ extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128"));
2222++
2323++/* Alias name defined automatically, with leading underscores. */
2424++# define __LDBL_REDIR2_DECL(name) \
2525++ extern __typeof (__##name) __##name \
2626++ __asm (__ASMNAME ("__" #name "ieee128"));
2727++
2828++/* Alias name defined manually. */
2929++# define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1
3030++# define __LDBL_REDIR1_DECL(name, alias) \
3131++ extern __typeof (name) name __asm (__ASMNAME (#alias));
3232++
3333++# define __LDBL_REDIR1_NTH(name, proto, alias) \
3434++ __REDIRECT_NTH (name, proto, alias)
3535++# define __REDIRECT_NTH_LDBL(name, proto, alias) \
3636++ __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
3737++
3838++/* Unused. */
3939++# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
4040++# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
4141++
4242++# else
4343++_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
4444++# endif
4545++#elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
4646+ # define __LDBL_COMPAT 1
4747+ # ifdef __REDIRECT
4848+ # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
4949+@@ -492,6 +532,8 @@
5050+ # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
5151+ # define __LDBL_REDIR_NTH(name, proto) \
5252+ __LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
5353++# define __LDBL_REDIR2_DECL(name) \
5454++ extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name));
5555+ # define __LDBL_REDIR1_DECL(name, alias) \
5656+ extern __typeof (name) name __asm (__ASMNAME (#alias));
5757+ # define __LDBL_REDIR_DECL(name) \
5858+@@ -502,11 +544,13 @@
5959+ __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
6060+ # endif
6161+ #endif
6262+-#if !defined __LDBL_COMPAT || !defined __REDIRECT
6363++#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
6464++ || !defined __REDIRECT
6565+ # define __LDBL_REDIR1(name, proto, alias) name proto
6666+ # define __LDBL_REDIR(name, proto) name proto
6767+ # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
6868+ # define __LDBL_REDIR_NTH(name, proto) name proto __THROW
6969++# define __LDBL_REDIR2_DECL(name)
7070+ # define __LDBL_REDIR_DECL(name)
7171+ # ifdef __REDIRECT
7272+ # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
+9
pkgs/development/tools/misc/texinfo/common.nix
···11{ version, sha256, patches ? [] }:
2233{ lib, stdenv, buildPackages, fetchurl, perl, xz, libintl, bash
44+, gnulib
4556# we are a dependency of gcc, this simplifies bootstraping
67, interactive ? false, ncurses, procps
···30313132 postPatch = ''
3233 patchShebangs tp/maintain
3434+ ''
3535+ # This patch is needed for IEEE-standard long doubles on
3636+ # powerpc64; it does not apply cleanly to texinfo 5.x or
3737+ # earlier. It is merged upstream in texinfo 6.8.
3838+ + lib.optionalString (with lib.strings; versionAtLeast version "6.0" && versionOlder version "6.8") ''
3939+ patch -p1 -d gnulib < ${gnulib.passthru.longdouble-redirect-patch}
3340 '';
34413542 # ncurses is required to build `makedoc'
···8289 license = licenses.gpl3Plus;
8390 platforms = platforms.all;
8491 maintainers = with maintainers; [ vrthra oxij ];
9292+ # see comment above in patches section
9393+ broken = stdenv.hostPlatform.isPower64 && lib.strings.versionOlder version "6.0";
85948695 longDescription = ''
8796 Texinfo is the official documentation format of the GNU project.