Library Infrastructure code & help wanted
Greetings, I'm looking for some help on the library infrastructure project. The project and its goals are explained here: http://www.haskell.org/libraryInfrastructure/ And the code is here: http://www.haskell.org/libraryInfrastructure/code.html In brief, the Library Infrastructure Project is an effort to provide a framework for developers to more effectively contribute their software to the Haskell community. I'm hoping to not have to implement this entire proposal myself, and I'm very flexible about implementation details. I've made some concrete progress, and I just mirrored my code repository on my web site, so now is the time to get involved! Specifically, at the moment, I want a couple of things: 1) A version parser. I implemented a parser which parses versions that are made of dates, or simple numeric versions. I'd like it to do more kinds of versions, though. Distribution.Version is attached. What is this version stuff used for? Well for one thing, you can use it to say something like: ./haskell-config --user list "MyPackage>1.2" where "MyPackage" is the name of a package. This will list all of the user-installed packages whose versions are greater than 1.2. If you look at the HUnit tests at the bottom of the attached file, you'll get a good idea of what it does right now. It uses Parsec. BTW, I understand that the Debian project has some standard version number parser which might give you some ideas. 2) I also would like someone to help out with the package configuration file IO. Right now, it uses HaXmL, with no generated code. Someone who has seen HaXmL before could give me advice about how my code could be better, submit patches, or rewrite it. As discussed on libraries@haskell.org, I'm open to not using XML if someone wants to redo what I've got there (not a huge task). This parsing code is in Distribution.Package. I do want something more flexible than straight-up read/show. 3) Someone to make it work with in nhc & hugs. The HaXmL page says that it doesn't work w/ Hugs yet (can anyone tell me why?), so that's one step. Also, at least for the version of NHC I have on my system, Parsec is different. So maybe we have to move away from Parsec, or maybe a different version thereof? It is absolutely vital for this project to be completely cross-platform and cross-compiler, so if we have to avoid depending on such things, I'm very willing to change. 4) Someone to make it work with Windows. Avoid using a filename that's called "Aux" ;) ABOUT THE CODE: It only works with GHC at the moment (see above) :( Right now what I've got is a first stab at Distribution.Package and haskell-config as explained in the proposal [1], though some things may have changed. It's hosted with Arch[2], a newish version control system. You can branch my code on your own machine and submit patches. Arch has some tools to help with patches. I've also provided a tarball. Arch is cool, though. You should try it. The HUnit tests in some of the modules should be pretty illuminating. The interactive help for haskell-config is pretty OK. Get the code here: http://www.haskell.org/libraryInfrastructure/code.html peace, isaac [1] http://www.haskell.org/libraryInfrastructure/proposal/index.html [2] http://regexps.srparish.net/www/
Isaac Jones <ijones@syntaxpolice.org> writes:
3) Someone to make it work with in nhc & hugs. The HaXmL page says that it doesn't work w/ Hugs yet (can anyone tell me why?),
Ironically enough, the only reason was an inadequate packaging framework... There is a new version of HaXml sitting in CVS just waiting for a release, which does work just fine with the latest version of Hugs.
Also, at least for the version of NHC I have on my system, Parsec is different. So maybe we have to move away from Parsec, or maybe a different version thereof?
Parsec recently moved out of 'base' into its own package, and nhc98 hasn't had a release since then. That should be the only difference(?). Regards, Malcolm
I'm looking into testing the Library infrastructure software under Windows (initially using GHC), but am running into a hurdle regarding HaXml. As far as I can tell, there is no script for building a Windows version of HaXml. Looking at the HaXml kit it looks as if the easiest way to try and to this will be to find a suitable version of make (i.e. compatible with whatever is used to build the HaXml package), and use that in conjunction with the Makefiles supplied. Can anyone point me at a suitable version of make to run on Windows (2K/XP)? An alternative possibility might be to use GHC --make, but I'm not sufficiently familiar with the GHC package framework or the HaXml build structure to know if this is possible. The HaXml release notes suggest it is, but I don't see how to do it. Does anyone have any other suggestions? #g -- BTW, I'm working with: - GHC 6.2 - HaXML 1.10 ------------ Graham Klyne For email: http://www.ninebynine.org/#Contact
Graham Klyne <GK@ninebynine.org> writes:
An alternative possibility might be to use GHC --make, but I'm not sufficiently familiar with the GHC package framework or the HaXml build structure to know if this is possible. The HaXml release notes suggest it is, but I don't see how to do it.
You can avoid using 'configure' and 'make' by just following the recipe in the Makefile by hand. Realising that as a Windows person you are probably inexperienced in reading a Makefile, here is the quick version. cd src ghc --make -cpp -i. -package-name HaXml $(SRCS) [ Replace $(SRCS) with the cut-and-pasted list of files from the Makefile ] ar r libHSHaXml.a $(OBJS) [ $(OBJS) is the source-file list replacing .hs by .o ] ld -r --whole-archive -o HSHaXml.o libHSHaXml.a [ only if you need to play with it in GHCi ] cp libHSHaXml.a HSHaXml.o $(GHC_LIB_DIR) [ install the library archive(s) where GHC can find them ] { tar cf interfaces.tar `find Text -name *.hi -print` cp interfaces.tar $(GHC_LIB_DIR)/imports cd $(GHC_LIB_DIR)/imports tar xf interfaces.tar rm interfaces.tar } [ install the interface files where GHC can find them ] ghc-pkg --add-package <pkg.conf [ and finally register the package with GHC ] Obviously I have used some Unix-isms here, but you will know the Windows equivalents better than I can guess them. Also, these instructions are just for the library package itself, not for any of the stand-alone tools that come with HaXml. Shout if you need to build those too. Regards, Malcolm
Thanks, your recipe was helpful to get me started. I'm trying to turn this into a Windows batch file, which I'll post back for your consideration (work-in-progress copy below). I notice that the Win32 distribution of GHC does not include ar, so I've located and downloaded a MinGW kit. ... Compiling the source kit, I find module: Text/XML/HaXml/Validate.hs imports FiniteMap when what is provided by GHC is Data.FiniteMap. ... Otherwise, the compilation and library build seems to complete OK. ... Copying the .hi files to the imports directory tree, I find that one existing file (from the GHC installation) is requested to be overwritten: Overwrite C:\DEV\ghc\ghc-6.2\imports\Text\PrettyPrint\HughesPJ.hi For now, I've refused the override and renamed the source file in the HaXml tree. Is there any reason that the GHC version should be replaced? (The source codes seem to be quite different, but clearly based on the same origin: a comment suggests that the HaXml version has been converted to "Standard Haskell".) ... Finally, I seem to be having a minor problem installing the resulting package: [[ C:\DEV\Haskell\lib\HaXml-1.10\src>C:\DEV\ghc\ghc-6.2\bin\ghc-pkg.exe --add-package 0<pkg.conf Reading package info from stdin... done. Expanding embedded variables... done. warning: can't find GHCi lib `HSHaXml.o' Saving old package config file... done. Writing new package config file... done. ]] I have confirmed that the file exists in the GHC install directory: [[ C:\DEV\ghc\ghc-6.2>dir *HaXml* Volume in drive C is SYS Volume Serial Number is F4A9-5305 Directory of C:\DEV\ghc\ghc-6.2 20/01/04 14:42 2,073,869 HSHaXml.o 20/01/04 14:42 2,322,312 libHSHaXml.a ]] I can't figure what I'm doing wrong here: can anyone help? #g -- Here's my work-in-progress file Make.bat. Note that the lines set SRCS=... set OBJS=... are very long lines (about 500 characters). [[ REM Build HaXml package using GHC set GHCDIR=C:\DEV\ghc\ghc-6.2 set GHC=C:\DEV\ghc\ghc-6.2\bin\ghc.exe set GHCPKG=C:\DEV\ghc\ghc-6.2\bin\ghc-pkg.exe set AR=C:\DEV\MinGW\bin\ar.exe set LD=C:\DEV\ghc\ghc-6.2\gcc-lib\ld.exe set SRC=C:\DEV\Haskell\lib\HaXml-1.10\src set SRCS=Text/XML/HaXml.hs Text/XML/HaXml/Combinators.hs Text/XML/HaXml/Lex.hs Text/XML/HaXml/Parse.hs Text/XML/HaXml/Pretty.hs Text/XML/HaXml/Types.hs Text/XML/HaXml/Validate.hs Text/XML/HaXml/Wrappers.hs Text/XML/HaXml/OneOfN.hs Text/XML/HaXml/Xml2Haskell.hs Text/XML/HaXml/Haskell2Xml.hs Text/XML/HaXml/Verbatim.hs Text/XML/HaXml/Escape.hs Text/XML/HaXml/Html/Generate.hs Text/XML/HaXml/Html/Parse.hs Text/XML/HaXml/Html/Pretty.hs Text/XML/HaXml/Xtract/Combinators.hs Text/XML/HaXml/Xtract/Lex.hs Text/XML/HaXml/Xtract/Parse.hs Text/ParserCombinators/HuttonMeijerWallace.hs set OBJS=Text/XML/HaXml.o Text/XML/HaXml/Combinators.o Text/XML/HaXml/Lex.o Text/XML/HaXml/Parse.o Text/XML/HaXml/Pretty.o Text/XML/HaXml/Types.o Text/XML/HaXml/Validate.o Text/XML/HaXml/Wrappers.o Text/XML/HaXml/OneOfN.o Text/XML/HaXml/Xml2Haskell.o Text/XML/HaXml/Haskell2Xml.o Text/XML/HaXml/Verbatim.o Text/XML/HaXml/Escape.o Text/XML/HaXml/Html/Generate.o Text/XML/HaXml/Html/Parse.o Text/XML/HaXml/Html/Pretty.o Text/XML/HaXml/Xtract/Combinators.o Text/XML/HaXml/Xtract/Lex.o Text/XML/HaXml/Xtract/Parse.o Text/ParserCombinators/HuttonMeijerWallace.o if "%1"=="Remove" goto Remove rem -- Compile sources and create library archive cd %SRC% %GHC% --make -cpp -i. -package-name HaXml %SRCS% %AR% r libHSHaXml.a %OBJS% rem -- Create library file for GHCi %LD% -r --whole-archive -o HSHaXml.o libHSHaXml.a rem -- Install the library archive(s) where GHC can find them COPY libHSHaXml.a %GHCDIR% COPY HSHaXml.o %GHCDIR% rem -- Install the interface files where GHC can find them rem /L - list only, /Y - overrite without confirmation rem /S - copy subdirectories, /T - create directories only rem /F - display full filenames while copying XCOPY /S /F *.hi %GHCDIR%\imports rem -- Finally, register the package with GHC %GHCPKG% --add-package <pkg.conf goto Exit :Remove %GHCPKG% --remove-package HaXml :Exit ]] At 10:52 20/01/04 +0000, Malcolm Wallace wrote:
You can avoid using 'configure' and 'make' by just following the recipe in the Makefile by hand. Realising that as a Windows person you are probably inexperienced in reading a Makefile, here is the quick version.
cd src ghc --make -cpp -i. -package-name HaXml $(SRCS) [ Replace $(SRCS) with the cut-and-pasted list of files from the Makefile ] ar r libHSHaXml.a $(OBJS) [ $(OBJS) is the source-file list replacing .hs by .o ] ld -r --whole-archive -o HSHaXml.o libHSHaXml.a [ only if you need to play with it in GHCi ] cp libHSHaXml.a HSHaXml.o $(GHC_LIB_DIR) [ install the library archive(s) where GHC can find them ] { tar cf interfaces.tar `find Text -name *.hi -print` cp interfaces.tar $(GHC_LIB_DIR)/imports cd $(GHC_LIB_DIR)/imports tar xf interfaces.tar rm interfaces.tar } [ install the interface files where GHC can find them ] ghc-pkg --add-package <pkg.conf [ and finally register the package with GHC ]
Obviously I have used some Unix-isms here, but you will know the Windows equivalents better than I can guess them.
------------ Graham Klyne For email: http://www.ninebynine.org/#Contact
Graham Klyne <GK@ninebynine.org> writes:
Thanks, your recipe was helpful to get me started. I'm trying to turn this into a Windows batch file, which I'll post back for your consideration (work-in-progress copy below).
I notice that the Win32 distribution of GHC does not include ar, so I've located and downloaded a MinGW kit.
It might be possible that you can use gcc's ld to build the archive, using some options like "--dll --out-implib file.a" although I can't be sure from the manual page whether this is really the right thing.
Compiling the source kit, I find module: Text/XML/HaXml/Validate.hs imports FiniteMap when what is provided by GHC is Data.FiniteMap.
Yup, FiniteMap was the old name (still available in package lang I think), but Data.FiniteMap should be essentially identical.
Copying the .hi files to the imports directory tree, I find that one existing file (from the GHC installation) is requested to be overwritten: Overwrite C:\DEV\ghc\ghc-6.2\imports\Text\PrettyPrint\HughesPJ.hi
Ah, yes, Text.PrettyPrint.HughesPJ is only included in the HaXml distribution for backward compatibility with older compiler versions that didn't have it. Probably best to remove the source from the tree before building.
ghc-pkg.exe --add-package 0<pkg.conf Reading package info from stdin... done. Expanding embedded variables... done. warning: can't find GHCi lib `HSHaXml.o' Saving old package config file... done. Writing new package config file... done.
I always get the same error too (on Linux and Solaris), even though the file does exist. Must be a bug in ghc-pkg. Regards, Malcolm
participants (3)
-
Graham Klyne -
Isaac Jones -
Malcolm Wallace