GrammaticalFramework/gf-core

Publish PGF2 in Hackage

inariksit opened this issue · 16 comments

Would it be possible to publish the Haskell bindings to the C runtime in Hackage? That would make it easier to distribute GF applications written in Haskell.

Duplicate of #32

Sorry, I remembered that 32 was just about the haskell, not haskell-bind. :-P

Oh no you're right, sorry myself.

I created a "candidate" upload on Hackage here: https://hackage.haskell.org/package/pgf2-1.1.0/candidate
This should be reviewed and tested before publishing, in particular by @krangelov. One can install locally with:

cabal install https://hackage.haskell.org/package/pgf2-1.1.0/candidate/pgf2-1.1.0.tar.gz

I updated the cabal file and README a little, those updates are on the branch pgf2-hackage which I'll PR now.

Also I wonder if the pgf-shell example should be removed, or at least not built by default. Most of the time if someone is installing the pgf2 Haskell library they don't want an extra toy executable compiled for nothing.

Is it possible to include the C libraries as well, so that only installing PGF2 from hackage is enough? For instance, the MiniSat package contains the C sources and a makefile along with the Haskell sources.
The cabal file for MiniSat contains .c and .h files in extra-source-files and a keyword c-sources.

Yes that would be a lot more convenient wouldn't it... I'm not so experienced with this kind of thing but I'll give it a shot.

Awesome, thank you!

Okay, thanks for the explanation! Can we make a binary package? Ease of installation is really my main motivation for requesting this, and if one has to install the C library separately, it's not a big improvement to only have the Haskell files from cabal.

I agree that the Haskell-only package is not very valuable and the goal should be a package which includes the runtime itself.
If we want to pre-build the binaries for distribution, I guess the headache here is that we have to have different versions for different OS's. This is probably doable using Docker locally and/or via GitHub actions. I could look into this.

When you say that the library is "shared", what exactly does this entail? Does it intrinsically affect the way the code is written, or is it just some flags or whatever passed at compile time? If the latter, then we could build a separate non-shared version of the runtime purely for distribution with the Haskell package (which is then compiled by client rather than distributing binaries).

So if I wrote a script to compile the C runtime for Debian, MacOS and Windows using Docker, should it then be straightforward to include these binary libraries into the Cabal package?

I see. I think that publishing the PGF C runtime in mainstream package managers like apt or Homebrew might be a lot of extra work. Perhaps we should have the binary libraries compiled and stored in GitHub, then we just provide some one-liners in the README which will download them and put them in the right place on your system.

I haven't done anything specific about distributing the compiled C runtime [yet], but I published PGF2 on Hackage anyway since I have a use for it: https://hackage.haskell.org/package/pgf2