guix_mirror_bot pushed a commit to branch mesa-updates
in repository guix.
commit 125be653ff372714f9e5c805605217e0360547b7
Author: Efraim Flashner <[email protected]>
AuthorDate: Wed Mar 4 17:44:22 2026 +0200
gnu: qemu: Prepare to build with rust.
* gnu/packages/virtualization.scm (qemu)[source]: Adjust snippet to
remove bundled rust crates.
[arguments]: Adjust configure-flags to build with rust when rust is in
the build environment. Add a phase when rust is available to make the
build system use the packaged rust crates.
[native-inputs]: When building with rust add rust, rust-bindgen-cli,
cargo-inputs qemu, and the cross-compiler for rust when needed.
* gnu/packages/rust-crates.scm (qemu): New entry.
Change-Id: Ib2f6fbd870740a674f6424e1e2800ca5dfa40aa7
Signed-off-by: John Kehayias <[email protected]>
---
gnu/packages/rust-crates.scm | 77 ++++++++++++++++++++++++++
gnu/packages/virtualization.scm | 117 +++++++++++++++++++++++++++-------------
2 files changed, 158 insertions(+), 36 deletions(-)
diff --git a/gnu/packages/rust-crates.scm b/gnu/packages/rust-crates.scm
index 5d63bdb084..f1f31de11f 100644
--- a/gnu/packages/rust-crates.scm
+++ b/gnu/packages/rust-crates.scm
@@ -711,6 +711,10 @@
(crate-source "arbitrary" "1.4.2"
"1wcbi4x7i3lzcrkjda4810nqv03lpmvfhb0a85xrq1mbqjikdl63"))
+(define rust-arbitrary-int-1.2.7
+ (crate-source "arbitrary-int" "1.2.7"
+ "0vgl3n5zzpdn2hxpz6gqk8zg2psk5gwyjzsgpngzd9iqwc1w0ky8"))
+
(define rust-arboard-3.5.0
(crate-source "arboard" "3.5.0"
"0w1yqcx51153hy5w3y0702xjc9nmlhncw9f5l0rdwbl62pvj3py1"))
@@ -1321,6 +1325,10 @@
(crate-source "attribute-derive-macro" "0.10.3"
"06zph2lyllkp6g1lsv7v4p84dnglbw2gw58r9fpn1d6m1ynm6fs6"))
+(define rust-attrs-0.2.9
+ (crate-source "attrs" "0.2.9"
+ "0pvy6b7arfr2f6awwkw6k1hc8sxidjxhj1fyyf2m5rixyi07s81a"))
+
(define rust-atty-0.2.11
(crate-source "atty" "0.2.11"
"0lln6vaczj521qqjbaqnb81w5p6xk4fjfkg33r0m22cm4f3mnzcs"))
@@ -1762,6 +1770,14 @@
(crate-source "biblatex" "0.11.0"
"0rlzfa1m33mh89ygwd4igfblphz71kq1qz1a0icrl6xszrsc7l2k"))
+(define rust-bilge-0.2.0
+ (crate-source "bilge" "0.2.0"
+ "0mvvwq9caiq701bmmwyd4q4pc8c69i5zaj3zdk6ya7gqxgc7ww6w"))
+
+(define rust-bilge-impl-0.2.0
+ (crate-source "bilge-impl" "0.2.0"
+ "1n5jml0c1z0np76ms0h5rxx19krblz46h84wycx29b9q4001xcgy"))
+
(define rust-binascii-0.1.4
(crate-source "binascii" "0.1.4"
"0wnaglgl72pn5ilv61q6y34w76gbg7crb8ifqk6lsxnq2gajjg9q"))
@@ -3144,6 +3160,10 @@
(crate-source "cfg-expr" "0.20.2"
"01l25g563n04ci6cjv0509d8ig91djvwidx9iln4h3qg7zb5im68"))
+(define rust-cfg-expr-0.20.3
+ (crate-source "cfg-expr" "0.20.3"
+ "0p0y56pd9yns6wsi7slxv0xhv22ds0qf5j5138sjbhjyy8xmyb0s"))
+
(define rust-cfg-if-0.1.10
(crate-source "cfg-if" "0.1.10"
"08h80ihs74jcyp24cd75wwabygbbdgl05k6p5dmq8akbr78vv1a7"))
@@ -6113,6 +6133,10 @@
(crate-source "ego-tree" "0.10.0"
"1n2csy99chk5v5vzjl0ff79vxpxhl76xmcb3aj6brrzzipmjz5xj"))
+(define rust-either-1.12.0
+ (crate-source "either" "1.12.0"
+ "12xmhlrv5gfsraimh6xaxcmb0qh6cc7w7ap4sw40ky9wfm095jix"))
+
(define rust-either-1.13.0
(crate-source "either" "1.13.0"
"1w2c1mybrd7vljyxk77y9f4w9dyjrmp3yp82mk7bcm8848fazcb0"))
@@ -7205,6 +7229,10 @@
"0aqxjgghmn8javsc5jcvx8lqpcrzajndl7v6q1j47zz87xmy2mrf"
#:snippet '(delete-file-recursively "images")))
+(define rust-foreign-0.3.1
+ (crate-source "foreign" "0.3.1"
+ "0ijqb18gllqr0319brxsrjdb036cgaf81wc6ygd21ly9x1dipjhp"))
+
(define rust-foreign-types-0.3.2
(crate-source "foreign-types" "0.3.2"
"1cgk0vyd7r45cj769jym4a6s7vwshvd0z4bqrb92q1fwibmkkwzn"))
@@ -10108,6 +10136,10 @@
(crate-source "glib-sys" "0.20.10"
"05f29ky5dnvy8vp5rdld5f8r2lgr5w7dxqr7p27km016s4g9xdwa"))
+(define rust-glib-sys-0.21.2
+ (crate-source "glib-sys" "0.21.2"
+ "1q97z7ii4qgmyxcz0m7c5xil9n7vbm3b0msfcwhra8zpvl7kv7fh"))
+
(define rust-glib-sys-0.9.1
(crate-source "glib-sys" "0.9.1"
"1qhnwfqqcp63mx4q9744rfkq78g6ky2j8ppsxxgw0ipl08w6z1cm"))
@@ -13038,6 +13070,10 @@
(crate-source "libc" "0.2.155"
"0z44c53z54znna8n322k5iwg80arxxpdzjj5260pxxzc9a58icwp"))
+(define rust-libc-0.2.162
+ (crate-source "libc" "0.2.162"
+ "1633a00yyx45kzx9r54fndvr8njsjqyr7zl12mzgsmgyczg8glhq"))
+
(define rust-libc-0.2.169
(crate-source "libc" "0.2.169"
"02m253hs8gw0m1n8iyrsc4n15yzbqwhddi7w1l0ds7i92kdsiaxm"))
@@ -25734,6 +25770,10 @@
"0jzf1znfpb2gx8nr8mvmyqs1crnv79l57nxnbiszc7xf7ynbjm1k"
#:snippet '(delete-file-recursively "tests")))
+(define rust-unicode-ident-1.0.12-unpatched
+ (crate-source "unicode-ident" "1.0.12"
+ "0jzf1znfpb2gx8nr8mvmyqs1crnv79l57nxnbiszc7xf7ynbjm1k"))
+
(define rust-unicode-ident-1.0.13
(crate-source "unicode-ident" "1.0.13"
"1zm1xylzsdfvm2a5ib9li3g5pp7qnkv4amhspydvgbmd9k6mc6z9"
@@ -54210,6 +54250,43 @@
rust-windows-x86-64-gnu-0.52.6
rust-windows-x86-64-gnullvm-0.52.6
rust-windows-x86-64-msvc-0.52.6))
+ (qemu =>
+ (list rust-anyhow-1.0.98
+ rust-arbitrary-int-1.2.7
+ rust-attrs-0.2.9
+ rust-bilge-0.2.0
+ rust-bilge-impl-0.2.0
+ rust-cfg-expr-0.20.3
+ rust-either-1.12.0
+ rust-equivalent-1.0.2
+ rust-foreign-0.3.1
+ rust-glib-sys-0.21.2
+ rust-hashbrown-0.16.0
+ rust-heck-0.5.0
+ rust-indexmap-2.11.4
+ rust-itertools-0.11.0
+ rust-libc-0.2.162
+ rust-memchr-2.7.6
+ rust-pkg-config-0.3.32
+ rust-proc-macro-error-1.0.4
+ rust-proc-macro-error-attr-1.0.4
+ rust-proc-macro2-1.0.95
+ rust-quote-1.0.36
+ rust-serde-1.0.226
+ rust-serde-core-1.0.226
+ rust-serde-derive-1.0.226
+ rust-serde-spanned-0.6.9
+ rust-smallvec-1.15.1
+ rust-syn-2.0.104
+ rust-system-deps-7.0.5
+ rust-target-lexicon-0.13.2
+ rust-toml-0.8.23
+ rust-toml-datetime-0.6.11
+ rust-toml-edit-0.22.27
+ rust-unicode-ident-1.0.12-unpatched
+ rust-version-compare-0.2.0
+ rust-version-check-0.9.4
+ rust-winnow-0.7.13))
(rabbitmqadmin =>
(list rust-addr2line-0.24.2
rust-adler2-2.0.1
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 434eea4e7e..3b30a9936a 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -159,6 +159,8 @@
#:use-module (gnu packages ruby)
#:use-module (gnu packages ruby-check)
#:use-module (gnu packages ruby-xyz)
+ #:use-module (gnu packages rust)
+ #:use-module (gnu packages rust-apps)
#:use-module (gnu packages rsync)
#:use-module (gnu packages sdl)
#:use-module (gnu packages selinux)
@@ -215,6 +217,9 @@
(modules '((guix build utils)))
(snippet
'(begin
+ ;; Delete the bundled rust crates.
+ (delete-file-recursively "subprojects/packagecache")
+ (mkdir-p "subprojects/packagecache")
;; TODO: Scrub all firmwares from this directory!
(with-directory-excursion "pc-bios"
;; Delete firmwares provided by SeaBIOS.
@@ -259,28 +264,34 @@
"share/qemu/pxe-virtio.rom"))
#~((string-append #$output "/share/qemu"))))
(out #$output))
- (list (string-append "--cc=" gcc)
- ;; Some architectures insist on using HOST_CC.
- (string-append "--host-cc=" gcc)
- (string-append "--prefix=" out)
- "--sysconfdir=/etc"
- "--enable-fdt=system"
- (string-append "--firmwarepath=" out "/share/qemu:"
- (dirname seabios) ":"
- (dirname ipxe) ":"
- (dirname openbios) ":"
- (dirname opensbi))
- (string-append "--smbd=" out "/libexec/samba-wrapper")
- "--disable-debug-info" ;for space considerations
- ;; The binaries need to be linked against -lrt.
- (string-append "--extra-ldflags=-lrt")))
+ (cons* (string-append "--cc=" gcc)
+ ;; Some architectures insist on using HOST_CC.
+ (string-append "--host-cc=" gcc)
+ (string-append "--prefix=" out)
+ "--sysconfdir=/etc"
+ "--enable-fdt=system"
+ (string-append "--firmwarepath=" out "/share/qemu:"
+ (dirname seabios) ":"
+ (dirname ipxe) ":"
+ (dirname openbios) ":"
+ (dirname opensbi))
+ (string-append "--smbd=" out "/libexec/samba-wrapper")
+ "--disable-debug-info" ;for space considerations
+ ;; The binaries need to be linked against -lrt.
+ (string-append "--extra-ldflags=-lrt")
+ #$@(if (this-package-native-input "rust")
+ #~((list "--enable-rust"))
+ #~((list)))))
;; Make build and test output verbose to facilitate investigation upon
failure.
#:make-flags #~'("V=1")
#:modules `((srfi srfi-1)
(srfi srfi-26)
(ice-9 ftw)
(ice-9 match)
+ ((guix build cargo-build-system) #:prefix cargo:)
,@%default-gnu-modules)
+ #:imported-modules `(,@%cargo-build-system-modules
+ ,@%default-gnu-imported-modules)
#:phases
#~(modify-phases %standard-phases
;; Since we removed the bundled firmwares above, many tests
@@ -323,6 +334,29 @@
"\"~a\",~%" file))
allowed-differences)
(close-port allowed-differences-whitelist))))
+ #$@(if (this-package-native-input "rust")
+ #~((add-after 'unpack 'prepare-rust-crates
+ (lambda args
+ (apply (assoc-ref cargo:%standard-phases
+ 'prepare-rust-crates)
+ args)
+ ;; Use /tmp/rust-crates as the source.
+ (substitute* (find-files "subprojects" "-rs\\.wrap$")
+ (("source_url = (.*)" _ url)
+ (let ((split-url (string-split url #\/)))
+ (string-append
+ "source_url = file:///tmp/rust-crates/rust-"
+ (list-ref split-url 6) "-"
+ (list-ref split-url 7) ".tar.gz\n"))))
+ ;; "Download" the packages.
+ (for-each
+ (lambda (wrapper)
+ (invoke "meson" "subprojects" "download"
+ (string-drop-right wrapper 5)))
+ (scandir "subprojects"
+ (lambda (file)
+ (string-suffix? "-rs.wrap" file)))))))
+ #~())
;; If the ipxe firmware isn't available, remove it from the list
;; of files expected to be available and remove some of the tests.
#$@(if (not (this-package-input "ipxe-qemu"))
@@ -585,27 +619,38 @@ exec smbd $@")))
zlib
`(,zstd "lib"))))
(native-inputs
- ;; Note: acpica is here only to pretty-print firmware differences with
IASL
- ;; (see the replace-firmwares phase above).
- (list acpica
- bison
- flex
- gettext-minimal
- `(,glib "bin") ;gtester, etc.
- meson
- ninja
- perl
- pkg-config
- python-wrapper
- python-sphinx
- python-sphinx-rtd-theme
- python-tomli
- texinfo
- ;; The following static libraries are required to build
- ;; the static output of QEMU.
- `(,glib "static")
- `(,pcre2 "static")
- `(,zlib "static")))
+ (append
+ ;; The rust code doesn't seem to be in use yet.
+ (if #f ;(supported-package? rust)
+ (append
+ (cons* rust
+ rust-bindgen-cli
+ (cargo-inputs 'qemu))
+ (or (and=> (%current-target-system)
+ (compose list make-rust-sysroot))
+ '()))
+ '())
+ ;; Note: acpica is here only to pretty-print firmware differences with
+ ;; IASL (see the replace-firmwares phase above).
+ (list acpica
+ bison
+ flex
+ gettext-minimal
+ `(,glib "bin") ;gtester, etc.
+ meson
+ ninja
+ perl
+ pkg-config
+ python-wrapper
+ python-sphinx
+ python-sphinx-rtd-theme
+ python-tomli
+ texinfo
+ ;; The following static libraries are required to build
+ ;; the static output of QEMU.
+ `(,glib "static")
+ `(,pcre2 "static")
+ `(,zlib "static"))))
(home-page "https://www.qemu.org")
(synopsis "Machine emulator and virtualizer")
(description