Cabal on Windows, revisited

I'm having another go at Building Cabal for Windows, this time using the make utility from mingw. (HMake doesn't serve, as it's specific to compiling Haskell programs. Mainly, I need to get the preprocessing performed for loading into Hugs). Issues noted. ... 1. The "mkdir -p" command fails: under Windows, the syntax of this command is different. I realize there are many other Unix shell commands that just wont work in a make file under Windows, so I'm going to proceed to create a Windows-specific makefile for Hugs. 2. I've replaced the GHC invocations with cpphs, rather like the makefile target for creating documentation. 3. I've changed the temporary target directory to dist\tmp\Distribution (needs to be the right name to match hierarchical module names with Hugs). Also created subdirectory Simple. Also copied Setup.lhs to dist\tmp, and used that as the Haskell program to be run using RunHugs. 4. I also create a target directory and preprocessing commands for the Compat modules: dist\tmp\Compat. 5. At this point, using a batch file to run Setup, I can issue the command Setup --help: [[ E:\HaskellTools\cabal>C:\DEV\Hugs98\runhugs-20040109.exe dist\tmp\Setup.lhs --he lp Usage: disttmpSetup.lhs [GLOBAL FLAGS] COMMAND [FLAGS] Global flags: -h, -? --help Show this help text Commands: configure Prepare to build the package. build Make this package ready for installation. clean Clean up after a build. install Copy the files into the install locations. sdist Generate a source distribution file (.tar.gz or .zip). register Register this package with the compiler. unregister Unregister this package with the compiler. For more information about a command, try 'disttmpSetup.lhs COMMAND --help'. E:\HaskellTools\cabal> ]] It's a small thing, but it looks as if the path separators in 'dist\tmp\Setup.lhs' are being inappropriately interpreted. 6. I tweak the makefile to be sensitive to the presence of 'dist\tmp\Setup.lhs', and running Setup config gives this: [[ E:\HaskellTools\cabal>make config .\Setup configure --hugs --prefix=E:\Temp\Cabal E:\HaskellTools\cabal>RunHaskell dist\tmp\Setup.lhs configure --hugs --prefix E: \Temp\Cabal E:\HaskellTools\cabal>C:\DEV\Hugs98\runhugs-20040109.exe dist\tmp\Setup.lhs configure --hugs --prefix E:\Temp\Cabal Configuring Cabal-0.1... configure: searching for hugs in path. Cannot find compiler for hugs make: *** [config] Error 1 E:\HaskellTools\cabal> ]] I guess this is because of my unusual Hugs setup: (a) I don't have Hugs on the path, and (b) I am currently using a non-standard name for the RunHugs executable. Both problems are resolved if I can override the search for the RunHugs executable with a command line option to specify it. That looks like the "--with-compiler" option. I try using that with the name of my batch file (which is on the path), but get a different error: [[ E:\HaskellTools\cabal>C:\DEV\Hugs98\runhugs-20040109.exe dist\tmp\Setup.lhs configure --hugs --with-compiler RunHaskell --prefix E:\Temp\Cabal Configuring Cabal-0.1... configure: looking for package tool: hugs-package near compiler in RunHaskell Cannot find package tool: ./hugs-package make: *** [config] Error 1 E:\HaskellTools\cabal> ]] OK, it seems to need the actual Hugs executable to find the proper path, so I'll have to make that available and try again: [[ E:\HaskellTools\cabal>C:\DEV\Hugs98\runhugs-20040109.exe dist\tmp\Setup.lhs conf igure --hugs --with-compiler C:\DEV\Hugs98\Hugs.exe --prefix E:\Temp\Cabal Configuring Cabal-0.1... configure: looking for package tool: hugs-package near compiler in C:DEVHugs98Hu gs.exe Cannot find package tool: ./hugs-package make: *** [config] Error 1 E:\HaskellTools\cabal> ]] I note the '\' in the filename are being processed incorrectly again. Also, it still can't find the package tool ./hugs-package. ... That's about as far as I'm going to get here. My makefile so far is: [[ PREF=E:\Temp\Cabal CPPHS=RunHaskell ..\cpphs\cpphs.hs --noline HUGS=C:\DEV\Hugs98\Hugs.exe # build the library itself: for Hugs, this is simply preprocessing into a new directory dist/tmp/Setup.lhs: mkdir dist\tmp\Distribution\Simple mkdir dist\tmp\Compat copy Setup.lhs dist\tmp\Setup.lhs $(CPPHS) Distribution/Package.hs > dist/tmp/Distribution/Package.hs $(CPPHS) Distribution/Misc.hs > dist/tmp/Distribution/Misc.hs $(CPPHS) Distribution/Version.hs > dist/tmp/Distribution/Version.hs $(CPPHS) Distribution/Setup.hs > dist/tmp/Distribution/Setup.hs $(CPPHS) Distribution/ModuleTest.hs > dist/tmp/Distribution/ModuleTest.hs $(CPPHS) Distribution/Simple.hs > dist/tmp/Distribution/Simple.hs $(CPPHS) Distribution/Make.hs > dist/tmp/Distribution/Make.hs $(CPPHS) Distribution/InstalledPackageInfo.hs > dist/tmp/Distribution/InstalledPackageInfo.hs $(CPPHS) Distribution/Simple/Build.hs > dist/tmp/Distribution/Simple/Build.hs $(CPPHS) Distribution/Simple/Install.hs > dist/tmp/Distribution/Simple/Install.hs $(CPPHS) Distribution/Simple/Configure.hs > dist/tmp/Distribution/Simple/Configure.hs $(CPPHS) Distribution/Simple/Register.hs > dist/tmp/Distribution/Simple/Register.hs $(CPPHS) Distribution/Simple/Utils.hs > dist/tmp/Distribution/Simple/Utils.hs $(CPPHS) Distribution/Simple/SrcDist.hs > dist/tmp/Distribution/Simple/SrcDist.hs $(CPPHS) Distribution/Simple/GHCPackageConfig.hs > dist/tmp/Distribution/Simple/GHCPackageConfig.hs $(CPPHS) Distribution/GetOpt.hs > dist/tmp/Distribution/GetOpt.hs $(CPPHS) Compat/Exception.hs > dist/tmp/Compat/Exception.hs $(CPPHS) Compat/H98.hs > dist/tmp/Compat/H98.hs $(CPPHS) Compat/RawSystem.hs > dist/tmp/Compat/RawSystem.hs $(CPPHS) Compat/ReadP.hs > dist/tmp/Compat/ReadP.hs setup-hugs: dist/tmp/Setup.lhs setup: setup-hugs config: setup .\Setup configure --hugs --with-compiler=$(HUGS) --prefix=$(PREF) ]] My Setup.bat file is: [[ rem run setup program for installing cabal rem assumes that RunHaskell utility or batch file is on the path RunHaskell dist\tmp\Setup.lhs %1 %2 %3 %4 %5 %6 %7 %8 ]] My RunHaskell.bat file is: [[ C:\DEV\Hugs98\runhugs-20040109.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 ]] (As I mentioned, I'm using a modified version of RunHugs, hence the unusual filename.) #g ------------ Graham Klyne For email: http://www.ninebynine.org/#Contact

Graham Klyne
I'm having another go at Building Cabal for Windows, this time using the make utility from mingw. (HMake doesn't serve, as it's specific to compiling Haskell programs. Mainly, I need to get the preprocessing performed for loading into Hugs).
Hi Graham, I think you're going to continue to have trouble with Hugs for a while, but I just did some hacking to add more hugs support to Cabal. If you get the new darcs sources or tarball, you should be able to get a little further. I think you'll have more success with GHC on Windows; I think it's been done before, in fact. http://www.haskell.org/cabal/code.html I still can't even get it to bootstrap on my own system with Hugs. In case I haven't mentioned this before, I'm not focusing very hard on Hugs right now, though it does _kinda_ work at this time. My focus is on getting an end-to-end solution with GHC before branching out to platforms and compilers that I don't use much. If you want to help with Hugs support, look at the TODO list in the sources, and grep around for "FIX (HUGS)" comments that'll direct your attention to things that need it. I just added those. One problem is that there's no tool for registering or unregistering packages with Hugs (HC-PKG), so the hacks that I have in place will just dump the files into hugs libraries tree directly (using hugs-package, which doesn't do the same kind of thing as ghc-package). I really need more hackers on this, and it would be great if you could grab the darcs tree and start to submit patches when you see problems. I'll be more than happy to work with you to get this running on your system.
1. The "mkdir -p" command fails: under Windows, the syntax of this command is different. I realize there are many other Unix shell commands that just wont work in a make file under Windows, so I'm going to proceed to create a Windows-specific makefile for Hugs.
Can you send me this file either as a darcs patch or as an attachment in private mail?
2. I've replaced the GHC invocations with cpphs, rather like the makefile target for creating documentation.
This shouldn't actually be necessary now, since hugs-package does this step. Do you have hugs-package on your platform?
5. At this point, using a batch file to run Setup, I can issue the command Setup --help:
Well, that's something! (snip)
Cannot find compiler for hugs make: *** [config] Error 1
E:\HaskellTools\cabal> ]]
I guess this is because of my unusual Hugs setup:
Yep.
configure: looking for package tool: hugs-package near compiler in RunHaskell Cannot find package tool: ./hugs-package make: *** [config] Error 1
(snip)
OK, it seems to need the actual Hugs executable to find the proper path, so I'll have to make that available and try again: [[ E:\HaskellTools\cabal>C:\DEV\Hugs98\runhugs-20040109.exe dist\tmp\Setup.lhs conf igure --hugs --with-compiler C:\DEV\Hugs98\Hugs.exe --prefix E:\Temp\Cabal Configuring Cabal-0.1... configure: looking for package tool: hugs-package near compiler in C:DEVHugs98Hu gs.exe Cannot find package tool: ./hugs-package make: *** [config] Error 1
It's looking for the hugs-package tool. You can tell it where to find it with the "--with-hc-pkg" option, just like you did for hugs itself above.
E:\HaskellTools\cabal> ]]
I note the '\' in the filename are being processed incorrectly again. Also, it still can't find the package tool ./hugs-package.
Hmm. Can you run the test suite in the Utils module? You should be able to preprocess that and load it pretty easily. Running the test suite will require HUnit.
That's about as far as I'm going to get here. My makefile so far is:
Thanks for messing with this. I hope that other windows users will be able to offer you more help with some of this stuff than I can. peace, isaac

Isaac, I'll do what I can as and when time and other involvements permit. Meanwhile I was trying to provide what I hope was some constructive feedback, at this stage being mainly with respect to identifying aspects of Hugs that may require different treatment. I feel that before I can seriously make patches to the code repository, I need to get a better overall handle on how the Cabal pieces fit together (which I'm slowly getting, I think). You asked for:
1. The "mkdir -p" command fails: under Windows, the syntax of this command is different. I realize there are many other Unix shell commands that just wont work in a make file under Windows, so I'm going to proceed to create a Windows-specific makefile for Hugs.
Can you send me this file either as a darcs patch or as an attachment in private mail?
Did you notice I included my makefile bits so far at the end of my previous message? For ease of reference, I include it again, below. Note that directories need to be edited for this to work. Keep up the good work! #g -- [[ PREF=E:\Temp\Cabal CPPHS=RunHaskell ..\cpphs\cpphs.hs --noline HUGS=C:\DEV\Hugs98\Hugs.exe # build the library itself: for Hugs, this is simply preprocessing into a new directory dist/tmp/Setup.lhs: mkdir dist\tmp\Distribution\Simple mkdir dist\tmp\Compat copy Setup.lhs dist\tmp\Setup.lhs $(CPPHS) Distribution/Package.hs > dist/tmp/Distribution/Package.hs $(CPPHS) Distribution/Misc.hs > dist/tmp/Distribution/Misc.hs $(CPPHS) Distribution/Version.hs > dist/tmp/Distribution/Version.hs $(CPPHS) Distribution/Setup.hs > dist/tmp/Distribution/Setup.hs $(CPPHS) Distribution/ModuleTest.hs > dist/tmp/Distribution/ModuleTest.hs $(CPPHS) Distribution/Simple.hs > dist/tmp/Distribution/Simple.hs $(CPPHS) Distribution/Make.hs > dist/tmp/Distribution/Make.hs $(CPPHS) Distribution/InstalledPackageInfo.hs > dist/tmp/Distribution/InstalledPackageInfo.hs $(CPPHS) Distribution/Simple/Build.hs > dist/tmp/Distribution/Simple/Build.hs $(CPPHS) Distribution/Simple/Install.hs > dist/tmp/Distribution/Simple/Install.hs $(CPPHS) Distribution/Simple/Configure.hs > dist/tmp/Distribution/Simple/Configure.hs $(CPPHS) Distribution/Simple/Register.hs > dist/tmp/Distribution/Simple/Register.hs $(CPPHS) Distribution/Simple/Utils.hs > dist/tmp/Distribution/Simple/Utils.hs $(CPPHS) Distribution/Simple/SrcDist.hs > dist/tmp/Distribution/Simple/SrcDist.hs $(CPPHS) Distribution/Simple/GHCPackageConfig.hs > dist/tmp/Distribution/Simple/GHCPackageConfig.hs $(CPPHS) Distribution/GetOpt.hs > dist/tmp/Distribution/GetOpt.hs $(CPPHS) Compat/Exception.hs > dist/tmp/Compat/Exception.hs $(CPPHS) Compat/H98.hs > dist/tmp/Compat/H98.hs $(CPPHS) Compat/RawSystem.hs > dist/tmp/Compat/RawSystem.hs $(CPPHS) Compat/ReadP.hs > dist/tmp/Compat/ReadP.hs setup-hugs: dist/tmp/Setup.lhs setup: setup-hugs config: setup .\Setup configure --hugs --with-compiler=$(HUGS) --prefix=$(PREF) ]] My Setup.bat file is: [[ rem run setup program for installing cabal rem assumes that RunHaskell utility or batch file is on the path RunHaskell dist\tmp\Setup.lhs %1 %2 %3 %4 %5 %6 %7 %8 ]] My RunHaskell.bat file is: [[ C:\DEV\Hugs98\runhugs-20040109.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 ]] (As I mentioned, I'm using a modified version of RunHugs, hence the unusual filename.) At 09:12 02/11/04 -0800, Isaac Jones wrote:
Graham Klyne
writes: I'm having another go at Building Cabal for Windows, this time using the make utility from mingw. (HMake doesn't serve, as it's specific to compiling Haskell programs. Mainly, I need to get the preprocessing performed for loading into Hugs).
Hi Graham,
I think you're going to continue to have trouble with Hugs for a while, but I just did some hacking to add more hugs support to Cabal. If you get the new darcs sources or tarball, you should be able to get a little further. I think you'll have more success with GHC on Windows; I think it's been done before, in fact.
http://www.haskell.org/cabal/code.html
I still can't even get it to bootstrap on my own system with Hugs. In case I haven't mentioned this before, I'm not focusing very hard on Hugs right now, though it does _kinda_ work at this time. My focus is on getting an end-to-end solution with GHC before branching out to platforms and compilers that I don't use much. If you want to help with Hugs support, look at the TODO list in the sources, and grep around for "FIX (HUGS)" comments that'll direct your attention to things that need it. I just added those.
One problem is that there's no tool for registering or unregistering packages with Hugs (HC-PKG), so the hacks that I have in place will just dump the files into hugs libraries tree directly (using hugs-package, which doesn't do the same kind of thing as ghc-package).
I really need more hackers on this, and it would be great if you could grab the darcs tree and start to submit patches when you see problems. I'll be more than happy to work with you to get this running on your system.
1. The "mkdir -p" command fails: under Windows, the syntax of this command is different. I realize there are many other Unix shell commands that just wont work in a make file under Windows, so I'm going to proceed to create a Windows-specific makefile for Hugs.
Can you send me this file either as a darcs patch or as an attachment in private mail?
2. I've replaced the GHC invocations with cpphs, rather like the makefile target for creating documentation.
This shouldn't actually be necessary now, since hugs-package does this step. Do you have hugs-package on your platform?
5. At this point, using a batch file to run Setup, I can issue the command Setup --help:
Well, that's something!
(snip)
Cannot find compiler for hugs make: *** [config] Error 1
E:\HaskellTools\cabal> ]]
I guess this is because of my unusual Hugs setup:
Yep.
configure: looking for package tool: hugs-package near compiler in RunHaskell Cannot find package tool: ./hugs-package make: *** [config] Error 1
(snip)
OK, it seems to need the actual Hugs executable to find the proper path, so I'll have to make that available and try again: [[ E:\HaskellTools\cabal>C:\DEV\Hugs98\runhugs-20040109.exe dist\tmp\Setup.lhs conf igure --hugs --with-compiler C:\DEV\Hugs98\Hugs.exe --prefix E:\Temp\Cabal Configuring Cabal-0.1... configure: looking for package tool: hugs-package near compiler in C:DEVHugs98Hu gs.exe Cannot find package tool: ./hugs-package make: *** [config] Error 1
It's looking for the hugs-package tool. You can tell it where to find it with the "--with-hc-pkg" option, just like you did for hugs itself above.
E:\HaskellTools\cabal> ]]
I note the '\' in the filename are being processed incorrectly again. Also, it still can't find the package tool ./hugs-package.
Hmm. Can you run the test suite in the Utils module? You should be able to preprocess that and load it pretty easily. Running the test suite will require HUnit.
That's about as far as I'm going to get here. My makefile so far is:
Thanks for messing with this. I hope that other windows users will be able to offer you more help with some of this stuff than I can.
peace,
isaac _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
------------ Graham Klyne For email: http://www.ninebynine.org/#Contact

Graham Klyne
Isaac,
I'll do what I can as and when time and other involvements permit. Meanwhile I was trying to provide what I hope was some constructive feedback, at this stage being mainly with respect to identifying aspects of Hugs that may require different treatment. I feel that before I can seriously make patches to the code repository, I need to get a better overall handle on how the Cabal pieces fit together (which I'm slowly getting, I think).
FYI, I just pushed a version of the cabal (in both darcs and tarball snapshot) that bootstraps with Hugs. If you have the hugs-package tool, you should be able to translate the makefile into a .bat file that'll work for you on Windows. It's pretty straightforward. This also adds CPP as a language extension. Since we have some basic hugs support and preprocessors, I'll probably release this as 0.2. I'm still thinking about my opinions on CPP. Everyone has an opinion on it, right? ;)
Keep up the good work!
Thanks! peace, isaac
participants (3)
-
Graham Klyne
-
Graham Klyne
-
Isaac Jones