Specify include directories via environment variable
This commit is contained in:
parent
4c9a9e4ef2
commit
b8eb0d01b7
@ -23,6 +23,10 @@
|
||||
targets = [ "x86_64-unknown-linux-gnu" ];
|
||||
}
|
||||
));
|
||||
addLibcIncludeDir =
|
||||
''
|
||||
export C_INCLUDE_PATH="${pkgs.stdenv.cc.libc.dev}/include''${C_INCLUDE_PATH:+:$C_INCLUDE_PATH}"
|
||||
'';
|
||||
haskell = (import inputs.nix-haskell { inherit system inputs; } {
|
||||
name = "garnet";
|
||||
src = ./.;
|
||||
@ -44,6 +48,7 @@
|
||||
libs = [ pkgs.llvmPackages.libclang ];
|
||||
};
|
||||
packages.garnet.components.library = {
|
||||
preBuild = addLibcIncludeDir;
|
||||
preConfigure = ''
|
||||
mkdir -p rust/target/debug
|
||||
ln -s ${garnet-rs}/include/garnet_rs.h rust/target/debug/garnet_rs.h
|
||||
@ -70,6 +75,7 @@
|
||||
};
|
||||
withHoogle = false;
|
||||
withHaddock = true;
|
||||
shellHook = addLibcIncludeDir;
|
||||
};
|
||||
});
|
||||
garnet-rs = crane.buildPackage {
|
||||
|
||||
@ -30,17 +30,9 @@ import Language.Haskell.TH
|
||||
import System.Process
|
||||
|
||||
do
|
||||
systemDirs <- -- TODO bit of a hack
|
||||
map (Dir . T.unpack . T.strip)
|
||||
. concatMap (takeWhile (maybe False ((== ' ') . fst) . T.uncons) . dropWhile T.null . T.lines)
|
||||
. drop 1
|
||||
. T.splitOn "search starts here:"
|
||||
. T.pack
|
||||
. thd3
|
||||
<$> runIO (readProcessWithExitCode "cpp" ["-v"] "")
|
||||
withHsBindgen
|
||||
def
|
||||
{ clang = def{extraIncludeDirs = Pkg "rust/target/debug" : systemDirs}
|
||||
{ clang = def{extraIncludeDirs = [Pkg "rust/target/debug"]}
|
||||
, fieldNamingStrategy = OmitFieldPrefixes
|
||||
}
|
||||
def
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user