Skip to content

Commit fd7953d

Browse files
authored
Merge pull request #32333 from NixOS/revert-32112-hask-split-out
Revert "Revive multiple outputs for Haskell packages."
2 parents e5e3282 + 8d8061e commit fd7953d

14 files changed

Lines changed: 37 additions & 172 deletions

File tree

pkgs/development/compilers/ghc/7.10.2.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
3434
sha256 = "1x8m4rp2v7ydnrz6z9g8x7z3x3d3pxhv2pixy7i7hkbqbdsp7kal";
3535
};
3636

37-
buildInputs = [ ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 (stdenv.lib.getBin hscolour) ];
37+
buildInputs = [ ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour ];
3838

3939
patches = [ ./relocation.patch ];
4040

pkgs/development/compilers/ghc/7.10.3.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
3030
./relocation.patch
3131
];
3232

33-
buildInputs = [ ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 (stdenv.lib.getBin hscolour) ];
33+
buildInputs = [ ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour ];
3434

3535
enableParallelBuilding = true;
3636

pkgs/development/compilers/ghc/8.0.2.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
2323
++ stdenv.lib.optional stdenv.isLinux ./ghc-no-madv-free.patch
2424
++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch;
2525

26-
buildInputs = [ ghc perl (stdenv.lib.getBin hscolour) sphinx ];
26+
buildInputs = [ ghc perl hscolour sphinx ];
2727

2828
enableParallelBuilding = true;
2929

pkgs/development/compilers/ghc/8.2.1.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
let
1111
inherit (bootPkgs) ghc;
1212
version = "8.2.1";
13-
preReleaseName = "ghc-8.2.1";
13+
1414
commonBuildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ];
1515
commonPreConfigure = ''
1616
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure

pkgs/development/compilers/ghc/head.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
let
1212
inherit (bootPkgs) ghc;
1313

14-
commonBuildInputs = [ ghc perl autoconf automake (stdenv.lib.getBin happy) (stdenv.lib.getBin alex) python3 ];
14+
commonBuildInputs = [ ghc perl autoconf automake happy alex python3 ];
1515

1616
rev = "14457cf6a50f708eecece8f286f08687791d51f7";
1717

pkgs/development/compilers/ghcjs/base.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ in mkDerivation (rec {
113113
lens optparse-applicative parallel safe shelly split
114114
stringsearch syb system-fileio system-filepath tar terminfo text-binary
115115
unordered-containers vector wl-pprint-text yaml
116-
(stdenv.lib.getBin alex) (stdenv.lib.getBin happy) git gnumake autoconf automake libtool patch gmp
116+
alex happy git gnumake autoconf automake libtool patch gmp
117117
base16-bytestring cryptohash executable-path haddock-api
118118
transformers-compat QuickCheck haddock hspec xhtml
119119
regex-posix libiconv

pkgs/development/compilers/halvm/2.4.0.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ stdenv.mkDerivation rec {
2020
sed -ie 's|ld |${targetPackages.stdenv.cc.bintools}/bin/ld |g' src/scripts/ldkernel.in
2121
'';
2222
configureFlags = stdenv.lib.optional (!enableIntegerSimple) [ "--enable-gmp" ];
23-
propagatedNativeBuildInputs = [ (stdenv.lib.getBin alex) (stdenv.lib.getBin happy) ];
23+
propagatedNativeBuildInputs = [ alex happy ];
2424
buildInputs =
25-
let haskellPkgs = [ (stdenv.lib.getBin alex) (stdenv.lib.getBin happy) (stdenv.lib.getBin bootPkgs.hscolour) bootPkgs.cabal-install bootPkgs.haddock bootPkgs.hpc
25+
let haskellPkgs = [ alex happy bootPkgs.hscolour bootPkgs.cabal-install bootPkgs.haddock bootPkgs.hpc
2626
]; in [ bootPkgs.ghc
2727
automake perl git targetPackages.stdenv.cc.bintools
2828
autoconf xen zlib ncurses.dev

pkgs/development/haskell-modules/configuration-common.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,6 @@ self: super: {
897897
# Don't install internal mkReadme tool.
898898
hastache = overrideCabal super.hastache (drv: {
899899
doCheck = false;
900-
enableSeparateBinOutput = false;
901900
postInstall = "rm $out/bin/mkReadme && rmdir $out/bin";
902901
});
903902

pkgs/development/haskell-modules/configuration-nix.nix

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,7 @@ self: super: builtins.intersectAttrs super {
217217

218218
# wxc supports wxGTX >= 3.0, but our current default version points to 2.8.
219219
# http://hydra.cryp.to/build/1331287/log/raw
220-
wxc = (overrideCabal super.wxc (drv: {
221-
buildDepends = (drv.buildDepends or []) ++ [self.split];
222-
postInstall = "cp -v dist/build/libwxc.so.0.92.3.0 $lib/lib/libwxc.so";
223-
})).override { wxGTK = pkgs.wxGTK30; };
220+
wxc = (addBuildDepend super.wxc self.split).override { wxGTK = pkgs.wxGTK30; };
224221
wxcore = super.wxcore.override { wxGTK = pkgs.wxGTK30; };
225222

226223
# Test suite wants to connect to $DISPLAY.
@@ -510,52 +507,4 @@ self: super: builtins.intersectAttrs super {
510507
# Break cyclic reference that results in an infinite recursion.
511508
partial-semigroup = dontCheck super.partial-semigroup;
512509

513-
# Alex has some weird files in /usr/share that create a cyclic ref with
514-
# its bin dir.
515-
alex = hasNoBinOutput super.alex;
516-
517-
# Disable separate bin outputs for these specific packages that break with it.
518-
H = hasNoBinOutput super.H;
519-
cryptol = hasNoBinOutput super.cryptol;
520-
hscolour = hasNoBinOutput super.hscolour;
521-
sproxy = hasNoBinOutput super.sproxy;
522-
sproxy2 = hasNoBinOutput super.sproxy2;
523-
sproxy-web = hasNoBinOutput super.sproxy-web;
524-
juandelacosa = hasNoBinOutput super.juandelacosa;
525-
mywatch = hasNoBinOutput super.mywatch;
526-
sugarhaskell = hasNoBinOutput super.sugarhaskell;
527-
zerobin = hasNoBinOutput super.zerobin;
528-
529-
git-annex = overrideCabal super.git-annex (drv: {
530-
enableSeparateBinOutput = false;
531-
enableSeparateEtcOutput = false;
532-
});
533-
534-
# Has extra data files which are referred to from the binary output,
535-
# creating a store reference cycle. Putting data in separate output
536-
# solves the problem.
537-
happy = overrideCabal super.happy (drv: { enableSeparateDataOutput = true; });
538-
539-
# Override a number of packages with specific references to $out in their
540-
# derivations
541-
stack = overrideCabal super.stack (drv: {
542-
postInstall = ''
543-
exe=$bin/bin/stack
544-
mkdir -p $bin/share/bash-completion/completions
545-
$exe --bash-completion-script $exe >$bin/share/bash-completion/completions/stack
546-
'';
547-
});
548-
Agda = overrideCabal super.Agda (drv: {
549-
postInstall = ''
550-
files=("$out/share/"*"-ghc-"*"/Agda-"*"/lib/prim/Agda/"{Primitive.agda,Builtin"/"*.agda})
551-
for f in "''${files[@]}" ; do
552-
$bin/bin/agda $f
553-
done
554-
for f in "''${files[@]}" ; do
555-
$bin/bin/agda -c --no-main $f
556-
done
557-
$bin/bin/agda-mode compile
558-
'';
559-
});
560-
561510
}

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

Lines changed: 22 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ let isCross = (ghc.cross or null) != null; in
5656
, hardeningDisable ? lib.optional (ghc.isHaLVM or false) "all"
5757
, enableSeparateDataOutput ? false
5858
, enableSeparateDocOutput ? doHaddock
59-
, enableSeparateBinOutput ? isExecutable
60-
, outputsToInstall ? []
61-
, enableSeparateLibOutput ? true
62-
, enableSeparateEtcOutput ? (stdenv.lib.versionOlder "7.7" ghc.version)
6359
} @ args:
6460

6561
assert editedCabalFile != null -> revision != null;
@@ -83,6 +79,9 @@ let
8379
then "package-db"
8480
else "package-conf";
8581

82+
# the target dir for haddock documentation
83+
docdir = docoutput: docoutput + "/share/doc";
84+
8685
newCabalFileUrl = "http://hackage.haskell.org/package/${pname}-${version}/revision/${revision}.cabal";
8786
newCabalFile = fetchurl {
8887
url = newCabalFileUrl;
@@ -96,13 +95,6 @@ let
9695
'';
9796

9897
hasActiveLibrary = isLibrary && (enableStaticLibraries || enableSharedLibraries || enableLibraryProfiling);
99-
hasLibOutput = enableSeparateLibOutput && hasActiveLibrary;
100-
libDir = if hasLibOutput then "$lib/lib/${ghc.name}" else "$out/lib/${ghc.name}";
101-
binDir = if enableSeparateBinOutput then "$bin/bin" else "$out/bin";
102-
libexecDir = if enableSeparateBinOutput then "$libexec/bin" else "$out/libexec";
103-
etcDir = if enableSeparateEtcOutput then "$etc/etc" else "$out/etc";
104-
docDir = if enableSeparateDocOutput then "$doc/share/doc" else "$out/share/doc";
105-
dataDir = if enableSeparateDataOutput then "$data/share/${ghc.name}" else "$out/share/${ghc.name}";
10698

10799
# We cannot enable -j<n> parallelism for libraries because GHC is far more
108100
# likely to generate a non-determistic library ID in that case. Further
@@ -121,20 +113,12 @@ let
121113
stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags);
122114

123115
defaultConfigureFlags = [
124-
"--verbose" "--prefix=$out"
125-
# Binary directory has to be $bin/bin instead of just $bin: this
126-
# is so that the package is added to the PATH when it's used as a
127-
# build input. Sadly mkDerivation won't add inputs that don't have
128-
# bin subdirectory.
129-
"--bindir=${binDir}"
130-
"--libdir=${libDir}" "--libsubdir=\\$pkgid"
131-
"--libexecdir=${libexecDir}"
132-
(optionalString (enableSeparateEtcOutput) "--sysconfdir=${etcDir}") # Old versions of cabal don't support this flag.
133-
"--datadir=${dataDir}"
134-
"--docdir=${docDir}"
116+
"--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
117+
(optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}")
118+
(optionalString enableSeparateDocOutput "--docdir=${docdir "$doc"}")
135119
"--with-gcc=$CC" # Clang won't work without that extra information.
136120
"--package-db=$packageConfDir"
137-
(optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=${libDir}/${pname}-${version}")
121+
(optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}")
138122
(optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
139123
(optionalString enableParallelBuilding "--ghc-option=-j$NIX_BUILD_CORES")
140124
(optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp")
@@ -168,11 +152,8 @@ let
168152
allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
169153
optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
170154

171-
nativeBuildInputs = map stdenv.lib.getBin
172-
( optional (allPkgconfigDepends != []) pkgconfig
173-
++ buildTools ++ libraryToolDepends ++ executableToolDepends
174-
++ [ removeReferencesTo ]
175-
);
155+
nativeBuildInputs = optional (allPkgconfigDepends != []) pkgconfig ++
156+
buildTools ++ libraryToolDepends ++ executableToolDepends ++ [ removeReferencesTo ];
176157
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
177158
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
178159
optionals (allPkgconfigDepends != []) allPkgconfigDepends ++
@@ -201,15 +182,7 @@ assert allPkgconfigDepends != [] -> pkgconfig != null;
201182
stdenv.mkDerivation ({
202183
name = "${pname}-${version}";
203184

204-
outputs = if (args ? outputs) then args.outputs else
205-
( (optional enableSeparateBinOutput "bin")
206-
++ (optional enableSeparateBinOutput "libexec")
207-
++ [ "out" ]
208-
++ (optional enableSeparateDataOutput "data")
209-
++ (optional enableSeparateDocOutput "doc")
210-
++ (optional enableSeparateEtcOutput "etc")
211-
++ (optional hasLibOutput "lib")
212-
);
185+
outputs = if (args ? outputs) then args.outputs else ([ "out" ] ++ (optional enableSeparateDataOutput "data") ++ (optional enableSeparateDocOutput "doc"));
213186
setOutputFlags = false;
214187

215188
pos = builtins.unsafeGetAttrPos "pname" args;
@@ -233,15 +206,15 @@ stdenv.mkDerivation ({
233206

234207
postPatch = optionalString jailbreak ''
235208
echo "Run jailbreak-cabal to lift version restrictions on build inputs."
236-
${stdenv.lib.getBin jailbreak-cabal}/bin/jailbreak-cabal ${pname}.cabal
209+
${jailbreak-cabal}/bin/jailbreak-cabal ${pname}.cabal
237210
'' + postPatch;
238211

239212
setupCompilerEnvironmentPhase = ''
240213
runHook preSetupCompilerEnvironment
241214
242215
echo "Build with ${ghc}."
243216
export PATH="${ghc}/bin:$PATH"
244-
${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${stdenv.lib.getBin hscolour}/bin:$PATH"}
217+
${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
245218
246219
packageConfDir="$TMPDIR/package.conf.d"
247220
mkdir -p $packageConfDir
@@ -268,7 +241,7 @@ stdenv.mkDerivation ({
268241
#
269242
# Create a local directory with symlinks of the *.dylib (macOS shared
270243
# libraries) from all the dependencies.
271-
local dynamicLinksDir="${libDir}/links"
244+
local dynamicLinksDir="$out/lib/links"
272245
mkdir -p $dynamicLinksDir
273246
for d in $(grep dynamic-library-dirs "$packageConfDir/"*|awk '{print $2}'); do
274247
ln -s "$d/"*.dylib $dynamicLinksDir
@@ -340,15 +313,15 @@ stdenv.mkDerivation ({
340313
341314
${if !hasActiveLibrary then "${setupCommand} install" else ''
342315
${setupCommand} copy
343-
local packageConfDir="${libDir}/package.conf.d"
316+
local packageConfDir="$out/lib/${ghc.name}/package.conf.d"
344317
local packageConfFile="$packageConfDir/${pname}-${version}.conf"
345318
mkdir -p "$packageConfDir"
346319
${setupCommand} register --gen-pkg-config=$packageConfFile
347320
local pkgId=$( ${gnused}/bin/sed -n -e 's|^id: ||p' $packageConfFile )
348321
mv $packageConfFile $packageConfDir/$pkgId.conf
349322
''}
350323
${optionalString isGhcjs ''
351-
for exeDir in "${binDir}/"*.jsexe; do
324+
for exeDir in "$out/bin/"*.jsexe; do
352325
exe="''${exeDir%.jsexe}"
353326
printWords '#!${nodejs}/bin/node' > "$exe"
354327
cat "$exeDir/all.js" >> "$exe"
@@ -357,68 +330,18 @@ stdenv.mkDerivation ({
357330
''}
358331
${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"}
359332
${optionalString (enableSharedExecutables && isExecutable && !isGhcjs && stdenv.isDarwin && stdenv.lib.versionOlder ghc.version "7.10") ''
360-
for exe in "${binDir}/"* ; do
361-
install_name_tool -add_rpath "${libDir}/${pname}-${version}" "$exe"
333+
for exe in "$out/bin/"* ; do
334+
install_name_tool -add_rpath "$out/lib/ghc-${ghc.version}/${pname}-${version}" "$exe"
362335
done
363336
''}
364337
365338
${optionalString enableSeparateDocOutput ''
366-
# Remove references back to $out but also back to $lib if we have
367-
# docs. $lib is needed as it stores path to haddock interfaces in the
368-
# conf file which creates a cycle if docs refer back to library
369-
# path.
370-
mkdir -p ${docDir}
371-
372-
for x in ${docDir}/html/src/*.html; do
373-
remove-references-to -t $out -t ${libDir} -t ${binDir} ${optionalString enableSeparateDataOutput "-t $data"} $x
339+
for x in ${docdir "$doc"}/html/src/*.html; do
340+
remove-references-to -t $out $x
374341
done
342+
mkdir -p $doc
375343
''}
376-
377-
${optionalString hasLibOutput ''
378-
# Even if we don't have binary output for the package, things like
379-
# Paths files will embed paths to bin/libexec directories in themselves
380-
# which results in .lib <-> $out cyclic store reference. We
381-
# therefore patch out the paths from separate library if we don't have
382-
# separate bin output too.
383-
#
384-
# If we _do_ have separate bin and lib outputs, we may still be in
385-
# trouble in case of shared executables: executable contains path to
386-
# .lib, .lib contains path (through Paths) to .bin and we have a
387-
# cycle.
388-
#
389-
# Lastly we have to deal with references from .lib back into
390-
# $out/share if we're not splitting out data directory.
391-
#
392-
# It may happen that we have hasLibOutput set but the library
393-
# directory was not created: this happens in the case that library
394-
# section is not exposing any modules. See "fail" package for an
395-
# example where no modules are exposed for GHC >= 8.0.
396-
if [ -d ${libDir} ]; then
397-
find ${libDir} -type f -exec \
398-
remove-references-to -t ${binDir} -t ${libexecDir} "{}" \;
399-
fi
400-
''}
401-
402-
${optionalString (hasLibOutput && ! enableSeparateDocOutput) ''
403-
# If we don't have separate docs, we have to patch out the ref to
404-
# docs in package conf. This will likely break Haddock
405-
# cross-package links but is necessary to break store cycle…
406-
find ${libDir}/ -type f -name '*.conf' -exec \
407-
remove-references-to -t ${docDir} "{}" \;
408-
''}
409-
410-
${optionalString (hasLibOutput && ! enableSeparateDataOutput) ''
411-
# Just like for doc output path in $out potentially landing in
412-
# *.conf, we have to also remove the data directory so that it
413-
# doesn't appear under data-dir field creating a cycle.
414-
find ${libDir}/ -type f -exec echo Removing ${dataDir} refs from "{}" \;
415-
find ${libDir}/ -type f -exec \
416-
remove-references-to -t ${dataDir} "{}" \;
417-
''}
418-
419-
${optionalString enableSeparateDataOutput "mkdir -p ${dataDir}"}
420-
${optionalString enableSeparateBinOutput "mkdir -p ${binDir} ${libexecDir}"}
421-
${optionalString enableSeparateEtcOutput "mkdir -p ${etcDir}"}
344+
${optionalString enableSeparateDataOutput "mkdir -p $data"}
422345
423346
runHook postInstall
424347
'';
@@ -435,7 +358,7 @@ stdenv.mkDerivation ({
435358
# the directory containing the haddock documentation.
436359
# `null' if no haddock documentation was built.
437360
# TODO: fetch the self from the fixpoint instead
438-
haddockDir = self: if doHaddock then "${docDir}/html" else null;
361+
haddockDir = self: if doHaddock then "${docdir self.doc}/html" else null;
439362

440363
env = stdenv.mkDerivation {
441364
name = "interactive-${pname}-${version}-environment";
@@ -463,7 +386,6 @@ stdenv.mkDerivation ({
463386
// optionalAttrs (description != "") { inherit description; }
464387
// optionalAttrs (maintainers != []) { inherit maintainers; }
465388
// optionalAttrs (hydraPlatforms != platforms) { inherit hydraPlatforms; }
466-
// optionalAttrs (outputsToInstall != []) { inherit outputsToInstall; }
467389
;
468390

469391
}

0 commit comments

Comments
 (0)