From 5f073a669da7f0147373799e1cf43a6943972991 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 11 Aug 2021 08:13:13 -0400 Subject: [PATCH] libsodium: Don't fortify on mingw --- pkgs/development/libraries/libsodium/default.nix | 7 ++++++- .../libraries/libsodium/mingw-no-fortify.patch | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/libraries/libsodium/mingw-no-fortify.patch diff --git a/pkgs/development/libraries/libsodium/default.nix b/pkgs/development/libraries/libsodium/default.nix index ba8bc3f334e6..bc8a2ced7cd5 100644 --- a/pkgs/development/libraries/libsodium/default.nix +++ b/pkgs/development/libraries/libsodium/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl }: +{ lib, stdenv, fetchurl, autoreconfHook }: stdenv.mkDerivation rec { pname = "libsodium"; @@ -10,6 +10,11 @@ stdenv.mkDerivation rec { }; outputs = [ "out" "dev" ]; + + patches = lib.optional stdenv.targetPlatform.isMinGW ./mingw-no-fortify.patch; + + nativeBuildInputs = lib.optional stdenv.targetPlatform.isMinGW autoreconfHook; + separateDebugInfo = stdenv.isLinux && stdenv.hostPlatform.libc != "musl"; enableParallelBuilding = true; diff --git a/pkgs/development/libraries/libsodium/mingw-no-fortify.patch b/pkgs/development/libraries/libsodium/mingw-no-fortify.patch new file mode 100644 index 000000000000..e13a801f8db7 --- /dev/null +++ b/pkgs/development/libraries/libsodium/mingw-no-fortify.patch @@ -0,0 +1,15 @@ +diff -Naur libsodium-1.0.18-orig/configure.ac libsodium-1.0.18/configure.ac +--- libsodium-1.0.18-orig/configure.ac 2019-05-30 16:20:24.000000000 -0400 ++++ libsodium-1.0.18/configure.ac 2021-08-11 08:09:54.653907245 -0400 +@@ -217,11 +217,6 @@ + + AC_CHECK_DEFINE([__wasi__], [WASI="yes"], []) + +-AC_CHECK_DEFINE([_FORTIFY_SOURCE], [], [ +- AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2], +- [CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"]) +-]) +- + AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], + [CFLAGS="$CFLAGS -fvisibility=hidden"]) +