2021-07-24 15:53:20 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-10-27 21:45:46 +01:00
|
|
|
, cmake
|
|
|
|
, brotli
|
|
|
|
, openssl
|
|
|
|
, pkgconfig
|
|
|
|
, fetchFromGitHub
|
|
|
|
}:
|
|
|
|
|
2020-11-17 22:00:39 +01:00
|
|
|
let
|
|
|
|
picotest = fetchFromGitHub {
|
|
|
|
owner = "h2o";
|
|
|
|
repo = "picotest";
|
|
|
|
rev = "6906d90b39684b8b2c18db5b0c7412128140655d";
|
|
|
|
sha256 = "1z26mcg40bkrgbxgh4469y97lixls00p75k9j9dw1w18bg8mg49n";
|
|
|
|
};
|
|
|
|
in
|
2020-10-27 21:45:46 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "picotls";
|
|
|
|
version = "20201012";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "h2o";
|
|
|
|
repo = "picotls";
|
|
|
|
rev = "9238121fa7788e8642072b6d4d1a2f2fb71db242";
|
2020-11-17 22:00:39 +01:00
|
|
|
sha256 = "0yam62yd606q8v515r74l110gmch4i4bif9hfxn7mgvcdv979l7d";
|
2020-10-27 21:45:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkgconfig
|
|
|
|
brotli
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
openssl
|
|
|
|
];
|
|
|
|
|
2020-11-17 22:00:39 +01:00
|
|
|
patchPhase = ''
|
2020-11-17 22:31:04 +01:00
|
|
|
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
|
2020-11-17 22:00:39 +01:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2020-10-27 21:45:46 +01:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -Dt $out/lib *.a
|
|
|
|
install -Dt $dev/include ../include/*.h
|
|
|
|
install -Dt $dev/include/picotls ../include/picotls/*.h
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2021-07-24 15:53:20 +02:00
|
|
|
meta = with lib; {
|
2020-10-27 21:45:46 +01:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|