From patchwork Mon Sep 9 16:12:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: aurtzy X-Patchwork-Id: 67821 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 9BF6A27BBEA; Mon, 9 Sep 2024 17:17:15 +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=-6.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 B5EA827BBE2 for ; Mon, 9 Sep 2024 17:17:14 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1snh4Z-0008JP-Md; Mon, 09 Sep 2024 12:17:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1snh4X-0008Iw-Ir for guix-patches@gnu.org; Mon, 09 Sep 2024 12:17:01 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1snh4X-00073X-9o for guix-patches@gnu.org; Mon, 09 Sep 2024 12:17:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=NLzcZcZoHHfeHAcb+ArYV62Yf3ea2aOiVj67cmQ8lEE=; b=ixhY17IktKpixW3xjd1O8ZR46rzRlppY5S4i7g3INA1Qe2VUgMV8AUkcDockEC1wGlPcTdByXwvAh/MD8odyobSKJ8/ado8FbWEsTM1J2cNzJ/qLDwqPS7B/Rft+wvEkoMqTEUEQ8y3UKua0bqI/6+h5a6TP+2Fb3aE/iP9+gjzni+1Jy7mdMZo8PsU1oodYQVnImLtrq7zauwDlaa1D3MudUec2Stlomwvil+Q6qyMZfT9lbg9+mVY80Cik1pEHcLcTsdIg8VYUHLAKggeNqWYfO5GvfDeWadwqPbR2o9AYouuwI5wskF7tEJv9J5o8MMomYVlFsR2LHC5MrVp3og==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1snh4X-0006rp-LI; Mon, 09 Sep 2024 12:17:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73071] [PATCH mesa-updates] gnu: mesa: Enable NVK driver for x86_64 architecture. References: In-Reply-To: Resent-From: aurtzy Original-Sender: "Debbugs-submit" Resent-CC: john.kehayias@protonmail.com, efraim@flashner.co.il, guix-patches@gnu.org Resent-Date: Mon, 09 Sep 2024 16:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73071 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73071@debbugs.gnu.org Cc: aurtzy , John Kehayias , Efraim Flashner X-Debbugs-Original-Xcc: John Kehayias , Efraim Flashner Received: via spool by 73071-submit@debbugs.gnu.org id=B73071.172589861226378 (code B ref 73071); Mon, 09 Sep 2024 16:17:01 +0000 Received: (at 73071) by debbugs.gnu.org; 9 Sep 2024 16:16:52 +0000 Received: from localhost ([127.0.0.1]:33925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snh4N-0006rO-Vt for submit@debbugs.gnu.org; Mon, 09 Sep 2024 12:16:52 -0400 Received: from mail-io1-f47.google.com ([209.85.166.47]:61830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snh4L-0006rA-Hc for 73071@debbugs.gnu.org; Mon, 09 Sep 2024 12:16:50 -0400 Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-82cd93a6617so67947039f.3 for <73071@debbugs.gnu.org>; Mon, 09 Sep 2024 09:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725898539; x=1726503339; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NLzcZcZoHHfeHAcb+ArYV62Yf3ea2aOiVj67cmQ8lEE=; b=ipZr8SS/+juOamt2Oce4spt4yhfegpzTX56AD99mcsfw838AbPvcM6O0Fk6Fswnz3Y B5qH13B+nwqKWNBmxcV3C4hYAh9ELEiTBaiMYfGetNxb49lHN0D3vU6OzjcFZSRQxAKW vFbEEvQx/h6qPLy6gBSyz7+ldzFptkAwnpLm/lx9RDzFb3Nx0tYxDNIbMi5g06z6Fem3 Pbe6QrR1eNTULVaLL4kjke9qeXDPgkjp2Q4It0YE0488HFoalFiuxXsTqfS6Mbza+pPq 1KsUdcQKT0efX0uK7UgFprNLbV9fV+/9d3VbU/RG71WT3ei4EIy5ZzYJzP9966tWUa07 wBVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725898539; x=1726503339; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NLzcZcZoHHfeHAcb+ArYV62Yf3ea2aOiVj67cmQ8lEE=; b=pPGcf9X03NDBKGPzmd9Xv+OXUB/z4pETdAgLWdcDml5YAH7sy9VIkSr+kJZT0qddDH WKobKFNXnCvK7O8vpwCAdxBOjJEw8bPQIoeFo7sbszn/HTg9+/payBYRCV5jLTeM9Qlp 41Iz2zH88n+Thnpiiw12P4lXEmmT406uWxMiTSJgWUhELcX7J/LS6j5P6Jt3cNn3prXm 9mKEYsrg4WONZxuQ90ZZsR3ECFb3WUZbNrxusp5tEopDFGFBwUu690pT417uOLMRsFuQ 82J8joGy9XKtenIeNd3gKc+TtvtHRbvSns0KhcsRb3M9pm+X7fvstErvZtux9aLUYdib URKQ== X-Gm-Message-State: AOJu0YzSCfQIy8i1AmQc66kxEPYUjIlBYyUbq2LSORD5ecwa4OKZGond 0Pu7+sTE2/JP83mjZSu47yLqK5Z6T8PbOtxXlLDKUa26AbyxHlbBSB+oPA== X-Google-Smtp-Source: AGHT+IHtM3MnZs0GN4Lc3v439DWRykae0K+T2jhoF3FcuwYTrdD2CF84qHM871vtvhik/aq3lTDsFA== X-Received: by 2002:a05:6602:1347:b0:82a:1f14:997f with SMTP id ca18e2360f4ac-82a9618b0bdmr1497880139f.4.1725898539129; Mon, 09 Sep 2024 09:15:39 -0700 (PDT) Received: from localhost.localdomain ([2600:4808:a053:7600::e413]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-82aa7382a53sm146289539f.30.2024.09.09.09.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 09:15:38 -0700 (PDT) From: aurtzy Date: Mon, 9 Sep 2024 12:12:11 -0400 Message-ID: <1bc738374fbd269f8b5c8e3e299aefa17117f58c.1725898038.git.aurtzy@gmail.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/gl.scm (mesa): Enable NVK vulkan driver for x86_64 architecture. [native-inputs]: Add rust, rust-bindgen-cli, rust-cbindgen-0.26 for x86_64. [arguments]<#:meson>: Use newer version of meson to satisfy NVK build requirements. <#:configure-flags>: Use "auto" for 'vulkan-drivers' flag when target arch is x86_64. <#:phases>: Add phase to patch rust subproject sources when target arch is x86_64. * gnu/packages/crates-io.scm (rust-paste-1, rust-proc-macro2-1, rust-quote-1, rust-syn-2, rust-unicode-ident-1): Add a comment about being dependencies of mesa. Change-Id: I76e3db5072ca3c718155b188ca64b52766d55f36 --- Hi John, Thanks for the CC, and sorry for not submitting a patch sooner! Since last, I have managed to find a better solution to the issue with substituting rust dependency sources. Briefly on what I have so far: this makes use of writing wrap files with just the "directory" property, having meson fall back to using a local directory that sources are copied to. Doing this resulted in an odd behavior with the overlay directories (i.e. important extra files in subprojects/packagefiles) where they don't seem to be automatically copied as expected when falling back to local files; however, a simple copy resolves it, although I thought it would still be good to note and add a comment about. I initially made the wrap-file-writing a build utility procedure 'patch-wrap-file' (which can be seen my personal config [1]) as it seemed like it could be useful for other meson packages, but for this patch I've inlined it since I'm not confident in its applicability across different projects. I'd be happy to hear thoughts about it if it might be useful, though. [1] https://github.com/aurtzy/guix-config/blob/5cf4c9e277f4ab3a8f1ef87ec5ac47a686da0ad2/my-guix/build/utils.scm#L27 Cheers, aurtzy gnu/packages/crates-io.scm | 5 +++ gnu/packages/gl.scm | 64 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 67 insertions(+), 2 deletions(-) base-commit: c1ca70a98024a1e9dd6fedded1d31ad763b8b282 diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm index 0cdb071ea0..2a40062500 100644 --- a/gnu/packages/crates-io.scm +++ b/gnu/packages/crates-io.scm @@ -51869,6 +51869,7 @@ (define-public rust-password-hash-0.2 ("rust-subtle" ,rust-subtle-2) ("rust-rand-core" ,rust-rand-core-0.6)))))) +;; WARNING: This package is a dependency of mesa. (define-public rust-paste-1 (package (name "rust-paste") @@ -56703,6 +56704,7 @@ (define-public rust-proc-macro-nested-0.1 "Support for nested proc-macro-hack invocations.") (license (list license:expat license:asl2.0)))) +;; WARNING: This package is a dependency of mesa. (define-public rust-proc-macro2-1 (package (name "rust-proc-macro2") @@ -60144,6 +60146,7 @@ (define-public rust-quinn-udp-0.1 ("rust-tokio" ,rust-tokio-1) ("rust-tracing" ,rust-tracing-0.1)))))) +;; WARNING: This package is a dependency of mesa. (define-public rust-quote-1 (package (name "rust-quote") @@ -76939,6 +76942,7 @@ (define-public rust-symphonia-utils-xiph-0.4 codecs and formats.") (license license:mpl2.0))) +;; WARNING: This package is a dependency of mesa. (define-public rust-syn-2 (package (name "rust-syn") @@ -86599,6 +86603,7 @@ (define-public rust-unicode-id-0.3 according to Unicode Standard Annex #31.") (license (list license:expat license:asl2.0)))) +;; WARNING: This package is a dependency of mesa. (define-public rust-unicode-ident-1 (package (name "rust-unicode-ident") diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm index c417f11571..3939f1ba1f 100644 --- a/gnu/packages/gl.scm +++ b/gnu/packages/gl.scm @@ -21,6 +21,7 @@ ;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com> ;;; Copyright © 2024 Liliana Marie Prikler ;;; Copyright © 2024 Artyom V. Poptsov +;;; Copyright © 2024 aurtzy ;;; ;;; This file is part of GNU Guix. ;;; @@ -41,6 +42,7 @@ (define-module (gnu packages gl) #:use-module (gnu packages) #:use-module (gnu packages autotools) #:use-module (gnu packages bison) + #:use-module (gnu packages build-tools) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages documentation) @@ -56,6 +58,7 @@ (define-module (gnu packages gl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages rust) #:use-module (gnu packages tls) #:use-module (gnu packages video) #:use-module (gnu packages vulkan) @@ -75,7 +78,8 @@ (define-module (gnu packages gl) #:use-module (guix gexp) #:use-module (guix utils) #:use-module (ice-9 match) - #:use-module ((srfi srfi-1) #:hide (zip))) + #:use-module ((srfi srfi-1) #:hide (zip)) + #:use-module (srfi srfi-26)) (define-public glu (package @@ -352,10 +356,19 @@ (define-public mesa pkg-config-for-build wayland wayland-protocols) + '()) + (if (target-x86-64?) + ;; NVK dependencies + (list rust + (module-ref (resolve-interface '(gnu packages rust-apps)) + 'rust-bindgen-cli) + (module-ref (resolve-interface '(gnu packages rust-apps)) + 'rust-cbindgen-0.26)) '()))) (outputs '("out" "bin")) (arguments (list + #:meson meson-1.5 #:configure-flags #~(list #$@(cond @@ -387,7 +400,7 @@ (define-public mesa "-Dshared-glapi=enabled" #$@(cond - ((or (target-x86-32?) (target-x86-64?)) + ((target-x86-32?) ;; This doesn't include nouveau (which is in "auto") as it needs ;; rust. ;; TODO: Enable nouveau/NVK. @@ -481,6 +494,53 @@ (define-public mesa (("'lp_test_arit', ") "")))) (_ '((display "No tests to disable on this architecture.\n")))))) + #$@(if (target-x86-64?) + #~((add-after 'unpack 'patch-subproject-sources + (lambda _ + ;; Patch each relevant subproject source URL in wrapfiles to + ;; use the store, which avoids an attempt to download them + ;; mid-build. + (for-each + (match-lambda + ((name source) + (let ((wrap-file (string-append + "subprojects/" name ".wrap")) + (subproject-dest (string-append + "subprojects/" name)) + (overlay-dir (string-append + "subprojects/packagefiles/" name))) + (copy-recursively source subproject-dest) + ;; Normally when the patch_directory wrap file property + ;; is specified, meson automatically copies from + ;; packagefiles, but this is not the case here (only + ;; happens when downloading source?) so we manually copy + ;; overlay-dir to subproject-dest. + (when (file-exists? overlay-dir) + (copy-recursively overlay-dir subproject-dest)) + (call-with-output-file wrap-file + (lambda (port) + (format port "[wrap-file] +directory = ~a +" + name)))))) + '#+(map (lambda (pkg) + (let ((name (package-upstream-name* pkg)) + (version (package-version pkg))) + (list (package-upstream-name* pkg) + (file-append pkg + "/share/cargo/src/" + name "-" version)))) + (let ((from-crates-io + (cut module-ref + (resolve-interface + '(gnu packages crates-io)) + <>))) + (list (from-crates-io 'rust-syn-2) + (from-crates-io 'rust-unicode-ident-1) + (from-crates-io 'rust-quote-1) + (from-crates-io 'rust-proc-macro2-1) + (from-crates-io 'rust-paste-1)))))))) + #~()) (add-before 'configure 'fix-dlopen-libnames (lambda* (#:key inputs #:allow-other-keys) (let ((out #$output))