on iko/ghcjs-patch-master help sign in
Add cross compile cabal wrapper (#936)
c3f4882Hamish Mackenzie
builder/shell-for.nix+16−1
@@ -127,7 +127,22 @@ in
127 nativeBuildInputs = [ ghcEnv ]
127 nativeBuildInputs = [ ghcEnv ]
128 ++ nativeBuildInputs
128 ++ nativeBuildInputs
129 ++ mkDrvArgs.nativeBuildInputs or []
129 ++ mkDrvArgs.nativeBuildInputs or []
130− ++ lib.attrValues (buildPackages.haskell-nix.tools compiler.nix-name tools);
130+ ++ lib.attrValues (buildPackages.haskell-nix.tools compiler.nix-name tools)
131+ # If this shell is a cross compilation shell include
132+ # wrapper script for running cabal build with appropriate args.
133+ ++ lib.optional (ghcEnv.targetPrefix != "") (
134+ buildPackages.writeShellScriptBin "${ghcEnv.targetPrefix}cabal" ''
135+ exec cabal \
136+ --with-ghc=${ghcEnv.targetPrefix}ghc \
137+ --with-ghc-pkg=${ghcEnv.targetPrefix}ghc-pkg \
138+ --with-hsc2hs=${ghcEnv.targetPrefix}hsc2hs \
139+ ${lib.optionalString (ghcEnv.targetPrefix == "js-unknown-ghcjs-") ''
140+ --with-ghcjs=${ghcEnv.targetPrefix}ghc \
141+ --with-ghcjs-pkg=${ghcEnv.targetPrefix}ghc-pkg \
142+ --ghcjs \
143+ ''} $(builtin type -P "${ghcEnv.targetPrefix}pkg-config" &> /dev/null && echo "--with-pkg-config=${ghcEnv.targetPrefix}pkg-config") \
144+ "$@"
145+ '');
131 phases = ["installPhase"];
146 phases = ["installPhase"];
132 installPhase = "echo $nativeBuildInputs $buildInputs > $out";
147 installPhase = "echo $nativeBuildInputs $buildInputs > $out";
133 LANG = "en_US.UTF-8";
148 LANG = "en_US.UTF-8";
changelog.md+4
@@ -1,6 +1,10 @@
1This file contains a summary of changes to Haskell.nix and `nix-tools`
1This file contains a summary of changes to Haskell.nix and `nix-tools`
2that will impact users.
2that will impact users.
3
3
4+## Nov 24, 2020
5+* Added `${targetPrefix}cabal` wrapper script for running cross
6+ compilers in `shellFor`.
7+
4## Oct 31, 2020
8## Oct 31, 2020
5* Passing `tools.hoogle` to `shellFor` with a value suitable for `haskel-nix.tool` will
9* Passing `tools.hoogle` to `shellFor` with a value suitable for `haskel-nix.tool` will
6 use the specified `hoogle` inside `shellFor`. This allows for materialization
10 use the specified `hoogle` inside `shellFor`. This allows for materialization