Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions pkgs/development/haskell-modules/generic-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ let
in

{ pname
, dontStrip ? (ghc.isGhcjs or false)
# Note that ghc.isGhcjs != stdenv.hostPlatform.isGhcjs.
# ghc.isGhcjs implies that we are using ghcjs, a project separate from GHC.
# (mere) stdenv.hostPlatform.isGhcjs means that we are using GHC's JavaScript
# backend. The latter is a normal cross compilation backend and needs little
# special accomodation.
, dontStrip ? (ghc.isGhcjs or false || stdenv.hostPlatform.isGhcjs)
, version, revision ? null
, sha256 ? null
, src ? fetchurl { url = "mirror://hackage/${pname}-${version}.tar.gz"; inherit sha256; }
Expand Down Expand Up @@ -171,7 +176,7 @@ let
# Pass the "wrong" C compiler rather than none at all so packages that just
# use the C preproccessor still work, see
# https://github.com/haskell/cabal/issues/6466 for details.
"--with-gcc=${(if stdenv.hasCC then stdenv else buildPackages.stdenv).cc.targetPrefix}cc"
"--with-gcc=${if stdenv.hasCC then "$CC" else "$CC_FOR_BUILD"}"
] ++ optionals stdenv.hasCC [
"--with-ld=${stdenv.cc.bintools.targetPrefix}ld"
"--with-ar=${stdenv.cc.bintools.targetPrefix}ar"
Expand Down Expand Up @@ -246,7 +251,10 @@ let
allPkgconfigDepends = pkg-configDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;

depsBuildBuild = [ nativeGhc ];
depsBuildBuild = [ nativeGhc ]
# CC_FOR_BUILD may be necessary if we have no C preprocessor for the host
# platform. See crossCabalFlags above for more details.
++ lib.optionals (!stdenv.hasCC) [ buildPackages.stdenv.cc ];
collectedToolDepends =
buildTools ++ libraryToolDepends ++ executableToolDepends ++
optionals doCheck testToolDepends ++
Expand Down Expand Up @@ -316,7 +324,9 @@ stdenv.mkDerivation ({
inherit src;

inherit depsBuildBuild nativeBuildInputs;
buildInputs = otherBuildInputs ++ optionals (!isLibrary) propagatedBuildInputs;
buildInputs = otherBuildInputs ++ optionals (!isLibrary) propagatedBuildInputs
# For patchShebangsAuto in fixupPhase
++ optionals stdenv.hostPlatform.isGhcjs [ nodejs ];
propagatedBuildInputs = optionals isLibrary propagatedBuildInputs;

LANG = "en_US.UTF-8"; # GHC needs the locale configured during the Haddock phase.
Expand Down
11 changes: 7 additions & 4 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14550,10 +14550,13 @@ with pkgs;
haskell = callPackage ./haskell-packages.nix { };

haskellPackages = dontRecurseIntoAttrs
# Prefer native-bignum to avoid linking issues with gmp
(if stdenv.hostPlatform.isStatic
then haskell.packages.native-bignum.ghc92
else haskell.packages.ghc92);
# JS backend is only available for GHC >= 9.6
(if stdenv.hostPlatform.isGhcjs
then haskell.packages.native-bignum.ghcHEAD
# Prefer native-bignum to avoid linking issues with gmp
else if stdenv.hostPlatform.isStatic
then haskell.packages.native-bignum.ghc92
else haskell.packages.ghc92);

# haskellPackages.ghc is build->host (it exposes the compiler used to build the
# set, similarly to stdenv.cc), but pkgs.ghc should be host->target to be more
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/release-cross.nix
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ in
/* Javacript */
ghcjs = mapTestOnCross lib.systems.examples.ghcjs {
haskell.packages.ghcjs.hello = nativePlatforms;
haskell.packages.native-bignum.ghcHEAD.hello = nativePlatforms;
haskellPackages.hello = nativePlatforms;
};

/* Linux on Raspberrypi */
Expand Down
7 changes: 7 additions & 0 deletions pkgs/top-level/release-haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,13 @@ let
;
};
};

pkgsCross.ghcjs.haskellPackages = {
inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskellPackages)
ghc
hello
;
};
})
(versionedCompilerJobs {
# Packages which should be checked on more than the
Expand Down