diff mbox series

[bug#60153,v1,1/3] gnu: python-pygame: Update to 2.1.2.

Message ID 169f8bfa-c40d-b5bb-ad7e-6517267096b7@disroot.org
State New
Headers show
Series [bug#60153,v1,1/3] gnu: python-pygame: Update to 2.1.2. | expand

Commit Message

Adam Faiz Dec. 18, 2022, 3:51 p.m. UTC
From 3e89a0d6f4cca4338661625bdf2b701425341507 Mon Sep 17 00:00:00 2001
From: AwesomeAdam54321 <adam.faiz@disroot.org>
Date: Sat, 17 Dec 2022 17:37:21 +0800
Subject: [PATCH v1 1/3] gnu: python-pygame: Update to 2.1.2.

* gnu/packages/game-development.scm (python-pygame): Update to 2.1.2.
---
  gnu/packages/game-development.scm | 98 +++++++++++--------------------
  1 file changed, 35 insertions(+), 63 deletions(-)

+       ("sdl2-ttf" ,sdl2-ttf)
+       ("sdl2-gfx" ,sdl2-gfx)
         ("libjpeg" ,libjpeg-turbo)
         ("libpng" ,libpng)
         ("libX11" ,libx11)
diff mbox series

Patch

diff --git a/gnu/packages/game-development.scm 
b/gnu/packages/game-development.scm
index 4a0435045b..f9a53799f5 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1194,82 +1194,54 @@  (define-public quesoglc
  (define-public python-pygame
    (package
      (name "python-pygame")
-    (version "1.9.4")
+    (version "2.1.2")
      (source (origin
                (method url-fetch)
                (uri (pypi-uri "pygame" version))
                (sha256
                 (base32
-                "1dn0nb86jl7yr8709cncxdr0yrmviqakw7zx3g8jbbwrr60if3bh"))))
+                "0g6j79naab7583kymf1bgxc5l5c9h5laq887rmvh8vw8iyifrl6n"))
+              (modules '((guix build utils)))
+              (snippet
+               #~(begin
+                   ;; Fix the configure script to allow passing the 
dependencies
+                   ;; as environment variables.
+                   (substitute* "buildconfig/config_unix.py"
+                     (("localbase.d") "d")
+                     (("origincdirs = .*/include.*]")
+                      "origincdirs = 
os.environ['C_INCLUDE_PATH'].split(\":\")")
+                     (("ORIGLIBDIRS") "LIBRARY_PATH")
+                     ;; Fix headers
+                     (("SDL_ttf.h") "SDL2/SDL_ttf.h")
+                     (("SDL_image.h") "SDL2/SDL_image.h")
+                     (("SDL_mixer.h") "SDL2/SDL_mixer.h"))
+                   (substitute* "src_c/imageext.c"
+                     (("SDL_image.h") "SDL2/SDL_image.h"))
+                   (substitute* "src_c/font.h"
+                     (("SDL_ttf.h") "SDL2/SDL_ttf.h"))
+                   (substitute* "src_c/mixer.h"
+                     (("SDL_mixer.h") "SDL2/SDL_mixer.h"))
+                   (substitute* "src_c/_sdl2/mixer.c"
+                     (("SDL_mixer.h") "SDL2/SDL_mixer.h"))))))
      (build-system python-build-system)
      (arguments
       `(#:tests? #f                ; tests require pygame to be 
installed first
         #:phases
         (modify-phases %standard-phases
-         ;; Set the paths to the dependencies manually because
-         ;; the configure script does not allow passing them as
-         ;; parameters.  This also means we can skip the configure
-         ;; phase.
+         ;; Pass the dependencies to the configure script
+         ;; through environment variables.
           (add-before 'build 'set-library-paths
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((sdl-ref   (assoc-ref inputs "sdl"))
-                   (font-ref  (assoc-ref inputs "sdl-ttf"))
-                   (image-ref (assoc-ref inputs "sdl-image"))
-                   (mixer-ref (assoc-ref inputs "sdl-mixer"))
-                   (smpeg-ref (assoc-ref inputs "libsmpeg"))
-                   (png-ref   (assoc-ref inputs "libpng"))
-                   (jpeg-ref  (assoc-ref inputs "libjpeg"))
-                   (freetype-ref (assoc-ref inputs "freetype"))
-                   (v4l-ref   (assoc-ref inputs "v4l-utils"))
-                   (out-ref   (assoc-ref outputs "out")))
-               (substitute* "Setup.in"
-                 (("SDL = -I/usr/include/SDL")
-                  (string-append "SDL = -I" sdl-ref "/include/SDL -I.")))
-               (substitute* "Setup.in"
-                 (("FONT = -lSDL_ttf")
-                  (string-append "FONT = -I" font-ref "/include/SDL -L"
-                                 font-ref "/lib -lSDL_ttf")))
-               (substitute* "Setup.in"
-                 (("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")))))))
+           (lambda _
+             (setenv "LOCALBASE" " "))))))
+    (native-inputs
+     (list pkg-config))
      (inputs
       `(("freetype" ,freetype)
-       ("sdl" ,sdl)
-       ("sdl-image" ,sdl-image)
-       ("sdl-mixer" ,sdl-mixer)
-       ("sdl-ttf" ,sdl-ttf)
-       ("sdl-gfx" ,sdl-gfx)
+       ("sdl2" ,sdl2)
+       ("sdl2-image" ,sdl2-image)
+       ("sdl2-mixer" ,sdl2-mixer)