[nhc-bugs] Re: Error building hmake-3.00 in RH Linux with ghc-5.02.2

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Mon, 21 Jan 2002 22:06:05 +0000


> There is a /usr/bin/ghc Bourne shell script:
> 
> 	#!/bin/sh
> 	GHCBIN=3D"/usr/lib/ghc-5.02.2/ghc-5.02.2";
> 	TOPDIROPT=3D"-B/usr/lib/ghc-5.02.2";
> 	# Mini-driver for GHC
> 	exec $GHCBIN $TOPDIROPT ${1+"$@"}

Thank you.  It would seem that this shell script is very different
in RPM-versions of ghc than the standard tar distributions.  In
particular, the regular expression 'libdir=.*' (which was supplied
to me by the GHC team as a foolproof way of recognising import
directories) is completely absent.

Here is a small patch to try to use the TOPDIROPT variable if the
libdir test fails.  Can you let me know whether it works please?

Regards,
    Malcolm


===================================================================
diff -u -r1.7 src/hmake/MkConfig.hs
--- src/hmake/MkConfig.hs	2002/01/21 11:25:47	1.7
+++ src/hmake/MkConfig.hs	2002/01/21 21:58:42
@@ -165,6 +165,10 @@
     else do
       dir <- runAndReadStdout ("grep '^libdir=' "++fullpath++" | head -1 | "
                                ++ "sed 's/^libdir=.\\(.*\\)./\\1/'")
+      dir <- if null dir then
+                 runAndReadStdout ("grep '^TOPDIROPT=' "++fullpath
+                                   ++" | sed 's/^TOPDIROPT=.-B\\(.*\\).;/\\1/'")
+             else return dir
       let incdir1 = dir++"/imports"
       ok <- doesDirectoryExist incdir1
       if ok