2018-01-28 01:10:04 +00:00
|
|
|
{ stdenv, fetchFromGitHub, perl }:
|
2015-04-06 22:41:54 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-05-07 08:14:33 +01:00
|
|
|
name = "mbedtls-2.9.0";
|
2015-04-06 22:41:54 +01:00
|
|
|
|
2018-01-28 01:10:04 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ARMmbed";
|
|
|
|
repo = "mbedtls";
|
|
|
|
rev = name;
|
2018-05-07 08:14:33 +01:00
|
|
|
sha256 = "1pb1my8wwa757hvd06qwidkj58fa1wayf16g98q600xhya5fj3vx";
|
2015-04-06 22:41:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ perl ];
|
|
|
|
|
2018-02-20 01:38:06 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs .
|
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
2016-12-10 16:29:50 +00:00
|
|
|
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
|
|
|
makeFlags = [
|
|
|
|
"SHARED=1"
|
2018-02-20 01:38:06 +00:00
|
|
|
] ++ stdenv.lib.optionals stdenv.isDarwin [
|
|
|
|
"DLEXT=dylib"
|
2015-04-06 22:41:54 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
installFlags = [
|
|
|
|
"DESTDIR=\${out}"
|
|
|
|
];
|
|
|
|
|
2016-12-10 16:29:50 +00:00
|
|
|
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
2018-05-07 19:11:18 +01:00
|
|
|
install_name_tool -change libmbedcrypto.dylib $out/lib/libmbedcrypto.dylib $out/lib/libmbedtls.dylib
|
|
|
|
install_name_tool -change libmbedcrypto.dylib $out/lib/libmbedcrypto.dylib $out/lib/libmbedx509.dylib
|
|
|
|
install_name_tool -change libmbedx509.dylib $out/lib/libmbedx509.dylib $out/lib/libmbedtls.dylib
|
|
|
|
|
|
|
|
for exe in $out/bin/*; do
|
|
|
|
if [[ $exe != *.sh ]]; then
|
|
|
|
install_name_tool -change libmbedtls.dylib $out/lib/libmbedtls.dylib $exe
|
|
|
|
install_name_tool -change libmbedx509.dylib $out/lib/libmbedx509.dylib $exe
|
|
|
|
install_name_tool -change libmbedcrypto.dylib $out/lib/libmbedcrypto.dylib $exe
|
|
|
|
fi
|
|
|
|
done
|
2016-12-10 16:29:50 +00:00
|
|
|
'';
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|