[Haskell-cafe] Stack project, dependency with build flags

John Z. johnz at pleasantnightmare.com
Wed Sep 5 16:35:19 UTC 2018

Hi everyone,
    I'll try with tl:dr; first:
    I have a project with a dependency that -on my system- needs a build
    flag, in order to correctly link against its native dependencies.
    What is a proper way to set up a project like this?

    A longer explanation:
    My project uses `ncurses` library and I'm running Arch. There seems
    to be some religious opinion going around about the layout of
    ncurses headers in /usr/include, and -naturally- Arch and `ncurses`
    disagree. Fortunately, author of `ncurses` included a build flag to
    allow (easy) build on systems which follow the 'wrong' layout.
    Thing is, I couldn't figure out how to add this configuration to the
    .cabal of my own project, so for now, I'm stuck with a Makefile that
    invokes `stack` commands with `--flag ncurses:force-narrow-library`.
    I looked in the manual and there doesn't seem to be a way to handle
    this aside the commandline argument.

    So this got me thinking - is there a different way projects like
    these are supposed to be organized? For example, am I supposed to
    check out `ncurses` as a submodule of my project, then replicate
    this build flag on my own project and 'pass it down' somehow?

    Any tips are highly appreciated; I'm really not proficient with
    organizing stack projects properly.


"That gum you like is going to come back in style."

More information about the Haskell-Cafe mailing list