unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#60586] [PATCH 1/1] gnu: p11-kit: Fix mingw cross-compilation.
  2023-01-05 23:32 [bug#60586] [PATCH 0/1] Fix p11-kit for mingw Vivien Kraus via Guix-patches via
@ 2023-01-05 22:08 ` Vivien Kraus via Guix-patches via
  2023-01-06 22:55 ` [bug#60586] [PATCH v2 0/2] Switch p11-kit-next to meson-build-system Vivien Kraus via Guix-patches via
  2023-01-07  3:15 ` [bug#60586] [PATCH v3 0/1] " Vivien Kraus via Guix-patches via
  2 siblings, 0 replies; 9+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-01-05 22:08 UTC (permalink / raw)
  To: 60586

* 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

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




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#60586] [PATCH 0/1] Fix p11-kit for mingw
@ 2023-01-05 23:32 Vivien Kraus via Guix-patches via
  2023-01-05 22:08 ` [bug#60586] [PATCH 1/1] gnu: p11-kit: Fix mingw cross-compilation Vivien Kraus via Guix-patches via
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-01-05 23:32 UTC (permalink / raw)
  To: 60586

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 665 bytes --]

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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#60586] [PATCH v2 1/2] gnu: move meson to (gnu packages meson).
  2023-01-06 22:55 ` [bug#60586] [PATCH v2 0/2] Switch p11-kit-next to meson-build-system Vivien Kraus via Guix-patches via
@ 2023-01-06 21:04   ` Vivien Kraus via Guix-patches via
  2023-01-06 22:48   ` [bug#60586] [PATCH v2 2/2] gnu: p11-kit-next: Switch to meson-build-system Vivien Kraus via Guix-patches via
  2023-01-06 23:05   ` [bug#60586] [PATCH v2 0/2] Switch p11-kit-next " Vivien Kraus via Guix-patches via
  2 siblings, 0 replies; 9+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-01-06 21:04 UTC (permalink / raw)
  To: 60586

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 23858 bytes --]

* 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

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")
+                                           " 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)))
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 2ffaa12247..8a992b8cb1 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -84,6 +84,7 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages man)
   #:use-module (gnu packages markup)
+  #:use-module (gnu packages meson)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index dab044d9f7..ebdcadad2c 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -52,6 +52,7 @@ (define-module (gnu packages python-science)
   #:use-module (gnu packages image-processing)
   #:use-module (gnu packages machine-learning)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages meson)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
diff --git a/gnu/packages/syndication.scm b/gnu/packages/syndication.scm
index 506245fd17..fd327fb27f 100644
--- a/gnu/packages/syndication.scm
+++ b/gnu/packages/syndication.scm
@@ -51,6 +51,7 @@ (define-module (gnu packages syndication)
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages kde-frameworks)
+  #:use-module (gnu packages meson)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages pretty-print)
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 64a26edb02..f3cb521599 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -96,6 +96,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages m4)
+  #:use-module (gnu packages meson)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages nettle)
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm
index 9fee6c4570..440577ddb8 100644
--- a/guix/build-system/meson.scm
+++ b/guix/build-system/meson.scm
@@ -124,7 +124,7 @@ (define (default-ninja)
 (define (default-meson)
   "Return the default meson package."
   ;; Lazily resolve the binding to avoid a circular dependency.
-  (let ((module (resolve-interface '(gnu packages build-tools))))
+  (let ((module (resolve-interface '(gnu packages meson))))
     (module-ref module 'meson)))
 
 (define* (lower name
-- 
2.38.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#60586] [PATCH v2 2/2] gnu: p11-kit-next: Switch to meson-build-system.
  2023-01-06 22:55 ` [bug#60586] [PATCH v2 0/2] Switch p11-kit-next to meson-build-system Vivien Kraus via Guix-patches via
  2023-01-06 21:04   ` [bug#60586] [PATCH v2 1/2] gnu: move meson to (gnu packages meson) Vivien Kraus via Guix-patches via
@ 2023-01-06 22:48   ` Vivien Kraus via Guix-patches via
  2023-01-06 23:05   ` [bug#60586] [PATCH v2 0/2] Switch p11-kit-next " Vivien Kraus via Guix-patches via
  2 siblings, 0 replies; 9+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-01-06 22:48 UTC (permalink / raw)
  To: 60586

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(-)

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




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#60586] [PATCH v3 1/1] gnu: p11-kit-next: Switch to meson-build-system.
  2023-01-07  3:15 ` [bug#60586] [PATCH v3 0/1] " Vivien Kraus via Guix-patches via
@ 2023-01-06 22:48   ` Vivien Kraus via Guix-patches via
  2023-02-17 15:49     ` bug#60586: " Christopher Baines
  0 siblings, 1 reply; 9+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-01-06 22:48 UTC (permalink / raw)
  To: 60586

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(-)

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




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#60586] [PATCH v2 0/2] Switch p11-kit-next to meson-build-system
  2023-01-05 23:32 [bug#60586] [PATCH 0/1] Fix p11-kit for mingw Vivien Kraus via Guix-patches via
  2023-01-05 22:08 ` [bug#60586] [PATCH 1/1] gnu: p11-kit: Fix mingw cross-compilation Vivien Kraus via Guix-patches via
@ 2023-01-06 22:55 ` Vivien Kraus via Guix-patches via
  2023-01-06 21:04   ` [bug#60586] [PATCH v2 1/2] gnu: move meson to (gnu packages meson) Vivien Kraus via Guix-patches via
                     ` (2 more replies)
  2023-01-07  3:15 ` [bug#60586] [PATCH v3 0/1] " Vivien Kraus via Guix-patches via
  2 siblings, 3 replies; 9+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-01-06 22:55 UTC (permalink / raw)
  To: 60586

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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#60586] [PATCH v2 0/2] Switch p11-kit-next to meson-build-system
  2023-01-06 22:55 ` [bug#60586] [PATCH v2 0/2] Switch p11-kit-next to meson-build-system Vivien Kraus via Guix-patches via
  2023-01-06 21:04   ` [bug#60586] [PATCH v2 1/2] gnu: move meson to (gnu packages meson) Vivien Kraus via Guix-patches via
  2023-01-06 22:48   ` [bug#60586] [PATCH v2 2/2] gnu: p11-kit-next: Switch to meson-build-system Vivien Kraus via Guix-patches via
@ 2023-01-06 23:05   ` Vivien Kraus via Guix-patches via
  2 siblings, 0 replies; 9+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-01-06 23:05 UTC (permalink / raw)
  To: 60586

Le vendredi 06 janvier 2023 à 23:55 +0100, Vivien Kraus a écrit :
> 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.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#60586] [PATCH v3 0/1] Switch p11-kit-next to meson-build-system.
  2023-01-05 23:32 [bug#60586] [PATCH 0/1] Fix p11-kit for mingw Vivien Kraus via Guix-patches via
  2023-01-05 22:08 ` [bug#60586] [PATCH 1/1] gnu: p11-kit: Fix mingw cross-compilation Vivien Kraus via Guix-patches via
  2023-01-06 22:55 ` [bug#60586] [PATCH v2 0/2] Switch p11-kit-next to meson-build-system Vivien Kraus via Guix-patches via
@ 2023-01-07  3:15 ` Vivien Kraus via Guix-patches via
  2023-01-06 22:48   ` [bug#60586] [PATCH v3 1/1] gnu: p11-kit-next: Switch " Vivien Kraus via Guix-patches via
  2 siblings, 1 reply; 9+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2023-01-07  3:15 UTC (permalink / raw)
  To: 60586

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#60586: [PATCH v3 1/1] gnu: p11-kit-next: Switch to meson-build-system.
  2023-01-06 22:48   ` [bug#60586] [PATCH v3 1/1] gnu: p11-kit-next: Switch " Vivien Kraus via Guix-patches via
@ 2023-02-17 15:49     ` Christopher Baines
  0 siblings, 0 replies; 9+ messages in thread
From: Christopher Baines @ 2023-02-17 15:49 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 60586-done, guix-patches

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]


Vivien Kraus via Guix-patches via <guix-patches@gnu.org> writes:

> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-02-17 15:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05 23:32 [bug#60586] [PATCH 0/1] Fix p11-kit for mingw Vivien Kraus via Guix-patches via
2023-01-05 22:08 ` [bug#60586] [PATCH 1/1] gnu: p11-kit: Fix mingw cross-compilation Vivien Kraus via Guix-patches via
2023-01-06 22:55 ` [bug#60586] [PATCH v2 0/2] Switch p11-kit-next to meson-build-system Vivien Kraus via Guix-patches via
2023-01-06 21:04   ` [bug#60586] [PATCH v2 1/2] gnu: move meson to (gnu packages meson) Vivien Kraus via Guix-patches via
2023-01-06 22:48   ` [bug#60586] [PATCH v2 2/2] gnu: p11-kit-next: Switch to meson-build-system Vivien Kraus via Guix-patches via
2023-01-06 23:05   ` [bug#60586] [PATCH v2 0/2] Switch p11-kit-next " Vivien Kraus via Guix-patches via
2023-01-07  3:15 ` [bug#60586] [PATCH v3 0/1] " Vivien Kraus via Guix-patches via
2023-01-06 22:48   ` [bug#60586] [PATCH v3 1/1] gnu: p11-kit-next: Switch " Vivien Kraus via Guix-patches via
2023-02-17 15:49     ` bug#60586: " Christopher Baines

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).