From 089fa3a4d7377231edf98510417e6346436c1803 Mon Sep 17 00:00:00 2001 From: Comrade Yuri 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