bug in libdir setting in ghc mk/config.mk
Tim Barbour
trb at eastpac.com.au
Mon Nov 5 23:42:04 EST 2001
Hi,
My recent build of the ghc5-5.02 Debian package produced an unusable compiler
(because libdir was missing a trailing "/ghc-5.02". michaelw at debian.org and I
tracked the problem down, as follows.
The problem occurs with make version 3.77, but not with make version 3.79.1
. Whether it will occur with make version 3.80 etc. is probably an open
question.
The setting of 'libdir' in "mk/config.mk" in the ghc source is infelicitous. It
is set using both '=' and ':=' - AFAIK this combination, besides being bad
practice, does not have a defined meaning.
Here is my patch (which solves the problem for me):
--- ghc-5.02.1.orig/mk/config.mk.in Tue Aug 28 00:27:23 2001
+++ ghc5-5.02.1/mk/config.mk.in Mon Nov 5 18:51:13 2001
@@ -462,7 +462,10 @@
# override libdir and datadir to put project-specific stuff in
# a subdirectory with the version number included.
#
-libdir := $(if $(ProjectNameShort),$(libdir)/$(ProjectNameShort)-$(ProjectVersion),$(libdir))
+libdir0 := $(libdir)
+ifneq "$(strip $(ProjectNameShort))" ""
+ libdir = $(libdir0)/$(ProjectNameShort)-$(ProjectVersion)
+endif
datadir := $(if $(ProjectNameShort),$(datadir)/$(ProjectNameShort)-$(ProjectVersion),$(datadir))
#
I have checked that the similar use of ':=' is not causing a problem with
'datadir', but believe this is mostly good luck.
I suggest a careful examination of the use of ':=', and also of the need to
"override" variables such as libdir. IMO, overriding make variables is better
avoided (think of referential transparency), and use of ':=' should be confined
to those cases where it is genuinely needed for a special reason (think of
laziness).
Tim
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." -- Benjamin Franklin
More information about the Glasgow-haskell-bugs
mailing list