all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add python-pygame.
@ 2016-07-29 21:13 Kei Kebreau
  2016-07-29 21:28 ` Kei Kebreau
  0 siblings, 1 reply; 4+ messages in thread
From: Kei Kebreau @ 2016-07-29 21:13 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 165 bytes --]


The python-pygame patch as promised. Note that it requires the
application of the most recently submitted libsmpeg patch. Would anyone
else like to test this? :-)


[-- Attachment #1.2: 0001-gnu-Add-python-pygame.patch --]
[-- Type: text/plain, Size: 5812 bytes --]

From 644a7e3e274f854f1487ab36bef59bba2003887c Mon Sep 17 00:00:00 2001
From: Kei Kebreau <kei@openmailbox.org>
Date: Fri, 29 Jul 2016 17:11:59 -0400
Subject: [PATCH] gnu: Add python-pygame.

* gnu/packages/game-development.scm (python-pygame): New variable.
---
 gnu/packages/game-development.scm | 93 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 7067a71..86471b1 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -31,6 +31,7 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages databases)
@@ -41,8 +42,11 @@
   #:use-module (gnu packages gnunet)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages music)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages zip)
   #:use-module (gnu packages gl)
@@ -512,3 +516,92 @@ It offers the following features:
 OpenGL programs with character rendering services via an application programming
 interface (API).")
     (license (list license:expat license:lgpl2.1+))))
+
+(define-public python-pygame
+  (package
+    (name "python-pygame")
+    (version "1.9.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://pygame.org/ftp/pygame-"
+                                  version "release.tar.gz"))
+              (sha256
+               (base32
+                "0cyl0ww4fjlf289pjxa53q4klyn55ajvkgymw0qrdgp4593raq52"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2
+       #: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.
+         (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"))
+                   (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"
+                 (("^pypm") "#pypm"))
+               (substitute* "src/movie.c")
+               ;; 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")))))))
+         ;; The default tries to install libraries into the python directory.
+         ;; Using --install-lib, we can provide the correct path.
+    (native-inputs
+     `(("python-setuptools" ,python-setuptools)))
+    (inputs
+     `(("sdl" ,sdl)
+       ("sdl-image" ,sdl-image)
+       ("sdl-mixer" ,sdl-mixer)
+       ("sdl-ttf" ,sdl-ttf)
+       ("sdl-gfx" ,sdl-gfx)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libX11" ,libx11)
+       ("libsmpeg" ,libsmpeg)
+       ("portmidi" ,portmidi)
+       ("v4l-utils" ,v4l-utils)))
+    (home-page "http://www.pygame.org")
+    (synopsis "SDL wrapper for Python")
+    (description "")
+    (license license:lgpl2.1+)))
-- 
2.9.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: Add python-pygame.
  2016-07-29 21:13 [PATCH] gnu: Add python-pygame Kei Kebreau
@ 2016-07-29 21:28 ` Kei Kebreau
  2016-07-30 13:52   ` Roel Janssen
  0 siblings, 1 reply; 4+ messages in thread
From: Kei Kebreau @ 2016-07-29 21:28 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 367 bytes --]

Kei Kebreau <kei@openmailbox.org> writes:

> The python-pygame patch as promised. Note that it requires the
> application of the most recently submitted libsmpeg patch. Would anyone
> else like to test this? :-)

Please disregard the earlier patch. I had to add the other licenses and
a description to the definition. Thanks to Roel for sharing a pygame definition!


[-- Attachment #1.2: 0001-gnu-Add-python-pygame.patch --]
[-- Type: text/plain, Size: 6536 bytes --]

From af15e77bb84532124660a36ad884ee6434a6136a Mon Sep 17 00:00:00 2001
From: Kei Kebreau <kei@openmailbox.org>
Date: Fri, 29 Jul 2016 17:26:30 -0400
Subject: [PATCH] gnu: Add python-pygame.

* gnu/packages/game-development.scm (python-pygame): New variable.
---
 gnu/packages/game-development.scm | 105 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 7067a71..b0a281e 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -31,6 +31,7 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages databases)
@@ -41,8 +42,11 @@
   #:use-module (gnu packages gnunet)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages music)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages zip)
   #:use-module (gnu packages gl)
@@ -512,3 +516,104 @@ It offers the following features:
 OpenGL programs with character rendering services via an application programming
 interface (API).")
     (license (list license:expat license:lgpl2.1+))))
+
+(define-public python-pygame
+  (package
+    (name "python-pygame")
+    (version "1.9.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://pygame.org/ftp/pygame-"
+                                  version "release.tar.gz"))
+              (sha256
+               (base32
+                "0cyl0ww4fjlf289pjxa53q4klyn55ajvkgymw0qrdgp4593raq52"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2
+       #: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.
+         (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"))
+                   (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"
+                 (("^pypm") "#pypm"))
+               (substitute* "src/movie.c")
+               ;; 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")))))))
+         ;; The default tries to install libraries into the python directory.
+         ;; Using --install-lib, we can provide the correct path.
+    (native-inputs
+     `(("python-setuptools" ,python-setuptools)))
+    (inputs
+     `(("sdl" ,sdl)
+       ("sdl-image" ,sdl-image)
+       ("sdl-mixer" ,sdl-mixer)
+       ("sdl-ttf" ,sdl-ttf)
+       ("sdl-gfx" ,sdl-gfx)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libX11" ,libx11)
+       ("libsmpeg" ,libsmpeg)
+       ("portmidi" ,portmidi)
+       ("v4l-utils" ,v4l-utils)))
+    (home-page "http://www.pygame.org")
+    (synopsis "SDL wrapper for Python")
+    (description "Pygame is a set of Python modules designed for writing games.
+Pygame adds functionality on top of the excellent SDL library. This allows you
+to create fully featured games and multimedia programs in the python language.")
+    (license (list license:bsd-2
+                   ;; python numeric license as listed by Debian looks like
+                   ;; an Expat-style license with a warranty disclaimer for
+                   ;; the U.S. government and the University of California.
+                   license:expat
+                   license:lgpl2.0+
+                   license:lgpl2.1+
+                   license:gpl3+
+                   license:psfl
+                   license:public-domain
+                   license:lgpl2.1+))))
-- 
2.9.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: Add python-pygame.
  2016-07-29 21:28 ` Kei Kebreau
@ 2016-07-30 13:52   ` Roel Janssen
  2016-07-30 14:26     ` Kei Kebreau
  0 siblings, 1 reply; 4+ messages in thread
From: Roel Janssen @ 2016-07-30 13:52 UTC (permalink / raw)
  To: Kei Kebreau; +Cc: guix-devel


Kei Kebreau writes:

> Kei Kebreau <kei@openmailbox.org> writes:
>
>> The python-pygame patch as promised. Note that it requires the
>> application of the most recently submitted libsmpeg patch. Would anyone
>> else like to test this? :-)

I've succesfully built both the libsmpeg patch and python-pygame.

> Please disregard the earlier patch. I had to add the other licenses and
> a description to the definition. Thanks to Roel for sharing a pygame definition!

Thank you for getting it to work!  I only have one comment:

>+               (system* "ln" "--symbolic" "Setup.in" "Setup")))))))
>+         ;; The default tries to install libraries into the python directory.
>+         ;; Using --install-lib, we can provide the correct path.
>+    (native-inputs
>+     `(("python-setuptools" ,python-setuptools)))

The comment seems to be out of place.  I don't even know where it
belongs to anymore.  Was this for another build phase customization? (it
seems to because of the indentation..).

Thank you.

Kind regards,
Roel Janssen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: Add python-pygame.
  2016-07-30 13:52   ` Roel Janssen
@ 2016-07-30 14:26     ` Kei Kebreau
  0 siblings, 0 replies; 4+ messages in thread
From: Kei Kebreau @ 2016-07-30 14:26 UTC (permalink / raw)
  To: Roel Janssen; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]

Roel Janssen <roel@gnu.org> writes:

> Kei Kebreau writes:
>
>> Kei Kebreau <kei@openmailbox.org> writes:
>>
>>> The python-pygame patch as promised. Note that it requires the
>>> application of the most recently submitted libsmpeg patch. Would anyone
>>> else like to test this? :-)
>
> I've succesfully built both the libsmpeg patch and python-pygame.
>
>> Please disregard the earlier patch. I had to add the other licenses and
>> a description to the definition. Thanks to Roel for sharing a pygame
>> definition!
>
> Thank you for getting it to work!  I only have one comment:
>
>>+               (system* "ln" "--symbolic" "Setup.in" "Setup")))))))
>>+         ;; The default tries to install libraries into the python directory.
>>+         ;; Using --install-lib, we can provide the correct path.
>>+    (native-inputs
>>+     `(("python-setuptools" ,python-setuptools)))
>
> The comment seems to be out of place.  I don't even know where it
> belongs to anymore.  Was this for another build phase customization? (it
> seems to because of the indentation..).
>
> Thank you.
>
> Kind regards,
> Roel Janssen

Indeed, that comment was left over from the install phase you replaced
when you used the gnu-build-system. I'll correct it before I push the
changes upstream. Unless anyone else has any input, I'll be pushing this
later today!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-30 14:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-29 21:13 [PATCH] gnu: Add python-pygame Kei Kebreau
2016-07-29 21:28 ` Kei Kebreau
2016-07-30 13:52   ` Roel Janssen
2016-07-30 14:26     ` Kei Kebreau

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.