Packaging stack projects as ports

Gleb Popov 6yearold at gmail.com
Mon Oct 28 06:39:27 UTC 2019


On Sun, Oct 27, 2019 at 11:53 PM Jesse Kempf <jesse.kempf at doublecrown.co>
wrote:

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

Stack projects should also have a .cabal file, so the port looks almost the
same. You just only need to override MASTER_SITES and set it to GitHub
instead of Hackage. See lang/elm port for an example. There are also some
auxiliary Makefile targets to aid porting in Mk/Uses/cabal.mk, take a look
at that too.


> 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.


It turns out that you need both --system-ghc and --no-install-ghc to build
using system GHC with Stack.

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.
>

That's great, feel free to ask for help there, or at #haskell-FreeBSD IRC
channel at Freenode.


> Regards,
> -Jesse
> _______________________________________________
> freebsd-haskell at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-haskell
> To unsubscribe, send any mail to "freebsd-haskell-unsubscribe at freebsd.org"
>


More information about the freebsd-haskell mailing list