on iko/ghcjs-patch-master help sign in
Add enableSeparateDataOutput like nixpkgs
d2db3c5Hamish Mackenzie
builder/comp-builder.nix+13−4
@@ -37,6 +37,9 @@
37, enableLibraryProfiling ? component.enableLibraryProfiling
37, enableLibraryProfiling ? component.enableLibraryProfiling
38, enableExecutableProfiling ? component.enableExecutableProfiling
38, enableExecutableProfiling ? component.enableExecutableProfiling
39, profilingDetail ? component.profilingDetail
39, profilingDetail ? component.profilingDetail
40+
41+# Data
42+, enableSeparateDataOutput ? component.enableSeparateDataOutput
40}:
43}:
41
44
42let
45let
@@ -69,7 +72,8 @@ let
69 (if dontStrip then "--disable-library-stripping" else "--enable-library-stripping")
72 (if dontStrip then "--disable-library-stripping" else "--enable-library-stripping")
70 (if enableLibraryProfiling then "--enable-library-profiling" else "--disable-library-profiling" )
73 (if enableLibraryProfiling then "--enable-library-profiling" else "--disable-library-profiling" )
71 (if enableExecutableProfiling then "--enable-executable-profiling" else "--disable-executable-profiling" )
74 (if enableExecutableProfiling then "--enable-executable-profiling" else "--disable-executable-profiling" )
75+ ] ++ lib.optional enableSeparateDataOutput "--datadir=$data/share/${ghc.name}"
72− ] ++ lib.optional doHaddock' "--docdir=${docdir "$doc"}"
76+ ++ lib.optional doHaddock' "--docdir=${docdir "$doc"}"
73 ++ lib.optional (enableLibraryProfiling || enableExecutableProfiling) "--profiling-detail=${profilingDetail}"
77 ++ lib.optional (enableLibraryProfiling || enableExecutableProfiling) "--profiling-detail=${profilingDetail}"
74 ++ lib.optional (deadCodeElimination && stdenv.hostPlatform.isLinux) "--enable-split-sections"
78 ++ lib.optional (deadCodeElimination && stdenv.hostPlatform.isLinux) "--enable-split-sections"
75 ++ lib.optional (static) "--enable-static"
79 ++ lib.optional (static) "--enable-static"
@@ -154,7 +158,9 @@ stdenv.mkDerivation ({
154
158
155 SETUP_HS = setup + /bin/Setup;
159 SETUP_HS = setup + /bin/Setup;
156
160
161+ outputs = ["out" ]
162+ ++ (lib.optional enableSeparateDataOutput "data")
157− outputs = ["out" ] ++ (lib.optional doHaddock' "doc");
163+ ++ (lib.optional doHaddock' "doc");
158
164
159 # Phases
165 # Phases
160 preInstallPhases = lib.optional doHaddock' "haddockPhase";
166 preInstallPhases = lib.optional doHaddock' "haddockPhase";
@@ -233,12 +239,15 @@ stdenv.mkDerivation ({
233 ${ghc.targetPrefix}ghc-pkg -v0 --package-db ${configFiles}/package.conf.d -f $out/package.conf.d register ${name}.conf
239 ${ghc.targetPrefix}ghc-pkg -v0 --package-db ${configFiles}/package.conf.d -f $out/package.conf.d register ${name}.conf
234 fi
240 fi
235 ''}
241 ''}
236− ${lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || haskellLib.isAll componentId) ''
242+ ${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || haskellLib.isAll componentId) ''
237 mkdir -p $out/${name}
243 mkdir -p $out/${name}
238 if [ -f ${testExecutable} ]; then
244 if [ -f ${testExecutable} ]; then
239 cp ${testExecutable} $out/${name}/
245 cp ${testExecutable} $out/${name}/
240 fi
246 fi
241− ''}
247+ '')
248+ # In case `setup copy` did not creat this
249+ + (lib.optionalString enableSeparateDataOutput "mkdir -p $data")
250+ }
242 runHook postInstall
251 runHook postInstall
243 '';
252 '';
244
253
modules/plan.nix+5
@@ -83,6 +83,11 @@ let
83 default = (def.enableLibraryProfiling or false);
83 default = (def.enableLibraryProfiling or false);
84 };
84 };
85
85
86+ enableSeparateDataOutput = mkOption {
87+ type = bool;
88+ default = (def.enableSeparateDataOutput or false);
89+ };
90+
86 enableExecutableProfiling = mkOption {
91 enableExecutableProfiling = mkOption {
87 type = bool;
92 type = bool;
88 default = (def.enableExecutableProfiling or false);
93 default = (def.enableExecutableProfiling or false);