From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GFi0F4Ek32JMGgAAbAwnHQ (envelope-from ) for ; Tue, 26 Jul 2022 01:17:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id ODrGF4Ek32K5LAEAauVa8A (envelope-from ) for ; Tue, 26 Jul 2022 01:17:21 +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 18FFA3921C for ; Tue, 26 Jul 2022 01:17:20 +0200 (CEST) Received: from localhost ([::1]:40362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oG7KB-0002kb-Q2 for larch@yhetil.org; Mon, 25 Jul 2022 19:17:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oG7Ju-0002kI-2F for guix-patches@gnu.org; Mon, 25 Jul 2022 19:17:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33774) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oG7Jt-0006pT-PD for guix-patches@gnu.org; Mon, 25 Jul 2022 19:17:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oG7Jt-0000Wj-KQ for guix-patches@gnu.org; Mon, 25 Jul 2022 19:17:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56771] [PATCH 28/33] build: qt: Add qtbase argument and wrap Qt environment variables exactly. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 25 Jul 2022 23:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56771 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56771@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 56771-submit@debbugs.gnu.org id=B56771.16587909921952 (code B ref 56771); Mon, 25 Jul 2022 23:17:01 +0000 Received: (at 56771) by debbugs.gnu.org; 25 Jul 2022 23:16:32 +0000 Received: from localhost ([127.0.0.1]:51753 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oG7JQ-0000VP-3L for submit@debbugs.gnu.org; Mon, 25 Jul 2022 19:16:32 -0400 Received: from mail-qv1-f52.google.com ([209.85.219.52]:42626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oG7JM-0000V8-Ip for 56771@debbugs.gnu.org; Mon, 25 Jul 2022 19:16:31 -0400 Received: by mail-qv1-f52.google.com with SMTP id mn11so5134365qvb.9 for <56771@debbugs.gnu.org>; Mon, 25 Jul 2022 16:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kO67ksnSma6PKy3f1j5SJrmf4cbGKJuRk++O3iLJ1uI=; b=NAcnz51kX0JkVhhwIULHCa3L3kkYLxdik8xEPAmkkQKqQQO6TJnf2kMZJYlmpFrUsP IBosyiKFsAdBWlQAT2gQT8blYPWvWgTfeTiG6UT/+6c+WUKuhbG/LJeu4Ja192ad6WRc CCiivBEkVWDzTgUQPmqAjUcojOWM2bn8VWCLl3RDtyfYlpLXXMBZCbSaNWNw0v52Pi4h U8rPPfOZB7H2zMMl9Yh4UHc6u5nsa1mC9J6eNVhMYgI42ycQX4UArf5UjaTnJAG9bwET CDRTpY4oQSex5XTNr4YsP0qP8VYuvSUmH3nqk/1yBQ6+jM73CJRAh1ieKhJrKxMJckyY 1dPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kO67ksnSma6PKy3f1j5SJrmf4cbGKJuRk++O3iLJ1uI=; b=euru2NRce/KRWze54Ai+J4w9Uvs8JPFg+mlreTIuDjehrzfDQQ7n6xaMlmY7UwdP/g PmImjSBYOJqIB182OOLTtu2bOrE+z16s9uV7HUH1MluP/+UkeDSYgbpBFSiE+Xo+LkoJ qtmqQp1rAuAbNPIjcpWhDM/tL2N8bXonSeSrd1+tqcyo9QGJ+jI8ekcbv7LmNPpU3kBN on8KpYm7UzGTGGCamkvDCGPqM9Gu/En5Ui9Q6o3fpU3mvkbuqHbuD7gF6/mcAx9e+Knu 53hExEzDMjLmsaG/339xm67ufkM9HQQiSX6NLqKjWQ/oBnIEGQU0Q+cM4yRr2wg2e95w oj3Q== X-Gm-Message-State: AJIora+xLTbi/cQK2e4Z+T7BbY6Z7GUdfyVRXLTYHs7ngvGWIqFlgfXz aHPTxyiA1Mbae/r5QMo2HrUIkDIdNt0= X-Google-Smtp-Source: AGRyM1vB/YpoX65S+77Jjkihv2qDOsesE3D4ktwf4lCf0KY1EIjfIVRASOqWSDkUUGuBUBLzCoMz2A== X-Received: by 2002:a0c:e0cf:0:b0:473:8509:57bb with SMTP id x15-20020a0ce0cf000000b00473850957bbmr12371020qvk.10.1658790515972; Mon, 25 Jul 2022 16:08:35 -0700 (PDT) Received: from localhost.localdomain (dsl-205-233-125-69.b2b2c.ca. [205.233.125.69]) by smtp.gmail.com with ESMTPSA id c15-20020ac8008f000000b0031ee9afafccsm8110580qtg.14.2022.07.25.16.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 16:08:35 -0700 (PDT) From: Maxim Cournoyer Date: Mon, 25 Jul 2022 19:07:58 -0400 Message-Id: <20220725230803.10002-28-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220725230803.10002-1-maxim.cournoyer@gmail.com> References: <20220725230803.10002-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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=1658791041; 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=kO67ksnSma6PKy3f1j5SJrmf4cbGKJuRk++O3iLJ1uI=; b=VlvFzVqOhLB+FiUQfKxiAUtqBIu2wBWFhktu3rTn6E03TXZmtlbGCDjYVU/M6rLvucOgba 7bZxBPNmO4uFqDV6Pr5EWN93XwYsXlGmia2FssojgabLUqsUVospGfnyBxcuXSKT5SwuOZ 2Yf6cg/Wt72fXr4oDIuLAzumMryHDoRx23oCpgZH4kZylQ2FPBeUcFn9Uw8NU0JdrLR2Jp S1Naha6ipm9RJGlWcbAnWC7bsLWl8PISBP4edbD3bOfNsHTtayF2FlQHSJwMCB6Y1kCKqr 7N4T060ISyJp6QANzqlFca2MCtVMet0EshgYZnJxhXRbd6BKnfDfew4mxVCCUg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658791041; a=rsa-sha256; cv=none; b=e3wV0CXTYmVQxk7oMovyd3iYdUVjBZo8z8W1qXrNR2CP1t7RMgoigni3ISVMnZ51kCLC8C 3wbXM1ib5fukCJC+RCbSXcjwIMQ1MLKze+yxHo+ORFAO4eqUrNfheiFptf9VBz8babuAbQ 9rVJ83b2bgSuwQdDr4O9/bZ5o+qDcasyX2CfbgBVWJ5Tj6D9w2aPk3gaJUhfsA0HLgoFbU c2Fuv/w+39sUUE7wN/53Sb30mqaW3p+Rv1tTEP0lJ0KmJMo736kczsiTayg2b+Mgq2wp87 0L6fPaeo7qK1R/p3ZMgZXuPO6xz7176+y2DEiG5ebIaTuvt5DC/fsgFHA2jZ7w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=NAcnz51k; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (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: 4.17 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=NAcnz51k; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (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: 18FFA3921C X-Spam-Score: 4.17 X-Migadu-Scanner: scn0.migadu.com X-TUID: SP9R2ub6+djR * guix/build-system/qt.scm (default-qtbase): New variable. (lower) <#:qtbase>: Add argument... [build-inputs]: ... and propagate it here. (qt-build): Add qtbase argument. (qt-cross-build): Likewise. * guix/build/qt-utils.scm (%default-qt-major-version): New variable. (variables-for-wrapping): Add qt-major-version argument, and use it to format the various path prefixes. Wrap QT environment variables exactly. (wrap-qt-program*): Add qt-major-version argument, and pass it to variables-for-wrapping. (wrap-qt-program): Add qt-major-version argument, and pass it to wrap-qt-program*. (wrap-all-qt-programs): Add qtbase argument, and extract the major version from it, passing it to wrap-qt-program*. --- guix/build-system/qt.scm | 14 +++++++++++++ guix/build/qt-utils.scm | 44 ++++++++++++++++++++++++++++------------ 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/guix/build-system/qt.scm b/guix/build-system/qt.scm index a0b968cef3..bd47ade3fc 100644 --- a/guix/build-system/qt.scm +++ b/guix/build-system/qt.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2017 Ricardo Wurmus ;;; Copyright © 2019 Hartmut Goebel ;;; Copyright © 2020 Jakub Kądziołka +;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -67,11 +68,19 @@ (define (default-cmake) (let ((module (resolve-interface '(gnu packages cmake)))) (module-ref module 'cmake-minimal))) +(define (default-qtbase) + "Return the default qtbase package." + + ;; Do not use `@' to avoid introducing circular dependencies. + (let ((module (resolve-interface '(gnu packages qt)))) + (module-ref module 'qtbase-5))) + ;; This barely is a copy from (guix build-system cmake), only adjusted to use ;; the variables defined here. (define* (lower name #:key source inputs native-inputs outputs system target (cmake (default-cmake)) + (qtbase (default-qtbase)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." @@ -87,6 +96,7 @@ (define private-keywords `(("source" ,source)) '()) ,@`(("cmake" ,cmake)) + ,@`(("qtbase" ,qtbase)) ,@native-inputs ,@(if target ;; Use the standard cross inputs of @@ -112,6 +122,7 @@ (define private-keywords (define* (qt-build name inputs #:key + qtbase source (guile #f) (outputs '("out")) (configure-flags ''()) (search-paths '()) @@ -150,6 +161,7 @@ (define builder #:phases #$(if (pair? phases) (sexp->gexp phases) phases) + #:qtbase #$qtbase #:qt-wrap-excluded-outputs #$qt-wrap-excluded-outputs #:qt-wrap-excluded-inputs #$qt-wrap-excluded-inputs #:configure-flags #$configure-flags @@ -181,6 +193,7 @@ (define* (qt-cross-build name #:key source target build-inputs target-inputs host-inputs + qtbase (guile #f) (outputs '("out")) (configure-flags ''()) @@ -237,6 +250,7 @@ (define %outputs search-path-specification->sexp native-search-paths) #:phases #$phases + #:qtbase #$qtbase #:configure-flags #$configure-flags #:make-flags #$make-flags #:out-of-source? #$out-of-source? diff --git a/guix/build/qt-utils.scm b/guix/build/qt-utils.scm index fa018a93ac..180b3aad77 100644 --- a/guix/build/qt-utils.scm +++ b/guix/build/qt-utils.scm @@ -3,7 +3,7 @@ ;;; Copyright © 2019, 2020, 2021 Hartmut Goebel ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2021 Ludovic Courtès -;;; Copyright © 2021 Maxim Cournoyer +;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2021 Brendan Tildesley ;;; ;;; This file is part of GNU Guix. @@ -26,10 +26,13 @@ (define-module (guix build qt-utils) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) + #:use-module (srfi srfi-71) #:export (wrap-qt-program wrap-all-qt-programs %qt-wrap-excluded-inputs)) +(define %default-qt-major-version "5") + (define %qt-wrap-excluded-inputs '(list "cmake" "extra-cmake-modules" "qttools")) @@ -37,7 +40,9 @@ (define %qt-wrap-excluded-inputs ;; facilities for per-application data directories, such as ;; /share/quassel. Thus, we include the output directory even if it doesn't ;; contain any of the standard subdirectories. -(define (variables-for-wrapping base-directories output-directory) +(define* (variables-for-wrapping base-directories output-directory + #:key + (qt-major-version %default-qt-major-version)) (define (collect-sub-dirs base-directories file-type subdirectory selectors) ;; Append SUBDIRECTORY and each of BASE-DIRECTORIES, and return the subset @@ -82,17 +87,20 @@ (define exists? (match file-type "/applications" "/cursors" "/fonts" "/icons" "/glib-2.0/schemas" "/mime" "/sounds" "/themes" "/wallpapers") '("XDG_CONFIG_DIRS" suffix directory "/etc/xdg") - ;; The following variables can be extended by the user, but not - ;; overridden, to ensure proper operation. - '("QT_PLUGIN_PATH" prefix directory "/lib/qt5/plugins") - '("QML2_IMPORT_PATH" prefix directory "/lib/qt5/qml") + ;; We wrap exactly to avoid potentially mixing Qt5/Qt6 components, which + ;; would cause warnings, perhaps problems. + `("QT_PLUGIN_PATH" = directory + ,(format #f "/lib/qt~a/plugins" qt-major-version)) + `("QML2_IMPORT_PATH" = directory + ,(format #f "/lib/qt~a/qml" qt-major-version)) ;; QTWEBENGINEPROCESS_PATH accepts a single value, which makes 'exact the ;; most suitable environment variable type for it. - '("QTWEBENGINEPROCESS_PATH" = regular - "/lib/qt5/libexec/QtWebEngineProcess")))) + `("QTWEBENGINEPROCESS_PATH" = regular + ,(format #f "/lib/qt~a/libexec/QtWebEngineProcess" qt-major-version))))) (define* (wrap-qt-program* program #:key inputs output-dir - qt-wrap-excluded-inputs) + qt-wrap-excluded-inputs + (qt-major-version %default-qt-major-version)) (define input-directories (filter-map @@ -104,12 +112,14 @@ (define input-directories (let ((vars-to-wrap (variables-for-wrapping (cons output-dir input-directories) - output-dir))) + output-dir + #:qt-major-version qt-major-version))) (when (not (null? vars-to-wrap)) (apply wrap-program program vars-to-wrap)))) (define* (wrap-qt-program program-name #:key inputs output - (qt-wrap-excluded-inputs %qt-wrap-excluded-inputs)) + (qt-wrap-excluded-inputs %qt-wrap-excluded-inputs) + (qt-major-version %default-qt-major-version)) "Wrap the specified program (which must reside in the OUTPUT's \"/bin\" directory) with suitably set environment variables. @@ -117,9 +127,11 @@ (define* (wrap-qt-program program-name #:key inputs output is wrapped." (wrap-qt-program* (string-append output "/bin/" program-name) #:output-dir output #:inputs inputs - #:qt-wrap-excluded-inputs qt-wrap-excluded-inputs)) + #:qt-wrap-excluded-inputs qt-wrap-excluded-inputs + #:qt-major-version qt-major-version)) (define* (wrap-all-qt-programs #:key inputs outputs + qtbase (qt-wrap-excluded-outputs '()) (qt-wrap-excluded-inputs %qt-wrap-excluded-inputs) #:allow-other-keys) @@ -131,6 +143,11 @@ (define* (wrap-all-qt-programs #:key inputs outputs QT-WRAP-EXCLUDED-OUTPUTS. This is useful when an output is known not to contain any Qt binaries, and where wrapping would gratuitously add a dependency of that output on Qt." + (define qt-major-version + (let ((_ version (package-name->name+version + (strip-store-file-name qtbase)))) + (first (string-split version #\.)))) + (define (find-files-to-wrap output-dir) (append-map (lambda (dir) @@ -149,7 +166,8 @@ (define handle-output (unless (member output qt-wrap-excluded-outputs) (for-each (cut wrap-qt-program* <> #:output-dir output-dir #:inputs inputs - #:qt-wrap-excluded-inputs qt-wrap-excluded-inputs) + #:qt-wrap-excluded-inputs qt-wrap-excluded-inputs + #:qt-major-version qt-major-version) (find-files-to-wrap output-dir)))))) (for-each handle-output outputs)) -- 2.36.1