nixpkgs/pkgs/development/libraries/mbedtls/default.nix
2020-04-10 17:54:53 +01:00

41 lines
1.2 KiB
Nix

{ stdenv
, fetchFromGitHub
, cmake
, ninja
, perl # Project uses Perl for scripting and testing
, python
, enableThreading ? true # Threading can be disabled to increase security https://tls.mbed.org/kb/development/thread-safety-and-multi-threading
}:
stdenv.mkDerivation rec {
pname = "mbedtls";
name = "mbedtls-${version}";
version = "2.16.3"; # nixpkgs-update: no auto update
src = fetchFromGitHub {
owner = "ARMmbed";
repo = "mbedtls";
rev = "${pname}-${version}";
sha256 = "1mzh92yyz93099a1gb2wvwc76jv12d1k1wg9k3dimbgczxgrkirc";
};
nativeBuildInputs = [ cmake ninja perl python ];
postConfigure = stdenv.lib.optionals enableThreading ''
perl scripts/config.pl set MBEDTLS_THREADING_C # Threading abstraction layer
perl scripts/config.pl set MBEDTLS_THREADING_PTHREAD # POSIX thread wrapper layer for the threading layer.
'';
cmakeFlags = [ "-DUSE_SHARED_MBEDTLS_LIBRARY=on" ];
meta = with stdenv.lib; {
homepage = "https://tls.mbed.org/";
description = "Portable cryptographic and TLS library, formerly known as PolarSSL";
license = licenses.asl20;
platforms = platforms.all;
maintainers = with maintainers; [ fpletz ];
};
}