on iko/ghcjs-patch-master help sign in
Add #! to dummy-ghc, --version and use bash case (#640)
c474dceHamish Mackenzie
lib/call-cabal-project-to-nix.nix+41−13
@@ -239,6 +239,7 @@ let
239 } ''
239 } ''
240 mkdir -p $out/ghc
240 mkdir -p $out/ghc
241 mkdir -p $out/ghc-pkg
241 mkdir -p $out/ghc-pkg
242+ ${ghc.targetPrefix}ghc --version > $out/ghc/version
242 ${ghc.targetPrefix}ghc --numeric-version > $out/ghc/numeric-version
243 ${ghc.targetPrefix}ghc --numeric-version > $out/ghc/numeric-version
243 ${ghc.targetPrefix}ghc --info | grep -v /nix/store > $out/ghc/info
244 ${ghc.targetPrefix}ghc --info | grep -v /nix/store > $out/ghc/info
244 ${ghc.targetPrefix}ghc --supported-languages > $out/ghc/supported-languages
245 ${ghc.targetPrefix}ghc --supported-languages > $out/ghc/supported-languages
@@ -269,14 +270,32 @@ let
269 executable = true;
270 executable = true;
270 destination = "/bin/${ghc.targetPrefix}ghc";
271 destination = "/bin/${ghc.targetPrefix}ghc";
271 text = ''
272 text = ''
273+ #!${pkgs.evalPackages.runtimeShell}
274+ case "$*" in
275+ --version)
276+ cat ${dummy-ghc-data}/ghc/version
277+ ;;
278+ --numeric-version)
272− if [ "'$*'" == "'--numeric-version'" ]; then cat ${dummy-ghc-data}/ghc/numeric-version;
279+ cat ${dummy-ghc-data}/ghc/numeric-version
280+ ;;
281+ --supported-languages)
273− elif [ "'$*'" == "'--supported-languages'" ]; then cat ${dummy-ghc-data}/ghc/supported-languages;
282+ cat ${dummy-ghc-data}/ghc/supported-languages
283+ ;;
274− elif [ "'$*'" == "'--print-global-package-db'" ]; then echo $out/dumby-db;
284+ --print-global-package-db)
285+ echo "$out/dumby-db"
286+ ;;
287+ --info)
275− elif [ "'$*'" == "'--info'" ]; then cat ${dummy-ghc-data}/ghc/info;
288+ cat ${dummy-ghc-data}/ghc/info
289+ ;;
290+ --print-libdir)
276− elif [ "'$*'" == "'--print-libdir'" ]; then echo ${dummy-ghc-data}/ghc/libdir;
291+ echo ${dummy-ghc-data}/ghc/libdir
277− else
292+ ;;
278− false
293+ *)
279− fi
294+ echo "Unknown argment '$*'" >&2
295+ exit 1
296+ ;;
297+ esac
298+ exit 0
280 '';
299 '';
281 };
300 };
282
301
@@ -286,11 +305,20 @@ let
286 executable = true;
305 executable = true;
287 destination = "/bin/${ghc.targetPrefix}ghc-pkg";
306 destination = "/bin/${ghc.targetPrefix}ghc-pkg";
288 text = ''
307 text = ''
308+ #!${pkgs.evalPackages.runtimeShell}
309+ case "$*" in
310+ --version)
289− if [ "'$*'" == "'--version'" ]; then cat ${dummy-ghc-data}/ghc-pkg/version;
311+ cat ${dummy-ghc-data}/ghc-pkg/version
312+ ;;
313+ 'dump --global -v0')
290− elif [ "'$*'" == "'dump --global -v0'" ]; then cat ${dummy-ghc-data}/ghc-pkg/dump-global;
314+ cat ${dummy-ghc-data}/ghc-pkg/dump-global
291− else
315+ ;;
292− false
316+ *)
293− fi
317+ echo "Unknown argment '$*'" >&2
318+ exit 1
319+ ;;
320+ esac
321+ exit 0
294 '';
322 '';
295 };
323 };
296
324
materialized/dummy-ghc/aarch64-unknown-linux-gnu-aarch64-unknown-linux-gnu-ghc-8.6.5-x86_64-linux/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.6.5
materialized/dummy-ghc/aarch64-unknown-linux-gnu-aarch64-unknown-linux-gnu-ghc-8.8.3-x86_64-linux/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.8.3
materialized/dummy-ghc/ghc-8.6.5-x86_64-darwin/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.6.5
materialized/dummy-ghc/ghc-8.6.5-x86_64-linux/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.6.5
materialized/dummy-ghc/ghc-8.8.3-x86_64-darwin/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.8.3
materialized/dummy-ghc/ghc-8.8.3-x86_64-linux/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.8.3
materialized/dummy-ghc/js-unknown-ghcjs-js-unknown-ghcjs-ghc-8.6.5-x86_64-darwin/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.6.5
materialized/dummy-ghc/js-unknown-ghcjs-js-unknown-ghcjs-ghc-8.6.5-x86_64-linux/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.6.5
materialized/dummy-ghc/js-unknown-ghcjs-js-unknown-ghcjs-ghc-8.8.3-x86_64-darwin/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.8.3
materialized/dummy-ghc/js-unknown-ghcjs-js-unknown-ghcjs-ghc-8.8.3-x86_64-linux/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.8.3
materialized/dummy-ghc/x86_64-unknown-linux-musl-x86_64-unknown-linux-musl-ghc-8.6.5-x86_64-linux/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.6.5
materialized/dummy-ghc/x86_64-unknown-linux-musl-x86_64-unknown-linux-musl-ghc-8.8.3-x86_64-linux/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.8.3
materialized/dummy-ghc/x86_64-w64-mingw32-x86_64-w64-mingw32-ghc-8.6.5-x86_64-linux/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.6.5
materialized/dummy-ghc/x86_64-w64-mingw32-x86_64-w64-mingw32-ghc-8.8.3-x86_64-linux/ghc/versionnew file+1
@@ -0,0 +1 @@
1+The Glorious Glasgow Haskell Compilation System, version 8.8.3