nixpkgs-overlay/pkgs/picotls/default.nix

70 lines
1.7 KiB
Nix

{ lib
, stdenv
, cmake
, brotli
, openssl
, pkgconfig
, fetchFromGitHub
}:
let
picotest = fetchFromGitHub {
owner = "h2o";
repo = "picotest";
rev = "6906d90b39684b8b2c18db5b0c7412128140655d";
sha256 = "1z26mcg40bkrgbxgh4469y97lixls00p75k9j9dw1w18bg8mg49n";
};
in
stdenv.mkDerivation rec {
pname = "picotls";
version = "20201012";
src = fetchFromGitHub {
owner = "h2o";
repo = "picotls";
rev = "9238121fa7788e8642072b6d4d1a2f2fb71db242";
sha256 = "0yam62yd606q8v515r74l110gmch4i4bif9hfxn7mgvcdv979l7d";
};
outputs = [ "out" "dev" ];
nativeBuildInputs = [
cmake
pkgconfig
brotli
];
buildInputs = [
openssl
];
patchPhase = ''
sed -i 's|^ADD_EXECUTABLE(ptlsbench t/ptlsbench.c)$||g' CMakeLists.txt
sed -i 's|^SET_TARGET_PROPERTIES(ptlsbench PROPERTIES COMPILE_FLAGS "-DPTLS_MEMORY_DEBUG=1")$||g' CMakeLists.txt
sed -i 's|^TARGET_LINK_LIBRARIES(ptlsbench ''${PTLSBENCH_LIBS})$||g' CMakeLists.txt
sed -i 's|deps/picotest|${picotest}|g' CMakeLists.txt
sed -i 's|../deps/picotest|${picotest}|g' t/picotls.c
sed -i 's|../deps/picotest|${picotest}|g' t/minicrypto.c
sed -i 's|../deps/picotest|${picotest}|g' t/openssl.c
sed -i 's|../deps/picotest|${picotest}|g' t/fusion.c
'';
installPhase = ''
runHook preInstall
install -Dt $out/lib *.a
install -Dt $dev/include ../include/*.h
install -Dt $dev/include/picotls ../include/picotls/*.h
runHook postInstall
'';
meta = with lib; {
description = "Picotls is a TLS 1.3 (RFC 8446) protocol stack written in C";
homepage = https://github.com/h2o/picotls;
license = licenses.mit;
maintainers = with maintainers; [ royneary ];
platforms = platforms.linux;
};
}