Skip to content

Commit 7b5b5fe

Browse files
sternenseemannwolfgangwalther
authored andcommitted
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.
1 parent 6bd0802 commit 7b5b5fe

4 files changed

Lines changed: 42 additions & 90 deletions

File tree

doc/release-notes/rl-2511.section.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
- `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.
4848

49-
- 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.
49+
- 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.
5050

5151
- The `ghcInfo` and `controlPhases` functions have been removed from `haskell.lib.compose` and `haskell.lib`. They were unused and would return incorrect results.
5252

pkgs/development/haskell-modules/generic-builder.nix

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@
1616
let
1717
isCross = stdenv.buildPlatform != stdenv.hostPlatform;
1818

19-
# Note that ghc.isGhcjs != stdenv.hostPlatform.isGhcjs.
20-
# ghc.isGhcjs implies that we are using ghcjs, a project separate from GHC.
21-
# (mere) stdenv.hostPlatform.isGhcjs means that we are using GHC's JavaScript
22-
# backend. The latter is a normal cross compilation backend and needs little
23-
# special accommodation.
24-
outputsJS = ghc.isGhcjs or false || stdenv.hostPlatform.isGhcjs;
25-
2619
# Pass the "wrong" C compiler rather than none at all so packages that just
2720
# use the C preproccessor still work, see
2821
# https://github.com/haskell/cabal/issues/6466 for details.
@@ -47,7 +40,7 @@ in
4740

4841
{
4942
pname,
50-
dontStrip ? outputsJS,
43+
dontStrip ? stdenv.hostPlatform.isGhcjs,
5144
version,
5245
revision ? null,
5346
sha256 ? null,
@@ -80,7 +73,7 @@ in
8073
doHaddockQuickjump ? doHoogle,
8174
doInstallIntermediates ? false,
8275
editedCabalFile ? null,
83-
enableLibraryProfiling ? !outputsJS,
76+
enableLibraryProfiling ? !stdenv.hostPlatform.isGhcjs,
8477
enableExecutableProfiling ? false,
8578
profilingDetail ? "exported-functions",
8679
# TODO enable shared libs for cross-compiling
@@ -90,7 +83,7 @@ in
9083
&& (ghc.enableShared or false)
9184
&& !stdenv.hostPlatform.useAndroidPrebuilt, # TODO: figure out why /build leaks into RPATH
9285
enableDeadCodeElimination ? (!stdenv.hostPlatform.isDarwin), # TODO: use -dead_strip for darwin
93-
# Disabling this for ghcjs prevents this crash: https://gitlab.haskell.org/ghc/ghc/-/issues/23235
86+
# Disabling this for JS prevents this crash: https://gitlab.haskell.org/ghc/ghc/-/issues/23235
9487
enableStaticLibraries ?
9588
!(stdenv.hostPlatform.isWindows || stdenv.hostPlatform.isWasm || stdenv.hostPlatform.isGhcjs),
9689
enableHsc2hsViaAsm ? stdenv.hostPlatform.isWindows,
@@ -228,13 +221,12 @@ let
228221
optionalAttrs
229222
;
230223

231-
isGhcjs = ghc.isGhcjs or false;
232224
isHaLVM = ghc.isHaLVM or false;
233225

234226
# GHC used for building Setup.hs
235227
#
236228
# Same as our GHC, unless we're cross, in which case it is native GHC with the
237-
# same version, or ghcjs, in which case its the ghc used to build ghcjs.
229+
# same version.
238230
nativeGhc = buildHaskellPackages.ghc;
239231

240232
# the target dir for haddock documentation
@@ -358,9 +350,6 @@ let
358350
(enableFeature (!dontStrip) "library-stripping")
359351
(enableFeature (!dontStrip) "executable-stripping")
360352
]
361-
++ optionals isGhcjs [
362-
"--ghcjs"
363-
]
364353
++ optionals isCross (
365354
[
366355
"--configure-option=--host=${stdenv.hostPlatform.config}"
@@ -490,7 +479,7 @@ let
490479

491480
setupCommand = "./Setup";
492481

493-
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
482+
ghcCommand' = "ghc";
494483
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
495484

496485
ghcNameWithPrefix = "${ghc.targetPrefix}${ghc.haskellCompilerName}";
@@ -519,9 +508,7 @@ let
519508

520509
intermediatesDir = "share/haskell/${ghc.version}/${pname}-${version}/dist";
521510

522-
# On old ghcjs, the jsexe directories are the output but on the js backend they seem to be treated as intermediates
523511
jsexe = rec {
524-
shouldUseNode = isGhcjs;
525512
shouldAdd = stdenv.hostPlatform.isGhcjs && isExecutable;
526513
shouldCopy = shouldAdd && !doInstallIntermediates;
527514
shouldSymlink = shouldAdd && doInstallIntermediates;
@@ -849,15 +836,7 @@ lib.fix (
849836
''
850837
}
851838
852-
${optionalString jsexe.shouldUseNode ''
853-
for exeDir in "${binDir}/"*.jsexe; do
854-
exe="''${exeDir%.jsexe}"
855-
printWords '#!${nodejs}/bin/node' > "$exe"
856-
echo >> "$exe"
857-
cat "$exeDir/all.js" >> "$exe"
858-
chmod +x "$exe"
859-
done
860-
''}
839+
861840
${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"}
862841
863842
${optionalString jsexe.shouldCopy ''

pkgs/development/haskell-modules/hoogle.nix

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,9 @@ let
2323
packages = selectPackages haskellPackages;
2424

2525
wrapper = ./hoogle-local-wrapper.sh;
26-
isGhcjs = ghc.isGhcjs or false;
27-
opts = lib.optionalString;
28-
haddockExe = if !isGhcjs then "haddock" else "haddock-ghcjs";
29-
ghcDocLibDir = if !isGhcjs then ghc.doc + "/share/doc/ghc*/html/libraries" else ghc + "/doc/lib";
30-
# On GHCJS, use a stripped down version of GHC's prologue.txt
31-
prologue =
32-
if !isGhcjs then
33-
"${ghcDocLibDir}/prologue.txt"
34-
else
35-
writeText "ghcjs-prologue.txt" ''
36-
This index includes documentation for many Haskell modules.
37-
'';
26+
haddockExe = "haddock";
27+
ghcDocLibDir = ghc.doc + "/share/doc/ghc*/html/libraries";
28+
prologue = "${ghcDocLibDir}/prologue.txt";
3829

3930
docPackages =
4031
lib.closePropagation
@@ -84,7 +75,6 @@ buildPackages.stdenv.mkDerivation (finalAttrs: {
8475
echo importing builtin packages
8576
for docdir in ${ghcDocLibDir}"/"*; do
8677
name="$(basename $docdir)"
87-
${opts isGhcjs ''docdir="$docdir/html"''}
8878
if [[ -d $docdir ]]; then
8979
ln -sfn $docdir $out/share/doc/hoogle/$name
9080
fi

pkgs/development/haskell-modules/with-packages-wrapper.nix

Lines changed: 32 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
installDocumentation ? true,
1414
hoogleWithPackages,
1515
postBuild ? "",
16-
ghcLibdir ? null, # only used by ghcjs, when resolving plugins
1716
}:
1817

1918
# This argument is a function which selects a list of Haskell packages from any
@@ -51,9 +50,8 @@ let
5150

5251
packages = selectPackages haskellPackages ++ [ hoogleWithPackages' ];
5352

54-
isGhcjs = ghc.isGhcjs or false;
5553
isHaLVM = ghc.isHaLVM or false;
56-
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
54+
ghcCommand' = "ghc";
5755
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
5856
ghcCommandCaps = lib.toUpper ghcCommand';
5957
libDir =
@@ -77,8 +75,6 @@ let
7775
);
7876
in
7977

80-
assert ghcLibdir != null -> (ghc.isGhcjs or false);
81-
8278
if paths == [ ] && !useLLVM then
8379
ghc
8480
else
@@ -101,9 +97,6 @@ else
10197
--set "NIX_${ghcCommandCaps}PKG" "$out/bin/${ghcCommand}-pkg" \
10298
--set "NIX_${ghcCommandCaps}_DOCDIR" "${docDir}" \
10399
--set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}" \
104-
${
105-
lib.optionalString (ghc.isGhcjs or false) ''--set NODE_PATH "${ghc.socket-io}/lib/node_modules"''
106-
} \
107100
${lib.optionalString useLLVM ''--prefix "PATH" ":" "${llvm}"''}
108101
fi
109102
done
@@ -136,39 +129,37 @@ else
136129
fi
137130
138131
''
139-
+ (lib.optionalString (stdenv.targetPlatform.isDarwin && !isGhcjs && !stdenv.targetPlatform.isiOS)
140-
''
141-
# Work around a linker limit in macOS Sierra (see generic-builder.nix):
142-
local packageConfDir="${packageCfgDir}";
143-
local dynamicLinksDir="$out/lib/links";
144-
mkdir -p $dynamicLinksDir
145-
# Clean up the old links that may have been (transitively) included by
146-
# symlinkJoin:
147-
rm -f $dynamicLinksDir/*
148-
149-
dynamicLibraryDirs=()
150-
151-
for pkg in $($out/bin/ghc-pkg list --simple-output); do
152-
dynamicLibraryDirs+=($($out/bin/ghc-pkg --simple-output field "$pkg" dynamic-library-dirs))
153-
done
154-
155-
for dynamicLibraryDir in $(echo "''${dynamicLibraryDirs[@]}" | tr ' ' '\n' | sort -u); do
156-
echo "Linking $dynamicLibraryDir/*.dylib from $dynamicLinksDir"
157-
find "$dynamicLibraryDir" -name '*.dylib' -exec ln -s {} "$dynamicLinksDir" \;
158-
done
159-
160-
for f in $packageConfDir/*.conf; do
161-
# Initially, $f is a symlink to a read-only file in one of the inputs
162-
# (as a result of this symlinkJoin derivation).
163-
# Replace it with a copy whose dynamic-library-dirs points to
164-
# $dynamicLinksDir
165-
cp $f $f-tmp
166-
rm $f
167-
sed "N;s,dynamic-library-dirs:\s*.*\n,dynamic-library-dirs: $dynamicLinksDir\n," $f-tmp > $f
168-
rm $f-tmp
169-
done
170-
''
171-
)
132+
+ (lib.optionalString (stdenv.targetPlatform.isDarwin && !stdenv.targetPlatform.isiOS) ''
133+
# Work around a linker limit in macOS Sierra (see generic-builder.nix):
134+
local packageConfDir="${packageCfgDir}";
135+
local dynamicLinksDir="$out/lib/links";
136+
mkdir -p $dynamicLinksDir
137+
# Clean up the old links that may have been (transitively) included by
138+
# symlinkJoin:
139+
rm -f $dynamicLinksDir/*
140+
141+
dynamicLibraryDirs=()
142+
143+
for pkg in $($out/bin/ghc-pkg list --simple-output); do
144+
dynamicLibraryDirs+=($($out/bin/ghc-pkg --simple-output field "$pkg" dynamic-library-dirs))
145+
done
146+
147+
for dynamicLibraryDir in $(echo "''${dynamicLibraryDirs[@]}" | tr ' ' '\n' | sort -u); do
148+
echo "Linking $dynamicLibraryDir/*.dylib from $dynamicLinksDir"
149+
find "$dynamicLibraryDir" -name '*.dylib' -exec ln -s {} "$dynamicLinksDir" \;
150+
done
151+
152+
for f in $packageConfDir/*.conf; do
153+
# Initially, $f is a symlink to a read-only file in one of the inputs
154+
# (as a result of this symlinkJoin derivation).
155+
# Replace it with a copy whose dynamic-library-dirs points to
156+
# $dynamicLinksDir
157+
cp $f $f-tmp
158+
rm $f
159+
sed "N;s,dynamic-library-dirs:\s*.*\n,dynamic-library-dirs: $dynamicLinksDir\n," $f-tmp > $f
160+
rm $f-tmp
161+
done
162+
'')
172163
+ ''
173164
${lib.optionalString hasLibraries ''
174165
# GHC 8.10 changes.
@@ -182,14 +173,6 @@ else
182173
183174
$out/bin/${ghcCommand}-pkg recache
184175
''}
185-
${
186-
# ghcjs will read the ghc_libdir file when resolving plugins.
187-
lib.optionalString (isGhcjs && ghcLibdir != null) ''
188-
mkdir -p "${libDir}"
189-
rm -f "${libDir}/ghc_libdir"
190-
printf '%s' '${ghcLibdir}' > "${libDir}/ghc_libdir"
191-
''
192-
}
193176
$out/bin/${ghcCommand}-pkg check
194177
''
195178
+ postBuild;

0 commit comments

Comments
 (0)