@@ -1649,6 +1649,7 @@ dist_patch_DATA = \
%D%/packages/patches/sqlite-hurd.patch \
%D%/packages/patches/strace-readlink-tests.patch \
%D%/packages/patches/sunxi-tools-remove-sys-io.patch \
+ %D%/packages/patches/p11-kit-fix-mingw.patch \
%D%/packages/patches/p11-kit-hurd.patch \
%D%/packages/patches/patch-hurd-path-max.patch \
%D%/packages/patches/perl-5.14-autosplit-default-time.patch \
new file mode 100644
@@ -0,0 +1,92 @@
+From de5a3522cc7dd28d9b12f26ad29803ae623dcf24 Mon Sep 17 00:00:00 2001
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Thu, 5 Jan 2023 22:56:35 +0100
+Subject: [PATCH] Make sure that libp11-kit does not have undefined symbols
+
+Under mingw, as a DLL, libp11-kit is not allowed to have undefined
+symbols. It means that it should also add the COMMON_LIBS in addition
+to the internal library.
+
+The programs must do that too, otherwise they have undefined symbols.
+---
+ p11-kit/Makefile.am | 13 ++++++++++---
+ trust/Makefile.am | 3 ++-
+ 2 files changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/p11-kit/Makefile.am b/p11-kit/Makefile.am
+index 7fe7a6c..11ec3da 100644
+--- a/p11-kit/Makefile.am
++++ b/p11-kit/Makefile.am
+@@ -237,6 +237,8 @@ EXTRA_DIST += \
+
+ bin_PROGRAMS += p11-kit/p11-kit
+
++p11_kit_p11_kit_CFLAGS = $(COMMON_CFLAGS)
++
+ p11_kit_p11_kit_SOURCES = \
+ p11-kit/lists.c \
+ p11-kit/p11-kit.c \
+@@ -244,8 +246,9 @@ p11_kit_p11_kit_SOURCES = \
+
+ p11_kit_p11_kit_LDADD = \
+ libp11-kit.la \
++ libp11-kit-internal.la \
+ libp11-tool.la \
+- libp11-common.la \
++ $(COMMON_LIBS) \
+ $(LTLIBINTL) \
+ $(NULL)
+
+@@ -257,12 +260,14 @@ private_PROGRAMS += p11-kit/p11-kit-remote
+
+ p11_kit_p11_kit_remote_SOURCES = \
+ p11-kit/remote.c \
++ $(libp11_kit_la_SOURCES) \
+ $(NULL)
+
+ p11_kit_p11_kit_remote_LDADD = \
+ libp11-tool.la \
+- libp11-common.la \
+ libp11-kit.la \
++ libp11-kit-internal.la \
++ $(COMMON_LIBS) \
+ $(NULL)
+
+ check_PROGRAMS += p11-kit/p11-kit-remote-testable
+@@ -278,12 +283,14 @@ private_PROGRAMS += p11-kit/p11-kit-server
+
+ p11_kit_p11_kit_server_SOURCES = \
+ p11-kit/server.c \
++ $(libp11_kit_la_SOURCES) \
+ $(NULL)
+
+ p11_kit_p11_kit_server_LDADD = \
+ libp11-tool.la \
+- libp11-common.la \
+ libp11-kit.la \
++ libp11-kit-internal.la \
++ $(COMMON_LIBS) \
+ $(LIBSYSTEMD_LIBS) \
+ $(NULL)
+
+diff --git a/trust/Makefile.am b/trust/Makefile.am
+index 6ff5d12..4e99a80 100644
+--- a/trust/Makefile.am
++++ b/trust/Makefile.am
+@@ -85,11 +85,12 @@ bin_PROGRAMS += trust/trust
+ trust_trust_LDADD = \
+ libtrust-data.la \
+ libp11-kit.la \
+- libp11-common.la \
++ libp11-kit-internal.la \
+ libp11-tool.la \
+ $(LTLIBINTL) \
+ $(LIBTASN1_LIBS) \
+ $(HASH_LIBS) \
++ $(COMMON_LIBS) \
+ $(NULL)
+
+ trust_trust_CFLAGS = \
+--
+2.38.1
+
@@ -148,11 +148,13 @@ (define-public p11-kit
(base32 "1dn6br4v033d3gp2max9lsr3y4q0nj6iyr1yq3kzi8ym7lal13wa"))))
(build-system gnu-build-system)
(native-inputs
- `(,@(if (hurd-target?)
+ `(,@(if (or (hurd-target?) (target-mingw?))
`(("autoconf" ,autoconf)
("automake" ,automake)
("gettext" ,gettext-minimal) ;for autopoint
- ("libtool" ,libtool))
+ ("libtool" ,libtool)
+ ;libtasn1 is a code generator
+ ("libtasn1" ,libtasn1))
'())
("pkg-config" ,pkg-config)))
(inputs
@@ -161,6 +163,9 @@ (define-public p11-kit
`(("libbsd" ,libbsd)
("hurd-patch" ,(search-patch "p11-kit-hurd.patch")))
'())
+ ,@(if (target-mingw?)
+ `(("mingw-patch" ,(search-patch "p11-kit-fix-mingw.patch")))
+ '())
("libtasn1" ,libtasn1)))
(arguments
`(#:configure-flags '("--without-trust-paths")
@@ -170,8 +175,17 @@ (define-public p11-kit
(lambda* (#:key inputs #:allow-other-keys)
(let ((patch (assoc-ref inputs "hurd-patch")))
(invoke "patch" "-p1" "--batch" "-i"
- patch))))
- (replace 'bootstrap
+ patch)))))
+ '())
+ ,@(if (target-mingw?)
+ '((add-after 'unpack 'apply-mingw-patch
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((patch (assoc-ref inputs "mingw-patch")))
+ (invoke "patch" "-p1" "--batch" "-i"
+ patch)))))
+ '())
+ ,@(if (or (hurd-target?) (target-mingw?))
+ '((replace 'bootstrap
(lambda _
(invoke "autoreconf" "-fiv"))))
'())