guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/05: gnu: godot: Build and install the headless version.


From: guix-commits
Subject: 03/05: gnu: godot: Build and install the headless version.
Date: Mon, 18 May 2020 12:25:58 -0400 (EDT)

ngz pushed a commit to branch master
in repository guix.

commit 545511df77837079afa63c1b420d8dd2b67f7235
Author: Timotej Lazar <address@hidden>
AuthorDate: Sun May 17 17:55:18 2020 +0200

    gnu: godot: Build and install the headless version.
    
    * gnu/packages/game-development.scm (godot): Build the headless (server)
    binary. This is needed to package games using Godot without depending on X.
    [outputs]: Add "headless".
    [arguments]<#:phases>[build-headless]: New phase.
    [arguments]<#:phases>[install]: Install headless version to separate output.
    
    Signed-off-by: Nicolas Goaziou <address@hidden>
---
 gnu/packages/game-development.scm | 35 +++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/game-development.scm 
b/gnu/packages/game-development.scm
index d84b3fb..03369a6 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1604,7 +1604,7 @@ games.")
                            "builtin_wslay=no"
                            "builtin_zlib=no"
                            "builtin_zstd=no")
-       #:tests? #f ; There are no tests
+       #:tests? #f                      ; There are no tests
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'scons-use-env
@@ -1617,20 +1617,30 @@ games.")
                  "env_base = Environment(tools=custom_tools)\n"
                  "env_base = Environment(ENV=os.environ)")))
              #t))
+         ;; Build headless tools, used for packaging games without depending 
on X.
+         (add-after 'build 'build-headless
+           (lambda* (#:key scons-flags #:allow-other-keys)
+             (apply invoke "scons"
+                    `(,(string-append "-j" (number->string 
(parallel-job-count)))
+                      "platform=server" ,@(delete "platform=x11" 
scons-flags)))))
          (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
+           (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
-                    (bin (string-append out "/bin")))
+                    (headless (assoc-ref outputs "headless"))
+                    (zenity (assoc-ref inputs "zenity")))
+               ;; Strip build info from filenames.
                (with-directory-excursion "bin"
-                 (if (file-exists? "godot.x11.tools.64")
-                     (rename-file "godot.x11.tools.64" "godot")
-                     (rename-file "godot.x11.tools.32" "godot"))
-                 (install-file "godot" bin))
-               ;; Tell Godot where to find zenity for OS.alert().
-               (wrap-program (string-append bin "/godot")
-                 `("PATH" ":" prefix
-                   (,(string-append (assoc-ref %build-inputs "zenity") 
"/bin"))))
-               #t)))
+                 (for-each
+                  (lambda (file)
+                    (let ((dest (car (string-split (basename file) #\.))))
+                      (rename-file file dest)))
+                  (find-files "." "godot.*\\.x11\\.opt\\.tools.*"))
+                 (install-file "godot" (string-append out "/bin"))
+                 (install-file "godot_server" (string-append headless "/bin")))
+               ;; Tell the editor where to find zenity for OS.alert().
+               (wrap-program (string-append out "/bin/godot")
+                 `("PATH" ":" prefix (,(string-append zenity "/bin")))))
+             #t))
          (add-after 'install 'install-godot-desktop
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
@@ -1652,6 +1662,7 @@ games.")
                            Type=Application~%"
                            out)))
                #t))))))
+    (outputs '("out" "headless"))
     (native-inputs `(("pkg-config" ,pkg-config)))
     (inputs `(("alsa-lib" ,alsa-lib)
               ("bullet" ,bullet)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]