I have a C library "myboo" that has a Makefile. I want to make a wrapper for this library. I do not want to install it in / usr / local, since "myboo" is not the main module. In addition, it is recommended that you create "myboo" not as a dynamic library but as a static library.
I create custom Setup.py to create "myboo";
main :: IO () main = defaultMainWithHooks simpleUserHooks { preBuild = \ab -> makeLib ab >> preBuild simpleUserHooks ab } makeLib :: Args -> BuildFlags -> IO () makeLib _ flags = do let verbosity = fromFlag $ buildVerbosity flags cflags <- lookupEnv "CFLAGS" >>= return . maybe "" id setEnv "CFLAGS" $ "-fPIC" ++ (' ' : cflags) rawSystemExit verbosity "env" ["make", "--directory=myboo", "libmyboo.a"]
And I am settling myboo.cabal to link my haskell codes to the C library;
library exposed-modules: MyBoo build-depends: base >=4.7 && <4.8 hs-source-dirs: src default-language: Haskell2010 include-dirs: myboo extra-libraries: myboo extra-lib-dirs: myboo
When I run "cabal build", I received the following messages.
myboo-0.1.0.0: library-dirs: myboo is a relative path which makes no sense (as there is nothing for it to be relative to). You can make paths relative to the package database itself by using ${pkgroot}. (use --force to override)
If I write "extra-lib-dirs: / absolute / path / to / working / dir / myboo", it seems to work fine. But this is not very good, because / absolute / ... is only a working directory.
How can I fix the above error messages? My environment is here;
% ghc
source share