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

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 would like the ${wxhlibdir} to be replaced by the value in the environment. This feature is absolutely *essential* to get the windows installer working. I use a batch file that gets the current directory and puts that in the environment before call ghc-pkg.
On unix, I can use sed to make it work, but this does not hold for windows. What can I do to allow the user to install wxhaskell at arbitrary places using just a batch file? (ie. we can not assume that cygwin is available) I can hardly believe if no one has thought of this before, so I hope it is just a syntax issue.
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 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: package.conf : package.conf.in 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. Cheers, Simon

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 : package.conf.in 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.
Cheers, Simon _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
participants (2)
-
Daan Leijen
-
Simon Marlow