[PATCH core-updates 0/2] Try to fix p11-kit compilation to mingw

  • Open
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Vivien Kraus
Owner
unassigned
Submitted by
Vivien Kraus
Severity
normal
V
V
Vivien Kraus wrote on 18 Apr 2023 00:20
(address . guix-patches@gnu.org)
cover.1681770007.git.vivien@planete-kraus.eu
Dear guix,

On core-updates, p11-kit still uses the gnu build system. However, it does not
seem to be recommended anymore: the README now documents the meson build
system, and the makefiles are broken when targetting mingw.

For reference, on AUR:

p11-kit comes early in the dependency chain. It being broken means that
we can’t cross-compile gnutls, curl and other packages.

However, there is some kind of dependency cycle when using the meson build
system (modules? Packages? I don’t know). Can someone help me sort that out?

Best regards,

Vivien

Vivien Kraus (2):
gnu: gcc: do not build gcov.
NOT WORKING gnu: p11-kit: switch to meson-build-system.

gnu/packages/gcc.scm | 4 ++++
gnu/packages/tls.scm | 19 ++++---------------
2 files changed, 8 insertions(+), 15 deletions(-)


base-commit: a6d2b54d3920d8858b5b36e4e4364088ed340107
--
2.39.2
V
V
Vivien Kraus wrote on 18 Apr 2023 00:09
[PATCH core-updates 1/2] gnu: gcc: do not build gcov.
(address . 62916@debbugs.gnu.org)
234715f3c0fe265574fd9708abe0e057ee3c1641.1681770007.git.vivien@planete-kraus.eu
* gnu/packages/gcc.scm (gcc-configure-flags-for-triplet): Disable gcov when
targetting mingw.
---
gnu/packages/gcc.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 5b1ef83ce6..c6575bf9db 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -88,6 +88,10 @@ (define (gcc-configure-flags-for-triplet target)
(string-prefix? "powerpc-" target))
'("--with-long-double-128"))
+ ;; See https://bugs.gentoo.org/show_bug.cgi?id=843989
+ ((target-mingw? target)
+ '("--disable-gcov"))
+
(else
;; TODO: Add `arm.*-gnueabi', etc.
'())))
--
2.39.2
V
V
Vivien Kraus wrote on 18 Apr 2023 00:17
[PATCH core-updates 2/2] NOT WORKING gnu: p11-kit: switch to meson-build-system.
(address . 62916@debbugs.gnu.org)
16c8a106c160315cef9c04287414e2788e8a87f2.1681770007.git.vivien@planete-kraus.eu
* gnu/packages/tls.scm (p11-kit): Switch to meson build system.
---
gnu/packages/tls.scm | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)

Toggle diff (47 lines)
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index d41efe23b0..eaa18b9064 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -150,12 +150,9 @@ (define-public p11-kit
"download/" version "/p11-kit-" version ".tar.xz"))
(sha256
(base32 "1y5fm9gwhkh902r26p90qf1g2h1ziqrk4hgf9i9sxm2wzlz7ignq"))))
- (build-system gnu-build-system)
+ (build-system meson-build-system)
(native-inputs
- (append (list pkg-config)
- (if (hurd-target?)
- (list autoconf automake gettext-minimal libtool)
- '())))
+ (list pkg-config))
(inputs
(append (list libffi libtasn1)
(if (hurd-target?)
@@ -165,7 +162,7 @@ (define-public p11-kit
(list #:configure-flags
;; Use the default certificates so that users such as flatpak
;; find them. See <https://issues.guix.gnu.org/49957>.
- #~'("--with-trust-paths=/etc/ssl/certs/ca-certificates.crt")
+ #~'("-Dtrust_paths=/etc/ssl/certs/ca-certificates.crt")
#:phases #~(modify-phases %standard-phases
#$@(if (hurd-target?)
#~((add-after 'unpack 'apply-hurd-patch
@@ -178,15 +175,7 @@ (define patch
(replace 'bootstrap
(lambda _
(invoke "autoreconf" "-fiv"))))
- #~())
- (add-before 'check 'prepare-tests
- (lambda _
- ;; "test-runtime" expects XDG_RUNTIME_DIR to be set up
- ;; and looks for .cache and other directories (only).
- ;; For simplicity just drop it since it is irrelevant
- ;; in the build container.
- (substitute* "Makefile"
- (("test-runtime\\$\\(EXEEXT\\)") "")))))))
+ #~()))))
(home-page "https://p11-glue.github.io/p11-glue/p11-kit.html")
(synopsis "PKCS#11 library")
(description
--
2.39.2
L
L
Ludovic Courtès wrote on 25 Apr 2023 18:11
Re: bug#62916: [PATCH core-updates 0/2] Try to fix p11-kit compilation to mingw
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)(address . 62916@debbugs.gnu.org)
87ildkym9z.fsf_-_@gnu.org
Hi,

Vivien Kraus <vivien@planete-kraus.eu> skribis:

Toggle quote (3 lines)
> * gnu/packages/gcc.scm (gcc-configure-flags-for-triplet): Disable gcov when
> targetting mingw.

Pushed this one as 74038cf66e3a8cdcd9d97a81d9176c3cdefdaaf7.

The p11-kit story isn’t good, but I’m not sure how to address it. When
we find a way, we can add a feature branch to rebuild everything that
depends on it though.

Thanks!

Ludo’.
V
V
Vivien Kraus wrote on 25 Apr 2023 18:16
[PATCH v2 0/1] Fix p11-kit build system for mingw
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 62916@debbugs.gnu.org)
cover.1682439400.git.vivien@planete-kraus.eu
Hi!

Toggle quote (4 lines)
> The p11-kit story isn’t good, but I’m not sure how to address it. When
> we find a way, we can add a feature branch to rebuild everything that
> depends on it though.

I just found out how to fix the makefiles, and the moment I was about to send
the patch, I received your reply. This V2 does not fix the core issue, but at
least it builds on mingw now! The core problem in the build system is that
every auxiliary program is a mix of re-compiled common sources, static
libraries, and the main shared object. I decided to use static libraries
everywhere I can. This is gross but at least it links now, so this is a W I
guess?

What do you think?

Best regards,

Vivien

Vivien Kraus (1):
gnu: p11-kit: fix build on mingw.

gnu/local.mk | 3 +-
.../p11-kit-fix-build-system-for-mingw.patch | 108 ++++++++++++++++++
gnu/packages/tls.scm | 14 ++-
3 files changed, 123 insertions(+), 2 deletions(-)
create mode 100644 gnu/packages/patches/p11-kit-fix-build-system-for-mingw.patch


base-commit: 74038cf66e3a8cdcd9d97a81d9176c3cdefdaaf7
--
2.39.2
V
V
Vivien Kraus wrote on 25 Apr 2023 17:50
[PATCH v2 1/1] gnu: p11-kit: fix build on mingw.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 62916@debbugs.gnu.org)
a99229ce9b42800614b8a9976b24261ecc464d9e.1682439400.git.vivien@planete-kraus.eu
* gnu/packages/patches/p11-kit-fix-build-system-for-mingw.patch: New patch. It
makes sure that all symbols are defined when linking objects.
* gnu/packages/tls.scm (p11-kit) [on target-mingw?] [phase
'apply-mingw-patch]: New phase, similar to what’s done with hurd.
* gnu/packages/tls.scm (p11-kit) [native-inputs]: also add the autotools on mingw.
---
gnu/local.mk | 3 +-
.../p11-kit-fix-build-system-for-mingw.patch | 108 ++++++++++++++++++
gnu/packages/tls.scm | 14 ++-
3 files changed, 123 insertions(+), 2 deletions(-)
create mode 100644 gnu/packages/patches/p11-kit-fix-build-system-for-mingw.patch

Toggle diff (162 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 66dd240ba9..355c09caa4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1696,7 +1696,8 @@ 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-hurd.patch \
+ %D%/packages/patches/p11-kit-hurd.patch \
+ %D%/packages/patches/p11-kit-fix-build-system-for-mingw.patch \
%D%/packages/patches/patch-hurd-path-max.patch \
%D%/packages/patches/perl-5.14-autosplit-default-time.patch \
%D%/packages/patches/perl-5.14-module-pluggable-search.patch \
diff --git a/gnu/packages/patches/p11-kit-fix-build-system-for-mingw.patch b/gnu/packages/patches/p11-kit-fix-build-system-for-mingw.patch
new file mode 100644
index 0000000000..cc02fdf1b3
--- /dev/null
+++ b/gnu/packages/patches/p11-kit-fix-build-system-for-mingw.patch
@@ -0,0 +1,108 @@
+From e350540c9e2259e2f66cbaf7c6dc347f03acac40 Mon Sep 17 00:00:00 2001
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Tue, 25 Apr 2023 17:41:47 +0200
+Subject: [PATCH] Fix the build system to avoid undefined references on mingw.
+
+---
+ p11-kit/Makefile.am | 23 ++++++++++++-----------
+ trust/Makefile.am | 5 ++---
+ 2 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/p11-kit/Makefile.am b/p11-kit/Makefile.am
+index 7fe7a6c..017edd3 100644
+--- a/p11-kit/Makefile.am
++++ b/p11-kit/Makefile.am
+@@ -13,6 +13,7 @@ COMMON_SRCS = \
+ p11-kit/conf.c p11-kit/conf.h \
+ p11-kit/iter.c \
+ p11-kit/log.c p11-kit/log.h \
++ p11-kit/lists.c \
+ p11-kit/filter.c p11-kit/filter.h \
+ p11-kit/modules.c p11-kit/modules.h \
+ p11-kit/pkcs11.h \
+@@ -80,6 +81,7 @@ COMMON_CFLAGS = \
+ COMMON_LIBS = \
+ libp11-common.la \
+ libp11-library.la \
++ libp11-tool.la \
+ $(LIBFFI_LIBS) \
+ $(LTLIBINTL) \
+ $(NULL)
+@@ -125,7 +127,8 @@ libp11_kit_testable_la_SOURCES = \
+ $(libp11_kit_internal_la_SOURCES) \
+ $(libp11_kit_la_SOURCES) \
+ $(NULL)
+-libp11_kit_testable_la_LIBADD = $(COMMON_LIBS)
++libp11_kit_testable_la_LIBADD = $(COMMON_LIBS) \
++ libp11-tool.la
+
+ pkcs11_gnu_sources = \
+ p11-kit/uri.gnu.c \
+@@ -238,14 +241,12 @@ EXTRA_DIST += \
+ bin_PROGRAMS += p11-kit/p11-kit
+
+ p11_kit_p11_kit_SOURCES = \
+- p11-kit/lists.c \
+ p11-kit/p11-kit.c \
+ $(NULL)
+
+ p11_kit_p11_kit_LDADD = \
+- libp11-kit.la \
+- libp11-tool.la \
+- libp11-common.la \
++ libp11-kit-internal.la \
++ $(COMMON_LIBS) \
+ $(LTLIBINTL) \
+ $(NULL)
+
+@@ -257,12 +258,12 @@ 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 +279,12 @@ 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..f5d87f5 100644
+--- a/trust/Makefile.am
++++ b/trust/Makefile.am
+@@ -84,9 +84,8 @@ bin_PROGRAMS += trust/trust
+
+ trust_trust_LDADD = \
+ libtrust-data.la \
+- libp11-kit.la \
+- libp11-common.la \
+- libp11-tool.la \
++ libp11-kit-internal.la \
++ $(COMMON_LIBS) \
+ $(LTLIBINTL) \
+ $(LIBTASN1_LIBS) \
+ $(HASH_LIBS) \
+--
+2.39.2
+
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index e0da7757e0..2cd43c6957 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -153,7 +153,7 @@ (define-public p11-kit
(build-system gnu-build-system)
(native-inputs
(append (list pkg-config)
- (if (hurd-target?)
+ (if (or (target-mingw?) (hurd-target?))
(list autoconf automake gettext-minimal libtool)
'())))
(inputs
@@ -179,6 +179,18 @@ (define patch
(lambda _
(invoke "autoreconf" "-fiv"))))
#~())
+ #$@(if (target-mingw?)
+ #~((add-after 'unpack 'apply-mingw-patch
+ (lambda* (#:key inputs #:allow-other-keys)
+ (define patch
+ #$(local-file
+ (search-patch "p11-kit-fix-build-system-for-mingw.patch")))
+ (invoke "patch" "-p1" "--batch" "-i"
+ patch)))
+ (replace 'bootstrap
+ (lambda _
+ (invoke "autoreconf" "-fiv"))))
+ #~())
(add-before 'check 'prepare-tests
(lambda _
;; "test-runtime" expects XDG_RUNTIME_DIR to be set up
--
2.39.2
V
V
Vivien Kraus wrote on 25 Apr 2023 23:33
[PATCH v3 0/1] Simpler fix for p11-kit@mingw
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 62916@debbugs.gnu.org)
cover.1682458392.git.vivien@planete-kraus.eu
I noticed that the only problem was the way to generate the list of symbols
for the DLL. So I don’t have to fix anything in the build system.

Vivien Kraus (1):
gnu: p11-kit: fix build on mingw.

gnu/packages/tls.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)


base-commit: 74038cf66e3a8cdcd9d97a81d9176c3cdefdaaf7
--
2.39.2
V
V
Vivien Kraus wrote on 25 Apr 2023 17:50
[PATCH v3 1/1] gnu: p11-kit: fix build on mingw.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 62916@debbugs.gnu.org)
8cde1bc525bc95c12b080de22d692d04b915618e.1682458392.git.vivien@planete-kraus.eu
* gnu/packages/patches/p11-kit-fix-build-system-for-mingw.patch: New patch. It
makes sure that all symbols are defined when linking objects.
* gnu/packages/tls.scm (p11-kit) [on target-mingw?] [phase
'apply-mingw-patch]: New phase, similar to what’s done with hurd.
* gnu/packages/tls.scm (p11-kit) [native-inputs]: also add the autotools on mingw.
---
gnu/packages/tls.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index e0da7757e0..38126e2326 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -165,7 +165,10 @@ (define-public p11-kit
(list #:configure-flags
;; Use the default certificates so that users such as flatpak
;; find them. See <https://issues.guix.gnu.org/49957>.
- #~'("--with-trust-paths=/etc/ssl/certs/ca-certificates.crt")
+ #~'("--with-trust-paths=/etc/ssl/certs/ca-certificates.crt"
+ #$@(if (target-mingw?)
+ #~("--disable-ld-version-script")
+ #~()))
#:phases #~(modify-phases %standard-phases
#$@(if (hurd-target?)
#~((add-after 'unpack 'apply-hurd-patch
--
2.39.2
?