on iko/ghcjs-patch-master help sign in
Fix libnuma dependency in rts.conf (#1342)
commit18ebf60137dd2ff1be7363eb46f67ebfa366d1dd authorCheng Shao <astrohavoc@gmail.com> dateTue 15 Feb 2022, 11:49 (5 years ago) parent90a0cf6
3 files changed+17−4
builder/comp-builder.nix+1−1 compiler/ghc/default.nix+14−1 test/with-packages/default.nix+2−2
builder/comp-builder.nix+1−1
@@ -1,4 +1,4 @@
1−{ pkgs, stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, haddockBuilder, ghcForComponent, hsPkgs, compiler, runCommand, libffi, gmp, zlib, ncurses, numactl, nodejs }@defaults:
1+{ pkgs, stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, haddockBuilder, ghcForComponent, hsPkgs, compiler, runCommand, libffi, gmp, zlib, ncurses, nodejs }@defaults:
22lib.makeOverridable (
33let self =
44{ componentId
compiler/ghc/default.nix+14−1
@@ -90,6 +90,8 @@ let
9090
9191 targetIconv = targetPackages.libiconv or libiconv;
9292
93+ targetNumactl = targetPackages.numactl or numactl;
94+
9395 # TODO(@Ericson2314) Make unconditional
9496 targetPrefix = lib.optionalString
9597 (targetPlatform != hostPlatform)
@@ -259,7 +261,18 @@ stdenv.mkDerivation (rec {
259261 ++ lib.optional stdenv.targetPlatform.isAarch32 "pic"
260262 ++ lib.optional stdenv.targetPlatform.isMusl "pie";
261263
262− postInstall = ''
264+ postInstall = lib.optionalString (enableNUMA && targetPlatform.isLinux) ''
265+ # Patch rts.conf to ensure libnuma can be found
266+
267+ for file in $(find "$out/lib" -name "rts*.conf"); do
268+ if grep -q numa $file; then
269+ substituteInPlace $file \
270+ --replace "library-dirs:" "library-dirs: ${targetNumactl}/lib" \
271+ --replace "include-dirs:" "include-dirs: ${targetNumactl}/include"
272+ "$out/bin/${targetPrefix}ghc-pkg" recache
273+ fi
274+ done
275+ '' + ''
263276 # Install the bash completion file.
264277 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
265278
test/with-packages/default.nix+2−2
@@ -1,4 +1,4 @@
1−{ stdenv, lib, numactl, util, mkPkgSet, recurseIntoAttrs, testSrc, compiler-nix-name }:
1+{ stdenv, lib, util, mkPkgSet, recurseIntoAttrs, testSrc, compiler-nix-name }:
22
33with lib;
44with util;
@@ -33,7 +33,7 @@ let
3333
3434 pkgId = p: "${p.identifier.name}-${p.identifier.version}";
3535 showDepends = component: concatMapStringsSep " " pkgId (component.depends or []);
36− extraFlags = if stdenv.isLinux then "-L${numactl}/lib" else "";
36+ extraFlags = "";
3737
3838in recurseIntoAttrs {
3939 meta.disabled = compiler-nix-name != "ghc865";