Advertisement
Guest User

Untitled

a guest
Jan 15th, 2025
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 4.32 KB | None | 0 0
  1. ;;; qemu.scm
  2. ;; I'm on debian, with guix installed via curl. My guix version:
  3. ;;
  4. ;; $ guix --version
  5. ;; guix (GNU Guix) 1.4.0
  6. ;; Copyright (C) 2022 the Guix authors
  7. ;; License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  8. ;; This is free software: you are free to change and redistribute it.
  9. ;; There is NO WARRANTY, to the extent permitted by law.
  10. ;;
  11. ;; I run build the file like so:
  12. ;;
  13. ;; $ time guix package -v3 -K -f qemu.scm
  14. ;; /home/stites/dev/guix/mnt-reform-nonguix/qemu.scm:45:18: error: (else (quote ())): bad use of 'else' syntactic keyword
  15. ;; guix package -v3 -K -f qemu.scm  0.87s user 0.11s system 132% cpu 0.741 total
  16.  
  17. (define-module (qemu)
  18.   #:use-module (gnu packages)
  19.   #:use-module (gnu packages virtualization))
  20.  
  21. ;; the rest (minus the last line) of this is c/p'd from qemu-minimal with a :%s/qemu-minimal/myqemu/g applied.
  22.  
  23. (define-public myqemu
  24.   ;; QEMU without GUI support, only supporting the host's architecture
  25.   (package/inherit qemu
  26.     (name "myqemu")
  27.     (outputs '("out" "doc"))
  28.     (synopsis
  29.      "Machine emulator and virtualizer (without GUI) for the host architecture")
  30.     (arguments
  31.      (substitute-keyword-arguments (package-arguments qemu)
  32.        ((#:configure-flags configure-flags #~'())
  33.         ;; Restrict to the host's architecture.
  34.         (let* ((system (or (%current-target-system)
  35.                            (%current-system)))
  36.                (target-list-arg
  37.                 (match system
  38.                   ((? (cut string-prefix? "i686" <>))
  39.                    "--target-list=i386-softmmu")
  40.                   ((? (cut string-prefix? "x86_64" <>))
  41.                    "--target-list=i386-softmmu,x86_64-softmmu")
  42.                   ((? (cut string-prefix? "mips64" <>))
  43.                    (string-append "--target-list=mips-softmmu,mipsel-softmmu,"
  44.                                   "mips64-softmmu,mips64el-softmmu"))
  45.                   ((? (cut string-prefix? "mips" <>))
  46.                    "--target-list=mips-softmmu,mipsel-softmmu")
  47.                   ((? (cut string-prefix? "aarch64" <>))
  48.                    "--target-list=arm-softmmu,aarch64-softmmu")
  49.                   ((? (cut string-prefix? "arm" <>))
  50.                    "--target-list=arm-softmmu")
  51.                   ((? (cut string-prefix? "alpha" <>))
  52.                    "--target-list=alpha-softmmu")
  53.                   ((? (cut string-prefix? "powerpc64" <>))
  54.                    "--target-list=ppc-softmmu,ppc64-softmmu")
  55.                   ((? (cut string-prefix? "powerpc" <>))
  56.                    "--target-list=ppc-softmmu")
  57.                   ((? (cut string-prefix? "s390" <>))
  58.                    "--target-list=s390x-softmmu")
  59.                   ((? (cut string-prefix? "riscv" <>))
  60.                    "--target-list=riscv32-softmmu,riscv64-softmmu")
  61.                   (else       ; An empty list actually builds all the targets.
  62.                    '()))))
  63.           #~(cons #$target-list-arg #$configure-flags)))
  64.        ((#:phases phases)
  65.         #~(modify-phases #$phases
  66.             (delete 'configure-user-static)
  67.             (delete 'build-user-static)
  68.             (delete 'install-user-static)))))
  69.  
  70.     ;; Remove dependencies on optional libraries, notably GUI libraries.
  71.     (native-inputs (filter (lambda (input)
  72.                              (match input
  73.                                ;; Work around the fact that modify-inputs can not
  74.                                ;; delete specific outputs; i.e. here we should keep
  75.                                ;; `(,glib "bin"), but not `(,glib "static").
  76.                                ((label package output)
  77.                                 (not (string=? "static" output)))
  78.                                (_ input)))
  79.                            (modify-inputs (package-native-inputs qemu)
  80.                              (delete "gettext-minimal"))))
  81.     (inputs (modify-inputs (package-inputs qemu)
  82.               (delete "libusb"
  83.                       "mesa"
  84.                       "sdl2"
  85.                       "spice"
  86.                       "virglrenderer"
  87.                       "gtk+"
  88.                       "usbredir"
  89.                       "libdrm"
  90.                       "libepoxy"
  91.                       "pulseaudio"
  92.                       "vde2"
  93.                       "libcacard")))))
  94.  
  95. ;;; and then I c/p here to build with guix package
  96. myqemu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement