diff mbox

gnu: Add libsmpeg.

Message ID 87bn1pu4lx.fsf@openmailbox.org
State New
Headers show

Commit Message

Kei Yamashita July 22, 2016, 2:31 p.m. UTC
This is a preliminary patch for pygame. I don't really have a test case
for it outside of (hopefully) a successful build of pygame. We'll see
how it goes.
From fa92b4e1fd08b19ad2427121b57a5a61ea798aca Mon Sep 17 00:00:00 2001
From: Kei Kebreau <kei@openmailbox.org>
Date: Fri, 22 Jul 2016 10:20:10 -0400
Subject: [PATCH] gnu: Add libsmpeg.

* gnu/packages/video.scm (libsmpeg): New variable.
---
 gnu/packages/video.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

Comments

Kei Yamashita July 22, 2016, 7:41 p.m. UTC | #1
Kei Kebreau <kei@openmailbox.org> writes:

> This is a preliminary patch for pygame. I don't really have a test case
> for it outside of (hopefully) a successful build of pygame. We'll see
> how it goes.

Pygame's config.py is not finding smpeg-config. This will be fun! Anyone
with skill in Python is welcome to offer me assistance!
Vincent Legoll July 22, 2016, 7:53 p.m. UTC | #2
> Pygame's config.py is not finding smpeg-config. This will be fun! Anyone
> with skill in Python is welcome to offer me assistance!

Maybe I can help, could you elaborate on how to reproduce ?
Roel Janssen July 23, 2016, 7:27 a.m. UTC | #3
Hello Kei,

I had patches for PyGame including SMPEG as well.  Here's what I did:

(define-public python-pygame
  (package
    (name "python-pygame")
    (version "1.9.1")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "https://github.com/illume/pygame/archive/release_"
                    (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
                    "release.tar.gz"))
              (sha256
               (base32 "0cbfff7lv15pgw5hifnj6hx4c63g1v9lyi3f8l47gjda3pbpkria"))))
    (build-system gnu-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.
         (replace 'configure
           (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 "smpeg"))
                   (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"))
               ;; 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.
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (system* "python" "setup.py" "install"
                      (string-append "--install-lib="
                                     (assoc-ref outputs "out"))))))))
    (native-inputs
     `(("python-setuptools" ,python-setuptools)))
    (inputs
     `(("python" ,python-2)
       ("sdl" ,sdl)
       ("sdl-image" ,sdl-image)
       ("sdl-mixer" ,sdl-mixer)
       ("sdl-ttf" ,sdl-ttf)
       ("sdl-gfx" ,sdl-gfx)
       ("libjpeg" ,libjpeg)
       ("libpng" ,libpng)
       ("libX11" ,libx11)
       ("smpeg" ,smpeg)
       ("portmidi" ,portmidi)
       ("v4l-utils" ,v4l-utils)))
    (home-page "http://www.pygame.org")
    (synopsis "SDL wrapper for Python")
    (description "")
    (license lgpl2.1+)))

Hope you can adapt it to your needs.

Kind regards,
Roel Janssen


Kei Kebreau writes:

> Kei Kebreau <kei@openmailbox.org> writes:
>
>> This is a preliminary patch for pygame. I don't really have a test case
>> for it outside of (hopefully) a successful build of pygame. We'll see
>> how it goes.
>
> Pygame's config.py is not finding smpeg-config. This will be fun! Anyone
> with skill in Python is welcome to offer me assistance!
Efraim Flashner July 24, 2016, 6:18 a.m. UTC | #4
Pygame seems popular, it was also on my backburner list todo. In the AUR¹
there's acutally a package for 1.9.2pre20141217-1, which doesn't have a
dependancy on smpeg. When I tried building pygame with smpeg pygame
couldn't find it, and I also ran into problems with the sdl inputs.


¹ https://aur.archlinux.org/packages/python-pygame/

On Fri, Jul 22, 2016 at 03:41:08PM -0400, Kei Kebreau wrote:
> Kei Kebreau <kei@openmailbox.org> writes:
> 
> > This is a preliminary patch for pygame. I don't really have a test case
> > for it outside of (hopefully) a successful build of pygame. We'll see
> > how it goes.
> 
> Pygame's config.py is not finding smpeg-config. This will be fun! Anyone
> with skill in Python is welcome to offer me assistance!
> 
> -- 
> Kei (GPG Key: 4096R/E6A5EE3C19467A0D)
diff mbox

Patch

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index d36400c..943ff26 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -8,6 +8,7 @@ 
 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -33,6 +34,7 @@ 
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix svn-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system glib-or-gtk)
@@ -1525,3 +1527,39 @@  implementation.")
 your graphical desktop and encodes it as a video.  This is a useful tool for
 making @dfn{screencasts}.")
     (license license:gpl2+)))
+
+(define-public libsmpeg
+  (package
+    (name "libsmpeg")
+    (version "0.4.5")
+    (source (origin
+              (method svn-fetch)
+              (uri (svn-reference
+                    (url "svn://svn.icculus.org/smpeg/trunk/")
+                    (revision 412)))
+              (sha256
+               (base32
+                "1irf2d8f150j8cx8lbb0pz1rijap536crsz0mw871xrh6wd2fd96"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'autogen.sh
+                    (lambda _
+                      (zero? (system* "sh" "autogen.sh")))))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)))
+    (inputs
+     `(("sdl" ,sdl2)))
+    (home-page "http://icculus.org/smpeg/")
+    (synopsis "SDL MPEG decoding library")
+    (description
+     "SMPEG (SDL MPEG Player Library) is a free MPEG1 video player library
+with sound support.  Video playback is based on the ubiquitous Berkeley MPEG
+player, mpeg_play v2.2.  Audio is played through a slightly modified mpegsound
+library, part of splay v0.8.2.  SMPEG supports MPEG audio (MP3), MPEG-1 video,
+and MPEG system streams.")
+    (license (list license:expat
+                   license:lgpl2.1
+                   license:lgpl2.1+
+                   license:gpl2))))