unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: 56882@debbugs.gnu.org
Cc: Maxime Devos <maximedevos@telenet.be>
Subject: [bug#56882] [PATCH 4/4] xdg-utils: Support cross-compilation.
Date: Tue,  2 Aug 2022 14:13:29 +0200	[thread overview]
Message-ID: <20220802121329.22276-4-maximedevos@telenet.be> (raw)
In-Reply-To: <20220802121329.22276-1-maximedevos@telenet.be>

"guix style" does not support with-directory-excursion yet, leading to too
much spacing, so I have ignored its results.

It has been verified that this does not cause rebuilds when compiling
natively.  The references graph when cross-compiling has also been verified --
glibc-2.33 and the native bash-static-5.1.8 still remains in the graph, but
via the cross-compiled inetutils-2.0, ncurses-6.2.20210619 and via
gcc-cross-TARGET-10.3.0-lib, which is not related with Perl cross-compilation.

* gnu/packages/freedesktop.scm
(xdg-utils)[inputs]{bash-minimal,file}: New inputs when cross-compiling.
(xdg-utils)[arguments]<#:phases>{locate-catalog-files}: Add 'native-inputs'
argument when cross-compiling. Look for docbook-xml and docbook-xsl in
native-inputs when cross-compiling.  While we are at it, eliminate input
labels with search-input-file.
(xdg-utils)[arguments]<#:phases>{patch-hardcoded-patch}: Use
search-input-file + inputs instead of 'which' when cross-compiling.
---
 gnu/packages/freedesktop.scm | 58 ++++++++++++++++++++++++++++--------
 1 file changed, 45 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 2d12567a42..1c984ebca8 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -25,7 +25,7 @@
 ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
 ;;; Copyright © 2021 Robby Zambito <contact@robbyzambito.me>
-;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
 ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
 ;;; Copyright © 2021, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de>
@@ -76,6 +76,7 @@ (define-module (gnu packages freedesktop)
   #:use-module (gnu packages disk)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages file)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages gettext)
@@ -414,7 +415,15 @@ (define-public xdg-utils
      (list docbook-xsl docbook-xml-4.1.2 libxslt w3m xmlto))
     (inputs
      `(("awk" ,gawk)
+       ;; TODO(staging): Make this unconditional, to avoid canonical packages,
+       ;; see <https://lists.gnu.org/archive/html/guix-devel/2020-02/msg00148.html>.
+       ,@(if (%current-target-system)
+             `(("bash-minimal" ,bash-minimal)) ; for 'wrap-program'
+             '())
        ("coreutils" ,coreutils)
+       ,@(if (%current-target-system)
+             `(("file" ,file))
+             '())
        ("grep" ,grep)
        ("inetutils" ,inetutils) ; xdg-screensaver uses `hostname'
        ("perl-file-mimeinfo" ,perl-file-mimeinfo) ; for mimeopen fallback
@@ -428,19 +437,41 @@ (define-public xdg-utils
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch-hardcoded-paths
-           (lambda _
-             (substitute* "scripts/xdg-mime.in"
-               (("/usr/bin/file") (which "file")))
-             (substitute* "scripts/xdg-open.in"
-               (("/usr/bin/printf") (which "printf")))
-             #t))
+           ;; TODO(staging): make unconditional
+           (,@(if (%current-target-system)
+                 '(lambda* (#:key inputs #:allow-other-keys))
+                 '(lambda _))
+            (substitute* "scripts/xdg-mime.in"
+              (("/usr/bin/file")
+               (,@(if (%current-target-system)
+                      '(search-input-file inputs "bin/file")
+                      '(which "file")))))
+            (substitute* "scripts/xdg-open.in"
+              (("/usr/bin/printf")
+               (,@(if (%current-target-system)
+                      '(search-input-file inputs "bin/printf")
+                      '(which "printf")))))
+            #t))
          (add-before 'build 'locate-catalog-files
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((xmldoc (string-append (assoc-ref inputs "docbook-xml")
-                                          "/xml/dtd/docbook"))
-                   (xsldoc (string-append (assoc-ref inputs "docbook-xsl")
-                                          "/xml/xsl/docbook-xsl-"
-                                          ,(package-version docbook-xsl))))
+           ;; TODO(staging): Make unconditional for simplicity.
+           (lambda* (#:key inputs ,@(if (%current-target-system)
+                                        '(native-inputs)
+                                        '()) #:allow-other-keys)
+             ;; TODO(staging): Make unconditional for simplicity and
+             ;; to avoid dependning on input labels.
+             (let ,(if (%current-target-system)
+                       `((native-inputs (or native-inputs inputs))
+                         (xmldoc (search-input-directory native-inputs
+                                                         "xml/dtd/docbook"))
+                         (xsldoc (search-input-directory
+                                  native-inputs
+                                  (string-append "xml/xsl/docbook-xsl-"
+                                                 ,(package-version docbook-xsl)))))
+                       `((xmldoc (string-append (assoc-ref inputs "docbook-xml")
+                                                "/xml/dtd/docbook"))
+                         (xsldoc (string-append (assoc-ref inputs "docbook-xsl")
+                                                "/xml/xsl/docbook-xsl-"
+                                                ,(package-version docbook-xsl)))))
                (for-each (lambda (file)
                            (substitute* file
                              (("http://.*/docbookx\\.dtd")
@@ -456,6 +487,7 @@ (define-public xdg-utils
                                  "/manpages/docbook.xsl man")))
                (setenv "STYLESHEET"
                        (string-append xsldoc "/html/docbook.xsl"))
+               ;; TODO(staging): Might as well remove the #t while we are at it.
                #t)))
          (add-after 'install 'wrap-executables
            (lambda* (#:key inputs outputs #:allow-other-keys)
-- 
2.37.0





  parent reply	other threads:[~2022-08-02 12:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02 11:54 [bug#56882] [PATCH 0/4] build-system/perl: Support some cross-compilation, and test with xdg-utils Maxime Devos
2022-08-02 12:13 ` [bug#56882] [PATCH 1/4] build-system/perl: Support cross-compilation of some Perl packages Maxime Devos
2022-08-02 12:13   ` [bug#56882] [PATCH 2/4] gnu: freedesktop: Add 'bash' input for 'wrap-program' Maxime Devos
2022-08-02 12:13   ` [bug#56882] [PATCH 3/4] perl-file-mimeinfo: Fix cross-compilation Maxime Devos
2022-08-02 12:13   ` Maxime Devos [this message]
2022-08-06 16:25 ` bug#56882: [PATCH 0/4] build-system/perl: Support some cross-compilation, and test with xdg-utils Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220802121329.22276-4-maximedevos@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=56882@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).