gnu: python-pygame: Update to 2.1.2.

* gnu/packages/game-development.scm (python-pygame): Update to 2.1.2.
[arguments]<#:phases>: Add  ‘fix-build-config’ and ‘fix-sdl2-headers’.
[inputs]: Remove “sdl”, “sdl-image”, “sdl-mixer”, “sdl-ttf”, and “sdl-gfx”.
Add “sdl2”, “sdl2-image”, “sdl2-mixer”, “sdl2-ttf”, and “sdl2-gfx”.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
This commit is contained in:
Adam Faiz 2022-12-18 23:51:04 +08:00 committed by Liliana Marie Prikler
parent 2b7e7b4a13
commit 211524df84
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87

View file

@ -1194,82 +1194,49 @@ (define-public quesoglc
(define-public python-pygame (define-public python-pygame
(package (package
(name "python-pygame") (name "python-pygame")
(version "1.9.4") (version "2.1.2")
(source (origin (source (origin
(method url-fetch) (method url-fetch)
(uri (pypi-uri "pygame" version)) (uri (pypi-uri "pygame" version))
(sha256 (sha256
(base32 (base32
"1dn0nb86jl7yr8709cncxdr0yrmviqakw7zx3g8jbbwrr60if3bh")))) "0g6j79naab7583kymf1bgxc5l5c9h5laq887rmvh8vw8iyifrl6n"))))
(build-system python-build-system) (build-system python-build-system)
(arguments (arguments
`(#:tests? #f ; tests require pygame to be installed first `(#:tests? #f ; tests require pygame to be installed first
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
;; Set the paths to the dependencies manually because (add-after 'unpack 'fix-build-config
;; the configure script does not allow passing them as (lambda _
;; parameters. This also means we can skip the configure (substitute* "buildconfig/config_unix.py"
;; phase. (("origincdirs = \\[.*\\]")
(add-before 'build 'set-library-paths "origincdirs = os.environ['C_INCLUDE_PATH'].split(\":\")")
(lambda* (#:key inputs outputs #:allow-other-keys) (("ORIGLIBDIRS") "LIBRARY_PATH")
(let ((sdl-ref (assoc-ref inputs "sdl")) (("incdirs = \\[\\]") "incdirs = origincdirs")
(font-ref (assoc-ref inputs "sdl-ttf")) (("libdirs = \\[\\]") "libdirs = origlibdirs"))))
(image-ref (assoc-ref inputs "sdl-image")) (add-after 'unpack 'fix-sdl2-headers
(mixer-ref (assoc-ref inputs "sdl-mixer")) (lambda _
(smpeg-ref (assoc-ref inputs "libsmpeg")) (substitute* "buildconfig/config_unix.py"
(png-ref (assoc-ref inputs "libpng")) (("SDL_ttf.h") "SDL2/SDL_ttf.h")
(jpeg-ref (assoc-ref inputs "libjpeg")) (("SDL_image.h") "SDL2/SDL_image.h")
(freetype-ref (assoc-ref inputs "freetype")) (("SDL_mixer.h") "SDL2/SDL_mixer.h"))
(v4l-ref (assoc-ref inputs "v4l-utils")) (substitute* "src_c/imageext.c"
(out-ref (assoc-ref outputs "out"))) (("SDL_image.h") "SDL2/SDL_image.h"))
(substitute* "Setup.in" (substitute* "src_c/font.h"
(("SDL = -I/usr/include/SDL") (("SDL_ttf.h") "SDL2/SDL_ttf.h"))
(string-append "SDL = -I" sdl-ref "/include/SDL -I."))) (substitute* "src_c/mixer.h"
(substitute* "Setup.in" (("SDL_mixer.h") "SDL2/SDL_mixer.h"))
(("FONT = -lSDL_ttf") (substitute* "src_c/_sdl2/mixer.c"
(string-append "FONT = -I" font-ref "/include/SDL -L" (("SDL_mixer.h") "SDL2/SDL_mixer.h")))))))
font-ref "/lib -lSDL_ttf"))) (native-inputs
(substitute* "Setup.in" (list pkg-config))
(("IMAGE = -lSDL_image")
(string-append "IMAGE = -I" image-ref "/include/SDL -L"
image-ref "/lib -lSDL_image")))
(substitute* "Setup.in"
(("MIXER = -lSDL_mixer")
(string-append "MIXER = -I" mixer-ref "/include/SDL -L"
mixer-ref "/lib -lSDL_mixer")))
(substitute* "Setup.in"
(("SMPEG = -lsmpeg")
(string-append "SMPEG = -I" smpeg-ref "/include/smpeg -L"
smpeg-ref "/lib -lsmpeg")))
(substitute* "Setup.in"
(("PNG = -lpng")
(string-append "PNG = -I" png-ref "/include -L"
png-ref "/lib -lpng")))
(substitute* "Setup.in"
(("JPEG = -ljpeg")
(string-append "JPEG = -I" jpeg-ref "/include -L"
jpeg-ref "/lib -ljpeg")))
(substitute* "Setup.in"
(("FREETYPE = -lfreetype")
(string-append "FREETYPE = -I" freetype-ref "/include/freetype2 -L"
freetype-ref "/lib -lfreetype")))
(substitute* "Setup.in"
(("^pypm") "#pypm"))
;; Create a path to a header file provided by v4l-utils.
(system* "mkdir" "linux")
(system* "ln" "--symbolic"
(string-append v4l-ref "/include/libv4l1-videodev.h")
"linux/videodev.h")
(system* "ln" "--symbolic" "Setup.in" "Setup")))))))
(inputs (inputs
`(("freetype" ,freetype) `(("freetype" ,freetype)
("sdl" ,sdl) ("sdl2" ,sdl2)
("sdl-image" ,sdl-image) ("sdl2-image" ,sdl2-image)
("sdl-mixer" ,sdl-mixer) ("sdl2-mixer" ,sdl2-mixer)
("sdl-ttf" ,sdl-ttf) ("sdl2-ttf" ,sdl2-ttf)
("sdl-gfx" ,sdl-gfx) ("sdl2-gfx" ,sdl2-gfx)
("libjpeg" ,libjpeg-turbo) ("libjpeg" ,libjpeg-turbo)
("libpng" ,libpng) ("libpng" ,libpng)
("libX11" ,libx11) ("libX11" ,libx11)