From patchwork Tue Aug 2 12:13:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: M X-Patchwork-Id: 41093 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 736FB27BBEA; Tue, 2 Aug 2022 13:14:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CE7D627BBE9 for ; Tue, 2 Aug 2022 13:14:24 +0100 (BST) Received: from localhost ([::1]:50012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIqn2-00022Z-0J for patchwork@mira.cbaines.net; Tue, 02 Aug 2022 08:14:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIqmh-0001YM-TB for guix-patches@gnu.org; Tue, 02 Aug 2022 08:14:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53006) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oIqmh-0000AP-K3 for guix-patches@gnu.org; Tue, 02 Aug 2022 08:14:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oIqmg-0008JD-FS for guix-patches@gnu.org; Tue, 02 Aug 2022 08:14:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56882] [PATCH 4/4] xdg-utils: Support cross-compilation. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 02 Aug 2022 12:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56882 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56882@debbugs.gnu.org Cc: Maxime Devos Received: via spool by 56882-submit@debbugs.gnu.org id=B56882.165944241931873 (code B ref 56882); Tue, 02 Aug 2022 12:14:02 +0000 Received: (at 56882) by debbugs.gnu.org; 2 Aug 2022 12:13:39 +0000 Received: from localhost ([127.0.0.1]:42750 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIqmJ-0008Hv-8e for submit@debbugs.gnu.org; Tue, 02 Aug 2022 08:13:39 -0400 Received: from andre.telenet-ops.be ([195.130.132.53]:54778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oIqmC-0008HL-Ul for 56882@debbugs.gnu.org; Tue, 02 Aug 2022 08:13:38 -0400 Received: from localhost.localdomain ([IPv6:2a02:1811:8c09:9d00:5dba:d409:33f7:a16]) by andre.telenet-ops.be with bizsmtp id 2cDX2800520ykKC01cDXHh; Tue, 02 Aug 2022 14:13:32 +0200 From: Maxime Devos Date: Tue, 2 Aug 2022 14:13:29 +0200 Message-Id: <20220802121329.22276-4-maximedevos@telenet.be> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220802121329.22276-1-maximedevos@telenet.be> References: <20220802121329.22276-1-maximedevos@telenet.be> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1659442412; bh=uLzfTY26V+BkB6bV1no9PanrbiO3+t8XiKbzq4cSmJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AtihJ1pYuQhiANyLK8gylzA4Y6tx0DgEurBFjsDJf5707ciIZHQqo5FCaN7nY662q WFfdKBIi4jdLmkTjhDJ/tLmMkugyM3G4MU6B2hKqPQp0xF7MJbhYS0vP9c4RRI+9/B 1onQnFcBUCuddchLw3T5J4V6GtzLt7s8ozzaOhlEdxsK4roJmDDAX/YfZUZHR02Y0f f/EAR5F0h7JhGrBrKhWFjdhPAzjLSUABV8hJIBV3u4g+H6dsWOFmymgQyhoGBe0Aht V3+AUY/85GxS9NcxyN+5c5FQJ5f7sBpmZ2rLCb594RGog3VdarNiiBW97ukI9dawQB HHuq/6mQlO2QQ== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches "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 ;;; Copyright © 2021 Sarah Morgensen ;;; Copyright © 2021 Robby Zambito -;;; Copyright © 2021 Maxime Devos +;;; Copyright © 2021, 2022 Maxime Devos ;;; Copyright © 2021 John Kehayias ;;; Copyright © 2021, 2021 Maxim Cournoyer ;;; Copyright © 2022 Daniel Meißner @@ -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 . + ,@(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)