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.
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
|
||||
- `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.
|
||||
|
||||
|
||||
@@ -16,13 +16,6 @@
|
||||
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.
|
||||
@@ -47,7 +40,7 @@ in
|
||||
|
||||
{
|
||||
pname,
|
||||
dontStrip ? outputsJS,
|
||||
dontStrip ? stdenv.hostPlatform.isGhcjs,
|
||||
version,
|
||||
revision ? null,
|
||||
sha256 ? null,
|
||||
@@ -80,7 +73,7 @@ in
|
||||
doHaddockQuickjump ? doHoogle,
|
||||
doInstallIntermediates ? false,
|
||||
editedCabalFile ? null,
|
||||
enableLibraryProfiling ? !outputsJS,
|
||||
enableLibraryProfiling ? !stdenv.hostPlatform.isGhcjs,
|
||||
enableExecutableProfiling ? false,
|
||||
profilingDetail ? "exported-functions",
|
||||
# TODO enable shared libs for cross-compiling
|
||||
@@ -90,7 +83,7 @@ in
|
||||
&& (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,
|
||||
@@ -228,13 +221,12 @@ let
|
||||
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
|
||||
@@ -358,9 +350,6 @@ let
|
||||
(enableFeature (!dontStrip) "library-stripping")
|
||||
(enableFeature (!dontStrip) "executable-stripping")
|
||||
]
|
||||
++ optionals isGhcjs [
|
||||
"--ghcjs"
|
||||
]
|
||||
++ optionals isCross (
|
||||
[
|
||||
"--configure-option=--host=${stdenv.hostPlatform.config}"
|
||||
@@ -490,7 +479,7 @@ let
|
||||
|
||||
setupCommand = "./Setup";
|
||||
|
||||
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
||||
ghcCommand' = "ghc";
|
||||
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
|
||||
|
||||
ghcNameWithPrefix = "${ghc.targetPrefix}${ghc.haskellCompilerName}";
|
||||
@@ -519,9 +508,7 @@ let
|
||||
|
||||
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;
|
||||
@@ -849,15 +836,7 @@ lib.fix (
|
||||
''
|
||||
}
|
||||
|
||||
${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 ''
|
||||
|
||||
@@ -23,18 +23,9 @@ let
|
||||
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
|
||||
@@ -84,7 +75,6 @@ buildPackages.stdenv.mkDerivation (finalAttrs: {
|
||||
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
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
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
|
||||
@@ -51,9 +50,8 @@ let
|
||||
|
||||
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 =
|
||||
@@ -77,8 +75,6 @@ let
|
||||
);
|
||||
in
|
||||
|
||||
assert ghcLibdir != null -> (ghc.isGhcjs or false);
|
||||
|
||||
if paths == [ ] && !useLLVM then
|
||||
ghc
|
||||
else
|
||||
@@ -101,9 +97,6 @@ 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
|
||||
@@ -136,39 +129,37 @@ else
|
||||
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.
|
||||
@@ -182,14 +173,6 @@ else
|
||||
|
||||
$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;
|
||||
|
||||
Reference in New Issue
Block a user