Skip to content

Commit 1b37e4b

Browse files
committed
ghc: 9.6.6-debian-binary for powerpc64le, too
Build on #439258 to bootstrap GHC on powerpc64le in the same way: using the Debian package. Move the conditionals in top-level/haskell-packages.nix to probe for support from the 9.6.6-debian-binary.nix package so it's easier to do the same thing for other architectures, too, should anyone else need it.
1 parent 92d40f8 commit 1b37e4b

2 files changed

Lines changed: 51 additions & 51 deletions

File tree

pkgs/development/compilers/ghc/9.6.6-debian-binary.nix

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,33 @@ let
2323
# GHC upstream doesn't release bindist tarballs for some platforms.
2424
# We're using Debian's binary package, and patching it into a usable-in-Nixpkgs state.
2525
ghcDebs = {
26+
powerpc64le-linux = {
27+
src = {
28+
urls = [
29+
"http://ftp.debian.org/debian/pool/main/g/ghc/ghc_9.6.6-4_ppc64el.deb"
30+
];
31+
sha256 = "6dd14937485831c72aef62851c4251f2afa2c7a06a2d4956e25a1f82ab195a01";
32+
};
33+
exePathForLibraryCheck = null;
34+
archSpecificLibraries = [
35+
{
36+
nixPackage = gmp;
37+
fileToCheckFor = null;
38+
}
39+
{
40+
nixPackage = ncurses6;
41+
fileToCheckFor = "libtinfo.so.6";
42+
}
43+
{
44+
nixPackage = numactl;
45+
fileToCheckFor = null;
46+
}
47+
{
48+
nixPackage = libffi;
49+
fileToCheckFor = null;
50+
}
51+
];
52+
};
2653
powerpc64-linux = {
2754
src = {
2855
urls = [
@@ -191,11 +218,11 @@ stdenv.mkDerivation (finalAttrs: {
191218
# Patch ghc settings
192219
+ ''
193220
substituteInPlace $out/lib/ghc/lib/settings \
194-
--replace-fail powerpc64-linux-gnu-gcc gcc \
195-
--replace-fail powerpc64-linux-gnu-g++ g++ \
196-
--replace-fail powerpc64-linux-gnu-ld ld \
197-
--replace-fail powerpc64-linux-gnu-ar ar \
198-
--replace-fail powerpc64-linux-gnu-ranlib ranlib \
221+
--replace-fail ${stdenv.hostPlatform.system}-gnu-gcc gcc \
222+
--replace-fail ${stdenv.hostPlatform.system}-gnu-g++ g++ \
223+
--replace-fail ${stdenv.hostPlatform.system}-gnu-ld ld \
224+
--replace-fail ${stdenv.hostPlatform.system}-gnu-ar ar \
225+
--replace-fail ${stdenv.hostPlatform.system}-gnu-ranlib ranlib \
199226
--replace-fail llc-18 llc \
200227
--replace-fail opt-18 opt
201228
'';

pkgs/top-level/haskell-packages.nix

Lines changed: 19 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
newScope,
77
stdenv,
88
config,
9+
lib,
910
}:
1011

1112
let
@@ -89,6 +90,14 @@ in
8990
compiler = pkgs.lib.recurseIntoAttrs (
9091
let
9192
bb = pkgsBuildBuild.haskell;
93+
94+
# No bindist, "borrowing" the GHC from Debian
95+
useDebianBinaryOr =
96+
pkg:
97+
if lib.meta.availableOn stdenv.hostPlatform bb.packages.ghc966DebianBinary.ghc then
98+
bb.packages.ghc966DebianBinary
99+
else
100+
pkg;
92101
in
93102
{
94103
# Required to bootstrap 9.4.8.
@@ -110,67 +119,31 @@ in
110119
inherit buildTargetLlvmPackages llvmPackages;
111120
};
112121
ghc967 = callPackage ../development/compilers/ghc/9.6.7.nix {
113-
bootPkgs =
114-
if
115-
stdenv.buildPlatform.isPower64
116-
&& stdenv.buildPlatform.isBigEndian
117-
&& pkgs.stdenv.hostPlatform.isAbiElfv1
118-
then
119-
# No bindist, "borrowing" the GHC from Debian
120-
bb.packages.ghc966DebianBinary
121-
else
122-
bb.packages.ghc948;
122+
bootPkgs = useDebianBinaryOr bb.packages.ghc948;
123123
inherit (buildPackages.python3Packages) sphinx;
124124
inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
125125
inherit buildTargetLlvmPackages llvmPackages;
126126
};
127127
ghc984 = callPackage ../development/compilers/ghc/9.8.4.nix {
128-
bootPkgs =
129-
if
130-
stdenv.buildPlatform.isPower64
131-
&& stdenv.buildPlatform.isBigEndian
132-
&& pkgs.stdenv.hostPlatform.isAbiElfv1
133-
then
134-
# No bindist, "borrowing" the GHC from Debian
135-
bb.packages.ghc966DebianBinary
136-
else if stdenv.buildPlatform.isi686 then
137-
bb.packages.ghc948
138-
else
139-
bb.packages.ghc984Binary;
128+
bootPkgs = useDebianBinaryOr (
129+
if stdenv.buildPlatform.isi686 then bb.packages.ghc948 else bb.packages.ghc984Binary
130+
);
140131
inherit (buildPackages.python3Packages) sphinx;
141132
inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
142133
inherit buildTargetLlvmPackages llvmPackages;
143134
};
144135
ghc9102 = callPackage ../development/compilers/ghc/9.10.2.nix {
145-
bootPkgs =
146-
if
147-
stdenv.buildPlatform.isPower64
148-
&& stdenv.buildPlatform.isBigEndian
149-
&& pkgs.stdenv.hostPlatform.isAbiElfv1
150-
then
151-
# No bindist, "borrowing" the GHC from Debian
152-
bb.packages.ghc966DebianBinary
153-
else if stdenv.buildPlatform.isi686 then
154-
bb.packages.ghc967
155-
else
156-
bb.packages.ghc984Binary;
136+
bootPkgs = useDebianBinaryOr (
137+
if stdenv.buildPlatform.isi686 then bb.packages.ghc967 else bb.packages.ghc984Binary
138+
);
157139
inherit (buildPackages.python3Packages) sphinx;
158140
inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
159141
inherit buildTargetLlvmPackages llvmPackages;
160142
};
161143
ghc9103 = callPackage ../development/compilers/ghc/9.10.3.nix {
162-
bootPkgs =
163-
if
164-
stdenv.buildPlatform.isPower64
165-
&& stdenv.buildPlatform.isBigEndian
166-
&& pkgs.stdenv.hostPlatform.isAbiElfv1
167-
then
168-
# No bindist, "borrowing" the GHC from Debian
169-
bb.packages.ghc966DebianBinary
170-
else if stdenv.buildPlatform.isi686 then
171-
bb.packages.ghc967
172-
else
173-
bb.packages.ghc984Binary;
144+
bootPkgs = useDebianBinaryOr (
145+
if stdenv.buildPlatform.isi686 then bb.packages.ghc967 else bb.packages.ghc984Binary
146+
);
174147
inherit (buildPackages.python3Packages) sphinx;
175148
inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
176149
inherit buildTargetLlvmPackages llvmPackages;

0 commit comments

Comments
 (0)