treewide: drop GHCJS specific code

This affects haskelPackages.mkDerivation, ghcWithPackages and
hoogleWithPackages which means that it is not possible to re-introduce
a ghcjs derivation downstream and create a ghcjs package set with an up
to date Nixpkgs.

Changed files
+38 -86
doc
release-notes
pkgs
+1 -1
doc/release-notes/rl-2511.section.md
···
- `conduwuit` was removed due to upstream ceasing development and deleting their repository. For existing data, a migration to `matrix-conduit`, `matrix-continuwuity` or `matrix-tuwunel` may be possible.
-
- The GHCJS 8.10.7, exposed via `haskell.compiler.ghcjs` and `haskell.compiler.ghcjs810`, has been removed. Downstream users should migrate their projects to the new JavaScript backend of GHC proper which can be used via `pkgsCross.ghcjs` from Nixpkgs.
+
- The GHCJS 8.10.7, exposed via `haskell.compiler.ghcjs` and `haskell.compiler.ghcjs810`, has been removed. Downstream users should migrate their projects to the new JavaScript backend of GHC proper which can be used via `pkgsCross.ghcjs` from Nixpkgs. Haskell packaging code, like `haskellPackages.mkDerivation`, `ghcWithPackages` and `hoogleWithPackages`, also no longer supports GHCJS.
- The `ghcInfo` and `controlPhases` functions have been removed from `haskell.lib.compose` and `haskell.lib`. They were unused and would return incorrect results.
+6 -27
pkgs/development/haskell-modules/generic-builder.nix
···
let
isCross = stdenv.buildPlatform != stdenv.hostPlatform;
-
# 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 accommodation.
-
outputsJS = ghc.isGhcjs or false || stdenv.hostPlatform.isGhcjs;
-
# 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.
···
{
pname,
-
dontStrip ? outputsJS,
+
dontStrip ? stdenv.hostPlatform.isGhcjs,
version,
revision ? null,
sha256 ? null,
···
doHaddockQuickjump ? doHoogle,
doInstallIntermediates ? false,
editedCabalFile ? null,
-
enableLibraryProfiling ? !outputsJS,
+
enableLibraryProfiling ? !stdenv.hostPlatform.isGhcjs,
enableExecutableProfiling ? false,
profilingDetail ? "exported-functions",
# TODO enable shared libs for cross-compiling
···
&& (ghc.enableShared or false)
&& !stdenv.hostPlatform.useAndroidPrebuilt, # TODO: figure out why /build leaks into RPATH
enableDeadCodeElimination ? (!stdenv.hostPlatform.isDarwin), # TODO: use -dead_strip for darwin
-
# Disabling this for ghcjs prevents this crash: https://gitlab.haskell.org/ghc/ghc/-/issues/23235
+
# Disabling this for JS prevents this crash: https://gitlab.haskell.org/ghc/ghc/-/issues/23235
enableStaticLibraries ?
!(stdenv.hostPlatform.isWindows || stdenv.hostPlatform.isWasm || stdenv.hostPlatform.isGhcjs),
enableHsc2hsViaAsm ? stdenv.hostPlatform.isWindows,
···
optionalAttrs
;
-
isGhcjs = ghc.isGhcjs or false;
isHaLVM = ghc.isHaLVM or false;
# GHC used for building Setup.hs
#
# Same as our GHC, unless we're cross, in which case it is native GHC with the
-
# same version, or ghcjs, in which case its the ghc used to build ghcjs.
+
# same version.
nativeGhc = buildHaskellPackages.ghc;
# the target dir for haddock documentation
···
(enableFeature (!dontStrip) "library-stripping")
(enableFeature (!dontStrip) "executable-stripping")
]
-
++ optionals isGhcjs [
-
"--ghcjs"
-
]
++ optionals isCross (
[
"--configure-option=--host=${stdenv.hostPlatform.config}"
···
setupCommand = "./Setup";
-
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
+
ghcCommand' = "ghc";
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
ghcNameWithPrefix = "${ghc.targetPrefix}${ghc.haskellCompilerName}";
···
intermediatesDir = "share/haskell/${ghc.version}/${pname}-${version}/dist";
-
# On old ghcjs, the jsexe directories are the output but on the js backend they seem to be treated as intermediates
jsexe = rec {
-
shouldUseNode = isGhcjs;
shouldAdd = stdenv.hostPlatform.isGhcjs && isExecutable;
shouldCopy = shouldAdd && !doInstallIntermediates;
shouldSymlink = shouldAdd && doInstallIntermediates;
···
''
}
-
${optionalString jsexe.shouldUseNode ''
-
for exeDir in "${binDir}/"*.jsexe; do
-
exe="''${exeDir%.jsexe}"
-
printWords '#!${nodejs}/bin/node' > "$exe"
-
echo >> "$exe"
-
cat "$exeDir/all.js" >> "$exe"
-
chmod +x "$exe"
-
done
-
''}
+
${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"}
${optionalString jsexe.shouldCopy ''
+3 -13
pkgs/development/haskell-modules/hoogle.nix
···
packages = selectPackages haskellPackages;
wrapper = ./hoogle-local-wrapper.sh;
-
isGhcjs = ghc.isGhcjs or false;
-
opts = lib.optionalString;
-
haddockExe = if !isGhcjs then "haddock" else "haddock-ghcjs";
-
ghcDocLibDir = if !isGhcjs then ghc.doc + "/share/doc/ghc*/html/libraries" else ghc + "/doc/lib";
-
# On GHCJS, use a stripped down version of GHC's prologue.txt
-
prologue =
-
if !isGhcjs then
-
"${ghcDocLibDir}/prologue.txt"
-
else
-
writeText "ghcjs-prologue.txt" ''
-
This index includes documentation for many Haskell modules.
-
'';
+
haddockExe = "haddock";
+
ghcDocLibDir = ghc.doc + "/share/doc/ghc*/html/libraries";
+
prologue = "${ghcDocLibDir}/prologue.txt";
docPackages =
lib.closePropagation
···
echo importing builtin packages
for docdir in ${ghcDocLibDir}"/"*; do
name="$(basename $docdir)"
-
${opts isGhcjs ''docdir="$docdir/html"''}
if [[ -d $docdir ]]; then
ln -sfn $docdir $out/share/doc/hoogle/$name
fi
+28 -45
pkgs/development/haskell-modules/with-packages-wrapper.nix
···
installDocumentation ? true,
hoogleWithPackages,
postBuild ? "",
-
ghcLibdir ? null, # only used by ghcjs, when resolving plugins
}:
# This argument is a function which selects a list of Haskell packages from any
···
packages = selectPackages haskellPackages ++ [ hoogleWithPackages' ];
-
isGhcjs = ghc.isGhcjs or false;
isHaLVM = ghc.isHaLVM or false;
-
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
+
ghcCommand' = "ghc";
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
ghcCommandCaps = lib.toUpper ghcCommand';
libDir =
···
);
in
-
assert ghcLibdir != null -> (ghc.isGhcjs or false);
-
if paths == [ ] && !useLLVM then
ghc
else
···
--set "NIX_${ghcCommandCaps}PKG" "$out/bin/${ghcCommand}-pkg" \
--set "NIX_${ghcCommandCaps}_DOCDIR" "${docDir}" \
--set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}" \
-
${
-
lib.optionalString (ghc.isGhcjs or false) ''--set NODE_PATH "${ghc.socket-io}/lib/node_modules"''
-
} \
${lib.optionalString useLLVM ''--prefix "PATH" ":" "${llvm}"''}
fi
done
···
fi
''
-
+ (lib.optionalString (stdenv.targetPlatform.isDarwin && !isGhcjs && !stdenv.targetPlatform.isiOS)
-
''
-
# Work around a linker limit in macOS Sierra (see generic-builder.nix):
-
local packageConfDir="${packageCfgDir}";
-
local dynamicLinksDir="$out/lib/links";
-
mkdir -p $dynamicLinksDir
-
# Clean up the old links that may have been (transitively) included by
-
# symlinkJoin:
-
rm -f $dynamicLinksDir/*
+
+ (lib.optionalString (stdenv.targetPlatform.isDarwin && !stdenv.targetPlatform.isiOS) ''
+
# Work around a linker limit in macOS Sierra (see generic-builder.nix):
+
local packageConfDir="${packageCfgDir}";
+
local dynamicLinksDir="$out/lib/links";
+
mkdir -p $dynamicLinksDir
+
# Clean up the old links that may have been (transitively) included by
+
# symlinkJoin:
+
rm -f $dynamicLinksDir/*
-
dynamicLibraryDirs=()
+
dynamicLibraryDirs=()
-
for pkg in $($out/bin/ghc-pkg list --simple-output); do
-
dynamicLibraryDirs+=($($out/bin/ghc-pkg --simple-output field "$pkg" dynamic-library-dirs))
-
done
+
for pkg in $($out/bin/ghc-pkg list --simple-output); do
+
dynamicLibraryDirs+=($($out/bin/ghc-pkg --simple-output field "$pkg" dynamic-library-dirs))
+
done
-
for dynamicLibraryDir in $(echo "''${dynamicLibraryDirs[@]}" | tr ' ' '\n' | sort -u); do
-
echo "Linking $dynamicLibraryDir/*.dylib from $dynamicLinksDir"
-
find "$dynamicLibraryDir" -name '*.dylib' -exec ln -s {} "$dynamicLinksDir" \;
-
done
+
for dynamicLibraryDir in $(echo "''${dynamicLibraryDirs[@]}" | tr ' ' '\n' | sort -u); do
+
echo "Linking $dynamicLibraryDir/*.dylib from $dynamicLinksDir"
+
find "$dynamicLibraryDir" -name '*.dylib' -exec ln -s {} "$dynamicLinksDir" \;
+
done
-
for f in $packageConfDir/*.conf; do
-
# Initially, $f is a symlink to a read-only file in one of the inputs
-
# (as a result of this symlinkJoin derivation).
-
# Replace it with a copy whose dynamic-library-dirs points to
-
# $dynamicLinksDir
-
cp $f $f-tmp
-
rm $f
-
sed "N;s,dynamic-library-dirs:\s*.*\n,dynamic-library-dirs: $dynamicLinksDir\n," $f-tmp > $f
-
rm $f-tmp
-
done
-
''
-
)
+
for f in $packageConfDir/*.conf; do
+
# Initially, $f is a symlink to a read-only file in one of the inputs
+
# (as a result of this symlinkJoin derivation).
+
# Replace it with a copy whose dynamic-library-dirs points to
+
# $dynamicLinksDir
+
cp $f $f-tmp
+
rm $f
+
sed "N;s,dynamic-library-dirs:\s*.*\n,dynamic-library-dirs: $dynamicLinksDir\n," $f-tmp > $f
+
rm $f-tmp
+
done
+
'')
+ ''
${lib.optionalString hasLibraries ''
# GHC 8.10 changes.
···
$out/bin/${ghcCommand}-pkg recache
''}
-
${
-
# ghcjs will read the ghc_libdir file when resolving plugins.
-
lib.optionalString (isGhcjs && ghcLibdir != null) ''
-
mkdir -p "${libDir}"
-
rm -f "${libDir}/ghc_libdir"
-
printf '%s' '${ghcLibdir}' > "${libDir}/ghc_libdir"
-
''
-
}
$out/bin/${ghcCommand}-pkg check
''
+ postBuild;