judah / terminfo

Haskell bindings to the terminfo API.
BSD 3-Clause "New" or "Revised" License
10 stars 10 forks source link

ncurses/curses is not listed as dependency #15

Closed fmthoma closed 6 years ago

fmthoma commented 8 years ago

Although (n)curses.h is obviously a dependency, it is not listed in the cabal file. This might be the reason why stack/nix builds break for some people including me.

This can be resolved by adding

nix:
  packages: [ncurses]

in the stack.yaml of projects using terminfo.

However, I would assume that a

pkgconfig-depends: ncurses

(or libncurses?) in your terminfo.cabal would just solve this problem for everyone.

judah commented 8 years ago

Thanks for the suggestion. The problem is that the relevant library is available by different names in different systems. On some it's ncurses, for some it's curses, some it's tinfo, etc...for an example of how tricky this is, see: https://ghc.haskell.org/trac/ghc/ticket/7281

Currently we solve this issue using Build-type: Configure in the .cabal file (and then checking which library is installed in the configure script. Is there a way for stack/nix to run the ./configure script in order to figure out which package to use?

fmthoma commented 8 years ago

Okay, point taken :-)

Unfortunately, NixOS won't even provide the ncurses dependency unless it is explicitly listed, which is why the build script fails. On the other hand, since the name of the library is stable in NixOS, there won't be any guessing necessary.

I guess adding a default.nix file in the project root will do the trick for this specific case. I will have a look into it and maybe come up with a pull request one of the next days.

fmthoma commented 8 years ago

FYI: https://github.com/NixOS/nixpkgs/issues/15995

judah commented 6 years ago

Closing since it looks like the nixpkgs ghc now provides ncurses automatically.