From 9866ea5245979ccb61a0a71499e268b0234d92ff Mon Sep 17 00:00:00 2001
From: Comrade Yuri <yuri@nijino>
Date: Sun, 20 Oct 2019 14:02:19 +0200
Subject: [PATCH 5/5] gnu: compile Ren'py games
* /gnu/packages/game-development: (python2-renpy) [arguments]: Update comment
on #:tests?
(renpy) [arguments]: Ditto.
[start-xserver]: New phase.
[build]: New phase.
[inputs]: Add xorg-server.
---
gnu/packages/game-development.scm | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
@@ -1033,7 +1033,7 @@ developed mainly for Ren'py.")
(sha256 (base32 "1anr5cfbvbsbik4v4rvrkdkciwhg700k4lydfbs4n85raimz9mw4"))))
(build-system python-build-system)
(arguments
- `(#:tests? #f ; non-trivial tests require a more complete Ren'py
+ `(#:tests? #f ; Ren'py doesn't seem to package tests
#:python ,python-2
#:phases
(modify-phases %standard-phases
@@ -1066,7 +1066,6 @@ developed mainly for Ren'py.")
(invoke "python" "-m" "compileall" "renpy"))
(getcwd) args)
#t))
-
(replace 'install
(lambda args
(apply
@@ -1110,9 +1109,7 @@ of renpy.")
(version "7.3.5")
(build-system python-build-system)
(arguments
- `(;; TODO: We currently can't run renpy inside the guixbuilder.
- ;; Perhaps we should set up an X server.
- #:tests? #f
+ `(#:tests? #f ; see python2-renpy
#:python ,python-2
#:phases
(modify-phases %standard-phases
@@ -1138,8 +1135,19 @@ of renpy.")
"launcher/game/gui7/images.py")
((", \"game\",") ","))
#t))
- ;; TODO: Here we would use ren'py to compile the games.
- (delete 'build)
+ (add-before 'build 'start-xserver
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((xorg-server (assoc-ref inputs "xorg-server")))
+ (setenv "HOME" (getcwd))
+ (system (format #f "~a/bin/Xvfb :1 &" xorg-server))
+ (setenv "DISPLAY" ":1")
+ #t)))
+ (replace 'build
+ (lambda _
+ (invoke "python" "renpy.py" "launcher" "quit")
+ (invoke "python" "renpy.py" "the_question" "quit")
+ (invoke "python" "renpy.py" "tutorial" "quit")
+ #t))
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
;; Here we install our custom renpy program.
@@ -1272,7 +1280,8 @@ if __name__ == \"__main__\":
(inputs
`(("python2-tkinter" ,python-2 "tk")
("python2-pygame" ,python2-pygame-sdl2)
- ("python2-renpy" ,python2-renpy)))
+ ("python2-renpy" ,python2-renpy)
+ ("xorg-server" ,xorg-server)))
(outputs
(list "out" "tutorial" "the-question"))
(home-page "http://www.renpy.org/")
--
2.23.0