gnu: renpy: Use new style.
* gnu/packages/game-development.scm (renpy)[arguments]: Change to list of G-Expressions. [inputs]: Drop labels. [native-inputs, outputs]: Squash to single line.
parent
6c04a8961f
commit
f7d66e41f8
|
@ -48,6 +48,7 @@
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module ((guix licenses) #:prefix license:)
|
#:use-module ((guix licenses) #:prefix license:)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
|
#:use-module (guix gexp)
|
||||||
#:use-module (guix download)
|
#:use-module (guix download)
|
||||||
#:use-module (guix git-download)
|
#:use-module (guix git-download)
|
||||||
#:use-module (guix svn-download)
|
#:use-module (guix svn-download)
|
||||||
|
@ -1352,156 +1353,154 @@ are only used to bootstrap it.")
|
||||||
(name "renpy")
|
(name "renpy")
|
||||||
(build-system python-build-system)
|
(build-system python-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:tests? #f ; see python-renpy
|
(list
|
||||||
#:modules ((srfi srfi-1)
|
#:tests? #f ; see python-renpy
|
||||||
|
#:modules '((srfi srfi-1)
|
||||||
(guix build python-build-system)
|
(guix build python-build-system)
|
||||||
(guix build utils))
|
(guix build utils))
|
||||||
#:imported-modules ((srfi srfi-1) ,@%python-build-system-modules)
|
#:imported-modules `((srfi srfi-1) ,@%python-build-system-modules)
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-phases
|
#~(modify-phases %standard-phases
|
||||||
(add-after 'unpack 'fix-commands
|
(add-after 'unpack 'fix-commands
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
(substitute* "launcher/game/choose_directory.rpy"
|
(substitute* "launcher/game/choose_directory.rpy"
|
||||||
(("/usr/bin/python")
|
(("/usr/bin/python")
|
||||||
(search-input-file inputs "/bin/python3")))
|
(search-input-file inputs "/bin/python3")))
|
||||||
(substitute* "launcher/game/front_page.rpy"
|
(substitute* "launcher/game/front_page.rpy"
|
||||||
(("xdg-open")
|
(("xdg-open")
|
||||||
(search-input-file inputs "/bin/xdg-open")))
|
(search-input-file inputs "/bin/xdg-open")))
|
||||||
(substitute* "launcher/game/project.rpy"
|
(substitute* "launcher/game/project.rpy"
|
||||||
(("cmd = \\[ executable, \"-EO\", sys.argv\\[0\\] \\]")
|
(("cmd = \\[ executable, \"-EO\", sys.argv\\[0\\] \\]")
|
||||||
(string-append "cmd = [ \"" (assoc-ref outputs "out")
|
(string-append "cmd = [ \"" (assoc-ref outputs "out")
|
||||||
"/bin/renpy\" ]"))
|
"/bin/renpy\" ]"))
|
||||||
;; Projects are still created in the usual style, so we need
|
;; Projects are still created in the usual style, so we need
|
||||||
;; to adjust the path.
|
;; to adjust the path.
|
||||||
(("cmd.append\\(self.path\\)")
|
(("cmd.append\\(self.path\\)")
|
||||||
"cmd.append(self.path + \"/game\")"))))
|
"cmd.append(self.path + \"/game\")"))))
|
||||||
(add-after 'unpack 'drop-game-from-paths
|
(add-after 'unpack 'drop-game-from-paths
|
||||||
(lambda _
|
(lambda _
|
||||||
(substitute* (list "launcher/game/gui7.rpy"
|
(substitute* (list "launcher/game/gui7.rpy"
|
||||||
"launcher/game/gui7/images.py")
|
"launcher/game/gui7/images.py")
|
||||||
((", \"game\",") ","))
|
((", \"game\",") ","))
|
||||||
#t))
|
#t))
|
||||||
(add-before 'build 'start-xserver
|
(add-before 'build 'start-xserver
|
||||||
(lambda* (#:key inputs native-inputs #:allow-other-keys)
|
(lambda* (#:key inputs native-inputs #:allow-other-keys)
|
||||||
(let ((Xvfb (search-input-file (or native-inputs inputs)
|
(let ((Xvfb (search-input-file (or native-inputs inputs)
|
||||||
"/bin/Xvfb")))
|
"/bin/Xvfb")))
|
||||||
(setenv "HOME" (getcwd))
|
(setenv "HOME" (getcwd))
|
||||||
(system (format #f "~a :1 &" Xvfb))
|
(system (format #f "~a :1 &" Xvfb))
|
||||||
(setenv "DISPLAY" ":1"))))
|
(setenv "DISPLAY" ":1"))))
|
||||||
(replace 'build
|
(replace 'build
|
||||||
(lambda _
|
(lambda _
|
||||||
(invoke "python" "renpy.py" "launcher" "quit")
|
(invoke "python" "renpy.py" "launcher" "quit")
|
||||||
(invoke "python" "renpy.py" "the_question" "quit")
|
(invoke "python" "renpy.py" "the_question" "quit")
|
||||||
(invoke "python" "renpy.py" "tutorial" "quit")))
|
(invoke "python" "renpy.py" "tutorial" "quit")))
|
||||||
(replace 'install
|
(replace 'install
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
;; Here we install our custom renpy program.
|
;; Here we install our custom renpy program.
|
||||||
;; After finishing this step, "out" will have the following:
|
;; After finishing this step, "out" will have the following:
|
||||||
;; |-- bin/renpy
|
;; |-- bin/renpy
|
||||||
;; `-- share/renpy ; i.e. path_to_renpy_base()
|
;; `-- share/renpy ; i.e. path_to_renpy_base()
|
||||||
;; |-- common
|
;; |-- common
|
||||||
;; `-- gui
|
;; `-- gui
|
||||||
;;
|
;;
|
||||||
;; Note that common shares the source files that would be installed
|
;; Note that common shares the source files that would be installed
|
||||||
;; by python-renpy (which are instead deleted from that package),
|
;; by python2-renpy (which are instead deleted from that package),
|
||||||
;; but also contains their byte-compiled versions.
|
;; but also contains their byte-compiled versions.
|
||||||
;; On other systems, renpy_base would point to site-packages or
|
;; On other systems, renpy_base would point to site-packages or
|
||||||
;; even somewhere in /opt.
|
;; even somewhere in /opt.
|
||||||
;; The former approach is not as straightforward as it seems
|
;; The former approach is not as straightforward as it seems
|
||||||
;; -- it causes renpy to load files twice for some weird reason --
|
;; -- it causes renpy to load files twice for some weird reason --
|
||||||
;; and the latter is impossible on Guix. Hence the detour through
|
;; and the latter is impossible on Guix. Hence the detour through
|
||||||
;; share/renpy and the custom renpy program.
|
;; share/renpy and the custom renpy program.
|
||||||
;;
|
;;
|
||||||
;; As a convention, other games should be installed as
|
;; As a convention, other games should be installed as
|
||||||
;; subdirectories of share/renpy in their respective outputs as
|
;; subdirectories of share/renpy in their respective outputs as
|
||||||
;; well. This differs from the traditional layout, which is
|
;; well. This differs from the traditional layout, which is
|
||||||
;; roughly the following:
|
;; roughly the following:
|
||||||
;; `-- Super Awesome Game
|
;; `-- Super Awesome Game
|
||||||
;; |-- game ; <- the folder we actually want
|
;; |-- game ; <- the folder we actually want
|
||||||
;; |-- lib ; compiled renpy module and dependencies
|
;; |-- lib ; compiled renpy module and dependencies
|
||||||
;; |-- renpy ; yet another copy of Ren'py's code
|
;; |-- renpy ; yet another copy of Ren'py's code
|
||||||
;; | |-- common ; the common folder from above
|
;; | |-- common ; the common folder from above
|
||||||
;; | `-- ... ; Python code (source + compiled)
|
;; | `-- ... ; Python code (source + compiled)
|
||||||
;; |-- Super Awesome Game.py
|
;; |-- Super Awesome Game.py
|
||||||
;; `-- Super Awesome Game.sh
|
;; `-- Super Awesome Game.sh
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(bin/renpy (string-append out "/bin/renpy")))
|
(bin/renpy (string-append out "/bin/renpy")))
|
||||||
(copy-recursively "renpy/common"
|
(copy-recursively "renpy/common"
|
||||||
(string-append out "/share/renpy/common"))
|
(string-append out "/share/renpy/common"))
|
||||||
(copy-recursively "gui"
|
(copy-recursively "gui"
|
||||||
(string-append out "/share/renpy/gui"))
|
(string-append out "/share/renpy/gui"))
|
||||||
|
|
||||||
(mkdir-p (string-append out "/bin"))
|
(mkdir-p (string-append out "/bin"))
|
||||||
(copy-file (assoc-ref inputs "renpy.in") bin/renpy)
|
(copy-file #$(local-file (search-auxiliary-file "renpy/renpy.in"))
|
||||||
(substitute* bin/renpy
|
bin/renpy)
|
||||||
(("@PYTHON@") (search-input-file inputs "bin/python3"))
|
(substitute* bin/renpy
|
||||||
(("@RENPY_BASE@") (string-append out "/share/renpy")))
|
(("@PYTHON@") (search-input-file inputs "bin/python3"))
|
||||||
(chmod bin/renpy #o755))))
|
(("@RENPY_BASE@") (string-append out "/share/renpy")))
|
||||||
|
(chmod bin/renpy #o755))))
|
||||||
|
|
||||||
(add-after 'install 'install-games
|
(add-after 'install 'install-games
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
(define renpy (assoc-ref outputs "out"))
|
(define renpy (assoc-ref outputs "out"))
|
||||||
;; TODO: We should offer a renpy-build-system to make the
|
;; TODO: We should offer a renpy-build-system to make the
|
||||||
;; installation of Ren'py games easier.
|
;; installation of Ren'py games easier.
|
||||||
(define* (install-renpy-game #:key output game name (renpy renpy)
|
(define* (install-renpy-game #:key output game name (renpy renpy)
|
||||||
#:allow-other-keys)
|
#:allow-other-keys)
|
||||||
(let* ((name (or name (basename game)))
|
(let* ((name (or name (basename game)))
|
||||||
(launcher (string-append output "/bin/renpy-" name))
|
(launcher (string-append output "/bin/renpy-" name))
|
||||||
(share (string-append output "/share/renpy/" name)))
|
(share (string-append output "/share/renpy/" name)))
|
||||||
(copy-recursively (string-append game "/game") share)
|
(copy-recursively (string-append game "/game") share)
|
||||||
(mkdir-p (string-append output "/bin"))
|
(mkdir-p (string-append output "/bin"))
|
||||||
(with-output-to-file launcher
|
(with-output-to-file launcher
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(format #t
|
(format #t
|
||||||
"#!~a~%~a ~a \"$@\""
|
"#!~a~%~a ~a \"$@\""
|
||||||
(search-input-file inputs "/bin/bash")
|
(search-input-file inputs "/bin/bash")
|
||||||
(string-append renpy "/bin/renpy")
|
(string-append renpy "/bin/renpy")
|
||||||
share)))
|
share)))
|
||||||
(chmod launcher #o755)))
|
(chmod launcher #o755)))
|
||||||
|
|
||||||
(install-renpy-game #:output (assoc-ref outputs "out")
|
(install-renpy-game #:output (assoc-ref outputs "out")
|
||||||
#:game "launcher")
|
#:game "launcher")
|
||||||
|
|
||||||
(install-renpy-game #:output (assoc-ref outputs "the-question")
|
(install-renpy-game #:output (assoc-ref outputs "the-question")
|
||||||
#:game "the_question"
|
#:game "the_question"
|
||||||
#:name "the-question")
|
#:name "the-question")
|
||||||
|
|
||||||
(install-renpy-game #:output (assoc-ref outputs "tutorial")
|
(install-renpy-game #:output (assoc-ref outputs "tutorial")
|
||||||
#:game "tutorial")))
|
#:game "tutorial")))
|
||||||
(replace 'wrap
|
(replace 'wrap
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
(let ((out (assoc-ref outputs "out"))
|
(let ((out (assoc-ref outputs "out"))
|
||||||
(site (string-append "/lib/python"
|
(site (string-append "/lib/python"
|
||||||
(python-version
|
(python-version
|
||||||
(assoc-ref inputs "python"))
|
(assoc-ref inputs "python"))
|
||||||
"/site-packages")))
|
"/site-packages")))
|
||||||
(wrap-program (string-append out "/bin/renpy")
|
(wrap-program (string-append out "/bin/renpy")
|
||||||
`("GUIX_PYTHONPATH" =
|
`("GUIX_PYTHONPATH" =
|
||||||
(,@(delete-duplicates
|
(,@(delete-duplicates
|
||||||
(map
|
(map
|
||||||
(lambda (store-path)
|
(lambda (store-path)
|
||||||
(string-append store-path site))
|
(string-append store-path site))
|
||||||
(cons (assoc-ref outputs "out")
|
(cons (assoc-ref outputs "out")
|
||||||
(map cdr
|
(map cdr
|
||||||
(filter
|
(filter
|
||||||
(lambda (input)
|
(lambda (input)
|
||||||
(string-prefix? "python" (car input)))
|
(string-prefix? "python" (car input)))
|
||||||
inputs))))))))))))))
|
inputs))))))))))))))
|
||||||
(inputs
|
(inputs (list bash-minimal
|
||||||
`(("bash-minimal" ,bash-minimal)
|
python
|
||||||
("renpy.in" ,(search-auxiliary-file "renpy/renpy.in"))
|
python-pefile
|
||||||
("python-pefile" ,python-pefile)
|
python-requests
|
||||||
("python-requests" ,python-requests)
|
python-renpy
|
||||||
("python-renpy" ,python-renpy)
|
python-six
|
||||||
("python:tk" ,python "tk")
|
`(,python "tk")
|
||||||
("python-six" ,python-six)
|
xdg-utils))
|
||||||
("python" ,python) ; for ‘fix-commands’ and ‘wrap’
|
|
||||||
("xdg-utils" ,xdg-utils)))
|
|
||||||
(propagated-inputs '())
|
(propagated-inputs '())
|
||||||
(native-inputs
|
(native-inputs (list xorg-server-for-tests))
|
||||||
(list xorg-server-for-tests))
|
(outputs (list "out" "tutorial" "the-question"))
|
||||||
(outputs
|
|
||||||
(list "out" "tutorial" "the-question"))
|
|
||||||
(home-page "https://www.renpy.org/")
|
(home-page "https://www.renpy.org/")
|
||||||
(synopsis "Visual Novel Engine")
|
(synopsis "Visual Novel Engine")
|
||||||
(description "Ren'Py is a visual novel engine that helps you use words,
|
(description "Ren'Py is a visual novel engine that helps you use words,
|
||||||
|
|
Reference in New Issue