2015-04-06 22:41:54 +01:00
|
|
|
{ stdenv, fetchurl, perl }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2017-06-20 00:59:37 +01:00
|
|
|
name = "mbedtls-2.4.2";
|
2015-04-06 22:41:54 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2016-07-10 00:06:24 +01:00
|
|
|
url = "https://tls.mbed.org/download/${name}-gpl.tgz";
|
2017-06-20 00:59:37 +01:00
|
|
|
sha256 = "17r9qs585gqghcf5yavb1cnvsigl0f8r0k8rklr5a855hrajs7yh";
|
2015-04-06 22:41:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ perl ];
|
|
|
|
|
2016-12-10 16:29:50 +00:00
|
|
|
patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
substituteInPlace library/Makefile --replace "-soname" "-install_name"
|
|
|
|
substituteInPlace tests/scripts/run-test-suites.pl --replace "LD_LIBRARY_PATH" "DYLD_LIBRARY_PATH"
|
|
|
|
# Necessary for install_name_tool below
|
|
|
|
echo "LOCAL_LDFLAGS += -headerpad_max_install_names" >> programs/Makefile
|
|
|
|
'';
|
|
|
|
|
2015-04-06 22:41:54 +01:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs .
|
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"SHARED=1"
|
|
|
|
];
|
|
|
|
|
|
|
|
installFlags = [
|
|
|
|
"DESTDIR=\${out}"
|
|
|
|
];
|
|
|
|
|
2016-12-10 16:29:50 +00:00
|
|
|
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
install_name_tool -change libmbedcrypto.so.0 $out/lib/libmbedcrypto.so.0 $out/lib/libmbedtls.so.10
|
|
|
|
install_name_tool -change libmbedcrypto.so.0 $out/lib/libmbedcrypto.so.0 $out/lib/libmbedx509.so.0
|
|
|
|
install_name_tool -change libmbedx509.so.0 $out/lib/libmbedx509.so.0 $out/lib/libmbedtls.so.10
|
|
|
|
|
|
|
|
for exe in $out/bin/*; do
|
|
|
|
install_name_tool -change libmbedtls.so.10 $out/lib/libmbedtls.so.10 $exe
|
|
|
|
install_name_tool -change libmbedx509.so.0 $out/lib/libmbedx509.so.0 $exe
|
|
|
|
install_name_tool -change libmbedcrypto.so.0 $out/lib/libmbedcrypto.so.0 $exe
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2015-04-06 22:41:54 +01:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2016-07-10 00:06:24 +01:00
|
|
|
homepage = https://tls.mbed.org/;
|
2015-04-06 22:41:54 +01:00
|
|
|
description = "Portable cryptographic and SSL/TLS library, aka polarssl";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
platforms = platforms.all;
|
2016-07-10 00:06:24 +01:00
|
|
|
maintainers = with maintainers; [ wkennington fpletz ];
|
2015-04-06 22:41:54 +01:00
|
|
|
};
|
|
|
|
}
|