unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 2/2] gnu: Add manaplus.
@ 2015-10-04 19:16 Alex Kost
  2015-10-09 12:40 ` Ludovic Courtès
  0 siblings, 1 reply; 14+ messages in thread
From: Alex Kost @ 2015-10-04 19:16 UTC (permalink / raw)
  To: guix-devel

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

I don't know if there is a better workaround for the SDL headers, but
this problem is rather common: there is a workaround in 'abbaye' and a
special patch for 'pingus'.

The problem is: the source code has lines like this:

  #include <SDL_mixer.h>

but the headers of all SDL packages are placed in “include/SDL/”
subdirectories.  And an upstream often doesn't use "pkg-config" for
every SDL package to define CFLAGS and assumes that all SDL headers are
placed in one directory.  So we have to invent workarounds for such
packages.

I just mention this problem here, perhaps someone will come up with a
general solution.


[-- Attachment #2: 0002-gnu-Add-manaplus.patch --]
[-- Type: text/x-diff, Size: 3698 bytes --]

From 220a23aad452663f8262935cfa09fe5321e33602 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Sun, 4 Oct 2015 20:34:48 +0300
Subject: [PATCH 2/2] gnu: Add manaplus.

* gnu/packages/games.scm (manaplus): New variable.
---
 gnu/packages/games.scm | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 7eb65bb..c080e61 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2015 David Hashe <david.hashe@dhashe.com>
 ;;; Copyright © 2015 Christopher Allan Webber <cwebber@dustycloud.org>
+;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,6 +47,7 @@
   #:use-module (gnu packages libunwind)
   #:use-module (gnu packages image)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages physfs)
   #:use-module (gnu packages python)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages xorg)
@@ -1047,3 +1049,59 @@ on the screen and keyboard to display letters.")
     ;; Most files under gpl2+ or gpl3+, but eat.wav under gpl3
     (license license:gpl3)))
 
+(define-public manaplus
+  (package
+    (name "manaplus")
+    (version "1.5.9.26")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://repo.manaplus.org/manaplus/download/"
+                    version "/manaplus-" version ".tar.xz"))
+              (sha256
+               (base32
+                "070ms1cv7q88284pqh66lfhacckgv7m9s8z9009k2laypibx7vs6"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:modules ((ice-9 match)
+                  (ice-9 regex)
+                  (srfi srfi-1)
+                  (guix build gnu-build-system)
+                  (guix build utils))
+       ;; The package relies on "sdl-config" to find SDL header files,
+       ;; which adds "include/SDL" for 'sdl' itself.  We need to include
+       ;; such directories for all sdl packages.
+       #:configure-flags
+       (let* ((sdl-rx   (make-regexp "\\`sdl"))
+              (includes (filter-map (match-lambda
+                                      ((name . dir)
+                                       (and (regexp-exec sdl-rx name)
+                                            (string-append
+                                             "-I" dir "/include/SDL"))))
+                                    %build-inputs)))
+         (list (format #f "CPPFLAGS=~{~a ~}" includes)))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("glu" ,glu)
+       ("curl" ,curl)
+       ("libxml2" ,libxml2)
+       ("mesa" ,mesa)
+       ("physfs" ,physfs)
+       ("sdl" ,sdl)
+       ("sdl-gfx" ,sdl-gfx)
+       ("sdl-image" ,sdl-image)
+       ("sdl-mixer" ,sdl-mixer)
+       ("sdl-net" ,sdl-net)
+       ("sdl-ttf" ,sdl-ttf)))
+    (home-page "http://manaplus.org")
+    (synopsis "Client for 'The Mana World' and similar games")
+    (description
+     "ManaPlus is a 2D MMORPG client for game servers.  It is the only
+fully supported client for @uref{http://www.themanaworld.org, The mana
+world}, @uref{http://evolonline.org, Evol Online} and
+@uref{http://landoffire.org, Land of fire}.")
+    ;; "src/debug/*" and "src/sdl2gfx/*" are under Zlib.
+    ;; "data/themes/{golden-delicious,jewelry}/*" are under CC-BY-SA.
+    ;; The rest is under GPL2+.
+    (license (list license:gpl2+ license:zlib license:cc-by-sa4.0))))
-- 
2.5.3


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

* Re: [PATCH 2/2] gnu: Add manaplus.
  2015-10-04 19:16 [PATCH 2/2] gnu: Add manaplus Alex Kost
@ 2015-10-09 12:40 ` Ludovic Courtès
  2015-10-09 16:56   ` Thompson, David
  2015-10-10  8:48   ` [PATCH 2/2] gnu: Add manaplus Alex Kost
  0 siblings, 2 replies; 14+ messages in thread
From: Ludovic Courtès @ 2015-10-09 12:40 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> I don't know if there is a better workaround for the SDL headers, but
> this problem is rather common: there is a workaround in 'abbaye' and a
> special patch for 'pingus'.
>
> The problem is: the source code has lines like this:
>
>   #include <SDL_mixer.h>
>
> but the headers of all SDL packages are placed in “include/SDL/”
> subdirectories.  And an upstream often doesn't use "pkg-config" for
> every SDL package to define CFLAGS and assumes that all SDL headers are
> placed in one directory.  So we have to invent workarounds for such
> packages.
>
> I just mention this problem here, perhaps someone will come up with a
> general solution.

Can’t ‘sdl-union’ be used here?  I think it was created specifically to
solve this problem.  (Currently it’s private to (gnu packages sdl) but
you can export it.)

Thanks,
Ludo’.

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

* Re: [PATCH 2/2] gnu: Add manaplus.
  2015-10-09 12:40 ` Ludovic Courtès
@ 2015-10-09 16:56   ` Thompson, David
  2015-10-09 21:56     ` Ludovic Courtès
  2015-10-10  8:48   ` [PATCH 2/2] gnu: Add manaplus Alex Kost
  1 sibling, 1 reply; 14+ messages in thread
From: Thompson, David @ 2015-10-09 16:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel, Alex Kost

On Fri, Oct 9, 2015 at 8:40 AM, Ludovic Courtès <ludo@gnu.org> wrote:
> Alex Kost <alezost@gmail.com> skribis:
>
>> I don't know if there is a better workaround for the SDL headers, but
>> this problem is rather common: there is a workaround in 'abbaye' and a
>> special patch for 'pingus'.
>>
>> The problem is: the source code has lines like this:
>>
>>   #include <SDL_mixer.h>
>>
>> but the headers of all SDL packages are placed in “include/SDL/”
>> subdirectories.  And an upstream often doesn't use "pkg-config" for
>> every SDL package to define CFLAGS and assumes that all SDL headers are
>> placed in one directory.  So we have to invent workarounds for such
>> packages.
>>
>> I just mention this problem here, perhaps someone will come up with a
>> general solution.
>
> Can’t ‘sdl-union’ be used here?  I think it was created specifically to
> solve this problem.  (Currently it’s private to (gnu packages sdl) but
> you can export it.)

Do you have any concerns about this package being picked up by UIs now
that it will be public?  Might confuse a user or two, dunno.

- Dave

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

* Re: [PATCH 2/2] gnu: Add manaplus.
  2015-10-09 16:56   ` Thompson, David
@ 2015-10-09 21:56     ` Ludovic Courtès
  2015-10-10  8:48       ` [PATCH] gnu: sdl-union: Wrap into a procedure and export it Alex Kost
  0 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2015-10-09 21:56 UTC (permalink / raw)
  To: Thompson, David; +Cc: guix-devel, Alex Kost

"Thompson, David" <dthompson2@worcester.edu> skribis:

> On Fri, Oct 9, 2015 at 8:40 AM, Ludovic Courtès <ludo@gnu.org> wrote:
>> Alex Kost <alezost@gmail.com> skribis:
>>
>>> I don't know if there is a better workaround for the SDL headers, but
>>> this problem is rather common: there is a workaround in 'abbaye' and a
>>> special patch for 'pingus'.
>>>
>>> The problem is: the source code has lines like this:
>>>
>>>   #include <SDL_mixer.h>
>>>
>>> but the headers of all SDL packages are placed in “include/SDL/”
>>> subdirectories.  And an upstream often doesn't use "pkg-config" for
>>> every SDL package to define CFLAGS and assumes that all SDL headers are
>>> placed in one directory.  So we have to invent workarounds for such
>>> packages.
>>>
>>> I just mention this problem here, perhaps someone will come up with a
>>> general solution.
>>
>> Can’t ‘sdl-union’ be used here?  I think it was created specifically to
>> solve this problem.  (Currently it’s private to (gnu packages sdl) but
>> you can export it.)
>
> Do you have any concerns about this package being picked up by UIs now
> that it will be public?  Might confuse a user or two, dunno.

No opinion.  If you think we’d rather keep it hidden, we can wrap it in
a thunk for instance so that the UIs don’t pick it up.  WDYT?

Ludo’.

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

* Re: [PATCH 2/2] gnu: Add manaplus.
  2015-10-09 12:40 ` Ludovic Courtès
  2015-10-09 16:56   ` Thompson, David
@ 2015-10-10  8:48   ` Alex Kost
  2015-10-11 16:52     ` Ludovic Courtès
  1 sibling, 1 reply; 14+ messages in thread
From: Alex Kost @ 2015-10-10  8:48 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2015-10-09 15:40 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> I don't know if there is a better workaround for the SDL headers, but
>> this problem is rather common: there is a workaround in 'abbaye' and a
>> special patch for 'pingus'.
>>
>> The problem is: the source code has lines like this:
>>
>>   #include <SDL_mixer.h>
>>
>> but the headers of all SDL packages are placed in “include/SDL/”
>> subdirectories.  And an upstream often doesn't use "pkg-config" for
>> every SDL package to define CFLAGS and assumes that all SDL headers are
>> placed in one directory.  So we have to invent workarounds for such
>> packages.
>>
>> I just mention this problem here, perhaps someone will come up with a
>> general solution.
>
> Can’t ‘sdl-union’ be used here?  I think it was created specifically to
> solve this problem.  (Currently it’s private to (gnu packages sdl) but
> you can export it.)

Oh, great, I didn't know about it, thanks!  It will reduce the workaround.

However, just using this package cannot solve the problem: 'sdl-config'
points directly to "/gnu/store/…-sdl-1.2.15", so you need to modify a
package anyway to make it find "/gnu/store/…-sdl-union-1.2.15/include/SDL"
(that's why 'guile-sdl' specifies "--with-sdl-prefix=").

-- 
Alex

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

* [PATCH] gnu: sdl-union: Wrap into a procedure and export it.
  2015-10-09 21:56     ` Ludovic Courtès
@ 2015-10-10  8:48       ` Alex Kost
  2015-10-11 16:50         ` Ludovic Courtès
  0 siblings, 1 reply; 14+ messages in thread
From: Alex Kost @ 2015-10-10  8:48 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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

Ludovic Courtès (2015-10-10 00:56 +0300) wrote:

> "Thompson, David" <dthompson2@worcester.edu> skribis:
>
>> On Fri, Oct 9, 2015 at 8:40 AM, Ludovic Courtès <ludo@gnu.org> wrote:
>>> Alex Kost <alezost@gmail.com> skribis:
>>>
>>>> I don't know if there is a better workaround for the SDL headers, but
>>>> this problem is rather common: there is a workaround in 'abbaye' and a
>>>> special patch for 'pingus'.
>>>>
>>>> The problem is: the source code has lines like this:
>>>>
>>>>   #include <SDL_mixer.h>
>>>>
>>>> but the headers of all SDL packages are placed in “include/SDL/”
>>>> subdirectories.  And an upstream often doesn't use "pkg-config" for
>>>> every SDL package to define CFLAGS and assumes that all SDL headers are
>>>> placed in one directory.  So we have to invent workarounds for such
>>>> packages.
>>>>
>>>> I just mention this problem here, perhaps someone will come up with a
>>>> general solution.
>>>
>>> Can’t ‘sdl-union’ be used here?  I think it was created specifically to
>>> solve this problem.  (Currently it’s private to (gnu packages sdl) but
>>> you can export it.)
>>
>> Do you have any concerns about this package being picked up by UIs now
>> that it will be public?  Might confuse a user or two, dunno.
>
> No opinion.  If you think we’d rather keep it hidden, we can wrap it in
> a thunk for instance so that the UIs don’t pick it up.  WDYT?

I like it.  But since there are several sdl libraries, and not all of
them may be required, what about making it a procedure that takes sdl
packages instead? (the patch is attached)


[-- Attachment #2: 0001-gnu-sdl-union-Wrap-into-a-procedure-and-export-it.patch --]
[-- Type: text/x-patch, Size: 4036 bytes --]

From f1bd9edbbae498fb3b4726428daf523e3fd83060 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Sat, 10 Oct 2015 11:27:27 +0300
Subject: [PATCH] gnu: sdl-union: Wrap into a procedure and export it.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Suggested by Ludovic Courtès <ludo@gnu.org>.

* gnu/packages/sdl.scm (sdl-union): Make it a procedure returning
  'sdl-union' package.
  (guile-sdl): Use it.
---
 gnu/packages/sdl.scm | 68 ++++++++++++++++++++++++++++++----------------------
 1 file changed, 39 insertions(+), 29 deletions(-)

diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 50fe010..021feff 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -42,7 +42,8 @@
             sdl-image
             sdl-mixer
             sdl-net
-            sdl-ttf))
+            sdl-ttf
+            sdl-union))
 
 (define sdl
   (package
@@ -268,33 +269,42 @@ SDL.")
     (home-page "http://www.libsdl.org/projects/SDL_ttf/")
     (license zlib)))
 
-(define sdl-union
-  (package
-    (name "sdl-union")
-    (version (package-version sdl))
-    (source #f)
-    (build-system trivial-build-system)
-    (arguments
-     '(#:modules ((guix build union))
-       #:builder (begin
-                   (use-modules (ice-9 match)
-                                (guix build union))
-                   (match %build-inputs
-                     (((names . directories) ...)
-                      (union-build (assoc-ref %outputs "out")
-                                   directories))))))
-    (inputs `(("sdl" ,sdl)
-              ("sdl-gfx" ,sdl-gfx)
-              ("sdl-image" ,sdl-image)
-              ("sdl-mixer" ,sdl-mixer)
-              ("sdl-ttf" ,sdl-ttf)))
-    (synopsis "Union of all SDL libraries")
-    (description
-     "A union of SDL and its extension libraries.  A union is required because
-sdl-config assumes that all of the headers and libraries are in the same
-directory.")
-    (home-page (package-home-page sdl))
-    (license (package-license sdl))))
+(define (sdl-union . sdl-packages)
+  "Return 'sdl-union' package that is the union of SDL-PACKAGES.
+If SDL-PACKAGES are not specified, all SDL libraries are used."
+  (let* ((sdl-packages (if (null? sdl-packages)
+                           (list sdl
+                                 sdl-gfx
+                                 sdl-image
+                                 sdl-mixer
+                                 sdl-net
+                                 sdl-ttf)
+                           sdl-packages))
+         (inputs (map (lambda (pkg)
+                        (list (package-name pkg) pkg))
+                      sdl-packages)))
+    (package
+      (name "sdl-union")
+      (version (package-version sdl))
+      (source #f)
+      (build-system trivial-build-system)
+      (arguments
+       '(#:modules ((guix build union))
+         #:builder (begin
+                     (use-modules (ice-9 match)
+                                  (guix build union))
+                     (match %build-inputs
+                       (((names . directories) ...)
+                        (union-build (assoc-ref %outputs "out")
+                                     directories))))))
+      (inputs inputs)
+      (synopsis "Union of SDL libraries")
+      (description
+       "A union of SDL and its extension libraries.  The union is
+required because sdl-config assumes that all of the headers and
+libraries are in the same directory.")
+      (home-page (package-home-page sdl))
+      (license (package-license sdl)))))
 
 (define-public guile-sdl
   (package
@@ -316,7 +326,7 @@ directory.")
        ("libjpeg" ,libjpeg)))
     (inputs
      `(("guile" ,guile-2.0)
-       ("sdl-union" ,sdl-union)))
+       ("sdl-union" ,(sdl-union))))
     (arguments
      '(#:configure-flags
        (list (string-append "--with-sdl-prefix="
-- 
2.5.0


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

* Re: [PATCH] gnu: sdl-union: Wrap into a procedure and export it.
  2015-10-10  8:48       ` [PATCH] gnu: sdl-union: Wrap into a procedure and export it Alex Kost
@ 2015-10-11 16:50         ` Ludovic Courtès
  2015-10-12  8:54           ` Alex Kost
  0 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2015-10-11 16:50 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> From f1bd9edbbae498fb3b4726428daf523e3fd83060 Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Sat, 10 Oct 2015 11:27:27 +0300
> Subject: [PATCH] gnu: sdl-union: Wrap into a procedure and export it.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Suggested by Ludovic Courtès <ludo@gnu.org>.
>
> * gnu/packages/sdl.scm (sdl-union): Make it a procedure returning
>   'sdl-union' package.
>   (guile-sdl): Use it.

I like this idea.

> +(define (sdl-union . sdl-packages)
> +  "Return 'sdl-union' package that is the union of SDL-PACKAGES.
> +If SDL-PACKAGES are not specified, all SDL libraries are used."
> +  (let* ((sdl-packages (if (null? sdl-packages)
> +                           (list sdl
> +                                 sdl-gfx
> +                                 sdl-image
> +                                 sdl-mixer
> +                                 sdl-net
> +                                 sdl-ttf)
> +                           sdl-packages))

What about writing it like this:

  (define* (sdl-union #:optional (packages (list sdl sdl-gfx …)))
    …)

That would be more concise and more idiomatic.

If that’s fine with you, OK to push with this change.

Thanks!

Ludo’.

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

* Re: [PATCH 2/2] gnu: Add manaplus.
  2015-10-10  8:48   ` [PATCH 2/2] gnu: Add manaplus Alex Kost
@ 2015-10-11 16:52     ` Ludovic Courtès
  2015-10-12  8:54       ` Alex Kost
  0 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2015-10-11 16:52 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2015-10-09 15:40 +0300) wrote:

[...]

>> Can’t ‘sdl-union’ be used here?  I think it was created specifically to
>> solve this problem.  (Currently it’s private to (gnu packages sdl) but
>> you can export it.)
>
> Oh, great, I didn't know about it, thanks!  It will reduce the workaround.
>
> However, just using this package cannot solve the problem: 'sdl-config'
> points directly to "/gnu/store/…-sdl-1.2.15", so you need to modify a
> package anyway to make it find "/gnu/store/…-sdl-union-1.2.15/include/SDL"
> (that's why 'guile-sdl' specifies "--with-sdl-prefix=").

Oh.  :-/  Then I guess you can go with the original patch, which LGTM.

Thanks,
Ludo’.

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

* Re: [PATCH] gnu: sdl-union: Wrap into a procedure and export it.
  2015-10-11 16:50         ` Ludovic Courtès
@ 2015-10-12  8:54           ` Alex Kost
  0 siblings, 0 replies; 14+ messages in thread
From: Alex Kost @ 2015-10-12  8:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2015-10-11 19:50 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> +(define (sdl-union . sdl-packages)
>> +  "Return 'sdl-union' package that is the union of SDL-PACKAGES.
>> +If SDL-PACKAGES are not specified, all SDL libraries are used."
>> +  (let* ((sdl-packages (if (null? sdl-packages)
>> +                           (list sdl
>> +                                 sdl-gfx
>> +                                 sdl-image
>> +                                 sdl-mixer
>> +                                 sdl-net
>> +                                 sdl-ttf)
>> +                           sdl-packages))
>
> What about writing it like this:
>
>   (define* (sdl-union #:optional (packages (list sdl sdl-gfx …)))
>     …)
>
> That would be more concise and more idiomatic.
>
> If that’s fine with you, OK to push with this change.

Sure, fixed and pushed, thanks !

-- 
Alex

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

* Re: [PATCH 2/2] gnu: Add manaplus.
  2015-10-11 16:52     ` Ludovic Courtès
@ 2015-10-12  8:54       ` Alex Kost
  2015-10-12 16:35         ` Ludovic Courtès
  0 siblings, 1 reply; 14+ messages in thread
From: Alex Kost @ 2015-10-12  8:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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

Ludovic Courtès (2015-10-11 19:52 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> Ludovic Courtès (2015-10-09 15:40 +0300) wrote:
>
> [...]
>
>>> Can’t ‘sdl-union’ be used here?  I think it was created specifically to
>>> solve this problem.  (Currently it’s private to (gnu packages sdl) but
>>> you can export it.)
>>
>> Oh, great, I didn't know about it, thanks!  It will reduce the workaround.
>>
>> However, just using this package cannot solve the problem: 'sdl-config'
>> points directly to "/gnu/store/…-sdl-1.2.15", so you need to modify a
>> package anyway to make it find "/gnu/store/…-sdl-union-1.2.15/include/SDL"
>> (that's why 'guile-sdl' specifies "--with-sdl-prefix=").
>
> Oh.  :-/  Then I guess you can go with the original patch, which LGTM.

Actually, I think it will be more clear to use 'sdl-union' here, because
the workaround is more concise, WDYT?

The original workaround was:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 899 bytes --]

+    (arguments
+     '(#:modules ((ice-9 match)
+                  (ice-9 regex)
+                  (srfi srfi-1)
+                  (guix build gnu-build-system)
+                  (guix build utils))
+       ;; The package relies on "sdl-config" to find SDL header files,
+       ;; which adds "include/SDL" for 'sdl' itself.  We need to include
+       ;; such directories for all sdl packages.
+       #:configure-flags
+       (let* ((sdl-rx   (make-regexp "\\`sdl"))
+              (includes (filter-map (match-lambda
+                                      ((name . dir)
+                                       (and (regexp-exec sdl-rx name)
+                                            (string-append
+                                             "-I" dir "/include/SDL"))))
+                                    %build-inputs)))
+         (list (format #f "CPPFLAGS=~{~a ~}" includes)))))



[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


Now it is:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: Type: text/x-patch, Size: 200 bytes --]

+    (arguments
+     '(#:configure-flags
+       (list (string-append "CPPFLAGS=-I"
+                            (assoc-ref %build-inputs "sdl-union")
+                            "/include/SDL"))))

[-- Attachment #5: Type: text/plain, Size: 34 bytes --]


The modified patch is attached.


[-- Attachment #6: 0001-gnu-Add-manaplus.patch --]
[-- Type: text/x-patch, Size: 2539 bytes --]

From 2ace868aa60b36eb134ac155f79cee6d2f402970 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Sun, 4 Oct 2015 20:34:48 +0300
Subject: [PATCH] gnu: Add manaplus.

* gnu/packages/games.scm (manaplus): New variable.
---
 gnu/packages/games.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 3f1f5a9..cbc147f 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2015 David Hashe <david.hashe@dhashe.com>
 ;;; Copyright © 2015 Christopher Allan Webber <cwebber@dustycloud.org>
 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1105,3 +1106,41 @@ on the screen and keyboard to display letters.")
     ;; Most files under gpl2+ or gpl3+, but eat.wav under gpl3
     (license license:gpl3)))
 
+(define-public manaplus
+  (package
+    (name "manaplus")
+    (version "1.5.9.26")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://repo.manaplus.org/manaplus/download/"
+                    version "/manaplus-" version ".tar.xz"))
+              (sha256
+               (base32
+                "070ms1cv7q88284pqh66lfhacckgv7m9s8z9009k2laypibx7vs6"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:configure-flags
+       (list (string-append "CPPFLAGS=-I"
+                            (assoc-ref %build-inputs "sdl-union")
+                            "/include/SDL"))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("glu" ,glu)
+       ("curl" ,curl)
+       ("libxml2" ,libxml2)
+       ("mesa" ,mesa)
+       ("physfs" ,physfs)
+       ("sdl-union" ,(sdl-union))))
+    (home-page "http://manaplus.org")
+    (synopsis "Client for 'The Mana World' and similar games")
+    (description
+     "ManaPlus is a 2D MMORPG client for game servers.  It is the only
+fully supported client for @uref{http://www.themanaworld.org, The mana
+world}, @uref{http://evolonline.org, Evol Online} and
+@uref{http://landoffire.org, Land of fire}.")
+    ;; "src/debug/*" and "src/sdl2gfx/*" are under Zlib.
+    ;; "data/themes/{golden-delicious,jewelry}/*" are under CC-BY-SA.
+    ;; The rest is under GPL2+.
+    (license (list license:gpl2+ license:zlib license:cc-by-sa4.0))))
-- 
2.5.0


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

* Re: [PATCH 2/2] gnu: Add manaplus.
  2015-10-12  8:54       ` Alex Kost
@ 2015-10-12 16:35         ` Ludovic Courtès
  2015-10-13 10:34           ` [PATCH] gnu: abbaye: Use 'sdl-union' Alex Kost
  0 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2015-10-12 16:35 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2015-10-11 19:52 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
>>> Ludovic Courtès (2015-10-09 15:40 +0300) wrote:
>>
>> [...]
>>
>>>> Can’t ‘sdl-union’ be used here?  I think it was created specifically to
>>>> solve this problem.  (Currently it’s private to (gnu packages sdl) but
>>>> you can export it.)
>>>
>>> Oh, great, I didn't know about it, thanks!  It will reduce the workaround.
>>>
>>> However, just using this package cannot solve the problem: 'sdl-config'
>>> points directly to "/gnu/store/…-sdl-1.2.15", so you need to modify a
>>> package anyway to make it find "/gnu/store/…-sdl-union-1.2.15/include/SDL"
>>> (that's why 'guile-sdl' specifies "--with-sdl-prefix=").
>>
>> Oh.  :-/  Then I guess you can go with the original patch, which LGTM.
>
> Actually, I think it will be more clear to use 'sdl-union' here, because
> the workaround is more concise, WDYT?

Indeed.

> From 2ace868aa60b36eb134ac155f79cee6d2f402970 Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Sun, 4 Oct 2015 20:34:48 +0300
> Subject: [PATCH] gnu: Add manaplus.
>
> * gnu/packages/games.scm (manaplus): New variable.

OK!

Ludo’.

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

* [PATCH] gnu: abbaye: Use 'sdl-union'.
  2015-10-12 16:35         ` Ludovic Courtès
@ 2015-10-13 10:34           ` Alex Kost
  2015-10-13 14:01             ` Thompson, David
  0 siblings, 1 reply; 14+ messages in thread
From: Alex Kost @ 2015-10-13 10:34 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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

Ludovic Courtès (2015-10-12 19:35 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
[...]
>> Actually, I think it will be more clear to use 'sdl-union' here, because
>> the workaround is more concise, WDYT?
>
> Indeed.

What about using 'sdl-union' in ‘abbaye’ as well?

I have switched ‘abbaye’ to 'modify-phases' syntax, but since it is
trivial I didn't send the patch for it (I hope it's OK).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-abbaye-Use-sdl-union.patch --]
[-- Type: text/x-patch, Size: 2495 bytes --]

From 310cd7241fdb8e5c37e8649473fb3d6a04e898ac Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Sat, 10 Oct 2015 10:47:15 +0300
Subject: [PATCH] gnu: abbaye: Use 'sdl-union'.

* gnu/packages/games.scm (abbaye)[inputs]: Use 'sdl-union'.
  [arguments]: Adjust 'set-sdl-paths' phase accordingly.
---
 gnu/packages/games.scm | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index e250bf9..dfaf838 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -163,17 +163,10 @@ scriptable with Guile.")
                   (guix build utils))
        #:phases (modify-phases %standard-phases
                   (add-after 'set-paths 'set-sdl-paths
-                    (lambda* (#:key inputs outputs (search-paths '())
-                              #:allow-other-keys)
-                      (define input-directories
-                        (match inputs
-                          (((_ . dir) ...)
-                           dir)))
-                      ;; This package does not use pkg-config, so modify CPATH
-                      ;; variable to point to include/SDL for SDL header files.
-                      (set-path-environment-variable "CPATH"
-                                                     '("include/SDL")
-                                                     input-directories)))
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (setenv "CPATH"
+                              (string-append (assoc-ref inputs "sdl-union")
+                                             "/include/SDL"))))
                   (add-after 'patch-source-shebangs 'patch-makefile
                     (lambda* (#:key outputs #:allow-other-keys)
                       ;; Replace /usr with package output directory.
@@ -192,11 +185,7 @@ scriptable with Guile.")
                   (delete 'configure))
        #:tests? #f)) ;; No check target.
     (native-inputs `(("pkg-config" ,pkg-config)))
-    (inputs `(("sdl" ,sdl)
-              ("sdl-gfx" ,sdl-gfx)
-              ("sdl-image" ,sdl-image)
-              ("sdl-mixer" ,sdl-mixer)
-              ("sdl-ttf" ,sdl-ttf)))
+    (inputs `(("sdl-union" ,(sdl-union))))
     (home-page "http://code.google.com/p/abbaye-for-linux/")
     (synopsis "GNU/Linux port of the indie game \"l'Abbaye des Morts\"")
     (description "L'Abbaye des Morts is a 2D platform game set in 13th century
-- 
2.5.0


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

* Re: [PATCH] gnu: abbaye: Use 'sdl-union'.
  2015-10-13 10:34           ` [PATCH] gnu: abbaye: Use 'sdl-union' Alex Kost
@ 2015-10-13 14:01             ` Thompson, David
  2015-10-14 16:23               ` Alex Kost
  0 siblings, 1 reply; 14+ messages in thread
From: Thompson, David @ 2015-10-13 14:01 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

On Tue, Oct 13, 2015 at 6:34 AM, Alex Kost <alezost@gmail.com> wrote:
> Ludovic Courtès (2015-10-12 19:35 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
> [...]
>>> Actually, I think it will be more clear to use 'sdl-union' here, because
>>> the workaround is more concise, WDYT?
>>
>> Indeed.
>
> What about using 'sdl-union' in ‘abbaye’ as well?
>
> I have switched ‘abbaye’ to 'modify-phases' syntax, but since it is
> trivial I didn't send the patch for it (I hope it's OK).

LGTM.  Thanks!

- Dave

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

* Re: [PATCH] gnu: abbaye: Use 'sdl-union'.
  2015-10-13 14:01             ` Thompson, David
@ 2015-10-14 16:23               ` Alex Kost
  0 siblings, 0 replies; 14+ messages in thread
From: Alex Kost @ 2015-10-14 16:23 UTC (permalink / raw)
  To: Thompson, David; +Cc: guix-devel

Thompson, David (2015-10-13 17:01 +0300) wrote:

> On Tue, Oct 13, 2015 at 6:34 AM, Alex Kost <alezost@gmail.com> wrote:
>> Ludovic Courtès (2015-10-12 19:35 +0300) wrote:
>>
>>> Alex Kost <alezost@gmail.com> skribis:
>>>
>> [...]
>>>> Actually, I think it will be more clear to use 'sdl-union' here, because
>>>> the workaround is more concise, WDYT?
>>>
>>> Indeed.
>>
>> What about using 'sdl-union' in ‘abbaye’ as well?
>>
>> I have switched ‘abbaye’ to 'modify-phases' syntax, but since it is
>> trivial I didn't send the patch for it (I hope it's OK).
>
> LGTM.  Thanks!

Thanks for looking into it!  Pushed.

-- 
Alex

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

end of thread, other threads:[~2015-10-14 16:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-04 19:16 [PATCH 2/2] gnu: Add manaplus Alex Kost
2015-10-09 12:40 ` Ludovic Courtès
2015-10-09 16:56   ` Thompson, David
2015-10-09 21:56     ` Ludovic Courtès
2015-10-10  8:48       ` [PATCH] gnu: sdl-union: Wrap into a procedure and export it Alex Kost
2015-10-11 16:50         ` Ludovic Courtès
2015-10-12  8:54           ` Alex Kost
2015-10-10  8:48   ` [PATCH 2/2] gnu: Add manaplus Alex Kost
2015-10-11 16:52     ` Ludovic Courtès
2015-10-12  8:54       ` Alex Kost
2015-10-12 16:35         ` Ludovic Courtès
2015-10-13 10:34           ` [PATCH] gnu: abbaye: Use 'sdl-union' Alex Kost
2015-10-13 14:01             ` Thompson, David
2015-10-14 16:23               ` Alex Kost

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).