gnu: xonotic: Use G-expressions.

* gnu/packages/games.scm (xonotic)[arguments]:
Rewrite as G-expressions.
This commit is contained in:
Tobias Geerinckx-Rice 2022-08-07 02:00:01 +02:00
parent d21ddfc9d8
commit 3dc16fe0dc
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -7807,148 +7807,148 @@ (define-public xonotic
(base32 "0pgahai0gk8bjmvkwx948bl50l9f9dhmjzwffl4vyldibajipa51"))))
(build-system gnu-build-system)
(arguments
`(#:configure-flags (list (string-append "--prefix="
(assoc-ref %outputs "out"))
"--disable-rijndael")
#:phases
(modify-phases %standard-phases
(add-before 'configure 'make-darkplaces
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(sharedir (string-append out "/share/xonotic/")))
(invoke "make" "-C" "source/darkplaces"
(string-append "DP_FS_BASEDIR="
sharedir)
"DP_LINK_TO_LIBJPEG=1"
"DP_SOUND_API=ALSA"
"CC=gcc"
"-f" "makefile"
"cl-release")
(invoke "make" "-C" "source/darkplaces"
(string-append "DP_FS_BASEDIR="
sharedir)
"DP_LINK_TO_LIBJPEG=1"
"DP_SOUND_API=ALSA"
"CC=gcc"
"-f" "makefile"
"sdl-release")
(invoke "make" "-C" "source/darkplaces"
(string-append "DP_FS_BASEDIR="
sharedir)
"DP_LINK_TO_LIBJPEG=1"
"DP_SOUND_API=ALSA"
"CC=gcc"
"-f" "makefile"
"sv-release"))))
(add-before 'configure 'bootstrap
(lambda _
(chdir "source/d0_blind_id")
(invoke "sh" "autogen.sh")))
(add-after 'build 'install-desktop-entry
(lambda* (#:key outputs #:allow-other-keys)
;; Add .desktop files for the 2 variants and the symlink
(let* ((output (assoc-ref outputs "out"))
(apps (string-append output "/share/applications")))
(mkdir-p apps)
(with-output-to-file
(string-append apps "/xonotic-glx.desktop")
(list #:configure-flags
#~(list (string-append "--prefix=" #$output)
"--disable-rijndael")
#:phases
#~(modify-phases %standard-phases
(add-before 'configure 'make-darkplaces
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(share (string-append out "/share/xonotic/")))
(invoke "make" "-C" "source/darkplaces"
(string-append "DP_FS_BASEDIR="
share)
"DP_LINK_TO_LIBJPEG=1"
"DP_SOUND_API=ALSA"
"CC=gcc"
"-f" "makefile"
"cl-release")
(invoke "make" "-C" "source/darkplaces"
(string-append "DP_FS_BASEDIR="
share)
"DP_LINK_TO_LIBJPEG=1"
"DP_SOUND_API=ALSA"
"CC=gcc"
"-f" "makefile"
"sdl-release")
(invoke "make" "-C" "source/darkplaces"
(string-append "DP_FS_BASEDIR="
share)
"DP_LINK_TO_LIBJPEG=1"
"DP_SOUND_API=ALSA"
"CC=gcc"
"-f" "makefile"
"sv-release"))))
(add-before 'configure 'bootstrap
(lambda _
(format #t
"[Desktop Entry]~@
Name=xonotic-glx~@
Comment=Xonotic glx~@
Exec=~a/bin/xonotic-glx~@
TryExec=~@*~a/bin/xonotic-glx~@
Icon=xonotic~@
Categories=Game~@
Type=Application~%"
output)))
(with-output-to-file
(string-append apps "/xonotic-sdl.desktop")
(lambda _
(format #t
"[Desktop Entry]~@
Name=xonotic-sdl~@
Comment=Xonotic sdl~@
Exec=~a/bin/xonotic-sdl~@
TryExec=~@*~a/bin/xonotic-sdl~@
Icon=xonotic~@
Categories=Game~@
Type=Application~%"
output)))
(with-output-to-file
(string-append apps "/xonotic.desktop")
(lambda _
(format #t
"[Desktop Entry]~@
Name=xonotic~@
Comment=Xonotic~@
Exec=~a/bin/xonotic-glx~@
TryExec=~@*~a/bin/xonotic~@
Icon=xonotic~@
Categories=Game~@
Type=Application~%"
output))))))
(add-after 'install-desktop-entry 'install-icons
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(with-directory-excursion "../../misc/logos/icons_png/"
(for-each
(lambda (file)
(let* ((size (string-filter char-numeric? file))
(icons (string-append out "/share/icons/hicolor/"
size "x" size "/apps")))
(mkdir-p icons)
(copy-file file (string-append icons "/xonotic.png"))))
'("xonotic_16.png" "xonotic_22.png" "xonotic_24.png"
"xonotic_32.png" "xonotic_48.png" "xonotic_64.png"
"xonotic_128.png" "xonotic_256.png" "xonotic_512.png"))))))
(add-after 'install-icons 'install-binaries
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(define (install src dst)
(let ((dst (string-append out dst)))
(mkdir-p (dirname dst))
(copy-file src dst)))
(mkdir-p (string-append out "/bin"))
(install "../darkplaces/darkplaces-dedicated"
"/bin/xonotic-dedicated")
(install "../darkplaces/darkplaces-glx"
"/bin/xonotic-glx")
(install "../darkplaces/darkplaces-sdl"
"/bin/xonotic-sdl")
;; Provide a default xonotic executable, defaulting to SDL.
(symlink (string-append out "/bin/xonotic-sdl")
(string-append out "/bin/xonotic")))))
(add-after 'install-binaries 'install-data
(lambda* (#:key outputs inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(data (assoc-ref inputs "xonotic-data")))
(symlink (string-append data "/share/xonotic")
(string-append out "/share/xonotic")))))
(add-after 'install-binaries 'wrap-binaries
(lambda* (#:key outputs inputs #:allow-other-keys)
;; Curl and libvorbis need to be wrapped so that we get
;; sound and networking.
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin/xonotic"))
(bin-sdl (string-append out "/bin/xonotic-sdl"))
(bin-glx (string-append out "/bin/xonotic-glx"))
(bin-dedicated (string-append out "/bin/xonotic-dedicated"))
(curl (assoc-ref inputs "curl"))
(vorbis (assoc-ref inputs "libvorbis")))
(wrap-program bin
`("LD_LIBRARY_PATH" ":" prefix
(,(string-append curl "/lib:" vorbis "/lib"))))
(wrap-program bin-sdl
`("LD_LIBRARY_PATH" ":" prefix
(,(string-append curl "/lib:" vorbis "/lib"))))
(wrap-program bin-glx
`("LD_LIBRARY_PATH" ":" prefix
(,(string-append curl "/lib:" vorbis "/lib"))))
(wrap-program bin-dedicated
`("LD_LIBRARY_PATH" ":" prefix
(,(string-append curl "/lib:" vorbis "/lib"))))))))))
(chdir "source/d0_blind_id")
(invoke "sh" "autogen.sh")))
(add-after 'install 'symlink-data
(lambda* (#:key outputs inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(data (assoc-ref inputs "xonotic-data")))
(symlink (string-append data "/share/xonotic")
(string-append out "/share/xonotic")))))
(add-after 'install 'install-desktop-entry
(lambda* (#:key outputs #:allow-other-keys)
;; Add .desktop files for the 2 variants and the symlink.
(let* ((output (assoc-ref outputs "out"))
(apps (string-append output "/share/applications")))
(mkdir-p apps)
(with-output-to-file
(string-append apps "/xonotic-glx.desktop")
(lambda _
(format #t
"[Desktop Entry]~@
Name=xonotic-glx~@
Comment=Xonotic glx~@
Exec=~a/bin/xonotic-glx~@
TryExec=~@*~a/bin/xonotic-glx~@
Icon=xonotic~@
Categories=Game~@
Type=Application~%"
output)))
(with-output-to-file
(string-append apps "/xonotic-sdl.desktop")
(lambda _
(format #t
"[Desktop Entry]~@
Name=xonotic-sdl~@
Comment=Xonotic sdl~@
Exec=~a/bin/xonotic-sdl~@
TryExec=~@*~a/bin/xonotic-sdl~@
Icon=xonotic~@
Categories=Game~@
Type=Application~%"
output)))
(with-output-to-file
(string-append apps "/xonotic.desktop")
(lambda _
(format #t
"[Desktop Entry]~@
Name=xonotic~@
Comment=Xonotic~@
Exec=~a/bin/xonotic-glx~@
TryExec=~@*~a/bin/xonotic~@
Icon=xonotic~@
Categories=Game~@
Type=Application~%"
output))))))
(add-after 'install 'install-icons
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(with-directory-excursion "../../misc/logos/icons_png/"
(for-each
(lambda (file)
(let* ((size (string-filter char-numeric? file))
(icons (string-append out "/share/icons/hicolor/"
size "x" size "/apps")))
(mkdir-p icons)
(copy-file file (string-append icons "/xonotic.png"))))
'("xonotic_16.png" "xonotic_22.png" "xonotic_24.png"
"xonotic_32.png" "xonotic_48.png" "xonotic_64.png"
"xonotic_128.png" "xonotic_256.png" "xonotic_512.png"))))))
(add-after 'install 'install-binaries
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(define (install src dst)
(let ((dst (string-append out dst)))
(mkdir-p (dirname dst))
(copy-file src dst)))
(mkdir-p (string-append out "/bin"))
(install "../darkplaces/darkplaces-dedicated"
"/bin/xonotic-dedicated")
(install "../darkplaces/darkplaces-glx"
"/bin/xonotic-glx")
(install "../darkplaces/darkplaces-sdl"
"/bin/xonotic-sdl")
;; Provide a default xonotic executable, defaulting to SDL.
(symlink (string-append out "/bin/xonotic-sdl")
(string-append out "/bin/xonotic")))))
(add-after 'install-binaries 'wrap
(lambda* (#:key outputs inputs #:allow-other-keys)
;; Curl and libvorbis need to be wrapped so that we get
;; sound and networking.
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin/xonotic"))
(bin-sdl (string-append out "/bin/xonotic-sdl"))
(bin-glx (string-append out "/bin/xonotic-glx"))
(bin-dedicated (string-append out "/bin/xonotic-dedicated"))
(curl (assoc-ref inputs "curl"))
(vorbis (assoc-ref inputs "libvorbis")))
(wrap-program bin
`("LD_LIBRARY_PATH" ":" prefix
(,(string-append curl "/lib:" vorbis "/lib"))))
(wrap-program bin-sdl
`("LD_LIBRARY_PATH" ":" prefix
(,(string-append curl "/lib:" vorbis "/lib"))))
(wrap-program bin-glx
`("LD_LIBRARY_PATH" ":" prefix
(,(string-append curl "/lib:" vorbis "/lib"))))
(wrap-program bin-dedicated
`("LD_LIBRARY_PATH" ":" prefix
(,(string-append curl "/lib:" vorbis "/lib"))))))))))
(native-inputs
(list autoconf
automake