Help! no environment variable expansion in package files ?!?

Daan Leijen daan at
Thu Apr 28 10:23:48 EDT 2005

Simon Marlow wrote:

>On 28 April 2005 14:37, Daan Leijen wrote:
>>I am trying to prepare a new release of wxHaskell based
>>on ghc 6.4 but I am in despair. It seems that the new
>>package descriptions do no longer allow environment
>>variables in there. For example:
>> import-dirs:${wxhlibdir}/imports
>I didn't port the feature to the new version of ghc-pkg.  Sorry about
>that, the reasons were that (a) there are other ways to do it, and (b)
>the other ways are in general better, because you can substitute
>multiple values for a variable.
:-( I was hoping that it was just a syntax issue.

>I suggest you use CPP ('gcc -E -undef -traditional -P' or 'cpphs').
>This is what we use in GHC to get values into the package.conf files.
>e.g. in a Makefile you would write something like:
This does not work for me. For the *binary* installer for windows,
I use a batch file (.bat). The user unzips the binary files (.hi & .o)
in some location and runs "register.bat" which calls ghc-pkg with
the .pkg files. This batch file sets the current directory (= the
install directory) as an environment variable that used to be expanded
in the .pkg files. Now, I need to generate those .pkg files inside
the .bat file which seems a lot of extra work, if it works at all..

Another thing that causes me trouble is that I seem to need to
list all exposed modules explicitly. For me, this means that I
need to put those modules into the configure script which makes
everything much more fragile. Is there a way to use a wildcard,
ie. saying "expose everything in here"?

All the best,
And thanks for the help,
-- Daan Leijen

>package.conf :
>	gcc -E -undef -traditional -P -x c $< >$@ \
>		-DWXHLIBDIR='"$(wxhlibdir)"'
>(untested; I copied this mostly from GHC's build system).
>Another option, if you use autoconf, is to process the file using the
>configure script.
>	Simon
>Libraries mailing list
>Libraries at

More information about the Libraries mailing list