mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
ghcWithPackages: expose targetPrefix; tests.haskell.ghcWithPackages: verify -fllvm works with useLLVM (#441471)
This commit is contained in:
@@ -178,7 +178,7 @@ else
|
||||
+ postBuild;
|
||||
preferLocalBuild = true;
|
||||
passthru = {
|
||||
inherit (ghc) version meta;
|
||||
inherit (ghc) version meta targetPrefix;
|
||||
|
||||
hoogle = hoogleWithPackages';
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
runCommand,
|
||||
runCommandCC,
|
||||
haskellPackages,
|
||||
}:
|
||||
|
||||
@@ -21,16 +22,19 @@ lib.recurseIntoAttrs {
|
||||
|
||||
# See: https://github.com/NixOS/nixpkgs/pull/224542
|
||||
regression-224542 =
|
||||
let
|
||||
ghc = haskellPackages.ghcWithPackages (hsPkgs: [
|
||||
hsPkgs.hspec
|
||||
]);
|
||||
in
|
||||
runCommand "regression-224542"
|
||||
{
|
||||
buildInputs = [
|
||||
(haskellPackages.ghcWithPackages (hsPkgs: [
|
||||
hsPkgs.hspec
|
||||
]))
|
||||
nativeBuildInputs = [
|
||||
ghc
|
||||
];
|
||||
}
|
||||
''
|
||||
ghc --interactive \
|
||||
${ghc.targetPrefix}ghc --interactive \
|
||||
-Werror=unrecognised-warning-flags \
|
||||
-Werror=missed-extra-shared-lib \
|
||||
2>&1 \
|
||||
@@ -45,4 +49,21 @@ lib.recurseIntoAttrs {
|
||||
|
||||
touch $out
|
||||
'';
|
||||
|
||||
use-llvm =
|
||||
let
|
||||
ghc = (haskellPackages.ghcWithPackages.override { useLLVM = true; }) (_: [ ]);
|
||||
in
|
||||
runCommandCC "ghc-with-packages-use-llvm"
|
||||
{
|
||||
nativeBuildInputs = [ ghc ];
|
||||
}
|
||||
''
|
||||
echo 'main = pure ()' > test.hs
|
||||
# -ddump-llvm is unnecessary, but nice for visual feedback in the build log
|
||||
${ghc.targetPrefix}ghc --make -fllvm -keep-llvm-files -ddump-llvm test.hs
|
||||
# Did we actually use the LLVM backend?
|
||||
test -f test.ll
|
||||
touch $out
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user