2023-03-08 16:32:21 +00:00
|
|
|
{ lib, stdenv, fetchurl, autoreconfHook
|
|
|
|
, testers
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-08 16:32:21 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2021-07-21 07:28:18 +00:00
|
|
|
pname = "libsodium";
|
|
|
|
version = "1.0.18";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-03-08 16:32:21 +00:00
|
|
|
url = "https://download.libsodium.org/libsodium/releases/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
|
2020-04-24 23:36:52 +00:00
|
|
|
sha256 = "1h9ncvj23qbbni958knzsli8dvybcswcjbx0qjjgi922nf848l3g";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
2021-08-12 14:41:47 +00:00
|
|
|
|
|
|
|
patches = lib.optional stdenv.targetPlatform.isMinGW ./mingw-no-fortify.patch;
|
|
|
|
|
|
|
|
nativeBuildInputs = lib.optional stdenv.targetPlatform.isMinGW autoreconfHook;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
separateDebugInfo = stdenv.isLinux && stdenv.hostPlatform.libc != "musl";
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2021-03-09 03:18:52 +00:00
|
|
|
hardeningDisable = lib.optional (stdenv.targetPlatform.isMusl && stdenv.targetPlatform.isx86_32) "stackprotector";
|
|
|
|
|
|
|
|
# FIXME: the hardeingDisable attr above does not seems effective, so
|
|
|
|
# the need to disable stackprotector via configureFlags
|
|
|
|
configureFlags = lib.optional (stdenv.targetPlatform.isMusl && stdenv.targetPlatform.isx86_32) "--disable-ssp";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2023-03-08 16:32:21 +00:00
|
|
|
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A modern and easy-to-use crypto library";
|
|
|
|
homepage = "http://doc.libsodium.org/";
|
|
|
|
license = licenses.isc;
|
|
|
|
maintainers = with maintainers; [ raskin ];
|
2023-03-08 16:32:21 +00:00
|
|
|
pkgConfigModules = [ "libsodium" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
2023-03-08 16:32:21 +00:00
|
|
|
})
|