core/pkgs/by-name/li/libsodium/default.nix

54 lines
1.6 KiB
Nix
Raw Normal View History

2024-05-13 21:24:10 +00:00
{ lib, stdenv, fetchurl, fetchpatch, autoreconfHook, testers }:
2024-05-02 00:46:19 +00:00
stdenv.mkDerivation (finalAttrs: {
pname = "libsodium";
version = "1.0.19";
src = fetchurl {
2024-05-13 21:24:10 +00:00
url =
"https://download.libsodium.org/libsodium/releases/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
2024-05-02 00:46:19 +00:00
hash = "sha256-AY15/goEXMoHMx03vQy1ey6DjFG8SP2DehRy5QBou+o=";
};
outputs = [ "out" "dev" ];
patches = [
# Drop -Ofast as it breaks floating point arithmetics in downstream
# users.
(fetchpatch {
name = "drop-Ofast.patch";
2024-05-13 21:24:10 +00:00
url =
"https://github.com/jedisct1/libsodium/commit/ffd1e374989197b44d815ac8b5d8f0b43b6ce534.patch";
2024-05-02 00:46:19 +00:00
hash = "sha256-jG0VirIoFBwYmRx6zHSu2xe6pXYwbeqNVhPJxO6eJEY=";
})
];
nativeBuildInputs = [ autoreconfHook ];
separateDebugInfo = stdenv.isLinux && stdenv.hostPlatform.libc != "musl";
enableParallelBuilding = true;
2024-05-13 21:24:10 +00:00
hardeningDisable =
lib.optional (stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isx86_32)
"stackprotector";
2024-05-02 00:46:19 +00:00
# FIXME: the hardeingDisable attr above does not seems effective, so
# the need to disable stackprotector via configureFlags
2024-05-13 21:24:10 +00:00
configureFlags =
lib.optional (stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isx86_32)
"--disable-ssp";
2024-05-02 00:46:19 +00:00
doCheck = true;
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
meta = with lib; {
description = "A modern and easy-to-use crypto library";
homepage = "https://doc.libsodium.org/";
license = licenses.isc;
maintainers = with maintainers; [ raskin ];
pkgConfigModules = [ "libsodium" ];
platforms = platforms.all;
};
})