me
/
guix
Archived
1
0
Fork 0

gnu: godot-lts: Improve package style.

* gnu/packages/game-development.scm (godot-lts): Re-indent and ensure
max column length to 79.
  [arguments]: Use gexp.

Change-Id: I0bedb66a4e7e0ebe6242df885f1e687ce3a43ce0
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
master
Nicolas Graves 2024-05-19 18:16:06 +02:00 committed by Maxim Cournoyer
parent 7f1c40df92
commit c12a6e7419
No known key found for this signature in database
GPG Key ID: 1260E46482E63562
1 changed files with 88 additions and 78 deletions

View File

@ -29,6 +29,7 @@
;;; Copyright © 2022 Jai Vetrivelan <jaivetrivelan@gmail.com> ;;; Copyright © 2022 Jai Vetrivelan <jaivetrivelan@gmail.com>
;;; Copyright © 2022 dan <i@dan.games> ;;; Copyright © 2022 dan <i@dan.games>
;;; Copyright © 2023 John Kehayias <john.kehayias@protonmail.com> ;;; Copyright © 2023 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -1972,86 +1973,95 @@ games.")
"vhacd" "vhacd"
"xatlas"))) "xatlas")))
(for-each delete-file-recursively (for-each delete-file-recursively
(lset-difference string=? (lset-difference
(scandir ".") string=?
(cons* "." ".." preserved-files))))))))) (scandir ".")
(cons* "." ".." preserved-files)))))))))
(build-system scons-build-system) (build-system scons-build-system)
(arguments (arguments
`(#:scons-flags (list "platform=x11" "target=release_debug" (list
;; Avoid using many of the bundled libs. ;; Avoid using many of the bundled libs.
;; Note: These options can be found in the SConstruct file. ;; Note: These options can be found in the SConstruct file.
"builtin_bullet=no" #:scons-flags #~(list "platform=x11" "target=release_debug"
"builtin_freetype=no" "builtin_bullet=no"
"builtin_glew=no" "builtin_freetype=no"
"builtin_libmpdec=no" "builtin_glew=no"
"builtin_libogg=no" "builtin_libmpdec=no"
"builtin_libpng=no" "builtin_libogg=no"
"builtin_libtheora=no" "builtin_libpng=no"
"builtin_libvorbis=no" "builtin_libtheora=no"
"builtin_libvpx=no" "builtin_libvorbis=no"
"builtin_libwebp=no" "builtin_libvpx=no"
"builtin_mbedtls=no" "builtin_libwebp=no"
"builtin_opus=no" "builtin_mbedtls=no"
"builtin_pcre2=no" "builtin_opus=no"
"builtin_wslay=no" "builtin_pcre2=no"
"builtin_zlib=no" "builtin_wslay=no"
"builtin_zstd=no") "builtin_zlib=no"
#:tests? #f ; There are no tests "builtin_zstd=no")
#:phases #:tests? #f ; There are no tests
(modify-phases %standard-phases #:phases
(add-after 'unpack 'scons-use-env #~(modify-phases %standard-phases
(lambda _ (add-after 'unpack 'scons-use-env
;; Scons does not use the environment variables by default, (lambda _
;; but this substitution makes it do so. ;; Scons does not use the environment variables by default,
(substitute* "SConstruct" ;; but this substitution makes it do so.
(("env_base = Environment\\(tools=custom_tools\\)") (substitute* "SConstruct"
(string-append (("env_base = Environment\\(tools=custom_tools\\)")
"env_base = Environment(tools=custom_tools)\n" (string-append
"env_base = Environment(ENV=os.environ)"))))) "env_base = Environment(tools=custom_tools)\n"
;; Build headless tools, used for packaging games without depending on X. "env_base = Environment(ENV=os.environ)")))))
(add-after 'build 'build-headless ;; Build headless tools, to package games without depending on X.
(lambda* (#:key scons-flags #:allow-other-keys) (add-after 'build 'build-headless
(apply invoke "scons" (lambda* (#:key scons-flags #:allow-other-keys)
`(,(string-append "-j" (number->string (parallel-job-count))) (apply invoke "scons"
"platform=server" ,@(delete "platform=x11" scons-flags))))) `(,(string-append
(replace 'install "-j" (number->string (parallel-job-count)))
(lambda* (#:key inputs outputs #:allow-other-keys) "platform=server"
(let* ((out (assoc-ref outputs "out")) ,@(delete "platform=x11" scons-flags)))))
(headless (assoc-ref outputs "headless")) (replace 'install
(zenity (assoc-ref inputs "zenity"))) (lambda* (#:key inputs outputs #:allow-other-keys)
;; Strip build info from filenames. (let* ((out (assoc-ref outputs "out"))
(with-directory-excursion "bin" (headless (assoc-ref outputs "headless"))
(for-each (zenity (assoc-ref inputs "zenity")))
(lambda (file) ;; Strip build info from filenames.
(let ((dest (car (string-split (basename file) #\.)))) (with-directory-excursion "bin"
(rename-file file dest))) (for-each
(find-files "." "godot.*\\.x11\\.opt\\.tools.*")) (lambda (file)
(install-file "godot" (string-append out "/bin")) (let ((dest (car (string-split (basename file) #\.))))
(install-file "godot_server" (string-append headless "/bin"))) (rename-file file dest)))
;; Tell the editor where to find zenity for OS.alert(). (find-files "." "godot.*\\.x11\\.opt\\.tools.*"))
(wrap-program (string-append out "/bin/godot") (install-file "godot" (string-append out "/bin"))
`("PATH" ":" prefix (,(string-append zenity "/bin"))))))) (install-file "godot_server"
(add-after 'install 'wrap-ld-path (string-append headless "/bin")))
(lambda* (#:key inputs outputs #:allow-other-keys) ;; Tell the editor where to find zenity for OS.alert().
(let* ((out (assoc-ref outputs "out")) (wrap-program (string-append out "/bin/godot")
(pulseaudio_path (string-append (assoc-ref inputs "pulseaudio") "/lib")) `("PATH" ":" prefix (,(string-append zenity "/bin")))))))
(alas_lib_path (string-append (assoc-ref inputs "alsa-lib") "/lib"))) (add-after 'install 'wrap-ld-path
(wrap-program (string-append out "/bin/godot") (lambda* (#:key inputs outputs #:allow-other-keys)
`("LD_LIBRARY_PATH" ":" prefix (,pulseaudio_path ,alas_lib_path)))))) (let* ((out (assoc-ref outputs "out"))
(add-after 'install 'install-godot-desktop (pulseaudio_path (string-append
(lambda* (#:key outputs #:allow-other-keys) (assoc-ref inputs "pulseaudio") "/lib"))
(let* ((out (assoc-ref outputs "out")) (alas_lib_path (string-append
(applications (string-append out "/share/applications")) (assoc-ref inputs "alsa-lib") "/lib")))
(icons (string-append out "/share/icons/hicolor"))) (wrap-program (string-append out "/bin/godot")
(mkdir-p applications) `("LD_LIBRARY_PATH" ":" prefix
(copy-file "misc/dist/linux/org.godotengine.Godot.desktop" (,pulseaudio_path ,alas_lib_path))))))
(string-append applications "/godot.desktop")) (add-after 'install 'install-godot-desktop
(for-each (lambda (icon dest) (lambda* (#:key outputs #:allow-other-keys)
(mkdir-p (dirname dest)) (let* ((out (assoc-ref outputs "out"))
(copy-file icon dest)) (applications (string-append out "/share/applications"))
'("icon.png" "icon.svg") (icons (string-append out "/share/icons/hicolor")))
`(,(string-append icons "/256x256/apps/godot.png") (mkdir-p applications)
,(string-append icons "/scalable/apps/godot.svg"))))))))) (copy-file "misc/dist/linux/org.godotengine.Godot.desktop"
(string-append applications "/godot.desktop"))
(for-each (lambda (icon dest)
(mkdir-p (dirname dest))
(copy-file icon dest))
'("icon.png" "icon.svg")
`(,(string-append icons "/256x256/apps/godot.png")
,(string-append icons
"/scalable/apps/godot.svg")))))))))
(outputs '("out" "headless")) (outputs '("out" "headless"))
(native-inputs (native-inputs
(list pkg-config)) (list pkg-config))