Packaging stack projects as ports

Jesse Kempf jesse.kempf at doublecrown.co
Sun Oct 27 19:53:53 UTC 2019


Hi,

What’s the preferred way of making ports for projects that use Stack and don’t and won’t appear on Hackage?

I’ve got an app up on Github, so I set what’s needed and then the meat of my port is:


do-build:
  @(cd ${WRKSRC} && stack build)
do-install:
  @(cd ${WRKSRC} && stack install --local-bin-path=${STAGEDIR}${PREFIX}/bin)
post-install:
  @(${INSTALL_DATA} ${WRKDIR}/${PORTNAME}.cfg.sample ${STAGEDIR}${PREFIX}/etc)


For my company’s purposes, this is perfectly adequate, however stack (installed from devel/stack) doesn’t seem to honor —system-ghc and so always installs its own version of GHC. On the one hand, this means that the app will be built with the correct compiler for Stackage snapshot. On the other hand, this means that port compiling is slow and more memory intensive than it needs to be because compiling GHC is more resource intensive than compiling small applications. And, finally, stack installs its own version of GHC into the invoking user’s home directory, not only affecting files outside `/usr/local` but also meaning that `make package` and `sudo make package` will build and install GHC twice.

We’d like to contribute our tool to the ports tree since it’s a general-purpose thing but what I just mentioned seems like an obvious show-stopper.

Regards,
-Jesse


More information about the freebsd-haskell mailing list