···1{ lib, targetPlatform }:
23let
4- p = targetPlatform.gcc or {}
05 // targetPlatform.parsed.abi;
6in lib.concatLists [
7 (lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64
···10 (lib.optional (p ? fpu) "--with-fpu=${p.fpu}")
11 (lib.optional (p ? float) "--with-float=${p.float}")
12 (lib.optional (p ? mode) "--with-mode=${p.mode}")
13- (lib.optional
14- (let tp = targetPlatform; in tp.isPower && tp.libc == "glibc" && tp.is64bit)
15- "--with-long-double-128")
0000000000016]
···1{ lib, targetPlatform }:
23let
4+ gcc = targetPlatform.gcc or {};
5+ p = gcc
6 // targetPlatform.parsed.abi;
7in lib.concatLists [
8 (lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64
···11 (lib.optional (p ? fpu) "--with-fpu=${p.fpu}")
12 (lib.optional (p ? float) "--with-float=${p.float}")
13 (lib.optional (p ? mode) "--with-mode=${p.mode}")
14+ (lib.optionals targetPlatform.isPower64
15+ # musl explicitly rejects 128-bit long double on
16+ # powerpc64; see musl/arch/powerpc64/bits/float.h
17+ (lib.optionals
18+ (!targetPlatform.isMusl
19+ && (targetPlatform.isLittleEndian ||
20+ # "... --with-long-double-format is only supported if the default cpu is power7 or newer"
21+ # https://github.com/NixOS/nixpkgs/pull/170215#issuecomment-1202164709
22+ (lib.lists.elem
23+ (lib.strings.substring 0 6 (p.cpu or ""))
24+ [ "power7" "power8" "power9" "power1"/*0, 11, etc*/ ]))) [
25+ "--with-long-double-128"
26+ "--with-long-double-format=${gcc.long-double-format or "ieee"}"
27+ ]))
28]
+11-1
pkgs/development/libraries/gettext/default.nix
···1-{ stdenv, lib, fetchurl, fetchpatch, libiconv, xz, bash }:
0023# Note: this package is used for bootstrapping fetchurl, and thus
4# cannot use fetchpatch! All mutable patches (generated by GitHub or
···45 '' + lib.optionalString stdenv.hostPlatform.isCygwin ''
46 sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
47 sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
0000000048 '';
4950 strictDeps = true;
···1+{ stdenv, lib, fetchurl, fetchpatch, libiconv, xz, bash
2+, gnulib
3+}:
45# Note: this package is used for bootstrapping fetchurl, and thus
6# cannot use fetchpatch! All mutable patches (generated by GitHub or
···47 '' + lib.optionalString stdenv.hostPlatform.isCygwin ''
48 sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
49 sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
50+ '' +
51+ # This change to gettext's vendored copy of gnulib is already
52+ # merged upstream; we can drop this patch on the next version
53+ # bump. It must be applied twice because gettext vendors gnulib
54+ # not once, but twice!
55+ ''
56+ patch -p2 -d gettext-tools/gnulib-lib/ < ${gnulib.passthru.longdouble-redirect-patch}
57+ patch -p2 -d gettext-tools/libgrep/ < ${gnulib.passthru.longdouble-redirect-patch}
58 '';
5960 strictDeps = true;
+7
pkgs/development/libraries/glibc/default.nix
···63 # Same for musl: https://github.com/NixOS/nixpkgs/issues/78805
64 "-Wno-error=missing-attributes"
65 ])
000000066 ]);
67 };
68
···63 # Same for musl: https://github.com/NixOS/nixpkgs/issues/78805
64 "-Wno-error=missing-attributes"
65 ])
66+ (lib.optionals (stdenv.hostPlatform.isPower64) [
67+ # Do not complain about the Processor Specific ABI (i.e. the
68+ # choice to use IEEE-standard `long double`). We pass this
69+ # flag in order to mute a `-Werror=psabi` passed by glibc;
70+ # hopefully future glibc releases will not pass that flag.
71+ "-Wno-error=psabi"
72+ ])
73 ]);
74 };
75
···28 # mpfr.h requires gmp.h
29 propagatedBuildInputs = [ gmp ];
3031+ configureFlags = lib.optional stdenv.hostPlatform.isSunOS "--disable-thread-safe"
32+ ++ lib.optional stdenv.hostPlatform.is64bit "--with-pic"
33+ ++ lib.optional stdenv.hostPlatform.isPower64 [
34+ # Without this, the `tget_set_d128` test experiences a link
35+ # error due to missing `__dpd_trunctdkf`.
36+ "--disable-decimal-float"
37+ ];
3839 doCheck = true; # not cross;
40
+11
pkgs/development/tools/gnulib/default.nix
···26 # do not change headers to not update all vendored build files
27 dontFixup = true;
280000000000029 meta = with lib; {
30 description = "Central location for code to be shared among GNU packages";
31 homepage = "https://www.gnu.org/software/gnulib/";
···26 # do not change headers to not update all vendored build files
27 dontFixup = true;
2829+ passthru = {
30+ # This patch is used by multiple other packages (currently:
31+ # gnused, gettext) which contain vendored copies of gnulib.
32+ # Without it, compilation will fail with error messages about
33+ # "__LDBL_REDIR1_DECL" or similar on platforms with longdouble
34+ # redirects (currently powerpc64). Once all of those other
35+ # packages make a release with a newer gnulib we can drop this
36+ # patch.
37+ longdouble-redirect-patch = ./gnulib-longdouble-redirect.patch;
38+ };
39+40 meta = with lib; {
41 description = "Central location for code to be shared among GNU packages";
42 homepage = "https://www.gnu.org/software/gnulib/";
···1+2+Below is the subset of gnulib commit
3+776af40e09b476a41073131a90022572f448c189 which deals with long double
4+redirects. The rest of that commit has been removed.
5+6+diff --git a/lib/cdefs.h b/lib/cdefs.h
7+index fd72b7b..4383e70 100644
8+--- a/lib/cdefs.h
9++++ b/lib/cdefs.h
10+@@ -483,7 +493,37 @@
11+ # include <bits/long-double.h>
12+ #endif
13+14+-#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
15++#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
16++# ifdef __REDIRECT
17++
18++/* Alias name defined automatically. */
19++# define __LDBL_REDIR(name, proto) ... unused__ldbl_redir
20++# define __LDBL_REDIR_DECL(name) \
21++ extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128"));
22++
23++/* Alias name defined automatically, with leading underscores. */
24++# define __LDBL_REDIR2_DECL(name) \
25++ extern __typeof (__##name) __##name \
26++ __asm (__ASMNAME ("__" #name "ieee128"));
27++
28++/* Alias name defined manually. */
29++# define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1
30++# define __LDBL_REDIR1_DECL(name, alias) \
31++ extern __typeof (name) name __asm (__ASMNAME (#alias));
32++
33++# define __LDBL_REDIR1_NTH(name, proto, alias) \
34++ __REDIRECT_NTH (name, proto, alias)
35++# define __REDIRECT_NTH_LDBL(name, proto, alias) \
36++ __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
37++
38++/* Unused. */
39++# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
40++# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
41++
42++# else
43++_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
44++# endif
45++#elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
46+ # define __LDBL_COMPAT 1
47+ # ifdef __REDIRECT
48+ # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
49+@@ -492,6 +532,8 @@
50+ # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
51+ # define __LDBL_REDIR_NTH(name, proto) \
52+ __LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
53++# define __LDBL_REDIR2_DECL(name) \
54++ extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name));
55+ # define __LDBL_REDIR1_DECL(name, alias) \
56+ extern __typeof (name) name __asm (__ASMNAME (#alias));
57+ # define __LDBL_REDIR_DECL(name) \
58+@@ -502,11 +544,13 @@
59+ __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
60+ # endif
61+ #endif
62+-#if !defined __LDBL_COMPAT || !defined __REDIRECT
63++#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
64++ || !defined __REDIRECT
65+ # define __LDBL_REDIR1(name, proto, alias) name proto
66+ # define __LDBL_REDIR(name, proto) name proto
67+ # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
68+ # define __LDBL_REDIR_NTH(name, proto) name proto __THROW
69++# define __LDBL_REDIR2_DECL(name)
70+ # define __LDBL_REDIR_DECL(name)
71+ # ifdef __REDIRECT
72+ # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
+9
pkgs/development/tools/misc/texinfo/common.nix
···1{ version, sha256, patches ? [] }:
23{ lib, stdenv, buildPackages, fetchurl, perl, xz, libintl, bash
045# we are a dependency of gcc, this simplifies bootstraping
6, interactive ? false, ncurses, procps
···3031 postPatch = ''
32 patchShebangs tp/maintain
00000033 '';
3435 # ncurses is required to build `makedoc'
···82 license = licenses.gpl3Plus;
83 platforms = platforms.all;
84 maintainers = with maintainers; [ vrthra oxij ];
008586 longDescription = ''
87 Texinfo is the official documentation format of the GNU project.
···1{ version, sha256, patches ? [] }:
23{ lib, stdenv, buildPackages, fetchurl, perl, xz, libintl, bash
4+, gnulib
56# we are a dependency of gcc, this simplifies bootstraping
7, interactive ? false, ncurses, procps
···3132 postPatch = ''
33 patchShebangs tp/maintain
34+ ''
35+ # This patch is needed for IEEE-standard long doubles on
36+ # powerpc64; it does not apply cleanly to texinfo 5.x or
37+ # earlier. It is merged upstream in texinfo 6.8.
38+ + lib.optionalString (with lib.strings; versionAtLeast version "6.0" && versionOlder version "6.8") ''
39+ patch -p1 -d gnulib < ${gnulib.passthru.longdouble-redirect-patch}
40 '';
4142 # ncurses is required to build `makedoc'
···89 license = licenses.gpl3Plus;
90 platforms = platforms.all;
91 maintainers = with maintainers; [ vrthra oxij ];
92+ # see comment above in patches section
93+ broken = stdenv.hostPlatform.isPower64 && lib.strings.versionOlder version "6.0";
9495 longDescription = ''
96 Texinfo is the official documentation format of the GNU project.