Haskell inline-c multi-step build/link with Cabal -
i writing ffi-heavy library uses inline-c
, , build process is:
- run ghc on
inline-c
files, produce c - compile c produced in previous step dynamic libraries
- compile haskell interface while linking both object files produced in step 2 , dynlibs of wrapped library.
question: i'm doing above in makefile (see https://github.com/ocramz/petsc-hs/blob/master/makefile ), i'd package in cabal file (working version : https://github.com/ocramz/petsc-hs/blob/master/petsc-hs.cabal).
sub-questions:
- how 1 control build/link sequence in cabal?
- are relative paths supported in cabal? couldn't find mentioned in guide , bash-like
~
doesn't work
thank in advance pointers
how 1 control build/link sequence in cabal?
you can use build-type: custom
in cabal file , control custom setup.hs
.
have @ userhooks
data type of phases of cabal can control.
some examples:
- sdl - uses
autoconfuserhooks
have cabal runconfigure
script - this answer contains links packages override
confhook
: https://stackoverflow.com/a/32679607/866915 - see paste links more custom setup.hs files: http://lpaste.net/142696
are relative paths supported in cabal? couldn't find mentioned in guide , bash-like ~ doesn't work
if library external cabal package, consider using pkg-config
on unix/linux systems have cabal locate library. see answers question: how specify dependency on external c library in .cabal?
if library part of cabal package, check out blog post , related github repo shows how write custom setup.hs file build , install library in right place cabal:
Comments
Post a Comment