on iko/ghcjs-patch-master help sign in
Add writeHieFiles (#1022)
37b9ce1Ollie Charles
builder/comp-builder.nix+12−2
@@ -47,6 +47,7 @@ let self =
47 # ghc's internal linker seems to be broken on x86.
47 # ghc's internal linker seems to be broken on x86.
48 && !(stdenv.hostPlatform.isMusl && !stdenv.hostPlatform.isx86)
48 && !(stdenv.hostPlatform.isMusl && !stdenv.hostPlatform.isx86)
49, enableDeadCodeElimination ? component.enableDeadCodeElimination
49, enableDeadCodeElimination ? component.enableDeadCodeElimination
50+, writeHieFiles ? component.writeHieFiles
50
51
51, ghcOptions ? component.ghcOptions
52, ghcOptions ? component.ghcOptions
52
53
@@ -143,7 +144,15 @@ let
143
144
144 finalConfigureFlags = lib.concatStringsSep " " (
145 finalConfigureFlags = lib.concatStringsSep " " (
145 [ "--prefix=$out"
146 [ "--prefix=$out"
146− ] ++ (
147+ ] ++
148+ # We don't specify this in 'commonConfigureFlags', as these are also
149+ # used by haddock-builder.nix. If we do specify these options in
150+ # commonConfigureFlags, then the haddock-builder will fail, because it
151+ # sets its own outputs which *don't* include $hie
152+ lib.optionals writeHieFiles [
153+ "--ghc-option=-fwrite-ide-info" "--ghc-option=-hiedir$hie"
154+ ] ++
155+ (
147 # If configureAllComponents is set we should not specify the component
156 # If configureAllComponents is set we should not specify the component
148 # and Setup will attempt to configure them all.
157 # and Setup will attempt to configure them all.
149 if configureAllComponents
158 if configureAllComponents
@@ -345,7 +354,8 @@ let
345
354
346 outputs = ["out" ]
355 outputs = ["out" ]
347 ++ (lib.optional enableSeparateDataOutput "data")
356 ++ (lib.optional enableSeparateDataOutput "data")
348− ++ (lib.optional keepSource "source");
357+ ++ (lib.optional keepSource "source")
358+ ++ (lib.optional writeHieFiles "hie");
349
359
350 prePatch =
360 prePatch =
351 # emcc is very slow if it cannot cache stuff in $HOME
361 # emcc is very slow if it cannot cache stuff in $HOME
modules/plan.nix+6
@@ -173,6 +173,12 @@ let
173 default = (def.keepSource or false);
173 default = (def.keepSource or false);
174 description = "Keep component source in the store in a `source` output";
174 description = "Keep component source in the store in a `source` output";
175 };
175 };
176+
177+ writeHieFiles = mkOption {
178+ type = bool;
179+ default = (def.writeHieFiles or false);
180+ description = "Write component `.hie` files in the store in a `hie` output";
181+ };
176 };
182 };
177 packageOptions = def: componentOptions def // {
183 packageOptions = def: componentOptions def // {
178 preUnpack = mkOption {
184 preUnpack = mkOption {