gnu: glew: Fix cross-compiling.
* gnu/packages/gl.scm (mesa)[native-inputs]: When cross-compiling, add cmake-minimal-cross. [arguments]: Adjust 'fix-cross-compiling to find llvm. * gnu/packages/llvm.scm (llvm-for-mesa) [arguments]<#:configure-flags>: When cross-compiling, set -DBUILD_SHARED_LIBS:BOOL=TRUE and -DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE, remove -DLLVM_LINK_LLVM_DYLIB.*. <#:phases>: When cross-compiling, remove the 'delete-static-libraries phase. Change-Id: If10dec7695e62604e080230e10f2b8d7167f660b Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
This commit is contained in:
parent
b26926189e
commit
53d9190efd
2 changed files with 32 additions and 15 deletions
|
@ -18,7 +18,7 @@
|
||||||
;;; Copyright © 2021, 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
|
;;; Copyright © 2021, 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
|
||||||
;;; Copyright © 2022 Petr Hodina <phodina@protonmail.com>
|
;;; Copyright © 2022 Petr Hodina <phodina@protonmail.com>
|
||||||
;;; Copyright © 2023 Kaelyn Takata <kaelyn.alexi@protonmail.com>
|
;;; Copyright © 2023 Kaelyn Takata <kaelyn.alexi@protonmail.com>
|
||||||
;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
|
;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -62,6 +62,7 @@
|
||||||
#:use-module (guix download)
|
#:use-module (guix download)
|
||||||
#:use-module (guix git-download)
|
#:use-module (guix git-download)
|
||||||
#:use-module (guix hg-download)
|
#:use-module (guix hg-download)
|
||||||
|
#:use-module (gnu packages cmake)
|
||||||
#:use-module (guix build-system gnu)
|
#:use-module (guix build-system gnu)
|
||||||
#:use-module (guix build-system cmake)
|
#:use-module (guix build-system cmake)
|
||||||
#:use-module (guix build-system meson)
|
#:use-module (guix build-system meson)
|
||||||
|
@ -338,7 +339,8 @@ also known as DXTn or DXTC) for Mesa.")
|
||||||
python-wrapper
|
python-wrapper
|
||||||
(@ (gnu packages base) which)
|
(@ (gnu packages base) which)
|
||||||
(if (%current-target-system)
|
(if (%current-target-system)
|
||||||
(list pkg-config-for-build
|
(list cmake-minimal-cross
|
||||||
|
pkg-config-for-build
|
||||||
wayland
|
wayland
|
||||||
wayland-protocols)
|
wayland-protocols)
|
||||||
'())))
|
'())))
|
||||||
|
@ -415,10 +417,13 @@ svga,swrast,virgl,zink")))
|
||||||
#~(modify-phases %standard-phases
|
#~(modify-phases %standard-phases
|
||||||
#$@(if (%current-target-system)
|
#$@(if (%current-target-system)
|
||||||
#~((add-after 'unpack 'fix-cross-compiling
|
#~((add-after 'unpack 'fix-cross-compiling
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(lambda* (#:key native-inputs #:allow-other-keys)
|
||||||
;; It isn't a problem to use the host's llvm-config.
|
;; When cross compiling, we use cmake to find llvm, not
|
||||||
(setenv "LLVM_CONFIG"
|
;; llvm-config, because llvm-config cannot be executed
|
||||||
(search-input-file inputs "/bin/llvm-config")))))
|
;; see https://github.com/llvm/llvm-project/issues/58984
|
||||||
|
(setenv "CMAKE"
|
||||||
|
(search-input-file
|
||||||
|
native-inputs "/bin/cmake")))))
|
||||||
#~())
|
#~())
|
||||||
(add-after 'unpack 'disable-failing-test
|
(add-after 'unpack 'disable-failing-test
|
||||||
(lambda _
|
(lambda _
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
;;; Copyright © 2022 Clément Lassieur <clement@lassieur.org>
|
;;; Copyright © 2022 Clément Lassieur <clement@lassieur.org>
|
||||||
;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
|
;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
|
||||||
;;; Copyright © 2023 Hilton Chain <hako@ultrarare.space>
|
;;; Copyright © 2023 Hilton Chain <hako@ultrarare.space>
|
||||||
|
;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -2169,20 +2170,31 @@ using @code{clang-rename}.")))
|
||||||
;; AMDGPU is needed by the vulkan drivers.
|
;; AMDGPU is needed by the vulkan drivers.
|
||||||
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
|
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
|
||||||
(system->llvm-target) ";AMDGPU")
|
(system->llvm-target) ";AMDGPU")
|
||||||
|
#$@(if (%current-target-system)
|
||||||
|
'("-DBUILD_SHARED_LIBS:BOOL=TRUE"
|
||||||
|
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE")
|
||||||
|
'())
|
||||||
;; Skipping tools and utils decreases the output by ~100 MiB.
|
;; Skipping tools and utils decreases the output by ~100 MiB.
|
||||||
"-DLLVM_BUILD_TOOLS=NO"
|
"-DLLVM_BUILD_TOOLS=NO"
|
||||||
(remove (cut string-match
|
(remove
|
||||||
"-DLLVM_(TARGETS_TO_BUILD|INSTALL_UTILS).*" <>)
|
(cut string-match
|
||||||
|
#$(if (%current-target-system)
|
||||||
|
"-DLLVM_(LINK_LLVM_DYLIB|TARGETS_TO_BUILD|INSTALL_UTILS).*"
|
||||||
|
"-DLLVM_(TARGETS_TO_BUILD|INSTALL_UTILS).*") <>)
|
||||||
#$cf)))
|
#$cf)))
|
||||||
((#:phases phases '%standard-phases)
|
((#:phases phases '%standard-phases)
|
||||||
#~(modify-phases #$phases
|
#~(modify-phases #$phases
|
||||||
(add-after 'install 'delete-static-libraries
|
#$@(if (%current-target-system)
|
||||||
;; If these are just relocated then llvm-config can't find them.
|
'()
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
#~((add-after 'install 'delete-static-libraries
|
||||||
(for-each delete-file
|
;; If these are just relocated then llvm-config
|
||||||
(find-files (string-append
|
;; can't find them.
|
||||||
(assoc-ref outputs "out") "/lib")
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
"\\.a$"))))
|
(for-each delete-file
|
||||||
|
(find-files
|
||||||
|
(string-append
|
||||||
|
(assoc-ref outputs "out") "/lib")
|
||||||
|
"\\.a$"))))))
|
||||||
;; llvm-config is how mesa and others find the various
|
;; llvm-config is how mesa and others find the various
|
||||||
;; libraries and headers they use.
|
;; libraries and headers they use.
|
||||||
(add-after 'install 'build-and-install-llvm-config
|
(add-after 'install 'build-and-install-llvm-config
|
||||||
|
|
Reference in a new issue