* [bug#37714] Add renpy package
@ 2019-10-12 7:20 Leo Prikler
2019-10-14 9:00 ` Leo Prikler
2019-10-18 19:49 ` Nicolas Goaziou
0 siblings, 2 replies; 10+ messages in thread
From: Leo Prikler @ 2019-10-12 7:20 UTC (permalink / raw)
To: 37714
[-- Attachment #1: Type: text/plain, Size: 657 bytes --]
This patch adds the Ren'py Visual Novel engine split into four outputs:
- "out": contains the engine itself. Since Guix differs strongly from
the platforms Ren'py usually runs on, we ship our own Ren'py main file.
- "launcher": The Ren'py launcher, that people would normally expect
when invoking renpy -- it does not seem very usable in Guix, though.
- "the-question": An example game, that ships with Ren'py.
- "tutorial": The tutorial that ships with Ren'py.
Ren'py also ships its own version of pygame. They call it pygame_sdl2
since it's a reimplementation of pygame using SDL2, but the tags make
it very clear, that it is developed alongside Ren'py.
[-- Attachment #2: 0001-gnu-Add-python2-renpy.patch --]
[-- Type: text/x-patch, Size: 10314 bytes --]
From edbb52a156a9129a7f5a74e5d6afc03ae1adf2dd Mon Sep 17 00:00:00 2001
From: Leo Prikler <leo.prikler@student.tugraz.at>
Date: Sat, 12 Oct 2019 08:34:31 +0200
Subject: [PATCH] gnu: Add python2-renpy
* gnu/packages/game-development: (python2-pygame-for-renpy): New procedure.
(python2-renpy): New variable.
---
gnu/packages/game-development.scm | 240 ++++++++++++++++++++++++++++++
1 file changed, 240 insertions(+)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 7fc0122faa..134664e773 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -971,6 +971,246 @@ to create fully featured games and multimedia programs in the python language.")
(define-public python2-pygame
(package-with-python2 python-pygame))
+(define (python2-pygame-for-renpy version hash)
+ (package
+ (inherit python2-pygame)
+ (name "python2-pygame-for-renpy")
+ (version version)
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/renpy/pygame_sdl2.git")
+ (commit (string-append "renpy-" version))))
+ (sha256
+ (base32
+ hash))
+ (file-name (git-file-name name version))))
+ (build-system python-build-system)
+ (arguments
+ `(#:tests? #f ; tests require pygame to be installed first
+ #:python ,python-2
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'set-paths 'set-sdl-vars
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "PYGAME_SDL2_CFLAGS"
+ (string-append "-I"
+ (assoc-ref inputs "sdl-union")
+ "/include/SDL2 -D_REENTRANT"))
+ (setenv "PYGAME_SDL2_LDFLAGS"
+ (string-append "-L"
+ (assoc-ref inputs "sdl-union")
+ "/lib -Wl,-rpath,"
+ (assoc-ref inputs "sdl-union")
+ "/lib -Wl,--enable-new-dtags -lSDL2"))
+ #t)))))
+ (inputs
+ `(("sdl-union"
+ ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
+ (native-inputs
+ `(("python2-cython" ,python2-cython)))
+ (home-page "http://www.renpy.org/")
+ (synopsis "Reimplementation of the Pygame API using SDL2")
+ (license (list license:lgpl2.1 license:zlib))))
+
+(define-public python2-renpy
+ (package
+ (name "python2-renpy")
+ (version "7.3.4.596")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/renpy/renpy.git")
+ (commit version)))
+ (sha256
+ (base32
+ "11g01bm1bxmc5f7l8ybaf8lg27i3fhy4i69dpwdsalv03i5xbw6y"))
+ (file-name (git-file-name name version))))
+ (build-system python-build-system)
+ (arguments
+ `(#:tests? #f ; can't really run renpy in guixbuilder
+ #:python ,python-2
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'set-paths 'set-build-vars
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "RENPY_CYTHON"
+ (string-append (assoc-ref inputs "python2-cython")
+ "/bin/cython"))
+ (setenv "RENPY_DEPS_INSTALL"
+ (string-join
+ (map cdr inputs)
+ ":"))
+ #t))
+ (replace 'build
+ (lambda args
+ (apply
+ (lambda* (build-root #:key inputs outputs #:allow-other-keys)
+ (chdir "module")
+ (apply (assoc-ref %standard-phases 'build) args)
+ (chdir build-root)
+ (delete-file "renpy/__init__.pyc")
+ (invoke "python" "-m" "compileall" "renpy"))
+ (getcwd) args)
+ #t))
+ (replace 'install
+ (lambda args
+ (apply
+ (lambda* (build-root #:key inputs outputs #:allow-other-keys)
+ (let* ((pygame (assoc-ref inputs "python2-pygame"))
+ (out (assoc-ref outputs "out"))
+ (site (string-append "/lib/python"
+ ,(version-major+minor
+ (package-version python-2))
+ "/site-packages")))
+ (chdir "module")
+ (apply (assoc-ref %standard-phases 'install) args)
+ (chdir build-root)
+ (copy-recursively "renpy"
+ (string-append out site "/renpy"))))
+ (getcwd) args)
+ #t))
+
+ (add-after 'install 'install-renpy
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((source (assoc-ref inputs "source"))
+ (pygame (assoc-ref inputs "python2-pygame"))
+
+ (site (string-append "/lib/python"
+ ,(version-major+minor
+ (package-version python-2))
+ "/site-packages"))
+
+ (out (assoc-ref outputs "out"))
+ (bin/renpy (string-append out "/bin/renpy")))
+ (chdir source)
+ (mkdir-p (string-append out "/bin"))
+
+ (copy-recursively "renpy/common"
+ (string-append out "/share/renpy/common"))
+
+ (call-with-output-file bin/renpy
+ (lambda (port)
+ (format port "#!~a~%" (which "python2"))
+ (format port "
+from __future__ import print_function
+
+import os
+import sys
+import warnings
+
+def path_to_common(renpy_base):
+ return renpy_base + \"/common\"
+
+def path_to_saves(gamedir, save_directory=None):
+ import renpy # @UnresolvedImport
+
+ if save_directory is None:
+ save_directory = renpy.config.save_directory
+ save_directory = renpy.exports.fsencode(save_directory)
+
+ if not save_directory:
+ return gamedir + \"/saves\"
+
+ return os.path.expanduser(\"~~/.renpy/\" + save_directory)
+
+def path_to_renpy_base():
+ return \"~a\"
+
+def main():
+ renpy_base = path_to_renpy_base()
+ try:
+ import renpy.bootstrap
+ import renpy.arguments
+ except ImportError:
+ print(\"\"\"Could not import renpy.bootstrap.
+Please ensure you decompressed Ren'Py correctly, preserving the directory
+structure.\"\"\", file=sys.stderr)
+ raise
+
+ args = renpy.arguments.bootstrap()
+ if not args.basedir:
+ print(\"\"\"This Ren'py requires a basedir to launch.
+The basedir is the directory, in which .rpy files live -- usually the 'game'
+subdirectory of a game packaged by Ren'py.
+
+If you want the Ren'py launcher, use renpy-launcher from python2-renpy:launcher
+instead.\"\"\", file=sys.stderr)
+ sys.exit()
+
+ renpy.bootstrap.bootstrap(renpy_base)
+
+if __name__ == \"__main__\":
+ main()
+"
+ (string-append out "/share/renpy"))))
+
+ (chmod bin/renpy #o755)
+
+ (wrap-program bin/renpy
+ `("PYTHONPATH" prefix
+ (,(string-append out site)
+ ,(string-append pygame site))))
+ #t)))
+ (add-after 'install 'install-games
+ (lambda* (#:key outputs #:allow-other-keys)
+ (define renpy (assoc-ref outputs "out"))
+ (define* (install-renpy-game #:key output game name (renpy renpy)
+ #:allow-other-keys)
+ (let* ((name (or name (basename game)))
+ (launcher (string-append output "/bin/renpy-" name))
+ (share (string-append output "/share/renpy/" name)))
+ (copy-recursively (string-append game "/game") share)
+ (mkdir-p (string-append output "/bin"))
+ (with-output-to-file launcher
+ (lambda ()
+ (format #t
+ "#!~a~%~a ~a \"$@\""
+ (which "bash")
+ (string-append renpy "/bin/renpy")
+ share)))
+ (chmod launcher #o755)))
+
+ (install-renpy-game #:output (assoc-ref outputs "launcher")
+ #:game "launcher")
+
+ (install-renpy-game #:output (assoc-ref outputs "the-question")
+ #:game "the_question"
+ #:name "the-question")
+
+ (install-renpy-game #:output (assoc-ref outputs "tutorial")
+ #:game "tutorial")))
+ ;; we already do our own wrapping during 'install-renpy
+ (delete 'wrap))))
+ (inputs
+ `(("ffmpeg" ,ffmpeg)
+ ("freetype" ,freetype)
+ ("glew" ,glew)
+ ("libpng" ,libpng)
+ ("sdl-union"
+ ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))
+ ("python" ,python)))
+ (outputs
+ (list "out" "launcher" "tutorial" "the-question"))
+ (propagated-inputs
+ `(("python2-pygame"
+ ,(python2-pygame-for-renpy
+ version
+ "1gwbqkyv7763813x7nmzb3nz4r8673d33ggsp6lgp1d640rimlpb"))))
+ (native-inputs
+ `(("python2-cython" ,python2-cython)))
+ (home-page "http://www.renpy.org/")
+ (synopsis "The Ren'Py Visual Novel Engine -- libary files")
+ (description "Ren'Py is a visual novel engine -- used by thousands of
+creators from around the world -- that helps you use words, images, and sounds
+to tell interactive stories that run on computers and mobile devices. These can
+be both visual novels and life simulation games. The easy to learn script
+language allows anyone to efficiently write large visual novels, while its
+Python scripting is enough for complex simulation games.")
+ (license license:x11)))
+
(define-public grafx2
(package
(name "grafx2")
--
2.23.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#37714] Add renpy package
2019-10-12 7:20 [bug#37714] Add renpy package Leo Prikler
@ 2019-10-14 9:00 ` Leo Prikler
2019-10-18 19:49 ` Nicolas Goaziou
1 sibling, 0 replies; 10+ messages in thread
From: Leo Prikler @ 2019-10-14 9:00 UTC (permalink / raw)
To: 37714
[-- Attachment #1: Type: text/plain, Size: 93 bytes --]
A small fixup to correct the synopsis of python2-renpy. It should now
follow the guidelines.
[-- Attachment #2: 0002-gnu-python2-renpy-fix-synopsis.patch --]
[-- Type: text/x-patch, Size: 1094 bytes --]
From fec000e3ca6f8e91504954995389c495590949ed Mon Sep 17 00:00:00 2001
From: Leo Prikler <leo.prikler@student.tugraz.at>
Date: Mon, 14 Oct 2019 10:55:59 +0200
Subject: [PATCH 2/2] gnu: python2-renpy: fix synopsis
* /gnu/packages/game-development: (python2-renpy): Follow synopsis guidelines.
---
gnu/packages/game-development.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 134664e773..98330c07a9 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1202,7 +1202,7 @@ if __name__ == \"__main__\":
(native-inputs
`(("python2-cython" ,python2-cython)))
(home-page "http://www.renpy.org/")
- (synopsis "The Ren'Py Visual Novel Engine -- libary files")
+ (synopsis "Visual novel engine")
(description "Ren'Py is a visual novel engine -- used by thousands of
creators from around the world -- that helps you use words, images, and sounds
to tell interactive stories that run on computers and mobile devices. These can
--
2.23.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#37714] Add renpy package
2019-10-12 7:20 [bug#37714] Add renpy package Leo Prikler
2019-10-14 9:00 ` Leo Prikler
@ 2019-10-18 19:49 ` Nicolas Goaziou
2019-10-19 20:59 ` Leo Prikler
1 sibling, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2019-10-18 19:49 UTC (permalink / raw)
To: Leo Prikler; +Cc: 37714
Hello,
Leo Prikler <leo.prikler@student.tugraz.at> writes:
> This patch adds the Ren'py Visual Novel engine split into four
> outputs:
Great! It was on my TODO list, too.
> - "out": contains the engine itself. Since Guix differs strongly from
> the platforms Ren'py usually runs on, we ship our own Ren'py main file.
> - "launcher": The Ren'py launcher, that people would normally expect
> when invoking renpy -- it does not seem very usable in Guix, though.
What do you mean?
> * gnu/packages/game-development: (python2-pygame-for-renpy): New procedure.
> (python2-renpy): New variable.
New variable for both in enough, I think.
> +(define (python2-pygame-for-renpy version hash)
> + (package
> + (inherit python2-pygame)
> + (name "python2-pygame-for-renpy")
> + (version version)
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/renpy/pygame_sdl2.git")
> + (commit (string-append "renpy-" version))))
Upstream provides a tarball for that:
https://www.renpy.org/dl/7.3.5/pygame_sdl2-2.1.0-for-renpy-7.3.5.tar.gz
I think it is preferable using it than pointing to Github.
> + (sha256
> + (base32
> + hash))
Nitpick: At least bash32 and hash could go on the same line.
> + (home-page "http://www.renpy.org/")
> + (synopsis "Reimplementation of the Pygame API using SDL2")
The description field is missing. Could you add one?
> +(define-public python2-renpy
"python2" prefix is for libraries. I think this one can be called
"renpy".
> + (package
> + (name "python2-renpy")
> + (version "7.3.4.596")
I noticed 7.3.5 is out. Could you update it?
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/renpy/renpy.git")
> + (commit version)))
As above, I suggest to use tarball from main site:
https://www.renpy.org/dl/7.3.5/renpy-7.3.5-source.tar.bz2
> + (replace 'build
> + (lambda args
> + (apply
> + (lambda* (build-root #:key inputs outputs #:allow-other-keys)
> + (chdir "module")
> + (apply (assoc-ref %standard-phases 'build) args)
> + (chdir build-root)
> + (delete-file "renpy/__init__.pyc")
> + (invoke "python" "-m" "compileall" "renpy"))
> + (getcwd) args)
> + #t))
This is a bit confusing because you're not really replacing `build'
phase, but wrapping stuff around it. I think it may be better to add
a `before-build' and an `after-build' phases, adding comments, if
possible, to explain why they are needed.
> + (replace 'install
> + (lambda args
> + (apply
> + (lambda* (build-root #:key inputs outputs #:allow-other-keys)
> + (let* ((pygame (assoc-ref inputs "python2-pygame"))
> + (out (assoc-ref outputs "out"))
> + (site (string-append "/lib/python"
> + ,(version-major+minor
> + (package-version python-2))
> + "/site-packages")))
> + (chdir "module")
> + (apply (assoc-ref %standard-phases 'install) args)
> + (chdir build-root)
> + (copy-recursively "renpy"
> + (string-append out site "/renpy"))))
> + (getcwd) args)
> + #t))
See above. It might be more readable to use one phase before, and one
after.
> + (inputs
> + `(("ffmpeg" ,ffmpeg)
> + ("freetype" ,freetype)
> + ("glew" ,glew)
> + ("libpng" ,libpng)
> + ("sdl-union"
> + ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))
> + ("python" ,python)))
So it needs both Python 2 and Python 3?
Could you order alphabetically the inputs?
> + (outputs
> + (list "out" "launcher" "tutorial" "the-question"))
> + (propagated-inputs
> + `(("python2-pygame"
> + ,(python2-pygame-for-renpy
> + version
> + "1gwbqkyv7763813x7nmzb3nz4r8673d33ggsp6lgp1d640rimlpb"))))
Could you see if there's a way to not propagate this input? What happens
if it is a simple input?
> + (native-inputs
> + `(("python2-cython" ,python2-cython)))
> + (home-page "http://www.renpy.org/")
> + (synopsis "The Ren'Py Visual Novel Engine -- libary files")
> + (description "Ren'Py is a visual novel engine -- used by thousands of
> +creators from around the world -- that helps you use words, images, and sounds
> +to tell interactive stories that run on computers and mobile devices. These can
> +be both visual novels and life simulation games. The easy to learn script
> +language allows anyone to efficiently write large visual novels, while its
> +Python scripting is enough for complex simulation games.")
You need to add two spaces at the end of sentences.
> + (license license:x11)))
I this should be license:expat.
Could you send an updated patch?
Thank you for the work.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#37714] Add renpy package
2019-10-18 19:49 ` Nicolas Goaziou
@ 2019-10-19 20:59 ` Leo Prikler
2019-10-20 12:09 ` Leo Prikler
0 siblings, 1 reply; 10+ messages in thread
From: Leo Prikler @ 2019-10-19 20:59 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: 37714
[-- Attachment #1: Type: text/plain, Size: 738 bytes --]
After some work, I've come up with this new patchset.
- 0001 is an update of the previous 0001 with most of the issues raised
(hopefully) being addressed. It still uses git from source and wraps
the build and install phase, though.
- 0002 causes the packages to use the main site instead of git.
- 0003 splits renpy into the python package python2-renpy and the
program itself. This makes the build rules a little easier to read,
even if they themselves did not change much.
- 0004 fixes the launcher (mostly). One can now set a project
directory, create projects, launch created projects and open project
directories in the default file explorer. However, setting the editor
(and hence launching one) still does not work.
Regards,
Leo
[-- Attachment #2: 0001-gnu-Add-renpy.patch --]
[-- Type: text/x-patch, Size: 12768 bytes --]
From c0890a64b9acf5c68fa0da0b8cc68e82f272e199 Mon Sep 17 00:00:00 2001
From: Comrade Yuri <yuri@nijino>
Date: Sat, 19 Oct 2019 17:40:27 +0200
Subject: [PATCH 1/4] gnu: Add renpy
* gnu/packages/game-development: (python2-pygame-for-renpy): New variable.
(python2-renpy): New variable.
---
gnu/packages/game-development.scm | 275 ++++++++++++++++++++++++++++++
1 file changed, 275 insertions(+)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index eb92443e0d..f04a9a5f51 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -971,6 +971,281 @@ to create fully featured games and multimedia programs in the python language.")
(define-public python2-pygame
(package-with-python2 python-pygame))
+(define (python2-pygame-for-renpy version hash)
+ (package
+ (inherit python2-pygame)
+ (name "python2-pygame-for-renpy")
+ (version version)
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/renpy/pygame_sdl2.git")
+ (commit (string-append "renpy-" version))))
+ (sha256 (base32 hash))
+ (file-name (git-file-name name version))))
+ (build-system python-build-system)
+ (arguments
+ `(#:tests? #f ; tests require pygame to be installed first
+ #:python ,python-2
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'set-paths 'set-sdl-vars
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "PYGAME_SDL2_CFLAGS"
+ (string-append "-I"
+ (assoc-ref inputs "sdl-union")
+ "/include/SDL2 -D_REENTRANT"))
+ (setenv "PYGAME_SDL2_LDFLAGS"
+ (string-append "-L"
+ (assoc-ref inputs "sdl-union")
+ "/lib -Wl,-rpath,"
+ (assoc-ref inputs "sdl-union")
+ "/lib -Wl,--enable-new-dtags -lSDL2"))
+ #t)))))
+ (inputs
+ `(("sdl-union"
+ ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
+ (native-inputs
+ `(("python2-cython" ,python2-cython)))
+ (home-page "http://www.renpy.org/")
+ (synopsis "Reimplementation of the Pygame API using SDL2")
+ (description "Pygame_SDL2 reimplements the Pygame API using SDL2,
+staying close to the original, but also adding some SDL2-specific features.
+While it aims to be used as a drop-in replacement, it appears to be
+developed mainly for Ren'py.")
+ (license (list license:lgpl2.1 license:zlib))))
+
+(define-public renpy
+ (package
+ (name "renpy")
+ (version "7.3.5.606")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/renpy/renpy.git")
+ (commit version)))
+ (sha256
+ (base32
+ "1xfbqfk6g4y5ivvd0mbaspagzhgxdcf0mbkpy8nvrilh6043i51i"))
+ (file-name (git-file-name name version))))
+ (build-system python-build-system)
+ (arguments
+ `(;; TODO: We currently can't run renpy inside the guixbuilder and
+ ;; hence can't test it or use it inside the build.
+ ;; Perhaps we should set up an X server.
+ #:tests? #f
+ #:python ,python-2
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'set-paths 'set-build-vars
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "RENPY_CYTHON"
+ (string-append (assoc-ref inputs "python2-cython")
+ "/bin/cython"))
+ (setenv "RENPY_DEPS_INSTALL" (string-join (map cdr inputs) ":"))
+ #t))
+ (replace 'build
+ (lambda args
+ (apply
+ (lambda* (build-root #:key inputs outputs #:allow-other-keys)
+ ;; The "module" subdirectory contains a python (really cython)
+ ;; project, which is built using a script, that is thankfully
+ ;; named "setup.py".
+ (chdir "module")
+ (apply (assoc-ref %standard-phases 'build) args)
+ ;; the above causes renpy.__init__ to be compiled but does not
+ ;; compile anything else, hence we do that here
+ (chdir build-root)
+ (delete-file "renpy/__init__.pyc")
+ (invoke "python" "-m" "compileall" "renpy"))
+ (getcwd) args)
+ #t))
+ ;; TODO: Here we might use a post-build phase to compile the games.
+
+ (replace 'install
+ (lambda args
+ (apply
+ (lambda* (build-root #:key inputs outputs #:allow-other-keys)
+ ;; Again, we have to wrap the module installation.
+ ;; Additionally, we want to install the python code
+ ;; (both source and compiled) in the same directory.
+ (let* ((out (assoc-ref outputs "out"))
+ (site (string-append "/lib/python"
+ ,(version-major+minor
+ (package-version python-2))
+ "/site-packages")))
+ (chdir "module")
+ (apply (assoc-ref %standard-phases 'install) args)
+ (chdir build-root)
+ (copy-recursively "renpy"
+ (string-append out site "/renpy"))))
+ (getcwd) args)
+ #t))
+
+ (add-after 'install 'install-renpy
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ ;; Here we install our custom renpy program.
+ ;; After finishing this step, "out" will have the following:
+ ;; |-- bin/renpy
+ ;; |-- lib/pythonX.Y/site-packages/renpy
+ ;; `-- share/renpy ; i.e. path_to_renpy_base()
+ ;; `-- common
+ ;;
+ ;; Note that common is also a de facto unused subdirectory of
+ ;; lib/pythonX.Y/site-packages/renpy. On other systems,
+ ;; renpy_base would point to site-packages or even somewhere in
+ ;; /opt. The former approach is not as straightforward as it seems
+ ;; -- it causes renpy to load files twice for some weird reason --
+ ;; and the latter is impossible on Guix. Hence the detour through
+ ;; share/renpy and the custom renpy program.
+ ;;
+ ;; As a convention, other games should be installed as
+ ;; subdirectories of share/renpy in their respective outputs as
+ ;; well. This differs from the traditional layout, which is
+ ;; roughly the following:
+ ;; `-- Super Awesome Game
+ ;; |-- game ; <- the folder we actually want
+ ;; |-- lib ; compiled renpy module and dependencies
+ ;; |-- renpy ; Ren'py python code (source + compiled)
+ ;; |-- Super Awesome Game.py
+ ;; `-- Super Awesome Game.sh
+ (let* ((pygame (assoc-ref inputs "python2-pygame"))
+ (site (string-append "/lib/python"
+ ,(version-major+minor
+ (package-version python-2))
+ "/site-packages"))
+ (out (assoc-ref outputs "out"))
+ (bin/renpy (string-append out "/bin/renpy")))
+ (mkdir-p (string-append out "/bin"))
+ (copy-recursively "renpy/common"
+ (string-append out "/share/renpy/common"))
+
+ (call-with-output-file bin/renpy
+ (lambda (port)
+ (format port "#!~a~%" (which "python2"))
+ (format port "
+from __future__ import print_function
+
+import os
+import sys
+import warnings
+
+def path_to_common(renpy_base):
+ return renpy_base + \"/common\"
+
+def path_to_saves(gamedir, save_directory=None):
+ import renpy # @UnresolvedImport
+
+ if save_directory is None:
+ save_directory = renpy.config.save_directory
+ save_directory = renpy.exports.fsencode(save_directory)
+
+ if not save_directory:
+ return gamedir + \"/saves\"
+
+ return os.path.expanduser(\"~~/.renpy/\" + save_directory)
+
+def path_to_renpy_base():
+ return \"~a\"
+
+def main():
+ renpy_base = path_to_renpy_base()
+ try:
+ import renpy.bootstrap
+ import renpy.arguments
+ except ImportError:
+ print(\"\"\"Could not import renpy.bootstrap.
+Please ensure you decompressed Ren'Py correctly, preserving the directory
+structure.\"\"\", file=sys.stderr)
+ raise
+
+ args = renpy.arguments.bootstrap()
+ if not args.basedir:
+ print(\"\"\"This Ren'py requires a basedir to launch.
+The basedir is the directory, in which .rpy files live -- usually the 'game'
+subdirectory of a game packaged by Ren'py.
+
+If you want the Ren'py launcher, use renpy-launcher from renpy:launcher
+instead.\"\"\", file=sys.stderr)
+ sys.exit()
+
+ renpy.bootstrap.bootstrap(renpy_base)
+
+if __name__ == \"__main__\":
+ main()
+"
+ (string-append out "/share/renpy"))))
+
+ ;; Since we already have all variables available here, let's
+ ;; also wrap the program.
+ (chmod bin/renpy #o755)
+ (wrap-program bin/renpy
+ `("PYTHONPATH" prefix
+ (,(string-append out site)
+ ,(string-append pygame site))))
+ #t)))
+
+ (add-after 'install 'install-games
+ (lambda* (#:key outputs #:allow-other-keys)
+ (define renpy (assoc-ref outputs "out"))
+ ;; TODO: We should offer a renpy-build-system to make the
+ ;; installation of Ren'py games easier.
+ (define* (install-renpy-game #:key output game name (renpy renpy)
+ #:allow-other-keys)
+ (let* ((name (or name (basename game)))
+ (launcher (string-append output "/bin/renpy-" name))
+ (share (string-append output "/share/renpy/" name)))
+ (copy-recursively (string-append game "/game") share)
+ (mkdir-p (string-append output "/bin"))
+ (with-output-to-file launcher
+ (lambda ()
+ (format #t
+ "#!~a~%~a ~a \"$@\""
+ (which "bash")
+ (string-append renpy "/bin/renpy")
+ share)))
+ (chmod launcher #o755)))
+
+ (install-renpy-game #:output (assoc-ref outputs "launcher")
+ #:game "launcher")
+
+ (install-renpy-game #:output (assoc-ref outputs "the-question")
+ #:game "the_question"
+ #:name "the-question")
+
+ (install-renpy-game #:output (assoc-ref outputs "tutorial")
+ #:game "tutorial")
+ #t))
+ ;; We already do our own wrapping during 'install-renpy, therefore we
+ ;; no longer need a wrap phase.
+ (delete 'wrap))))
+ (inputs
+ `(("ffmpeg" ,ffmpeg)
+ ("freetype" ,freetype)
+ ("glew" ,glew)
+ ("libpng" ,libpng)
+ ("python2-pygame"
+ ,(python2-pygame-for-renpy
+ version
+ "1gwbqkyv7763813x7nmzb3nz4r8673d33ggsp6lgp1d640rimlpb"))
+ ("sdl-union"
+ ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
+ (outputs
+ (list "out" "launcher" "tutorial" "the-question"))
+ (native-inputs
+ `(("python2-cython" ,python2-cython)))
+ (home-page "http://www.renpy.org/")
+ (synopsis "Visual Novel Engine")
+ (description "Ren'Py is a visual novel engine -- used by thousands of
+creators from around the world -- that helps you use words, images, and sounds
+to tell interactive stories that run on computers and mobile devices. These
+can be both visual novels and life simulation games. The easy to learn script
+language allows anyone to efficiently write large visual novels, while its
+Python scripting is enough for complex simulation games.")
+ (license license:expat)))
+
(define-public grafx2
(package
(name "grafx2")
--
2.23.0
[-- Attachment #3: 0002-gnu-renpy-use-main-site-instead-of-git.patch --]
[-- Type: text/x-patch, Size: 6148 bytes --]
From 7895bcf9d979ffe4396b123ab677b93a551e5fe9 Mon Sep 17 00:00:00 2001
From: Comrade Yuri <yuri@nijino>
Date: Sat, 19 Oct 2019 15:31:37 +0200
Subject: [PATCH 2/4] gnu: renpy: use main site instead of git
* /gnu/packages/game-development: (python2-pygame-for-renpy): Removed variable.
(python2-pygame-sdl2): New variable.
(renpy): Use renpy main site. Adjust version and inputs.
---
gnu/packages/game-development.scm | 106 +++++++++++++++---------------
1 file changed, 52 insertions(+), 54 deletions(-)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index f04a9a5f51..ebebe96328 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -971,65 +971,66 @@ to create fully featured games and multimedia programs in the python language.")
(define-public python2-pygame
(package-with-python2 python-pygame))
-(define (python2-pygame-for-renpy version hash)
- (package
- (inherit python2-pygame)
- (name "python2-pygame-for-renpy")
- (version version)
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/renpy/pygame_sdl2.git")
- (commit (string-append "renpy-" version))))
- (sha256 (base32 hash))
- (file-name (git-file-name name version))))
- (build-system python-build-system)
- (arguments
- `(#:tests? #f ; tests require pygame to be installed first
- #:python ,python-2
- #:phases
- (modify-phases %standard-phases
- (add-after 'set-paths 'set-sdl-vars
- (lambda* (#:key inputs #:allow-other-keys)
- (setenv "PYGAME_SDL2_CFLAGS"
- (string-append "-I"
- (assoc-ref inputs "sdl-union")
- "/include/SDL2 -D_REENTRANT"))
- (setenv "PYGAME_SDL2_LDFLAGS"
- (string-append "-L"
- (assoc-ref inputs "sdl-union")
- "/lib -Wl,-rpath,"
- (assoc-ref inputs "sdl-union")
- "/lib -Wl,--enable-new-dtags -lSDL2"))
- #t)))))
- (inputs
- `(("sdl-union"
- ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
- (native-inputs
- `(("python2-cython" ,python2-cython)))
- (home-page "http://www.renpy.org/")
- (synopsis "Reimplementation of the Pygame API using SDL2")
- (description "Pygame_SDL2 reimplements the Pygame API using SDL2,
+(define-public python2-pygame-sdl2
+ (let ((real-version "2.1.0")
+ (renpy-version "7.3.5"))
+ (package
+ (inherit python2-pygame)
+ (name "python2-pygame-sdl2")
+ (version (string-append real-version "-for-renpy-" renpy-version))
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://www.renpy.org/dl/" renpy-version
+ "/pygame_sdl2-" version ".tar.gz"))
+ (sha256 (base32 "1bmr7j9mlsc4czpgw70ld15ymyp4wxrk9hdsqad40wjwdxvvg2dr"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:tests? #f ; tests require pygame to be installed first
+ #:python ,python-2
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'set-paths 'set-sdl-vars
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "PYGAME_SDL2_CFLAGS"
+ (string-append "-I"
+ (assoc-ref inputs "sdl-union")
+ "/include/SDL2 -D_REENTRANT"))
+ (setenv "PYGAME_SDL2_LDFLAGS"
+ (string-append "-L"
+ (assoc-ref inputs "sdl-union")
+ "/lib -Wl,-rpath,"
+ (assoc-ref inputs "sdl-union")
+ "/lib -Wl,--enable-new-dtags -lSDL2"))
+ #t))
+ (add-before 'build 'drop-generated-files
+ (lambda args
+ (delete-file-recursively "gen")
+ (delete-file-recursively "gen3")
+ #t)))))
+ (inputs
+ `(("sdl-union"
+ ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
+ (native-inputs
+ `(("python2-cython" ,python2-cython)))
+ (home-page "http://www.renpy.org/")
+ (synopsis "Reimplementation of the Pygame API using SDL2")
+ (description "Pygame_SDL2 reimplements the Pygame API using SDL2,
staying close to the original, but also adding some SDL2-specific features.
While it aims to be used as a drop-in replacement, it appears to be
developed mainly for Ren'py.")
- (license (list license:lgpl2.1 license:zlib))))
+ (license (list license:lgpl2.1 license:zlib)))))
(define-public renpy
(package
(name "renpy")
- (version "7.3.5.606")
+ (version "7.3.5")
(source
(origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/renpy/renpy.git")
- (commit version)))
- (sha256
- (base32
- "1xfbqfk6g4y5ivvd0mbaspagzhgxdcf0mbkpy8nvrilh6043i51i"))
- (file-name (git-file-name name version))))
+ (method url-fetch)
+ (uri (string-append "https://www.renpy.org/dl/" version
+ "/renpy-" version "-source.tar.bz2"))
+ (sha256 (base32 "1anr5cfbvbsbik4v4rvrkdkciwhg700k4lydfbs4n85raimz9mw4"))))
(build-system python-build-system)
(arguments
`(;; TODO: We currently can't run renpy inside the guixbuilder and
@@ -1226,10 +1227,7 @@ if __name__ == \"__main__\":
("freetype" ,freetype)
("glew" ,glew)
("libpng" ,libpng)
- ("python2-pygame"
- ,(python2-pygame-for-renpy
- version
- "1gwbqkyv7763813x7nmzb3nz4r8673d33ggsp6lgp1d640rimlpb"))
+ ("python2-pygame" ,python2-pygame-sdl2)
("sdl-union"
,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
(outputs
--
2.23.0
[-- Attachment #4: 0003-gnu-split-renpy-into-library-and-program.patch --]
[-- Type: text/x-patch, Size: 6202 bytes --]
From 089fa3a4d7377231edf98510417e6346436c1803 Mon Sep 17 00:00:00 2001
From: Comrade Yuri <yuri@nijino>
Date: Sat, 19 Oct 2019 18:34:18 +0200
Subject: [PATCH 3/4] gnu: split renpy into library and program
gnu/packages/game-development: (python2-renpy): New variable.
(renpy): Split off python module into python2-renpy.
Adjust inputs accordingly.
---
gnu/packages/game-development.scm | 78 +++++++++++++++++--------------
1 file changed, 43 insertions(+), 35 deletions(-)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index ebebe96328..fb322008ca 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1021,9 +1021,9 @@ While it aims to be used as a drop-in replacement, it appears to be
developed mainly for Ren'py.")
(license (list license:lgpl2.1 license:zlib)))))
-(define-public renpy
+(define-public python2-renpy
(package
- (name "renpy")
+ (name "python2-renpy")
(version "7.3.5")
(source
(origin
@@ -1033,10 +1033,7 @@ developed mainly for Ren'py.")
(sha256 (base32 "1anr5cfbvbsbik4v4rvrkdkciwhg700k4lydfbs4n85raimz9mw4"))))
(build-system python-build-system)
(arguments
- `(;; TODO: We currently can't run renpy inside the guixbuilder and
- ;; hence can't test it or use it inside the build.
- ;; Perhaps we should set up an X server.
- #:tests? #f
+ `(#:tests? #f ; non-trivial tests require a more complete Ren'py
#:python ,python-2
#:phases
(modify-phases %standard-phases
@@ -1063,7 +1060,6 @@ developed mainly for Ren'py.")
(invoke "python" "-m" "compileall" "renpy"))
(getcwd) args)
#t))
- ;; TODO: Here we might use a post-build phase to compile the games.
(replace 'install
(lambda args
@@ -1083,14 +1079,42 @@ developed mainly for Ren'py.")
(copy-recursively "renpy"
(string-append out site "/renpy"))))
(getcwd) args)
- #t))
+ #t)))))
+ (inputs
+ `(("ffmpeg" ,ffmpeg)
+ ("freetype" ,freetype)
+ ("glew" ,glew)
+ ("libpng" ,libpng)
+ ("python2-pygame" ,python2-pygame-sdl2)
+ ("sdl-union"
+ ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
+ (native-inputs
+ `(("python2-cython" ,python2-cython)))
+ (home-page "http://www.renpy.org/")
+ (synopsis "Ren'py python module")
+ (description #f)
+ (license license:expat)))
- (add-after 'install 'install-renpy
+(define-public renpy
+ (package
+ (inherit python2-renpy)
+ (name "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
+ #:python ,python-2
+ #:phases
+ (modify-phases %standard-phases
+ ;; TODO: Here we would use ren'py to compile the games.
+ (delete 'build)
+ (replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
;; Here we install our custom renpy program.
;; After finishing this step, "out" will have the following:
;; |-- bin/renpy
- ;; |-- lib/pythonX.Y/site-packages/renpy
;; `-- share/renpy ; i.e. path_to_renpy_base()
;; `-- common
;;
@@ -1112,12 +1136,7 @@ developed mainly for Ren'py.")
;; |-- renpy ; Ren'py python code (source + compiled)
;; |-- Super Awesome Game.py
;; `-- Super Awesome Game.sh
- (let* ((pygame (assoc-ref inputs "python2-pygame"))
- (site (string-append "/lib/python"
- ,(version-major+minor
- (package-version python-2))
- "/site-packages"))
- (out (assoc-ref outputs "out"))
+ (let* ((out (assoc-ref outputs "out"))
(bin/renpy (string-append out "/bin/renpy")))
(mkdir-p (string-append out "/bin"))
(copy-recursively "renpy/common"
@@ -1178,14 +1197,7 @@ if __name__ == \"__main__\":
main()
"
(string-append out "/share/renpy"))))
-
- ;; Since we already have all variables available here, let's
- ;; also wrap the program.
(chmod bin/renpy #o755)
- (wrap-program bin/renpy
- `("PYTHONPATH" prefix
- (,(string-append out site)
- ,(string-append pygame site))))
#t)))
(add-after 'install 'install-games
@@ -1219,21 +1231,17 @@ if __name__ == \"__main__\":
(install-renpy-game #:output (assoc-ref outputs "tutorial")
#:game "tutorial")
#t))
- ;; We already do our own wrapping during 'install-renpy, therefore we
- ;; no longer need a wrap phase.
- (delete 'wrap))))
+ (replace 'wrap
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (wrap-program (string-append (assoc-ref outputs "out")
+ "/bin/renpy")
+ `("PYTHONPATH" = (,(getenv "PYTHONPATH"))))
+ #t)))))
(inputs
- `(("ffmpeg" ,ffmpeg)
- ("freetype" ,freetype)
- ("glew" ,glew)
- ("libpng" ,libpng)
- ("python2-pygame" ,python2-pygame-sdl2)
- ("sdl-union"
- ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
+ `(("python2-pygame" ,python2-pygame-sdl2)
+ ("python2-renpy" ,python2-renpy)))
(outputs
(list "out" "launcher" "tutorial" "the-question"))
- (native-inputs
- `(("python2-cython" ,python2-cython)))
(home-page "http://www.renpy.org/")
(synopsis "Visual Novel Engine")
(description "Ren'Py is a visual novel engine -- used by thousands of
--
2.23.0
[-- Attachment #5: 0004-gnu-fix-renpy-launcher.patch --]
[-- Type: text/x-patch, Size: 5746 bytes --]
From 863ecacec6c89ec5e148ca478190bfa505da2045 Mon Sep 17 00:00:00 2001
From: Comrade Yuri <yuri@nijino>
Date: Sat, 19 Oct 2019 20:50:41 +0200
Subject: [PATCH 4/4] gnu: fix renpy-launcher
* /gnu/packages/game-development: (python2-renpy): Patch xdg-open.
(renpy): Merge "out" and "launcher". Patch python, renpy binary and xdg-open.
---
gnu/packages/game-development.scm | 52 +++++++++++++++++++++++++------
1 file changed, 42 insertions(+), 10 deletions(-)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index fb322008ca..2bff9533ec 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1037,6 +1037,12 @@ developed mainly for Ren'py.")
#:python ,python-2
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'fix-commands
+ (lambda _
+ (substitute* "renpy/editor.py"
+ (("xdg-open")
+ (which "xdg-open")))
+ #t))
(add-after 'set-paths 'set-build-vars
(lambda* (#:key inputs #:allow-other-keys)
(setenv "RENPY_CYTHON"
@@ -1089,7 +1095,8 @@ developed mainly for Ren'py.")
("sdl-union"
,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
(native-inputs
- `(("python2-cython" ,python2-cython)))
+ `(("python2-cython" ,python2-cython)
+ ("xdg-utils" ,xdg-utils)))
(home-page "http://www.renpy.org/")
(synopsis "Ren'py python module")
(description #f)
@@ -1108,6 +1115,28 @@ developed mainly for Ren'py.")
#:python ,python-2
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'fix-commands
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* "launcher/game/choose_directory.rpy"
+ (("/usr/bin/python") (which "python2")))
+ (substitute* "launcher/game/front_page.rpy"
+ (("xdg-open")
+ (which "xdg-open")))
+ (substitute* "launcher/game/project.rpy"
+ (("cmd = \\[ executable, \"-EO\", sys.argv\\[0\\] \\]")
+ (string-append "cmd = [ \"" (assoc-ref outputs "out")
+ "/bin/renpy\" ]"))
+ ;; Projects are still created in the usual style, so we need
+ ;; to adjust the path.
+ (("cmd.append\\(self.path\\)")
+ "cmd.append(self.path + \"/game\")"))
+ #t))
+ (add-after 'unpack 'drop-game-from-paths
+ (lambda _
+ (substitute* (list "launcher/game/gui7.rpy"
+ "launcher/game/gui7/images.py")
+ ((", \"game\",") ","))
+ #t))
;; TODO: Here we would use ren'py to compile the games.
(delete 'build)
(replace 'install
@@ -1118,10 +1147,10 @@ developed mainly for Ren'py.")
;; `-- share/renpy ; i.e. path_to_renpy_base()
;; `-- common
;;
- ;; Note that common is also a de facto unused subdirectory of
- ;; lib/pythonX.Y/site-packages/renpy. On other systems,
- ;; renpy_base would point to site-packages or even somewhere in
- ;; /opt. The former approach is not as straightforward as it seems
+ ;; Note that common is also a de facto unused directory in
+ ;; python2-renpy. On other systems, renpy_base would point to
+ ;; site-packages or even somewhere in /opt.
+ ;; The former approach is not as straightforward as it seems
;; -- it causes renpy to load files twice for some weird reason --
;; and the latter is impossible on Guix. Hence the detour through
;; share/renpy and the custom renpy program.
@@ -1141,6 +1170,8 @@ developed mainly for Ren'py.")
(mkdir-p (string-append out "/bin"))
(copy-recursively "renpy/common"
(string-append out "/share/renpy/common"))
+ (copy-recursively "gui"
+ (string-append out "/share/renpy/gui"))
(call-with-output-file bin/renpy
(lambda (port)
@@ -1187,8 +1218,8 @@ structure.\"\"\", file=sys.stderr)
The basedir is the directory, in which .rpy files live -- usually the 'game'
subdirectory of a game packaged by Ren'py.
-If you want the Ren'py launcher, use renpy-launcher from renpy:launcher
-instead.\"\"\", file=sys.stderr)
+If you want the Ren'py launcher, use renpy-launcher instead.\"\"\",
+ file=sys.stderr)
sys.exit()
renpy.bootstrap.bootstrap(renpy_base)
@@ -1221,7 +1252,7 @@ if __name__ == \"__main__\":
share)))
(chmod launcher #o755)))
- (install-renpy-game #:output (assoc-ref outputs "launcher")
+ (install-renpy-game #:output (assoc-ref outputs "out")
#:game "launcher")
(install-renpy-game #:output (assoc-ref outputs "the-question")
@@ -1238,10 +1269,11 @@ if __name__ == \"__main__\":
`("PYTHONPATH" = (,(getenv "PYTHONPATH"))))
#t)))))
(inputs
- `(("python2-pygame" ,python2-pygame-sdl2)
+ `(("python2-tkinter" ,python-2 "tk")
+ ("python2-pygame" ,python2-pygame-sdl2)
("python2-renpy" ,python2-renpy)))
(outputs
- (list "out" "launcher" "tutorial" "the-question"))
+ (list "out" "tutorial" "the-question"))
(home-page "http://www.renpy.org/")
(synopsis "Visual Novel Engine")
(description "Ren'Py is a visual novel engine -- used by thousands of
--
2.23.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#37714] Add renpy package
2019-10-19 20:59 ` Leo Prikler
@ 2019-10-20 12:09 ` Leo Prikler
2019-10-21 7:26 ` Nicolas Goaziou
0 siblings, 1 reply; 10+ messages in thread
From: Leo Prikler @ 2019-10-20 12:09 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: 37714
[-- Attachment #1: Type: text/plain, Size: 721 bytes --]
Am Samstag, den 19.10.2019, 22:59 +0200 schrieb Leo Prikler:
> - 0003 splits renpy into the python package python2-renpy and the
> program itself. This makes the build rules a little easier to read,
> even if they themselves did not change much.
Now also with a package description for python2-renpy.
> - 0004 fixes the launcher (mostly). One can now set a project
> directory, create projects, launch created projects and open project
> directories in the default file explorer. However, setting the editor
> (and hence launching one) still does not work.
Adjusted accordingly.
- 0005 uses pre-install renpy to compile the games. I've also updated
the comments on #:tests? that are inaccurate as of 0002.
Regards,
Leo
[-- Attachment #2: 0003-gnu-split-renpy-into-library-and-program.patch --]
[-- Type: text/x-patch, Size: 6274 bytes --]
From 21170c387d4d1363123f86dcd1a0891ae226c9ab Mon Sep 17 00:00:00 2001
From: Comrade Yuri <yuri@nijino>
Date: Sat, 19 Oct 2019 18:34:18 +0200
Subject: [PATCH 3/5] gnu: split renpy into library and program
gnu/packages/game-development: (python2-renpy): New variable.
(renpy): Split off python module into python2-renpy.
Adjust inputs accordingly.
---
gnu/packages/game-development.scm | 79 +++++++++++++++++--------------
1 file changed, 44 insertions(+), 35 deletions(-)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index ebebe96328..2110518f0b 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1021,9 +1021,9 @@ While it aims to be used as a drop-in replacement, it appears to be
developed mainly for Ren'py.")
(license (list license:lgpl2.1 license:zlib)))))
-(define-public renpy
+(define-public python2-renpy
(package
- (name "renpy")
+ (name "python2-renpy")
(version "7.3.5")
(source
(origin
@@ -1033,10 +1033,7 @@ developed mainly for Ren'py.")
(sha256 (base32 "1anr5cfbvbsbik4v4rvrkdkciwhg700k4lydfbs4n85raimz9mw4"))))
(build-system python-build-system)
(arguments
- `(;; TODO: We currently can't run renpy inside the guixbuilder and
- ;; hence can't test it or use it inside the build.
- ;; Perhaps we should set up an X server.
- #:tests? #f
+ `(#:tests? #f ; non-trivial tests require a more complete Ren'py
#:python ,python-2
#:phases
(modify-phases %standard-phases
@@ -1063,7 +1060,6 @@ developed mainly for Ren'py.")
(invoke "python" "-m" "compileall" "renpy"))
(getcwd) args)
#t))
- ;; TODO: Here we might use a post-build phase to compile the games.
(replace 'install
(lambda args
@@ -1083,14 +1079,43 @@ developed mainly for Ren'py.")
(copy-recursively "renpy"
(string-append out site "/renpy"))))
(getcwd) args)
- #t))
+ #t)))))
+ (inputs
+ `(("ffmpeg" ,ffmpeg)
+ ("freetype" ,freetype)
+ ("glew" ,glew)
+ ("libpng" ,libpng)
+ ("python2-pygame" ,python2-pygame-sdl2)
+ ("sdl-union"
+ ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
+ (native-inputs
+ `(("python2-cython" ,python2-cython)))
+ (home-page "http://www.renpy.org/")
+ (synopsis "Ren'py python module")
+ (description "This package contains the shared libraries and Python modules
+of renpy.")
+ (license license:expat)))
- (add-after 'install 'install-renpy
+(define-public renpy
+ (package
+ (inherit python2-renpy)
+ (name "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
+ #:python ,python-2
+ #:phases
+ (modify-phases %standard-phases
+ ;; TODO: Here we would use ren'py to compile the games.
+ (delete 'build)
+ (replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
;; Here we install our custom renpy program.
;; After finishing this step, "out" will have the following:
;; |-- bin/renpy
- ;; |-- lib/pythonX.Y/site-packages/renpy
;; `-- share/renpy ; i.e. path_to_renpy_base()
;; `-- common
;;
@@ -1112,12 +1137,7 @@ developed mainly for Ren'py.")
;; |-- renpy ; Ren'py python code (source + compiled)
;; |-- Super Awesome Game.py
;; `-- Super Awesome Game.sh
- (let* ((pygame (assoc-ref inputs "python2-pygame"))
- (site (string-append "/lib/python"
- ,(version-major+minor
- (package-version python-2))
- "/site-packages"))
- (out (assoc-ref outputs "out"))
+ (let* ((out (assoc-ref outputs "out"))
(bin/renpy (string-append out "/bin/renpy")))
(mkdir-p (string-append out "/bin"))
(copy-recursively "renpy/common"
@@ -1178,14 +1198,7 @@ if __name__ == \"__main__\":
main()
"
(string-append out "/share/renpy"))))
-
- ;; Since we already have all variables available here, let's
- ;; also wrap the program.
(chmod bin/renpy #o755)
- (wrap-program bin/renpy
- `("PYTHONPATH" prefix
- (,(string-append out site)
- ,(string-append pygame site))))
#t)))
(add-after 'install 'install-games
@@ -1219,21 +1232,17 @@ if __name__ == \"__main__\":
(install-renpy-game #:output (assoc-ref outputs "tutorial")
#:game "tutorial")
#t))
- ;; We already do our own wrapping during 'install-renpy, therefore we
- ;; no longer need a wrap phase.
- (delete 'wrap))))
+ (replace 'wrap
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (wrap-program (string-append (assoc-ref outputs "out")
+ "/bin/renpy")
+ `("PYTHONPATH" = (,(getenv "PYTHONPATH"))))
+ #t)))))
(inputs
- `(("ffmpeg" ,ffmpeg)
- ("freetype" ,freetype)
- ("glew" ,glew)
- ("libpng" ,libpng)
- ("python2-pygame" ,python2-pygame-sdl2)
- ("sdl-union"
- ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
+ `(("python2-pygame" ,python2-pygame-sdl2)
+ ("python2-renpy" ,python2-renpy)))
(outputs
(list "out" "launcher" "tutorial" "the-question"))
- (native-inputs
- `(("python2-cython" ,python2-cython)))
(home-page "http://www.renpy.org/")
(synopsis "Visual Novel Engine")
(description "Ren'Py is a visual novel engine -- used by thousands of
--
2.23.0
[-- Attachment #3: 0004-gnu-fix-renpy-launcher.patch --]
[-- Type: text/x-patch, Size: 5748 bytes --]
From d72b88651d66d0cdfe2a0bd94fde810b8ac7c73a Mon Sep 17 00:00:00 2001
From: Comrade Yuri <yuri@nijino>
Date: Sat, 19 Oct 2019 20:50:41 +0200
Subject: [PATCH 4/5] gnu: fix renpy-launcher
* /gnu/packages/game-development: (python2-renpy): Patch xdg-open.
(renpy): Merge "out" and "launcher". Patch python, renpy binary and xdg-open.
---
gnu/packages/game-development.scm | 52 +++++++++++++++++++++++++------
1 file changed, 42 insertions(+), 10 deletions(-)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 2110518f0b..a57cddfbcb 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1037,6 +1037,12 @@ developed mainly for Ren'py.")
#:python ,python-2
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'fix-commands
+ (lambda _
+ (substitute* "renpy/editor.py"
+ (("xdg-open")
+ (which "xdg-open")))
+ #t))
(add-after 'set-paths 'set-build-vars
(lambda* (#:key inputs #:allow-other-keys)
(setenv "RENPY_CYTHON"
@@ -1089,7 +1095,8 @@ developed mainly for Ren'py.")
("sdl-union"
,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
(native-inputs
- `(("python2-cython" ,python2-cython)))
+ `(("python2-cython" ,python2-cython)
+ ("xdg-utils" ,xdg-utils)))
(home-page "http://www.renpy.org/")
(synopsis "Ren'py python module")
(description "This package contains the shared libraries and Python modules
@@ -1109,6 +1116,28 @@ of renpy.")
#:python ,python-2
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'fix-commands
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* "launcher/game/choose_directory.rpy"
+ (("/usr/bin/python") (which "python2")))
+ (substitute* "launcher/game/front_page.rpy"
+ (("xdg-open")
+ (which "xdg-open")))
+ (substitute* "launcher/game/project.rpy"
+ (("cmd = \\[ executable, \"-EO\", sys.argv\\[0\\] \\]")
+ (string-append "cmd = [ \"" (assoc-ref outputs "out")
+ "/bin/renpy\" ]"))
+ ;; Projects are still created in the usual style, so we need
+ ;; to adjust the path.
+ (("cmd.append\\(self.path\\)")
+ "cmd.append(self.path + \"/game\")"))
+ #t))
+ (add-after 'unpack 'drop-game-from-paths
+ (lambda _
+ (substitute* (list "launcher/game/gui7.rpy"
+ "launcher/game/gui7/images.py")
+ ((", \"game\",") ","))
+ #t))
;; TODO: Here we would use ren'py to compile the games.
(delete 'build)
(replace 'install
@@ -1119,10 +1148,10 @@ of renpy.")
;; `-- share/renpy ; i.e. path_to_renpy_base()
;; `-- common
;;
- ;; Note that common is also a de facto unused subdirectory of
- ;; lib/pythonX.Y/site-packages/renpy. On other systems,
- ;; renpy_base would point to site-packages or even somewhere in
- ;; /opt. The former approach is not as straightforward as it seems
+ ;; Note that common is also a de facto unused directory in
+ ;; python2-renpy. On other systems, renpy_base would point to
+ ;; site-packages or even somewhere in /opt.
+ ;; The former approach is not as straightforward as it seems
;; -- it causes renpy to load files twice for some weird reason --
;; and the latter is impossible on Guix. Hence the detour through
;; share/renpy and the custom renpy program.
@@ -1142,6 +1171,8 @@ of renpy.")
(mkdir-p (string-append out "/bin"))
(copy-recursively "renpy/common"
(string-append out "/share/renpy/common"))
+ (copy-recursively "gui"
+ (string-append out "/share/renpy/gui"))
(call-with-output-file bin/renpy
(lambda (port)
@@ -1188,8 +1219,8 @@ structure.\"\"\", file=sys.stderr)
The basedir is the directory, in which .rpy files live -- usually the 'game'
subdirectory of a game packaged by Ren'py.
-If you want the Ren'py launcher, use renpy-launcher from renpy:launcher
-instead.\"\"\", file=sys.stderr)
+If you want the Ren'py launcher, use renpy-launcher instead.\"\"\",
+ file=sys.stderr)
sys.exit()
renpy.bootstrap.bootstrap(renpy_base)
@@ -1222,7 +1253,7 @@ if __name__ == \"__main__\":
share)))
(chmod launcher #o755)))
- (install-renpy-game #:output (assoc-ref outputs "launcher")
+ (install-renpy-game #:output (assoc-ref outputs "out")
#:game "launcher")
(install-renpy-game #:output (assoc-ref outputs "the-question")
@@ -1239,10 +1270,11 @@ if __name__ == \"__main__\":
`("PYTHONPATH" = (,(getenv "PYTHONPATH"))))
#t)))))
(inputs
- `(("python2-pygame" ,python2-pygame-sdl2)
+ `(("python2-tkinter" ,python-2 "tk")
+ ("python2-pygame" ,python2-pygame-sdl2)
("python2-renpy" ,python2-renpy)))
(outputs
- (list "out" "launcher" "tutorial" "the-question"))
+ (list "out" "tutorial" "the-question"))
(home-page "http://www.renpy.org/")
(synopsis "Visual Novel Engine")
(description "Ren'Py is a visual novel engine -- used by thousands of
--
2.23.0
[-- Attachment #4: 0005-gnu-compile-Ren-py-games.patch --]
[-- Type: text/x-patch, Size: 3108 bytes --]
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(-)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index a57cddfbcb..10111ebf1c 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [bug#37714] Add renpy package
2019-10-20 12:09 ` Leo Prikler
@ 2019-10-21 7:26 ` Nicolas Goaziou
2019-10-21 7:35 ` Leo Prikler
0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2019-10-21 7:26 UTC (permalink / raw)
To: Leo Prikler; +Cc: 37714
Hello,
Leo Prikler <leo.prikler@student.tugraz.at> writes:
> Am Samstag, den 19.10.2019, 22:59 +0200 schrieb Leo Prikler:
>> - 0003 splits renpy into the python package python2-renpy and the
>> program itself. This makes the build rules a little easier to read,
>> even if they themselves did not change much.
> Now also with a package description for python2-renpy.
>> - 0004 fixes the launcher (mostly). One can now set a project
>> directory, create projects, launch created projects and open project
>> directories in the default file explorer. However, setting the editor
>> (and hence launching one) still does not work.
> Adjusted accordingly.
> - 0005 uses pre-install renpy to compile the games. I've also updated
> the comments on #:tests? that are inaccurate as of 0002.
Could you squeeze all those patches into a single one and send it again?
Thank you for all the work so far!
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#37714] Add renpy package
2019-10-21 7:26 ` Nicolas Goaziou
@ 2019-10-21 7:35 ` Leo Prikler
2019-10-29 23:04 ` bug#37714: " Nicolas Goaziou
0 siblings, 1 reply; 10+ messages in thread
From: Leo Prikler @ 2019-10-21 7:35 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: 37714
[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]
Am Montag, den 21.10.2019, 09:26 +0200 schrieb Nicolas Goaziou:
> Hello,
>
> Leo Prikler <leo.prikler@student.tugraz.at> writes:
>
> > Am Samstag, den 19.10.2019, 22:59 +0200 schrieb Leo Prikler:
> > > - 0003 splits renpy into the python package python2-renpy and the
> > > program itself. This makes the build rules a little easier to
> > > read,
> > > even if they themselves did not change much.
> > Now also with a package description for python2-renpy.
> > > - 0004 fixes the launcher (mostly). One can now set a project
> > > directory, create projects, launch created projects and open
> > > project
> > > directories in the default file explorer. However, setting the
> > > editor
> > > (and hence launching one) still does not work.
> > Adjusted accordingly.
> > - 0005 uses pre-install renpy to compile the games. I've also
> > updated
> > the comments on #:tests? that are inaccurate as of 0002.
>
> Could you squeeze all those patches into a single one and send it
> again?
>
> Thank you for all the work so far!
>
> Regards,
>
Sure.
Regards,
Leo
[-- Attachment #2: 0001-gnu-Add-renpy.patch --]
[-- Type: text/x-patch, Size: 14864 bytes --]
From 7acd7d1f6bfbe95f27c5b7bd1752631bccbfd3aa Mon Sep 17 00:00:00 2001
From: Comrade Yuri <yuri@nijino>
Date: Sat, 19 Oct 2019 17:40:27 +0200
Subject: [PATCH] gnu: Add renpy
* gnu/packages/game-development: (python2-pygame-sdl2): New variable.
(python2-renpy): New variable.
(renpy): New variable.
---
gnu/packages/game-development.scm | 323 ++++++++++++++++++++++++++++++
1 file changed, 323 insertions(+)
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index eb92443e0d..10111ebf1c 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -971,6 +971,329 @@ to create fully featured games and multimedia programs in the python language.")
(define-public python2-pygame
(package-with-python2 python-pygame))
+(define-public python2-pygame-sdl2
+ (let ((real-version "2.1.0")
+ (renpy-version "7.3.5"))
+ (package
+ (inherit python2-pygame)
+ (name "python2-pygame-sdl2")
+ (version (string-append real-version "-for-renpy-" renpy-version))
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://www.renpy.org/dl/" renpy-version
+ "/pygame_sdl2-" version ".tar.gz"))
+ (sha256 (base32 "1bmr7j9mlsc4czpgw70ld15ymyp4wxrk9hdsqad40wjwdxvvg2dr"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:tests? #f ; tests require pygame to be installed first
+ #:python ,python-2
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'set-paths 'set-sdl-vars
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "PYGAME_SDL2_CFLAGS"
+ (string-append "-I"
+ (assoc-ref inputs "sdl-union")
+ "/include/SDL2 -D_REENTRANT"))
+ (setenv "PYGAME_SDL2_LDFLAGS"
+ (string-append "-L"
+ (assoc-ref inputs "sdl-union")
+ "/lib -Wl,-rpath,"
+ (assoc-ref inputs "sdl-union")
+ "/lib -Wl,--enable-new-dtags -lSDL2"))
+ #t))
+ (add-before 'build 'drop-generated-files
+ (lambda args
+ (delete-file-recursively "gen")
+ (delete-file-recursively "gen3")
+ #t)))))
+ (inputs
+ `(("sdl-union"
+ ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
+ (native-inputs
+ `(("python2-cython" ,python2-cython)))
+ (home-page "http://www.renpy.org/")
+ (synopsis "Reimplementation of the Pygame API using SDL2")
+ (description "Pygame_SDL2 reimplements the Pygame API using SDL2,
+staying close to the original, but also adding some SDL2-specific features.
+While it aims to be used as a drop-in replacement, it appears to be
+developed mainly for Ren'py.")
+ (license (list license:lgpl2.1 license:zlib)))))
+
+(define-public python2-renpy
+ (package
+ (name "python2-renpy")
+ (version "7.3.5")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://www.renpy.org/dl/" version
+ "/renpy-" version "-source.tar.bz2"))
+ (sha256 (base32 "1anr5cfbvbsbik4v4rvrkdkciwhg700k4lydfbs4n85raimz9mw4"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:tests? #f ; Ren'py doesn't seem to package tests
+ #:python ,python-2
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'fix-commands
+ (lambda _
+ (substitute* "renpy/editor.py"
+ (("xdg-open")
+ (which "xdg-open")))
+ #t))
+ (add-after 'set-paths 'set-build-vars
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "RENPY_CYTHON"
+ (string-append (assoc-ref inputs "python2-cython")
+ "/bin/cython"))
+ (setenv "RENPY_DEPS_INSTALL" (string-join (map cdr inputs) ":"))
+ #t))
+ (replace 'build
+ (lambda args
+ (apply
+ (lambda* (build-root #:key inputs outputs #:allow-other-keys)
+ ;; The "module" subdirectory contains a python (really cython)
+ ;; project, which is built using a script, that is thankfully
+ ;; named "setup.py".
+ (chdir "module")
+ (apply (assoc-ref %standard-phases 'build) args)
+ ;; the above causes renpy.__init__ to be compiled but does not
+ ;; compile anything else, hence we do that here
+ (chdir build-root)
+ (delete-file "renpy/__init__.pyc")
+ (invoke "python" "-m" "compileall" "renpy"))
+ (getcwd) args)
+ #t))
+ (replace 'install
+ (lambda args
+ (apply
+ (lambda* (build-root #:key inputs outputs #:allow-other-keys)
+ ;; Again, we have to wrap the module installation.
+ ;; Additionally, we want to install the python code
+ ;; (both source and compiled) in the same directory.
+ (let* ((out (assoc-ref outputs "out"))
+ (site (string-append "/lib/python"
+ ,(version-major+minor
+ (package-version python-2))
+ "/site-packages")))
+ (chdir "module")
+ (apply (assoc-ref %standard-phases 'install) args)
+ (chdir build-root)
+ (copy-recursively "renpy"
+ (string-append out site "/renpy"))))
+ (getcwd) args)
+ #t)))))
+ (inputs
+ `(("ffmpeg" ,ffmpeg)
+ ("freetype" ,freetype)
+ ("glew" ,glew)
+ ("libpng" ,libpng)
+ ("python2-pygame" ,python2-pygame-sdl2)
+ ("sdl-union"
+ ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
+ (native-inputs
+ `(("python2-cython" ,python2-cython)
+ ("xdg-utils" ,xdg-utils)))
+ (home-page "http://www.renpy.org/")
+ (synopsis "Ren'py python module")
+ (description "This package contains the shared libraries and Python modules
+of renpy.")
+ (license license:expat)))
+
+(define-public renpy
+ (package
+ (inherit python2-renpy)
+ (name "renpy")
+ (version "7.3.5")
+ (build-system python-build-system)
+ (arguments
+ `(#:tests? #f ; see python2-renpy
+ #:python ,python-2
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'fix-commands
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* "launcher/game/choose_directory.rpy"
+ (("/usr/bin/python") (which "python2")))
+ (substitute* "launcher/game/front_page.rpy"
+ (("xdg-open")
+ (which "xdg-open")))
+ (substitute* "launcher/game/project.rpy"
+ (("cmd = \\[ executable, \"-EO\", sys.argv\\[0\\] \\]")
+ (string-append "cmd = [ \"" (assoc-ref outputs "out")
+ "/bin/renpy\" ]"))
+ ;; Projects are still created in the usual style, so we need
+ ;; to adjust the path.
+ (("cmd.append\\(self.path\\)")
+ "cmd.append(self.path + \"/game\")"))
+ #t))
+ (add-after 'unpack 'drop-game-from-paths
+ (lambda _
+ (substitute* (list "launcher/game/gui7.rpy"
+ "launcher/game/gui7/images.py")
+ ((", \"game\",") ","))
+ #t))
+ (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.
+ ;; After finishing this step, "out" will have the following:
+ ;; |-- bin/renpy
+ ;; `-- share/renpy ; i.e. path_to_renpy_base()
+ ;; `-- common
+ ;;
+ ;; Note that common is also a de facto unused directory in
+ ;; python2-renpy. On other systems, renpy_base would point to
+ ;; site-packages or even somewhere in /opt.
+ ;; The former approach is not as straightforward as it seems
+ ;; -- it causes renpy to load files twice for some weird reason --
+ ;; and the latter is impossible on Guix. Hence the detour through
+ ;; share/renpy and the custom renpy program.
+ ;;
+ ;; As a convention, other games should be installed as
+ ;; subdirectories of share/renpy in their respective outputs as
+ ;; well. This differs from the traditional layout, which is
+ ;; roughly the following:
+ ;; `-- Super Awesome Game
+ ;; |-- game ; <- the folder we actually want
+ ;; |-- lib ; compiled renpy module and dependencies
+ ;; |-- renpy ; Ren'py python code (source + compiled)
+ ;; |-- Super Awesome Game.py
+ ;; `-- Super Awesome Game.sh
+ (let* ((out (assoc-ref outputs "out"))
+ (bin/renpy (string-append out "/bin/renpy")))
+ (mkdir-p (string-append out "/bin"))
+ (copy-recursively "renpy/common"
+ (string-append out "/share/renpy/common"))
+ (copy-recursively "gui"
+ (string-append out "/share/renpy/gui"))
+
+ (call-with-output-file bin/renpy
+ (lambda (port)
+ (format port "#!~a~%" (which "python2"))
+ (format port "
+from __future__ import print_function
+
+import os
+import sys
+import warnings
+
+def path_to_common(renpy_base):
+ return renpy_base + \"/common\"
+
+def path_to_saves(gamedir, save_directory=None):
+ import renpy # @UnresolvedImport
+
+ if save_directory is None:
+ save_directory = renpy.config.save_directory
+ save_directory = renpy.exports.fsencode(save_directory)
+
+ if not save_directory:
+ return gamedir + \"/saves\"
+
+ return os.path.expanduser(\"~~/.renpy/\" + save_directory)
+
+def path_to_renpy_base():
+ return \"~a\"
+
+def main():
+ renpy_base = path_to_renpy_base()
+ try:
+ import renpy.bootstrap
+ import renpy.arguments
+ except ImportError:
+ print(\"\"\"Could not import renpy.bootstrap.
+Please ensure you decompressed Ren'Py correctly, preserving the directory
+structure.\"\"\", file=sys.stderr)
+ raise
+
+ args = renpy.arguments.bootstrap()
+ if not args.basedir:
+ print(\"\"\"This Ren'py requires a basedir to launch.
+The basedir is the directory, in which .rpy files live -- usually the 'game'
+subdirectory of a game packaged by Ren'py.
+
+If you want the Ren'py launcher, use renpy-launcher instead.\"\"\",
+ file=sys.stderr)
+ sys.exit()
+
+ renpy.bootstrap.bootstrap(renpy_base)
+
+if __name__ == \"__main__\":
+ main()
+"
+ (string-append out "/share/renpy"))))
+ (chmod bin/renpy #o755)
+ #t)))
+
+ (add-after 'install 'install-games
+ (lambda* (#:key outputs #:allow-other-keys)
+ (define renpy (assoc-ref outputs "out"))
+ ;; TODO: We should offer a renpy-build-system to make the
+ ;; installation of Ren'py games easier.
+ (define* (install-renpy-game #:key output game name (renpy renpy)
+ #:allow-other-keys)
+ (let* ((name (or name (basename game)))
+ (launcher (string-append output "/bin/renpy-" name))
+ (share (string-append output "/share/renpy/" name)))
+ (copy-recursively (string-append game "/game") share)
+ (mkdir-p (string-append output "/bin"))
+ (with-output-to-file launcher
+ (lambda ()
+ (format #t
+ "#!~a~%~a ~a \"$@\""
+ (which "bash")
+ (string-append renpy "/bin/renpy")
+ share)))
+ (chmod launcher #o755)))
+
+ (install-renpy-game #:output (assoc-ref outputs "out")
+ #:game "launcher")
+
+ (install-renpy-game #:output (assoc-ref outputs "the-question")
+ #:game "the_question"
+ #:name "the-question")
+
+ (install-renpy-game #:output (assoc-ref outputs "tutorial")
+ #:game "tutorial")
+ #t))
+ (replace 'wrap
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (wrap-program (string-append (assoc-ref outputs "out")
+ "/bin/renpy")
+ `("PYTHONPATH" = (,(getenv "PYTHONPATH"))))
+ #t)))))
+ (inputs
+ `(("python2-tkinter" ,python-2 "tk")
+ ("python2-pygame" ,python2-pygame-sdl2)
+ ("python2-renpy" ,python2-renpy)
+ ("xorg-server" ,xorg-server)))
+ (outputs
+ (list "out" "tutorial" "the-question"))
+ (home-page "http://www.renpy.org/")
+ (synopsis "Visual Novel Engine")
+ (description "Ren'Py is a visual novel engine -- used by thousands of
+creators from around the world -- that helps you use words, images, and sounds
+to tell interactive stories that run on computers and mobile devices. These
+can be both visual novels and life simulation games. The easy to learn script
+language allows anyone to efficiently write large visual novels, while its
+Python scripting is enough for complex simulation games.")
+ (license license:expat)))
+
(define-public grafx2
(package
(name "grafx2")
--
2.23.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* bug#37714: Add renpy package
2019-10-21 7:35 ` Leo Prikler
@ 2019-10-29 23:04 ` Nicolas Goaziou
2019-10-30 9:16 ` [bug#37714] " Leo Prikler
0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2019-10-29 23:04 UTC (permalink / raw)
To: Leo Prikler; +Cc: 37714-done
Hello,
Leo Prikler <leo.prikler@student.tugraz.at> writes:
> Subject: [PATCH] gnu: Add renpy
I applied your patch and added a line to your name in the authors list,
at the beginning of the file. I used the name from your commit. Let me
know if it should be otherwise.
Thank you!
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#37714] Add renpy package
2019-10-29 23:04 ` bug#37714: " Nicolas Goaziou
@ 2019-10-30 9:16 ` Leo Prikler
2019-10-30 13:45 ` Nicolas Goaziou
0 siblings, 1 reply; 10+ messages in thread
From: Leo Prikler @ 2019-10-30 9:16 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: 37714-done
Am Mittwoch, den 30.10.2019, 00:04 +0100 schrieb Nicolas Goaziou:
> Hello,
>
> Leo Prikler <leo.prikler@student.tugraz.at> writes:
>
> > Subject: [PATCH] gnu: Add renpy
>
> I applied your patch and added a line to your name in the authors
> list,
> at the beginning of the file. I used the name from your commit. Let
> me
> know if it should be otherwise.
Ah, that was my mistake, I messed up my git environment and the two
were different. It should be "Leo Prikler <
leo.prikler@student.tugraz.at>" as in the sender of the email.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#37714] Add renpy package
2019-10-30 9:16 ` [bug#37714] " Leo Prikler
@ 2019-10-30 13:45 ` Nicolas Goaziou
0 siblings, 0 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2019-10-30 13:45 UTC (permalink / raw)
To: Leo Prikler; +Cc: 37714-done
Hello,
Leo Prikler <leo.prikler@student.tugraz.at> writes:
> Ah, that was my mistake, I messed up my git environment and the two
> were different. It should be "Leo Prikler <
> leo.prikler@student.tugraz.at>" as in the sender of the email.
I fixed the attribution line.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-10-30 13:46 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-12 7:20 [bug#37714] Add renpy package Leo Prikler
2019-10-14 9:00 ` Leo Prikler
2019-10-18 19:49 ` Nicolas Goaziou
2019-10-19 20:59 ` Leo Prikler
2019-10-20 12:09 ` Leo Prikler
2019-10-21 7:26 ` Nicolas Goaziou
2019-10-21 7:35 ` Leo Prikler
2019-10-29 23:04 ` bug#37714: " Nicolas Goaziou
2019-10-30 9:16 ` [bug#37714] " Leo Prikler
2019-10-30 13:45 ` Nicolas Goaziou
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).