Skip to content

Commit

Permalink
rustls-ffi: 0.10.0 -> 0.13.0
Browse files Browse the repository at this point in the history
Switched to the recently introduced cargo-c build in order
to get pkg-config/.so config.

Changelog:
https://github.com/rustls/rustls-ffi/blob/v0.13.0/CHANGELOG.md
  • Loading branch information
LeSuisse committed Jul 8, 2024
1 parent d549100 commit 248ffce
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 415 deletions.
68 changes: 68 additions & 0 deletions pkgs/by-name/ru/rustls-ffi/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{ lib
, stdenv
, fetchFromGitHub
, cargo
, rustPlatform
, cargo-c
, validatePkgConfig
, rust
, libiconv
, darwin
, curl
, apacheHttpd
, testers
}:

stdenv.mkDerivation (finalAttrs: {
pname = "rustls-ffi";
version = "0.13.0";

src = fetchFromGitHub {
owner = "rustls";
repo = "rustls-ffi";
rev = "v${finalAttrs.version}";
hash = "sha256-Bc9bVZ2pDsG118l/SlElZpgh9F1JEgPF8LzBX7d4mhE=";
};

cargoDeps = rustPlatform.fetchCargoTarball {
src = finalAttrs.src;
name = "${finalAttrs.pname}-${finalAttrs.version}";
hash = "sha256-gDQ9AFrJuV7SrzKCAHQBkKj6clXuPLO0DHhnvcBqRLs=";
};

propagatedBuildInputs = lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.Security ];

nativeBuildInputs = [ cargo rustPlatform.cargoSetupHook cargo-c validatePkgConfig ];

buildPhase = ''
runHook preBuild
${rust.envVars.setEnv} cargo cbuild -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
runHook postBuild
'';

installPhase = ''
runHook preInstall
${rust.envVars.setEnv} cargo cinstall -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
runHook postInstall
'';

checkPhase = ''
runHook preCheck
${rust.envVars.setEnv} cargo ctest -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
runHook postCheck
'';

passthru.tests = {
curl = curl.override { opensslSupport = false; rustlsSupport = true; rustls-ffi = finalAttrs.finalPackage; };
apacheHttpd = apacheHttpd.override { modTlsSupport = true; rustls-ffi = finalAttrs.finalPackage; };
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
};

meta = with lib; {
description = "C-to-rustls bindings";
homepage = "https://github.com/rustls/rustls-ffi/";
pkgConfigModules = [ "rustls" ];
license = with lib.licenses; [ mit asl20 isc ];
maintainers = [ maintainers.lesuisse ];
};
})
Loading

0 comments on commit 248ffce

Please sign in to comment.