I am writing an FFI-heavy library that uses inline-c
, and the build process is:
inline-c
files, produce CQUESTION: Currently I'm doing the above in a makefile (see https://github.com/ocramz/petsc-hs/blob/master/makefile ), but I'd like to package it up in a Cabal file (working version : https://github.com/ocramz/petsc-hs/blob/master/petsc-hs.cabal).
SUB-QUESTIONS:
~
doesn't workThank you in advance for all pointers
How does one control the build/link sequence in Cabal?
You can use Build-Type: Custom
in your cabal file and control everything with a custom Setup.hs
.
Have a look at the UserHooks
data type for all of the phases of cabal which you can control.
Some examples:
autoconfUserHooks
to have cabal run a configure
scriptconfHook
: https://stackoverflow.com/a/32679607/866915Are relative paths supported in Cabal? couldn't find this mentioned in the guide and bash-like ~ doesn't work
If your library is external to your cabal package, I would consider using pkg-config
on Unix/Linux systems to have cabal locate the library. See the answers to this SO question: How to specify dependency on external C library in .cabal?
If your library is part of your cabal package, check out this blog post and related github repo which shows how to write a custom Setup.hs file to build and install the library in the right place for cabal: