From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GOibLB4V6WIkbAEAbAwnHQ (envelope-from ) for ; Tue, 02 Aug 2022 14:14:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id SDi3LB4V6WJKUwAA9RJhRA (envelope-from ) for ; Tue, 02 Aug 2022 14:14:22 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 672BF112E2 for ; Tue, 2 Aug 2022 14:14:22 +0200 (CEST) Received: from localhost ([::1]:50012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIqmz-00022Z-Js for larch@yhetil.org; Tue, 02 Aug 2022 08:14:21 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659442462; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=uLzfTY26V+BkB6bV1no9PanrbiO3+t8XiKbzq4cSmJs=; b=Mswbtrce8D88+QheS7UDhsQ6ztp+xrk8y6jUkw0ehaLj3GUoCFBaOyq3SpmvN5rdODClKD TlXrLsywhThsbUgu+WjHIy018fEkTNGtd7A6Gw8SD68qaq3YoS+f5zyiaKA9/netmEDH0s +qRs2/lGNR3qu8eYC/WBm+p0046LTyuETYuZ027IFdRqV3oxBVZK0ElUwWmoR+pWuTN9xn NpmApkHQ7aR6/msEL6kCc+7KMrGtRENiF7mIWJJoDVL3LxfaZoVsrf5XfN24C5QDfGfdTc d8vTqjYjIVhpCA+Z0Du7Iio/wGGiCRYsmyiZ+nuPELgayCL2FxBw3Q3J6qH59g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659442462; a=rsa-sha256; cv=none; b=Yew7O1ei2jN9+m9rOog6s5ho8qr6jN03OK8ncf9WiODAaWBe36D+4nfiAUQI809gPPr5LT BARvTJc3sEobuNkPBaUESSfb5SRG0RvmACbYnbOqWgjRdSYgFF4SFHQCoscIJl+2Er1b7f julxSEhkN/nGqUB+rdsvJHsHr1CZfMa+ZDyo6eUKQaoINlkGpKSm0uW2fvfYt8Jx1t5vUr jYCWvylK9JG2X4TkNoeg3XCG4rBatXPrJrcA/uFzhOV2Tf9wsyQgMYTo0tuMgim+M2ZQT5 jEsO7EfCrAIxaM287vm0oNru5Ren5CnOGmhSPZhM24rJga1yIBipKIbg2Hl7kQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b=AtihJ1pY; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 6.98 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b=AtihJ1pY; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 672BF112E2 X-Spam-Score: 6.98 X-Migadu-Scanner: scn1.migadu.com X-TUID: ElBvBnzmrsTu "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) -- 2.37.0