2021-06-28 23:13:55 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2024-02-29 20:09:43 +00:00
|
|
|
, llvmPackages_16
|
2021-06-28 23:13:55 +00:00
|
|
|
, unstableGitUpdater
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-02-29 20:09:43 +00:00
|
|
|
c2ffiBranch = "llvm-16.0.0";
|
|
|
|
llvmPackages = llvmPackages_16;
|
2021-06-28 23:13:55 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
llvmPackages.stdenv.mkDerivation {
|
|
|
|
pname = "c2ffi-${c2ffiBranch}";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "0-unstable-2023-11-18";
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rpav";
|
|
|
|
repo = "c2ffi";
|
2024-02-29 20:09:43 +00:00
|
|
|
rev = "097cbe61ca02dc79ea60859aa056975131a9d985";
|
|
|
|
hash = "sha256-pflolW5OoEkVDozy4cjCdUIVxgE/SfVKIhQyNBDhENc=";
|
2021-06-28 23:13:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
passthru.updateScript = unstableGitUpdater {
|
|
|
|
url = "https://github.com/rpav/c2ffi.git";
|
|
|
|
branch = c2ffiBranch;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
llvmPackages.llvm
|
|
|
|
llvmPackages.clang
|
|
|
|
llvmPackages.libclang
|
|
|
|
];
|
|
|
|
|
|
|
|
# This isn't much, but...
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/c2ffi --help 2>&1 >/dev/null
|
|
|
|
'';
|
|
|
|
|
|
|
|
# LLVM may be compiled with -fno-rtti, so let's just turn it off.
|
|
|
|
# A mismatch between lib{clang,LLVM}* and us can lead to the link time error:
|
|
|
|
# undefined reference to `typeinfo for clang::ASTConsumer'
|
2024-02-29 20:09:43 +00:00
|
|
|
env.CXXFLAGS="-fno-rtti";
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/rpav/c2ffi";
|
|
|
|
description = "An LLVM based tool for extracting definitions from C, C++, and Objective C header files for use with foreign function call interfaces";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "c2ffi";
|
2021-06-28 23:13:55 +00:00
|
|
|
license = licenses.lgpl21Only;
|
2024-02-29 20:09:43 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2021-06-28 23:13:55 +00:00
|
|
|
};
|
|
|
|
}
|