1{ lib
2, rustPlatform
3, fetchCrate
4, pkg-config
5, curl
6, openssl
7, stdenv
8, CoreFoundation
9, libiconv
10, Security
11}:
12
13rustPlatform.buildRustPackage rec {
14 pname = "cargo-c";
15 version = "0.9.2";
16
17 src = fetchCrate {
18 inherit pname;
19 # this version may need to be updated along with package version
20 version = "${version}+cargo-0.55";
21 sha256 = "sha256-yh5vAtKlBvoSlJBsW2RSduSK6T8aOssM84WQMNjLZqA=";
22 };
23
24 cargoSha256 = "sha256-YikTjAeroaHyNe3ygUWRHSXJwdm2BSBV7RgIDN4suZ4=";
25
26 nativeBuildInputs = [ pkg-config (lib.getDev curl) ];
27 buildInputs = [ openssl curl ] ++ lib.optionals stdenv.isDarwin [
28 CoreFoundation
29 libiconv
30 Security
31 ];
32
33 # Ensure that we are avoiding build of the curl vendored in curl-sys
34 doInstallCheck = stdenv.hostPlatform.libc == "glibc";
35 installCheckPhase = ''
36 runHook preInstallCheck
37
38 ldd "$out/bin/cargo-cbuild" | grep libcurl.so
39
40 runHook postInstallCheck
41 '';
42
43 meta = with lib; {
44 description = "A cargo subcommand to build and install C-ABI compatibile dynamic and static libraries";
45 longDescription = ''
46 Cargo C-ABI helpers. A cargo applet that produces and installs a correct
47 pkg-config file, a static library and a dynamic library, and a C header
48 to be used by any C (and C-compatible) software.
49 '';
50 homepage = "https://github.com/lu-zero/cargo-c";
51 changelog = "https://github.com/lu-zero/cargo-c/releases/tag/v${version}";
52 license = licenses.mit;
53 maintainers = with maintainers; [ ];
54 };
55}