8

I made my own cabal package (let's call it package-1) with two targets, a library and a executable. The library section has a build-depends list, and the executable has another build-depends list that is much larger.

Now I create package-2, which lists package-1 in its build-depends section. I would like to only bring in the dependencies listed in the library target of package-1. But it seems to bring in all the dependencies listed in all the sections of package-1, including the dependencies for the executable target.

Is there any way to prune the dependency graph to just the library inside package-1, or do I have to resort to breaking out that library target into a separate standalone package?

dan
  • 43,914
  • 47
  • 153
  • 254
  • This is a well-known and long-standing issue, a question has been asked on SO (it's a dupe), and some workarounds exist. – Bartek Banachewicz Feb 25 '15 at 16:10
  • 1
    @BartekBanachewicz I've seen this question before: http://stackoverflow.com/questions/10163604/how-to-reduce-duplication-in-the-build-depends-fields-of-a-cabal-file?rq=1 which you may be referring to, but my question is different. – dan Feb 25 '15 at 16:17

1 Answers1

3

You can put Buildable: False to executable, and then build it explicitly when needed with cabal build Foo, or via flag (cabal configure -fbuild-foo or -fbuild-executables).

Example that might be helpful: Cabal Multiple Executables

Community
  • 1
  • 1
Konstantine Rybnikov
  • 2,457
  • 1
  • 22
  • 29