unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#60934] [CORE-UPDATES PATCH] gnu: mesa: Use smaller llvm backend.
@ 2023-01-18 14:49 Efraim Flashner
  2023-01-19  3:14 ` John Kehayias via Guix-patches via
  2023-01-19 13:56 ` [bug#60934] [PATCH v2 0/2] llvm-for-mesa patch Efraim Flashner
  0 siblings, 2 replies; 9+ messages in thread
From: Efraim Flashner @ 2023-01-18 14:49 UTC (permalink / raw)
  To: 60934; +Cc: Ludovic Courtès, Efraim Flashner

* gnu/packages/gl.scm (mesa)[inputs]: Replace llvm with llvm-for-mesa.
* gnu/packages/llvm.scm (llvm-for-mesa): New variable.
---

I wasn't able to tweak this to be able to build a cross compiled mesa. I
was able to build and run glxgears on core-updates with this patch
applied.

 gnu/packages/gl.scm   |  5 ++---
 gnu/packages/llvm.scm | 49 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index dd62fac13e..bce2aead4c 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -5,7 +5,7 @@
 ;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Nikita <nikita@n0.is>
 ;;; Copyright © 2016, 2017, 2018, 2020, 2021 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2017, 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017-2019, 2021, 2023 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
@@ -298,8 +298,7 @@ (define-public mesa
            libxml2
            libxrandr
            libxvmc
-           ;; Note: update the 'clang' input of mesa-opencl when bumping this.
-           llvm
+           llvm-for-mesa
            wayland
            wayland-protocols))
     (native-inputs
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index b46cb06443..2296647969 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -7,7 +7,7 @@
 ;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
 ;;; Copyright © 2018–2022 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2018, 2021, 2022 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2018, 2021-2023 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
 ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
@@ -1886,6 +1886,53 @@ (define-public emacs-clang-rename
 ;;; LLVM variants.
 ;;;
 
+(define-public llvm-for-mesa
+  ;; Note: update the 'clang' input of mesa-opencl when bumping this.
+  (let ((base-llvm llvm-13))
+    (package
+      (inherit base-llvm)
+      ;; If we can separate out the include directory we'd save another 23MB.
+      (outputs (list "out"))
+      (version (package-version base-llvm))
+      (arguments
+       (substitute-keyword-arguments (package-arguments base-llvm)
+         ((#:configure-flags _ ''())
+          #~(list
+              ;; AMDGPU is needed by the vulkan drivers.
+              #$(string-append "-DLLVM_TARGETS_TO_BUILD="
+                               (system->llvm-target) ";AMDGPU")
+              "-DLLVM_BUILD_TOOLS=NO"
+              "-DLLVM_BUILD_LLVM_DYLIB=YES"
+              "-DLLVM_LINK_LLVM_DYLIB=YES"
+              "-DLLVM_ENABLE_RTTI:BOOL=TRUE"))
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (add-after 'install 'delete-static-libraries
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (for-each delete-file
+                            (find-files (string-append
+                                          (assoc-ref outputs "out") "/lib")
+                                        "\\.a$"))))
+              ;; We don't need it for this version.
+              (replace 'install-opt-viewer
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (let ((out (assoc-ref outputs "out")))
+                    (delete-file-recursively
+                      (string-append out "/share/opt-viewer")))))
+              (add-after 'install 'build-and-install-llvm-config
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (let ((out (assoc-ref outputs "out")))
+                    (substitute*
+                      "tools/llvm-config/CMakeFiles/llvm-config.dir/link.txt"
+                      (((string-append "/tmp/guix-build-llvm-"
+                                       #$version ".drv-0/build/lib"))
+                       (string-append out "/lib")))
+                    (invoke "make" "llvm-config")
+                    (install-file "bin/llvm-config"
+                                  (string-append out "/bin")))))))))
+      (properties `((hidden? . #t)
+                    ,@(package-properties base-llvm))))))
+
 (define make-ocaml-llvm
   ;; Make it a memoizing procedure so its callers below don't end up defining
   ;; two equal-but-not-eq "ocaml-llvm" packages for the default LLVM.

base-commit: b8d684af76a41f5856b73640eb6f21940f214497
prerequisite-patch-id: 32cb914a2879991546162c9c87e371e7faf56c27
prerequisite-patch-id: 322468b8512360f3addd2e9788a3b53166fc3997
prerequisite-patch-id: 7b9e82394c1c3b8f7cb04ed14c6c17e7e6a19020
-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted





^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-01-30 18:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-18 14:49 [bug#60934] [CORE-UPDATES PATCH] gnu: mesa: Use smaller llvm backend Efraim Flashner
2023-01-19  3:14 ` John Kehayias via Guix-patches via
2023-01-19  7:23   ` Efraim Flashner
2023-01-19 13:56 ` [bug#60934] [PATCH v2 0/2] llvm-for-mesa patch Efraim Flashner
2023-01-19 13:56   ` [bug#60934] [PATCH v2 1/2] gnu: Add llvm-for-mesa Efraim Flashner
2023-01-23 10:35     ` Ludovic Courtès
2023-01-23 11:57       ` Efraim Flashner
2023-01-30 18:12       ` bug#60934: " Efraim Flashner
2023-01-19 13:56   ` [bug#60934] [PATCH v2 2/2] HELPER PATCH Efraim Flashner

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).