Haskell Homebrew Distribution

I am writing a program in Haskell on my Mac (a command line executable, not an application). I use GitHub to host the git repository and the main page. I made the <project>.cabal and Setup.hs , since Cabal makes it easy to build, test, and create documentation. I can also upload to Hackage, I don’t know.

When I mark version 1.0, I want to make a Homebrew formula to load the tarball from GitHub and build it. I want the only dependency is GHC .

I will use runhaskell Setup configure / build / install (with a prefix like / usr / local / Cellar / ...) instead of the cabal command to avoid dependency on cabal installation.

All this is fine until I start using packages from Hackage, for example. flame builder and eson. How can I do it?

I do not want to force non-Haskellers to download the entire Haskell platform. Ideally, people should be able to just let Homebrew install GHC before it builds my program, and then if they want to, uninstall GHC afterwards. If I make the Haskell platform dependent and first install my Haskell dependencies using cabal-install or similar,

  • The ~/.cabal/ folder with packages will be left behind, even if later they are brew uninstall haskell-platform
  • I could only go through Hackage and make people cabal install it, i.e. limit the area for the most part to Haskellers.

I see Cabal (-install) + Hackage as a useful development tool and for Haskellers, but not suitable for this.

Should I just download the source code of the packages I'm using and include it in the source tree by adding it to the build command? Or should I use the --package-db option (found here )? Or can my formula load tarball for a package on the fly and build it too?

I looked a bit at cabal2arch ( Arch wiki , GitHub repo ), but I'm not sure how it handles the dependencies, or if it just does what I don't want to do.

+4
source share
2 answers

In my opinion, if you decide to go with the package manager, you should make sure that all dependencies can be created or accessed in another way. If you rely solely on GHC and its core set of libraries, there should be no need to create the entire platform side by side.

However, if you want to build from the source (that, IMO is a good idea in many, but not all) cases, then creating all the dependencies is what you need to live with. We are doing the same for our build system [1], which we use in the HPC environment to deploy scientific software on our supercomputers. But it is really expensive. It may take quite a while to bootstrap such a system, since you want the entire toolchain and all the necessary libraries to be present.

In fact, as we speak, I provide support in our build system for the GHC and haskell packages, and yes, the dependencies will also be involved if necessary. At least I will take care that we can deploy cabal so that our users can install Haskell content on their accounts if they so wish.

TL DR Add dependency support.

[1] http://hpcugent.github.com/easybuild

+1
source

Hledger is a Haskell program and can only be installed using homegrown. You can look here in the formula file:

https://github.com/Homebrew/homebrew-core/blob/master/Formula/hledger.rb

As you can see in the file, these are some of the dependencies included by ghc and cabal-install .

0
source

All Articles