[PATCH 0/1] Fix p11-kit for mingw

  • Done
  • quality assurance status badge
Details
2 participants
  • Christopher Baines
  • Vivien Kraus
Owner
unassigned
Submitted by
Vivien Kraus
Severity
normal
V
V
Vivien Kraus wrote on 6 Jan 2023 00:32
(address . guix-patches@gnu.org)
cover.1672961565.git.vivien@planete-kraus.eu
Dear guix,

I think I managed to get p11-kit to build for mingw. I am not sure that
everything is correct, because gnutls still fails to build, and I don’t
understand why.

Could someone help me with this?

Best regards,

Vivien

Vivien Kraus (1):
gnu: p11-kit: Fix mingw cross-compilation.

gnu/local.mk | 1 +
gnu/packages/patches/p11-kit-fix-mingw.patch | 92 ++++++++++++++++++++
gnu/packages/tls.scm | 22 ++++-
3 files changed, 111 insertions(+), 4 deletions(-)
create mode 100644 gnu/packages/patches/p11-kit-fix-mingw.patch


base-commit: 6f8a03fad32261b6d4b38991f6757fb0bcc4bd86
--
2.38.1
V
V
Vivien Kraus wrote on 5 Jan 2023 23:08
[PATCH 1/1] gnu: p11-kit: Fix mingw cross-compilation.
(address . 60586@debbugs.gnu.org)
20f2359427de9bfa0cdaccfed5b1b4a0f24a01b6.1672961565.git.vivien@planete-kraus.eu
* gnu/packages/patches/p11-kit-fix-mingw.patch: New patch. It removes
undefined symbol errors.
* gnu/packages/tls.scm (p11-kit) [native-inputs]: Add libtasn1 as a dependency
for a code generator. The autotools are added when compiling for mingw.
[inputs]: Add the mingw patch, similar to the hurd patch.
[phases]: Add a new apply-mingw-patch phase, similar to apply-hurd-patch. The
'bootstrap phase replacement happens both for hurd and mingw.
---
gnu/local.mk | 1 +
gnu/packages/patches/p11-kit-fix-mingw.patch | 92 ++++++++++++++++++++
gnu/packages/tls.scm | 22 ++++-
3 files changed, 111 insertions(+), 4 deletions(-)
create mode 100644 gnu/packages/patches/p11-kit-fix-mingw.patch

Toggle diff (162 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 4a94c3b8c8..a35c2d2f33 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -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 \
diff --git a/gnu/packages/patches/p11-kit-fix-mingw.patch b/gnu/packages/patches/p11-kit-fix-mingw.patch
new file mode 100644
index 0000000000..cfb8a3c9ba
--- /dev/null
+++ b/gnu/packages/patches/p11-kit-fix-mingw.patch
@@ -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
+
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index a74b423ccf..d4220284e8 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -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"))))
'())
--
2.38.1
V
V
Vivien Kraus wrote on 6 Jan 2023 23:55
[PATCH v2 0/2] Switch p11-kit-next to meson-build-system
(address . 60586@debbugs.gnu.org)
cover.1673045732.git.vivien@planete-kraus.eu
Dear guix,

Upstream recommends to build with meson (see README.md), and it happens to
solve the mingw cross-compilation failure.

I had to isolate meson from the other build tools, because one of the package
in (gnu packages build-tools) depends on openssl, which is in (gnu packages
tls) like p11-kit. So, using the meson build system would be a circular
dependency.

Since now meson has quite a few public variables, I figured out it could go to
its own file.

I had to read the git log twice to make sure I got the correct copyright
notices (including dates) for both meson-related stuff and the other packages
in (gnu packages build-tools).

Vivien Kraus (2):
gnu: move meson to (gnu packages meson).
gnu: p11-kit-next: Switch to meson-build-system.

gnu/local.mk | 1 +
gnu/packages/build-tools.scm | 169 ++---------------------
gnu/packages/freedesktop.scm | 3 +-
gnu/packages/geo.scm | 1 +
gnu/packages/gnome.scm | 1 +
gnu/packages/meson.scm | 204 ++++++++++++++++++++++++++++
gnu/packages/package-management.scm | 1 +
gnu/packages/python-science.scm | 1 +
gnu/packages/syndication.scm | 1 +
gnu/packages/tls.scm | 7 +-
gnu/packages/virtualization.scm | 1 +
guix/build-system/meson.scm | 2 +-
12 files changed, 230 insertions(+), 162 deletions(-)
create mode 100644 gnu/packages/meson.scm


base-commit: cce9ff2d5ada3d1e26e1c70205f21271a0065482
--
2.38.1
V
V
Vivien Kraus wrote on 6 Jan 2023 22:04
[PATCH v2 1/2] gnu: move meson to (gnu packages meson).
(address . 60586@debbugs.gnu.org)
28f09f45f5ded05a459aafac932207a28e4d27d3.1673045732.git.vivien@planete-kraus.eu
* gnu/packages/meson.scm: New file with meson.
* gnu/packages/build-tools.scm (meson-0.63, meson-0.60 meson-0.59 meson
meson-python): Move to (gnu packages meson).
* gnu/packages/freedesktop.scm, gnu/packages/geo.scm, gnu/packages/gnome.scm,
gnu/packages/package-management.scm, gnu/packages/python-science.scm,
gnu/packages/syndication.scm, gnu/packages/virtualization.scm: import (gnu
packages meson).
* guix/build-system/meson.scm (default-meson): get it from (gnu packages meson).
---
gnu/local.mk | 1 +
gnu/packages/build-tools.scm | 169 ++---------------------
gnu/packages/freedesktop.scm | 3 +-
gnu/packages/geo.scm | 1 +
gnu/packages/gnome.scm | 1 +
gnu/packages/meson.scm | 204 ++++++++++++++++++++++++++++
gnu/packages/package-management.scm | 1 +
gnu/packages/python-science.scm | 1 +
gnu/packages/syndication.scm | 1 +
gnu/packages/virtualization.scm | 1 +
guix/build-system/meson.scm | 2 +-
11 files changed, 224 insertions(+), 161 deletions(-)
create mode 100644 gnu/packages/meson.scm

Toggle diff (429 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 325bdd570a..ccf225efbb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -419,6 +419,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/medical.scm \
%D%/packages/mercury.scm \
%D%/packages/mes.scm \
+ %D%/packages/meson.scm \
%D%/packages/messaging.scm \
%D%/packages/minetest.scm \
%D%/packages/mingw.scm \
diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
index 6c1350c44f..e61db21325 100644
--- a/gnu/packages/build-tools.scm
+++ b/gnu/packages/build-tools.scm
@@ -1,10 +1,10 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2017 Corentin Bocquillon <corentin@nybble.fr>
-;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
;;; Copyright © 2018 Tomáš ?ech <sleep_walker@gnu.org>
-;;; Copyright © 2018, 2020 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018-2022 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018-2022 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2019, 2020 Brett Gilio <brettg@gnu.org>
;;; Copyright © 2019 Jonathan Brielmaier <jonathan.brielmaier@web.de>
@@ -12,9 +12,14 @@
;;; Copyright © 2020 Yuval Kogman <nothingmuch@woobling.org>
;;; Copyright © 2020 Jakub K?dzio?ka <kuba@kadziolka.net>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020 Raghav Gururajan <rg@raghavgururajan.name>
;;; Copyright © 2021 qblade <qblade@protonmail.com>
-;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Léo Le Bouter <lle-bout@zaclys.net>
+;;; Copyright © 2021, 2022 Greg Hogan <code@greghogan.com>
+;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Juliana Sims <jtsims@protonmail.com>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -273,160 +278,6 @@ (define-public gn
;; X11 license.
(license (list license:bsd-3 license:x11)))))
-(define-public meson-0.63
- (package
- (name "meson")
- (version "0.63.2")
- (source (origin
- (method url-fetch)
- (uri (string-append "https://github.com/mesonbuild/meson/"
- "releases/download/" version "/meson-"
- version ".tar.gz"))
- (sha256
- (base32
- "1gwba75z47m2hv3w08gw8sgqgbknjr7rj1qwr510bgknxwbjy8hn"))))
- (build-system python-build-system)
- (arguments
- `(;; FIXME: Tests require many additional inputs and patching many
- ;; hard-coded file system locations in "run_unittests.py".
- #:tests? #f
- #:phases (modify-phases %standard-phases
- ;; Meson calls the various executables in out/bin through the
- ;; Python interpreter, so we cannot use the shell wrapper.
- (replace 'wrap
- (lambda* (#:key outputs inputs #:allow-other-keys)
- (let ((python-version
- (python-version (assoc-ref inputs "python")))
- (output (assoc-ref outputs "out")))
- (substitute* (string-append output "/bin/meson")
- (("# EASY-INSTALL-ENTRY-SCRIPT")
- (format #f "\
-import sys
-sys.path.insert(0, '~a/lib/python~a/site-packages')
-# EASY-INSTALL-ENTRY-SCRIPT"
- output python-version)))))))))
- (inputs (list python-wrapper ninja))
- (home-page "https://mesonbuild.com/")
- (synopsis "Build system designed to be fast and user-friendly")
- (description
- "The Meson build system is focused on user-friendliness and speed.
-It can compile code written in C, C++, Fortran, Java, Rust, and other
-languages. Meson provides features comparable to those of the
-Autoconf/Automake/make combo. Build specifications, also known as @dfn{Meson
-files}, are written in a custom domain-specific language (@dfn{DSL}) that
-resembles Python.")
- (license license:asl2.0)))
-
-(define-public meson-0.60
- (package
- (inherit meson-0.63)
- (version "0.60.3")
- (source (origin
- (method url-fetch)
- (uri (string-append "https://github.com/mesonbuild/meson/"
- "releases/download/" version "/meson-"
- version ".tar.gz"))
- (sha256
- (base32
- "13mrrizg4vl6n5k7fz6amyafnn3i097dcarr552qc0ca6nlmzjl7"))
- (patches (search-patches
- "meson-allow-dirs-outside-of-prefix.patch"))))))
-
-;;; This older Meson variant is kept for now for gtkmm and others that may
-;;; have problems with 0.60.
-(define-public meson-0.59
- (package
- (inherit meson-0.60)
- (version "0.59.4")
- (source (origin
- (method url-fetch)
- (uri (string-append "https://github.com/mesonbuild/meson/"
- "releases/download/" version "/meson-"
- version ".tar.gz"))
- (sha256
- (base32
- "117cm8794h291lca1wljz1pwnzidgbvrpg3mw3np6ksma368hyd7"))
- (patches (search-patches
- "meson-allow-dirs-outside-of-prefix.patch"))))))
-
-;; TODO: Bump this in the next rebuild cycle.
-(define-public meson meson-0.60)
-
-(define-public meson-python
- (package
- (name "meson-python")
- (version "0.8.1")
- (source (origin
- (method url-fetch)
- (uri (pypi-uri "meson_python" version))
- (sha256
- (base32
- "0k2yn0iws1n184sdznzmfw4xgbqgq5cn02hpc7m0xdaxryj1ybs4"))))
- (build-system python-build-system)
- (arguments
- (list #:phases
- #~(modify-phases %standard-phases
- (add-after 'unpack 'avoid-ninja-dependency
- (lambda _
- ;; Avoid dependency on the "ninja" PyPI distribution,
- ;; which is a meta-package that simply downloads and
- ;; installs ninja from the web ...
- (substitute* "pyproject.toml"
- (("'ninja',")
- ""))))
- (replace 'build
- (lambda _
- ;; ZIP does not support timestamps before 1980.
- (setenv "SOURCE_DATE_EPOCH" "315532800")
- (invoke "python" "-m" "build" "--wheel" "--no-isolation" ".")))
- (replace 'install
- (lambda _
- (let ((whl (car (find-files "dist" "\\.whl$"))))
- (invoke "pip" "--no-cache-dir" "--no-input"
- "install" "--no-deps" "--prefix" #$output whl))))
- (replace 'check
- (lambda* (#:key tests? #:allow-other-keys)
- (when tests?
- (invoke "pytest" "-vv" "tests" "-k"
- (string-append
- "not "
- ;; These tests require a git checkout.
- (string-join '("test_contents_unstaged"
- "test_no_pep621"
- "test_pep621"
- "test_dynamic_version"
- "test_contents"
- "test_contents_subdirs")
- " and not ")))))))))
- (propagated-inputs
- (list meson-0.63 ;>=0.62 required
- ninja
- ;; XXX: python-meson forcefully sets the RUNPATH of binaries
- ;; for vendoring purposes, and uses PatchELF for that(!). This
- ;; functionality is not useful in Guix, but removing this
- ;; dependency is tricky. There is discussion upstream about making
- ;; it optional, but for now we'll just carry it:
- ;; https://github.com/FFY00/meson-python/issues/125
- patchelf
- python-colorama
- python-pyproject-metadata
- python-tomli
- python-wheel))
- (native-inputs
- (list python-pypa-build
- python-wheel
-
- ;; For tests.
- pkg-config
- python-gitpython
- python-pytest
- python-pytest-mock))
- (home-page "https://github.com/FFY00/mesonpy")
- (synopsis "Meson-based build backend for Python")
- (description
- "meson-python is a PEP 517 build backend for Meson projects.")
- (license license:expat)))
-
(define-public premake4
(package
(name "premake")
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 515d9b9cea..b442ec8ab7 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -103,8 +103,9 @@ (define-module (gnu packages freedesktop)
#:use-module (gnu packages libunwind)
#:use-module (gnu packages libusb)
#:use-module (gnu packages linux)
- #:use-module (gnu packages man)
#:use-module (gnu packages m4)
+ #:use-module (gnu packages man)
+ #:use-module (gnu packages meson)
#:use-module (gnu packages networking)
#:use-module (gnu packages nss)
#:use-module (gnu packages package-management)
diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index 2185af7a98..5fbe6f8dd7 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -99,6 +99,7 @@ (define-module (gnu packages geo)
#:use-module (gnu packages linux)
#:use-module (gnu packages lua)
#:use-module (gnu packages maths)
+ #:use-module (gnu packages meson)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages pcre)
#:use-module (gnu packages pdf)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 47a0f237fe..3774b9af9f 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -162,6 +162,7 @@ (define-module (gnu packages gnome)
#:use-module (gnu packages mail)
#:use-module (gnu packages man)
#:use-module (gnu packages markup)
+ #:use-module (gnu packages meson)
#:use-module (gnu packages messaging)
#:use-module (gnu packages mp3)
#:use-module (gnu packages multiprecision)
diff --git a/gnu/packages/meson.scm b/gnu/packages/meson.scm
new file mode 100644
index 0000000000..c42e13cf2a
--- /dev/null
+++ b/gnu/packages/meson.scm
@@ -0,0 +1,204 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Corentin Bocquillon <corentin@nybble.fr>
+;;; Copyright © 2017, 2018, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10@gmail.com>
+;;; Copyright © 2018-2022 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2018 Brett Gilio <brettg@gnu.org>
+;;; Copyright © 2020 Alexandros Theodotou <alex@zrythm.org>
+;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2021 Sou Bunnbu (???) <iyzsong@gmail.com>
+;;; Copyright © 2021 Kaelyn Takata <kaelyn.alexi@protonmail.com>
+;;; Copyright © 2021 Mathieu Othacehe <othacehe@gnu.org>
+;;; Copyright © 2021 Vivien Kraus <vivien@planete-kraus.eu>
+;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages meson)
+ #:use-module (ice-9 optargs)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix build-system python)
+ #:use-module (guix download)
+ #:use-module (guix gexp)
+ #:use-module (guix git-download)
+ #:use-module (guix modules)
+ #:use-module (guix packages)
+ #:use-module (guix utils)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages check)
+ #:use-module (gnu packages elf)
+ #:use-module (gnu packages ninja)
+ #:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages python-build)
+ #:use-module (gnu packages python-xyz)
+ #:use-module (gnu packages version-control))
+
+(define-public meson-0.63
+ (package
+ (name "meson")
+ (version "0.63.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://github.com/mesonbuild/meson/"
+ "releases/download/" version "/meson-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "1gwba75z47m2hv3w08gw8sgqgbknjr7rj1qwr510bgknxwbjy8hn"))))
+ (build-system python-build-system)
+ (arguments
+ `(;; FIXME: Tests require many additional inputs and patching many
+ ;; hard-coded file system locations in "run_unittests.py".
+ #:tests? #f
+ #:phases (modify-phases %standard-phases
+ ;; Meson calls the various executables in out/bin through the
+ ;; Python interpreter, so we cannot use the shell wrapper.
+ (replace 'wrap
+ (lambda* (#:key outputs inputs #:allow-other-keys)
+ (let ((python-version
+ (python-version (assoc-ref inputs "python")))
+ (output (assoc-ref outputs "out")))
+ (substitute* (string-append output "/bin/meson")
+ (("# EASY-INSTALL-ENTRY-SCRIPT")
+ (format #f "\
+import sys
+sys.path.insert(0, '~a/lib/python~a/site-packages')
+# EASY-INSTALL-ENTRY-SCRIPT"
+ output python-version)))))))))
+ (inputs (list python-wrapper ninja))
+ (home-page "https://mesonbuild.com/")
+ (synopsis "Build system designed to be fast and user-friendly")
+ (description
+ "The Meson build system is focused on user-friendliness and speed.
+It can compile code written in C, C++, Fortran, Java, Rust, and other
+languages. Meson provides features comparable to those of the
+Autoconf/Automake/make combo. Build specifications, also known as @dfn{Meson
+files}, are written in a custom domain-specific language (@dfn{DSL}) that
+resembles Python.")
+ (license license:asl2.0)))
+
+(define-public meson-0.60
+ (package
+ (inherit meson-0.63)
+ (version "0.60.3")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://github.com/mesonbuild/meson/"
+ "releases/download/" version "/meson-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "13mrrizg4vl6n5k7fz6amyafnn3i097dcarr552qc0ca6nlmzjl7"))
+ (patches (search-patches
+ "meson-allow-dirs-outside-of-prefix.patch"))))))
+
+;;; This older Meson variant is kept for now for gtkmm and others that may
+;;; have problems with 0.60.
+(define-public meson-0.59
+ (package
+ (inherit meson-0.60)
+ (version "0.59.4")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://github.com/mesonbuild/meson/"
+ "releases/download/" version "/meson-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "117cm8794h291lca1wljz1pwnzidgbvrpg3mw3np6ksma368hyd7"))
+ (patches (search-patches
+ "meson-allow-dirs-outside-of-prefix.patch"))))))
+
+;; TODO: Bump this in the next rebuild cycle.
+(define-public meson meson-0.60)
+
+(define-public meson-python
+ (package
+ (name "meson-python")
+ (version "0.8.1")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "meson_python" version))
+ (sha256
+ (base32
+ "0k2yn0iws1n184sdznzmfw4xgbqgq5cn02hpc7m0xdaxryj1ybs4"))))
+ (build-system python-build-system)
+ (arguments
+ (list #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'avoid-ninja-dependency
+ (lambda _
+ ;; Avoid dependency on the "ninja" PyPI distribution,
+ ;; which is a meta-package that simply downloads and
+ ;; installs ninja from the web ...
+ (substitute* "pyproject.toml"
+ (("'ninja',")
+ ""))))
+ (replace 'build
+ (lambda _
+ ;; ZIP does not support timestamps before 1980.
+ (setenv "SOURCE_DATE_EPOCH" "315532800")
+ (invoke "python" "-m" "build" "--wheel" "--no-isolation" ".")))
+ (replace 'install
+ (lambda _
+ (let ((whl (car (find-files "dist" "\\.whl$"))))
+ (invoke "pip" "--no-cache-dir" "--no-input"
+ "install" "--no-deps" "--prefix" #$output whl))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "pytest" "-vv" "tests" "-k"
+ (string-append
+ "not "
+ ;; These tests require a git checkout.
+ (string-join '("test_contents_unstaged"
+ "test_no_pep621"
+ "test_pep621"
+ "test_dynamic_version"
+ "test_contents"
+ "test_contents_subdirs")
+
This message was truncated. Download the full message here.
V
V
Vivien Kraus wrote on 6 Jan 2023 23:48
[PATCH v2 2/2] gnu: p11-kit-next: Switch to meson-build-system.
(address . 60586@debbugs.gnu.org)
e7e1e7d1d77ce0e578b8a0d73af7feed3f2ba150.1673045732.git.vivien@planete-kraus.eu
README.md says to use meson to build.

* gnu/packages/tls.scm (p11-kit-next): Use meson-build-system.
---
gnu/packages/tls.scm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

Toggle diff (32 lines)
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index a74b423ccf..a5c8ec1624 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -51,6 +51,7 @@ (define-module (gnu packages tls)
#:use-module (guix build-system python)
#:use-module (guix build-system cmake)
#:use-module (guix build-system trivial)
+ #:use-module (guix build-system meson)
#:use-module ((guix search-paths) #:select ($SSL_CERT_DIR $SSL_CERT_FILE))
#:use-module (gnu packages compression)
#:use-module (gnu packages)
@@ -205,12 +206,16 @@ (define-public p11-kit-next
"download/" version "/p11-kit-" version ".tar.xz"))
(sha256
(base32 "1y5fm9gwhkh902r26p90qf1g2h1ziqrk4hgf9i9sxm2wzlz7ignq"))))
+ (build-system meson-build-system)
(arguments
;; Use the default certificates so that users such as flatpak find them.
;; See <https://issues.guix.gnu.org/49957>.
(substitute-keyword-arguments (package-arguments p11-kit)
((#:configure-flags flags ''())
- ''("--with-trust-paths=/etc/ssl/certs/ca-certificates.crt"))))))
+ ''("-Dtrust_paths=/etc/ssl/certs/ca-certificates.crt"))
+ ;; p11-kit is still on gnu-build-system.
+ ((#:phases gnu-phases)
+ '%standard-phases)))))
(define-public gnutls
(package
--
2.38.1
V
V
Vivien Kraus wrote on 7 Jan 2023 00:05
Re: [PATCH v2 0/2] Switch p11-kit-next to meson-build-system
(address . 60586@debbugs.gnu.org)
a7ba477298ef46210fa42fdd21b49f305a4c8127.camel@planete-kraus.eu
Le vendredi 06 janvier 2023 à 23:55 +0100, Vivien Kraus a écrit :
Toggle quote (6 lines)
> I had to read the git log twice to make sure I got the correct
> copyright
> notices (including dates) for both meson-related stuff and the other
> packages
> in (gnu packages build-tools).

To be clear, I’m not complaining, I’m just explaining where I got these
copyright notices from.
V
V
Vivien Kraus wrote on 7 Jan 2023 04:15
[PATCH v3 0/1] Switch p11-kit-next to meson-build-system.
(address . 60586@debbugs.gnu.org)
cover.1673061304.git.vivien@planete-kraus.eu
It’s simpler than what I thought: p11-kit builds directly, no need to isolate
meson.

Vivien Kraus (1):
gnu: p11-kit-next: Switch to meson-build-system.

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


base-commit: cce9ff2d5ada3d1e26e1c70205f21271a0065482
--
2.38.1
V
V
Vivien Kraus wrote on 6 Jan 2023 23:48
[PATCH v3 1/1] gnu: p11-kit-next: Switch to meson-build-system.
(address . 60586@debbugs.gnu.org)
6fd07b81d511ed41e2147380f0cbb7d02e851318.1673061304.git.vivien@planete-kraus.eu
README.md says to use meson to build.

* gnu/packages/tls.scm (p11-kit-next): Use meson-build-system.
---
gnu/packages/tls.scm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

Toggle diff (32 lines)
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index a74b423ccf..a5c8ec1624 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -51,6 +51,7 @@ (define-module (gnu packages tls)
#:use-module (guix build-system python)
#:use-module (guix build-system cmake)
#:use-module (guix build-system trivial)
+ #:use-module (guix build-system meson)
#:use-module ((guix search-paths) #:select ($SSL_CERT_DIR $SSL_CERT_FILE))
#:use-module (gnu packages compression)
#:use-module (gnu packages)
@@ -205,12 +206,16 @@ (define-public p11-kit-next
"download/" version "/p11-kit-" version ".tar.xz"))
(sha256
(base32 "1y5fm9gwhkh902r26p90qf1g2h1ziqrk4hgf9i9sxm2wzlz7ignq"))))
+ (build-system meson-build-system)
(arguments
;; Use the default certificates so that users such as flatpak find them.
;; See <https://issues.guix.gnu.org/49957>.
(substitute-keyword-arguments (package-arguments p11-kit)
((#:configure-flags flags ''())
- ''("--with-trust-paths=/etc/ssl/certs/ca-certificates.crt"))))))
+ ''("-Dtrust_paths=/etc/ssl/certs/ca-certificates.crt"))
+ ;; p11-kit is still on gnu-build-system.
+ ((#:phases gnu-phases)
+ '%standard-phases)))))
(define-public gnutls
(package
--
2.38.1
C
C
Christopher Baines wrote on 17 Feb 2023 16:49
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
877cwgmgvf.fsf@cbaines.net
Vivien Kraus via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (7 lines)
> README.md says to use meson to build.
>
> * gnu/packages/tls.scm (p11-kit-next): Use meson-build-system.
> ---
> gnu/packages/tls.scm | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)

I tweaked the changelog in the commit message to be a bit more specific
and pushed this to master as 95f481b33167cd231fda080c76eb980550fd1eae.

Thanks,

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmPvohRfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xe6khAAl0S0iv5cFBFMAGd6PfEZZxyIWaz/3+Sr
f+0LDVpq1tm+CmcsdK7aiW6QLxSrhRDWXLnQBMZpkG1F/dbIyg4id+YVnuBsNigu
D49zjsXtu8SvJH2ieqm2HP/rlj8+h1kfRqq+WL0poYfxQ6yfRDp2l/OIAw2EMcUk
4xBVZCTKb7uShLSDf8QdQeixz9yJ9utzxY2lsiS7RFLKPCR6vwIfW9I8Qp0B/rEv
xcoTSQRJ1sL8/NKn/mMeKOCRwT8WgHecJOkpqzhn8vYwpt1pC6EH9YK+Dys1OoXl
8WwiW0zysYxvWeDJds8Y3vOGNNxY/ir1fX7bzf1qW3L7Jh5dFSKnRR+3fu02kyuM
tZmlWVl7pxpHn1cosmZ02dRwkbPblu2vQOYCPTOk3naGn4wVO6Dcbqp1Pb66bTpb
cTUY6yRO3FZ9Kfr3SLM8oBTVAC96OD/QP0M1/AX3aoZguq4QM3wXv7G9SOmvHRGh
Bq3hfnvSua0jh8L1e814XjfGr0Njur0QNRgtz0YmfCWHe/7pJODZamHR8jzHj/Xs
eew0YzC1l64lW+f5s7X4N0MTPYcLp/JfxinEALPAPINkYSl4aCNH/bGxs8SbMwFj
kPnmM6bT7MVs/Y7BIKGz5vgmB+fdJXd2ynaSgQRCJCvVawK6XwW0LYuAHqUuvidJ
/gm/0sPYVlY=
=hN5y
-----END PGP SIGNATURE-----

?