From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8J+3F2KGJmG4mwAAgWs5BA (envelope-from ) for ; Wed, 25 Aug 2021 20:05: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 mp0 with LMTPS id iCdbE2KGJmExHQAA1q6Kng (envelope-from ) for ; Wed, 25 Aug 2021 18:05:22 +0000 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 AF985706A for ; Wed, 25 Aug 2021 20:05:21 +0200 (CEST) Received: from localhost ([::1]:59378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIxH6-00026w-ED for larch@yhetil.org; Wed, 25 Aug 2021 14:05:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIxG0-000861-Qj for guix-patches@gnu.org; Wed, 25 Aug 2021 14:04:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36179) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIxFw-0000t8-Cb for guix-patches@gnu.org; Wed, 25 Aug 2021 14:04:11 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mIxFw-0002oI-7g for guix-patches@gnu.org; Wed, 25 Aug 2021 14:04:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50201] [PATCH 11/52] build-system/glib-or-gtk: Support cross-compilaton. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 25 Aug 2021 18:04:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50201 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50201@debbugs.gnu.org Cc: Maxime Devos Received: via spool by 50201-submit@debbugs.gnu.org id=B50201.162991464010627 (code B ref 50201); Wed, 25 Aug 2021 18:04:08 +0000 Received: (at 50201) by debbugs.gnu.org; 25 Aug 2021 18:04:00 +0000 Received: from localhost ([127.0.0.1]:47691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIxFn-0002lF-Q7 for submit@debbugs.gnu.org; Wed, 25 Aug 2021 14:04:00 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:50752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIxFX-0002fv-4V for 50201@debbugs.gnu.org; Wed, 25 Aug 2021 14:03:45 -0400 Received: from localhost.localdomain ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by michel.telenet-ops.be with bizsmtp id lu3d2500J0mfAB406u3iTw; Wed, 25 Aug 2021 20:03:42 +0200 From: Maxime Devos Date: Wed, 25 Aug 2021 20:02:51 +0200 Message-Id: <20210825180332.5720-11-maximedevos@telenet.be> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210825180332.5720-1-maximedevos@telenet.be> References: <20210825180332.5720-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=r21; t=1629914622; bh=+t9HQzRRTiVRVkIgQOQ1sz7vCx1LXB/2p6pzE0Yz2gY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Walr6b7L5J2RZqIZUQI6B7DAFBsvslaP/s5y2yQs15ezy11Zu3gkDQQAneA/LnO3z SlATlBbhmSa4HyUDB+qE0zlPfxYmrIsRsTOyH+C6N56S0LdgnKT5rNJDlrCoHXiTZT j5Yf5BwyGj5RGTzekXSH85fMNYKw+IhvLvMy+pCXv6+93NSEDcGbxXkBJp15Fa8anc woGnpziOtYDydkgrZ8ZtObZ9SK0gL/qim6D1cCmay/0nH81aPjG2oNHHso+8BvwrxD JG828EZiX/vfJm06Ug2peZn9SE0b7/JKgKHl0gb4rSfeM7XGaClYMaRK0qTQuOIClt c/Hc//Butqhhw== 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1629914721; 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=+t9HQzRRTiVRVkIgQOQ1sz7vCx1LXB/2p6pzE0Yz2gY=; b=l6UTDr9NOu2ZYD+eMjOS2d96ATv9GvwQiyJnnyIOsyc6Nh/lZJ+bhjybw2dhYrXGYUFS1v fhdlm45R9ZFAQnccHy8rfjE/KqTiCvOBmXqLU58f9/DlxQsKhGqiIliORmiFbWCdnJfISA cFNeU4rBiAbgD0l3kJKUFkOkP8imNQO4+pw4f7dnfl6+XTFoNA5nL/z8DfteNQChFqXAUp JSK9bfcoBIfHccIqR3AZfbtPt11tyoBB1Ye/ZFiGhPTfNhPYUfGzipqdmC+5SZ9JJWuAGl QlEpj5lWLGoclNBn1epwzOWtt6OCkHGVWvjLqB21VZ33xzy27n74Z8vJETsihw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629914721; a=rsa-sha256; cv=none; b=IZ3O4uYEccDTzDQmD/0IAmF5F/HvEVcIIn8hBm2ncKFUNzFc+SCW4noh0VOGF/EpRAKviy Z2j5owr5WsMuICnsY/X2rckW4XbiOaEtiP8qGnaH6HYUeBpvAScHG8bgJ/2XF9btaDugDb /tuGKumzWdR0h5JE9pMxpsXCbfTXKVRJ9MWTiSpFUeU/tlmhIVtaJLyBH/tGrpX2hI49Kh lOkkUaKSxKFITu0wqAS8QiX3ZYyhR2d9hA58DX4GB7RqEzYpbPA4n39r7mSylkbBm8TYZC 5nW12GbrGxetpbm3Dxt6EarEa4SxtbfLHnkfJ8+Dx0PdmsdP4JOgOxYXpilIDg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=Walr6b7L; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=Walr6b7L; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: AF985706A X-Spam-Score: -0.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: yHx1gJHTD8zr * guix/build-system/glib-or-gtk.scm (lower): Add 'implicit-cross-inputs?' argument. Generate a bag when cross-compiling. (glib-or-gtk-cross-build): New procedure. --- guix/build-system/glib-or-gtk.scm | 146 ++++++++++++++++++++++++++---- 1 file changed, 127 insertions(+), 19 deletions(-) diff --git a/guix/build-system/glib-or-gtk.scm b/guix/build-system/glib-or-gtk.scm index 2df49a2495..ec491ff0bd 100644 --- a/guix/build-system/glib-or-gtk.scm +++ b/guix/build-system/glib-or-gtk.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2013, 2014, 2015, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2013 Cyril Roelandt ;;; Copyright © 2014 Federico Beffa +;;; Copyright © 2021 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -31,6 +32,7 @@ #:use-module (ice-9 match) #:export (%glib-or-gtk-build-system-modules glib-or-gtk-build + glib-or-gtk-cross-build glib-or-gtk-build-system)) ;; Commentary: @@ -82,30 +84,42 @@ #:key source inputs native-inputs outputs system target (glib (default-glib)) (implicit-inputs? #t) + (implicit-cross-inputs? #t) (strip-binaries? #t) #:allow-other-keys #:rest arguments) "Return a bag for NAME." (define private-keywords - '(#:target #:glib #:inputs #:native-inputs - #:outputs #:implicit-inputs?)) - - (and (not target) ;XXX: no cross-compilation - (bag - (name name) - (system system) - (host-inputs (if source - `(("source" ,source)) - '())) - (build-inputs `(,@native-inputs - ,@inputs - ("glib:bin" ,glib "bin") ; to compile schemas - ,@(if implicit-inputs? - (standard-packages) - '()))) - (outputs outputs) - (build glib-or-gtk-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + `(#:glib #:inputs #:native-inputs + #:outputs #:implicit-inputs? #:implicit-cross-inputs? + ,@(if target '() '(#:target)))) + + (bag + (name name) + (system system) (target target) + (host-inputs `(,@(if source + `(("source" ,source)) + '()) + ,@(if target + inputs + '()))) + (build-inputs `(,@native-inputs + ,@(if target '() inputs) + ("glib:bin" ,glib "bin") ; to compile schemas + ;; Keep standard inputs of gnu-build-system. + ,@(if (and target implicit-cross-inputs?) + (standard-cross-packages target 'host) + '()) + ,@(if implicit-inputs? + (standard-packages) + '()))) + ;; Keep standard inputs of 'gnu-build-system'. + (target-inputs (if (and target implicit-cross-inputs?) + (standard-cross-packages target 'target) + '())) + (outputs outputs) + (build (if target glib-or-gtk-cross-build glib-or-gtk-build)) + (arguments (strip-keyword-arguments private-keywords arguments)))) (define* (glib-or-gtk-build name inputs #:key guile source @@ -176,6 +190,100 @@ #:disallowed-references disallowed-references #:guile-for-build guile))) +(define* (glib-or-gtk-cross-build name + #:key + target + build-inputs target-inputs host-inputs + guile source + (outputs '("out")) + (search-paths '()) + (native-search-paths '()) + (configure-flags ''()) + ;; Disable icon theme cache generation. + (make-flags ''("gtk_update_icon_cache=true")) + (out-of-source? #f) + (tests? #f) + (test-target "check") + (parallel-build? #t) + (parallel-tests? #t) + (validate-runpath? #t) + (make-dynamic-linker-cache? #f) + (patch-shebangs? #t) + (strip-binaries? #t) + (strip-flags ''("--strip-debug")) + (strip-directories ''("lib" "lib64" "libexec" + "bin" "sbin")) + (phases '(@ (guix build glib-or-gtk-build-system) + %standard-phases)) + (glib-or-gtk-wrap-excluded-outputs ''()) + (system (%current-system)) + (build (nix-system->gnu-triplet system)) + (imported-modules %glib-or-gtk-build-system-modules) + (modules %default-modules) + allowed-references + disallowed-references) + "Cross-build SOURCE with INPUTS. See GNU-BUILD for more details." + (define builder + #~(begin + (use-modules #$@(sexp->gexp modules)) + + (define %build-host-inputs + #+(input-tuples->gexp build-inputs)) + + (define %build-target-inputs + (append #$(input-tuples->gexp host-inputs) + #+(input-tuples->gexp target-inputs))) + + (define %build-inputs + (append %build-host-inputs %build-target-inputs)) + + (define %outputs + #$(outputs->gexp outputs)) + + (glib-or-gtk-build #:source #+source + #:system #$system + #:build #$build + #:target #$target + #:outputs %outputs + #:inputs %build-target-inputs + #:native-inputs %build-host-inputs + #:search-paths '#$(sexp->gexp + (map search-path-specification->sexp + search-paths)) + #:native-search-paths '#$(sexp->gexp + (map search-path-specification->sexp + native-search-paths)) + #:phases #$(if (pair? phases) + (sexp->gexp phases) + phases) + #:glib-or-gtk-wrap-excluded-outputs + #$glib-or-gtk-wrap-excluded-outputs + #:configure-flags #$configure-flags + #:make-flags #$make-flags + #:out-of-source? #$out-of-source? + #:tests? #$tests? + #:test-target #$test-target + #:parallel-build? #$parallel-build? + #:parallel-tests? #$parallel-tests? + #:validate-runpath? #$validate-runpath? + #:make-dynamic-linker-cache? #$make-dynamic-linker-cache? + #:patch-shebangs? #$patch-shebangs? + #:strip-binaries? #$strip-binaries? + #:strip-flags #$(sexp->gexp strip-flags) + #:strip-directories + #$(sexp->gexp strip-directories)))) + + + (mlet %store-monad ((guile (package->derivation (or guile (default-guile)) + system #:graft? #f))) + (gexp->derivation name builder + #:system system + #:target target + #:modules imported-modules + #:allowed-references allowed-references + #:disallowed-references disallowed-references + #:guile-for-build guile))) + (define glib-or-gtk-build-system (build-system (name 'glib-or-gtk) -- 2.33.0