
Hi folks, I'm in need of some Cabal assistance. I want to build the unit tests for MissingH using Cabal. According to the docs, this should require me to list all of the exposed modules from the library as other modules to the binary. Since there are dozens of these, I thought a simple hook could do the trick. I tried hooking into the confHook (which I have already used successfully to add "unix" as a build-dep on non-Windows platforms), and thought I could just pull the exposedModules list from the package and add those as otherModules to the executable. But it had no effect. So I tried hooking in to customBuildHook to do the same thing. Again, no effect. Here's the code I've tried. Suggestions appreciated. import Distribution.Simple import Distribution.PackageDescription import Distribution.Version import System.Info import Data.Maybe winHooks = defaultUserHooks {confHook = customConfHook} customConfHook descrip flags = let mydescrip = case System.Info.os of "mingw32" -> descrip _ -> descrip {buildDepends = (Dependency "unix" AnyVersion) : buildDepends descrip} in (confHook defaultUserHooks) mydescrip flags customBuildHook descrip lbi uh flags = let myexecutables = map bdfix (executables descrip) bdfix exe = exe {buildInfo = (buildInfo exe) {otherModules = exposedModules . fromJust . library $ descrip}} mydescrip = descrip {executables = myexecutables} in (buildHook defaultUserHooks) mydescrip flags main = defaultMainWithHooks winHooks

I posted a weird version of the code. Here's the real version. Same problem I described, though. Distribution.Simple import Distribution.PackageDescription import Distribution.Version import System.Info import Data.Maybe winHooks = defaultUserHooks {confHook = customConfHook, buildHook = customBuildHook} customConfHook descrip flags = let mydescrip = case System.Info.os of "mingw32" -> descrip _ -> descrip {buildDepends = (Dependency "unix" AnyVersion) : buildDepends descrip} in (confHook defaultUserHooks) mydescrip flags customBuildHook descrip lbi uh flags = let myexecutables = map bdfix (executables descrip) bdfix exe = exe {buildInfo = (buildInfo exe) {otherModules = exposedModules . fromJust . library $ descrip}} mydescrip = descrip {executables = myexecutables} in do print mydescrip (buildHook defaultUserHooks) mydescrip lbi uh flags main = defaultMainWithHooks winHooks

Hi
let mydescrip = case System.Info.os of "mingw32" -> descrip _ -> descrip {buildDepends =
Arrrrggggghhhhhhh! To test if the operating system is windows you compare against a hard coded string which _isn't_ an OS, but _is_ an optional component by a 3rd party. It's required to build some Haskell compilers, but for Yhc and Hugs its not required at any stage, and its presence is optional! I know this isn't your fault, it just scares me deeply that "os" could return something that isn't an os! How about we add a cpu string, which returns the amount of RAM installed. Or how about we add a compiler string, which returns the users surname... Thanks Neil

On Thu, Nov 30, 2006 at 08:53:36PM +0000, Neil Mitchell wrote:
Arrrrggggghhhhhhh! To test if the operating system is windows you compare against a hard coded string which _isn't_ an OS, but _is_ an optional component by a 3rd party. It's required to build some Haskell compilers, but for Yhc and Hugs its not required at any stage, and its presence is optional!
Your point is well-taken, but the distinction is useful. If running on cygwin, my platform is essentially POSIX, even though the OS is Windows. And yes, I do claim that this isn't my fault ;-) -- John
participants (2)
-
John Goerzen
-
Neil Mitchell