6

I have a library which depends on some other libraries and of course the haskell runtime. It exports C API. I want to build it in a way that it was fully self-contained and user wouldn't be bothered with installing haskell, cabal and all the dependencies.

user1887615
  • 123
  • 2
  • How to you imagine the library users to interact with the library? One option would be to make packages (rpm, deb, dmg, etc) while another option would be to add hundreds of megabytes of build infrastructure to your library's source distribution. – Thomas M. DuBuisson Jun 26 '13 at 15:54
  • @ThomasM.DuBuisson I think he wants something analogous to a multi-project solution. – Gabriella Gonzalez Jun 26 '13 at 15:55
  • @ThomasM.DuBuisson They would link their code with the library using gcc, just like ghc does when I invoke it like this: `ghc -no-hs-main -static test.c libMylibrary.a ' – user1887615 Jun 27 '13 at 11:33
  • 1
    Ah, so you do want to distribute some sort of pre-compiled binary. Cabal is really a system for building from source more than a binary distribution system, but some packages do what you want and could be used as examples - `intel-aes` is one such package. – Thomas M. DuBuisson Jun 27 '13 at 14:33

1 Answers1

1

it was fully self-contained and user wouldn't be bothered with installing haskell, cabal and all the dependencies

Then you must distribute your library with all its dependencies -- the Haskell compiler, runtime, C libraries, Cabal, dependent libraries. This is a non-trivial task -- you're rolling your own Haskell Platform.

You could modify the HP source and generate installers. They would be in effect standalone installers for your library.

Don Stewart
  • 137,316
  • 36
  • 365
  • 468
  • I don't quite understand why is that so. I can build a test C file calling my library by explicitly listing all the dependencies' .a files. Wouldn't it be possible to just pack all the dependencies into one big .a and distribute it as my library? I only need my library to be called from C code, not haskell code. – user1887615 Jun 27 '13 at 13:45
  • Yes, you could write your own installer/bundler that takes all your dependencies and links them. – Don Stewart Jun 27 '13 at 14:17