@@ -239,6 +239,7 @@ let
239239 } ''
240240 mkdir -p $out/ghc
241241 mkdir -p $out/ghc-pkg
242+ ${ghc.targetPrefix}ghc --version > $out/ghc/version
242243 ${ghc.targetPrefix}ghc --numeric-version > $out/ghc/numeric-version
243244 ${ghc.targetPrefix}ghc --info | grep -v /nix/store > $out/ghc/info
244245 ${ghc.targetPrefix}ghc --supported-languages > $out/ghc/supported-languages
@@ -269,14 +270,32 @@ let
269270 executable = true;
270271 destination = "/bin/${ghc.targetPrefix}ghc";
271272 text = ''
272− if [ "'$*'" == "'--numeric-version'" ]; then cat ${dummy-ghc-data}/ghc/numeric-version;
273− elif [ "'$*'" == "'--supported-languages'" ]; then cat ${dummy-ghc-data}/ghc/supported-languages;
274− elif [ "'$*'" == "'--print-global-package-db'" ]; then echo $out/dumby-db;
275− elif [ "'$*'" == "'--info'" ]; then cat ${dummy-ghc-data}/ghc/info;
276− elif [ "'$*'" == "'--print-libdir'" ]; then echo ${dummy-ghc-data}/ghc/libdir;
277− else
278− false
279− fi
273+ #!${pkgs.evalPackages.runtimeShell}
274+ case "$*" in
275+ --version)
276+ cat ${dummy-ghc-data}/ghc/version
277+ ;;
278+ --numeric-version)
279+ cat ${dummy-ghc-data}/ghc/numeric-version
280+ ;;
281+ --supported-languages)
282+ cat ${dummy-ghc-data}/ghc/supported-languages
283+ ;;
284+ --print-global-package-db)
285+ echo "$out/dumby-db"
286+ ;;
287+ --info)
288+ cat ${dummy-ghc-data}/ghc/info
289+ ;;
290+ --print-libdir)
291+ echo ${dummy-ghc-data}/ghc/libdir
292+ ;;
293+ *)
294+ echo "Unknown argment '$*'" >&2
295+ exit 1
296+ ;;
297+ esac
298+ exit 0
280299 '';
281300 };
282301
@@ -286,11 +305,20 @@ let
286305 executable = true;
287306 destination = "/bin/${ghc.targetPrefix}ghc-pkg";
288307 text = ''
289− if [ "'$*'" == "'--version'" ]; then cat ${dummy-ghc-data}/ghc-pkg/version;
290− elif [ "'$*'" == "'dump --global -v0'" ]; then cat ${dummy-ghc-data}/ghc-pkg/dump-global;
291− else
292− false
293− fi
308+ #!${pkgs.evalPackages.runtimeShell}
309+ case "$*" in
310+ --version)
311+ cat ${dummy-ghc-data}/ghc-pkg/version
312+ ;;
313+ 'dump --global -v0')
314+ cat ${dummy-ghc-data}/ghc-pkg/dump-global
315+ ;;
316+ *)
317+ echo "Unknown argment '$*'" >&2
318+ exit 1
319+ ;;
320+ esac
321+ exit 0
294322 '';
295323 };
296324