all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Add MARS shooter.
@ 2015-09-18 19:25 Ricardo Wurmus
  2015-09-19  8:25 ` Ricardo Wurmus
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Ricardo Wurmus @ 2015-09-18 19:25 UTC (permalink / raw)
  To: guix-devel

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

Hi Guix,

attached is a patch to add MARS.  This is really a fun game and you can
play it with a friend on the same machine.

I could not get sound to work, unfortunately, because /dev/dsp does not
exist on my machine.  It’s not a problem with the package, but maybe
someone could give me a hint about what kernel module to load to get
this device.  The game is more fun with sound :)

~~ Ricardo


[-- Attachment #2: 0001-gnu-Add-MARS.patch --]
[-- Type: text/x-patch, Size: 12017 bytes --]

From 75019485e0090a9c4169a55005232689efa70c2f Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Mon, 31 Aug 2015 10:09:40 +0200
Subject: [PATCH] gnu: Add MARS.

* gnu/packages/games.scm (mars): New variable.
* gnu/packages/patches/mars-install.patch: New file.
* gnu/packages/patches/mars-sfml-2.3.patch: New file.
* gnu-system.am (dist_patch_DATA): Add them.
---
 gnu-system.am                            |   2 +
 gnu/packages/games.scm                   |  54 +++++++++++
 gnu/packages/patches/mars-install.patch  |  17 ++++
 gnu/packages/patches/mars-sfml-2.3.patch | 151 +++++++++++++++++++++++++++++++
 4 files changed, 224 insertions(+)
 create mode 100644 gnu/packages/patches/mars-install.patch
 create mode 100644 gnu/packages/patches/mars-sfml-2.3.patch

diff --git a/gnu-system.am b/gnu-system.am
index d3c63ca..9f878bd 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -558,6 +558,8 @@ dist_patch_DATA =						\
   gnu/packages/patches/luit-posix.patch				\
   gnu/packages/patches/m4-gets-undeclared.patch			\
   gnu/packages/patches/make-impure-dirs.patch			\
+  gnu/packages/patches/mars-install.patch			\
+  gnu/packages/patches/mars-sfml-2.3.patch			\
   gnu/packages/patches/maxima-defsystem-mkdir.patch		\
   gnu/packages/patches/mc-fix-ncurses-build.patch		\
   gnu/packages/patches/mcron-install.patch			\
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 7eb65bb..3d5e4f9 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 Ricardo Wurmus <rekado@elephly.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,11 +32,14 @@
   #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages fribidi)
+  #:use-module (gnu packages game-development)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
@@ -44,6 +48,7 @@
   #:use-module (gnu packages guile)
   #:use-module (gnu packages libcanberra)
   #:use-module (gnu packages libunwind)
+  #:use-module (gnu packages mp3)
   #:use-module (gnu packages image)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages python)
@@ -573,6 +578,55 @@ for common mesh file formats, and collision detection.")
     (home-page "http://irrlicht.sourceforge.net/")
     (license license:zlib)))
 
+(define-public mars
+  ;; The latest release on SourceForge relies on an unreleased version of SFML
+  ;; with a different API, so we take the latest version from the official
+  ;; repository on Github.
+  (let ((commit "c855d04409"))
+    (package
+      (name "mars")
+      (version (string-append "0.7.5-c" commit ))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/thelaui/M.A.R.S..git")
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "1r4c5gap1z2zsv4yjd34qriqkxaq4lb4rykapyzkkdf4g36lc3nh"))
+                (patches (list (search-patch "mars-sfml-2.3.patch")
+                               (search-patch "mars-install.patch")))))
+      (build-system cmake-build-system)
+      (arguments
+       `(#:tests? #f        ; There are no tests
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'fix-install-path
+            (lambda _
+              (substitute* "src/CMakeLists.txt"
+                (("\\$\\{CMAKE_INSTALL_PREFIX\\}/games")
+                 "${CMAKE_INSTALL_PREFIX}/bin"))))
+           (add-after 'unpack 'fix-data-path
+            (lambda* (#:key outputs #:allow-other-keys)
+              (substitute* "src/System/settings.cpp"
+                (("C_dataPath = \"./data/\";")
+                 (string-append "C_dataPath = \""
+                                (assoc-ref outputs "out")
+                                "/share/games/marsshooter/\";")))
+              #t)))))
+      (inputs
+       `(("mesa" ,mesa)
+         ("fribidi" ,fribidi)
+         ("taglib" ,taglib)
+         ("sfml" ,sfml)))
+      (home-page "http://marsshooter.org")
+      (synopsis "2D space shooter")
+      (description
+       "M.A.R.S. is a 2D space shooter with awesome visual effects and
+attractive physics.  Players can battle each other or computer controlled
+enemies in exciting game modes.")
+      (license license:gpl3+))))
+
 (define minetest-data
   (package
     (name "minetest-data")
diff --git a/gnu/packages/patches/mars-install.patch b/gnu/packages/patches/mars-install.patch
new file mode 100644
index 0000000..1e3964c
--- /dev/null
+++ b/gnu/packages/patches/mars-install.patch
@@ -0,0 +1,17 @@
+Remove install target for non-existant directory.
+
+--- a/src/CMakeLists.txt	2015-09-13 20:52:28.517344327 +0200
++++ b/src/CMakeLists.txt	2015-09-13 20:53:04.842453987 +0200
+@@ -122,12 +122,6 @@
+ 		DESTINATION
+ 			${CMAKE_INSTALL_PREFIX}/share/applications
+ 	)
+-	install(
+-		FILES
+-			${MARS_SOURCE_DIR}/resources/mars
+-		DESTINATION
+-			${CMAKE_INSTALL_PREFIX}/share/menu
+-	)
+ 
+ else(UNIX)
+ 	# executable
diff --git a/gnu/packages/patches/mars-sfml-2.3.patch b/gnu/packages/patches/mars-sfml-2.3.patch
new file mode 100644
index 0000000..01ec05f
--- /dev/null
+++ b/gnu/packages/patches/mars-sfml-2.3.patch
@@ -0,0 +1,151 @@
+This is a concatenation of the following two patches:
+
+  https://github.com/jcowgill/M.A.R.S./commit/33d5affabf8ff84f2c028b9303c6a9e83cc824ad.patch
+  https://patch-diff.githubusercontent.com/raw/thelaui/M.A.R.S./pull/2.patch
+
+Their purpose is to allow Mars to be built against the latest version of SFML.
+
+From 33d5affabf8ff84f2c028b9303c6a9e83cc824ad Mon Sep 17 00:00:00 2001
+From: James Cowgill <james410@cowgill.org.uk>
+Date: Sat, 9 May 2015 01:54:14 +0100
+Subject: [PATCH] Remove dependency on GLU - fixes build with SFML 2.3
+
+---
+ premake4.lua           |  8 ++++----
+ src/Shaders/postFX.cpp |  2 +-
+ src/System/window.cpp  | 12 ++++++------
+ 3 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/premake4.lua b/premake4.lua
+index 023dddd..5af4495 100755
+--- a/premake4.lua
++++ b/premake4.lua
+@@ -11,11 +11,11 @@ project "mars"
+     defines { "NDEBUG" }
+     flags   { "Optimize" }
+     if os.get() == "windows" then
+-      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "glu32", "opengl32", "fribidi-0", "tag" }
++      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "opengl32", "fribidi-0", "tag" }
+     elseif os.get() == "macosx" then
+       links { "sfml-graphics.framework", "sfml-audio.framework", "sfml-system.framework", "sfml-window.framework", "opengl.framework", "fribidi", "tag" }
+     else
+-      links { "GLU", "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
++      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
+       libdirs { "/usr/lib", "/usr/local/lib" }
+     end
+     
+@@ -23,10 +23,10 @@ project "mars"
+     defines { "_DEBUG", "DEBUG" }
+     flags   { "Symbols" }
+     if os.get() == "windows" then
+-      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "glu32", "opengl32", "fribidi-0", "tag" }
++      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "opengl32", "fribidi-0", "tag" }
+     elseif os.get() == "macosx" then
+       links { "sfml-graphics.framework", "sfml-audio.framework", "sfml-system.framework", "sfml-window.framework", "opengl.framework", "fribidi", "tag" }
+     else
+-      links { "GLU", "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
++      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
+       libdirs { "/usr/lib", "/usr/local/lib" }
+     end
+diff --git a/src/Shaders/postFX.cpp b/src/Shaders/postFX.cpp
+index 987f411..f767a47 100644
+--- a/src/Shaders/postFX.cpp
++++ b/src/Shaders/postFX.cpp
+@@ -78,7 +78,7 @@ namespace postFX {
+             postFX_.loadFromFile(settings::C_dataPath + "shaders/bump.frag", sf::Shader::Fragment);
+             bumpMap_.create(SPACE_X_RESOLUTION*0.5f, SPACE_Y_RESOLUTION*0.5f);
+             glViewport(0,0,SPACE_X_RESOLUTION*0.5f,SPACE_Y_RESOLUTION*0.5f);
+-            gluOrtho2D(0, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0);
++            glOrtho(0, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0, -1, 1);
+             glEnable(GL_BLEND);
+             glMatrixMode(GL_MODELVIEW);
+             postFX_.setParameter("BumpMap", bumpMap_.getTexture());
+diff --git a/src/System/window.cpp b/src/System/window.cpp
+index e9a099a..8e12dcc 100644
+--- a/src/System/window.cpp
++++ b/src/System/window.cpp
+@@ -222,7 +222,7 @@ namespace window {
+         glLoadIdentity();
+ 
+         // Setup translation (according to left-upper corner)
+-        gluOrtho2D(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f);
++        glOrtho(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f, -1, 1);
+ 
+         // probably improves performance...
+         glDisable(GL_LIGHTING);
+@@ -247,7 +247,7 @@ namespace window {
+ 
+         glMatrixMode(GL_PROJECTION);
+         glLoadIdentity();
+-        gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
++        glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
+         glMatrixMode(GL_MODELVIEW);
+         glLoadIdentity();
+ 
+@@ -255,7 +255,7 @@ namespace window {
+ 
+         glMatrixMode(GL_PROJECTION);
+         glLoadIdentity();
+-        gluOrtho2D(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f);
++        glOrtho(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f, -1, 1);
+         glMatrixMode(GL_MODELVIEW);
+         glLoadIdentity();
+     }
+@@ -270,7 +270,7 @@ namespace window {
+             glLoadIdentity();
+             setViewPort();
+ 
+-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
++            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
+ 
+             glMatrixMode(GL_MODELVIEW);
+             glLoadIdentity();
+@@ -284,7 +284,7 @@ namespace window {
+             glLoadIdentity();
+             setViewPort();
+ 
+-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
++            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
+ 
+             glMatrixMode(GL_MODELVIEW);
+             glLoadIdentity();
+@@ -294,7 +294,7 @@ namespace window {
+         else {
+             glMatrixMode(GL_PROJECTION);
+             glLoadIdentity();
+-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
++            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
+             glMatrixMode(GL_MODELVIEW);
+             glLoadIdentity();
+         }
+
+From a97d0d6a19b5b43e3c53081e36f1f1747b6674e6 Mon Sep 17 00:00:00 2001
+From: Sylvain BOILARD <boilard@crans.org>
+Date: Wed, 23 Jan 2013 02:02:47 +0100
+Subject: [PATCH] Use sf::Shader::Bind() correctly after latest update of the
+ SFML's API.
+
+---
+ src/System/window.cpp | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/src/System/window.cpp b/src/System/window.cpp
+index e9a099a..3ffcf65 100644
+--- a/src/System/window.cpp
++++ b/src/System/window.cpp
+@@ -307,13 +307,11 @@ namespace window {
+         window_.setActive(true);
+         glEnable(GL_TEXTURE_2D);
+ 
+-        if (shader)
+-            shader->bind();
++        sf::Shader::bind(shader);
+ 
+         window_.draw(toBeDrawn, states);
+ 
+-        if (shader)
+-            shader->unbind();
++        sf::Shader::bind(NULL);
+ 
+         window_.popGLStates();
+         glPopMatrix();
-- 
2.5.0


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

* Re: [PATCH] Add MARS shooter.
  2015-09-18 19:25 [PATCH] Add MARS shooter Ricardo Wurmus
@ 2015-09-19  8:25 ` Ricardo Wurmus
  2015-09-19 15:44   ` Thompson, David
  2015-09-19 17:17 ` Eric Bavier
  2015-09-20 15:49 ` [PATCH] Add MARS shooter Ricardo Wurmus
  2 siblings, 1 reply; 18+ messages in thread
From: Ricardo Wurmus @ 2015-09-19  8:25 UTC (permalink / raw)
  To: guix-devel

Hi again,

> attached is a patch to add MARS.  This is really a fun game and you can
> play it with a friend on the same machine.

Eric Bavier told me on IRC that there is actually a tarball I could use
instead of the git reference, so I tried it:

    $ guix download https://github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz
    starting download of `/tmp/guix-file.674jSo' from `https://github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz'...
    following redirection to `https://cloud.github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz'...
    ERROR: Bad media-type header component: .gz

    failed to download "/tmp/guix-file.674jSo" from "https://github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz"
    guix download: error: https://github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz: download failed

“wget --server-response” tells me that these are the headers:

~~~~~~
...
Location: https://cloud.github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz [following]
--2015-09-19 10:21:18--  https://cloud.github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz
Resolving cloud.github.com (cloud.github.com)... 54.230.44.22, 54.230.44.124, 54.230.44.114, ...
Connecting to cloud.github.com (cloud.github.com)|54.230.44.22|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Content-Type: .gz
  Content-Length: 86856256
  Connection: keep-alive
  Date: Sat, 19 Sep 2015 08:21:20 GMT
  Last-Modified: Fri, 29 Jun 2012 16:04:12 GMT
  ETag: "bbbc5fda27ce7f35a0660269c11e93d6"
  Accept-Ranges: bytes
  Server: AmazonS3
  X-Cache: Miss from cloudfront
  Via: 1.1 d2fa707728d9947a31db9f8dc3e9e56c.cloudfront.net (CloudFront)
  X-Amz-Cf-Id: HSTrtLUzjdqLxCh9_ZoNDe5WGkZcCF7-gs9mGYBYe32i3ADvttP9gA==
~~~~~~

“Content-Type: .gz” is what trips up “guix download”.  What follows
“Content-Type:” should be a mime type and I suppose “.gz” is not a valid
mime type.  Would it make sense for the HTTP client to be a little more
tolerant about this?

~~ Ricardo

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

* Re: [PATCH] Add MARS shooter.
  2015-09-19  8:25 ` Ricardo Wurmus
@ 2015-09-19 15:44   ` Thompson, David
  2015-09-19 20:06     ` Ricardo Wurmus
  2015-09-25 22:30     ` Christopher Allan Webber
  0 siblings, 2 replies; 18+ messages in thread
From: Thompson, David @ 2015-09-19 15:44 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Sat, Sep 19, 2015 at 4:25 AM, Ricardo Wurmus <rekado@elephly.net> wrote:
> Hi again,
>
>> attached is a patch to add MARS.  This is really a fun game and you can
>> play it with a friend on the same machine.
>
> Eric Bavier told me on IRC that there is actually a tarball I could use
> instead of the git reference, so I tried it:
>
>     $ guix download https://github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz
>     starting download of `/tmp/guix-file.674jSo' from `https://github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz'...
>     following redirection to `https://cloud.github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz'...
>     ERROR: Bad media-type header component: .gz
>
>     failed to download "/tmp/guix-file.674jSo" from "https://github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz"
>     guix download: error: https://github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz: download failed
>
> “wget --server-response” tells me that these are the headers:
>
> ~~~~~~
> ...
> Location: https://cloud.github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz [following]
> --2015-09-19 10:21:18--  https://cloud.github.com/downloads/thelaui/M.A.R.S./mars_source_0.7.5.tar.gz
> Resolving cloud.github.com (cloud.github.com)... 54.230.44.22, 54.230.44.124, 54.230.44.114, ...
> Connecting to cloud.github.com (cloud.github.com)|54.230.44.22|:443... connected.
> HTTP request sent, awaiting response...
>   HTTP/1.1 200 OK
>   Content-Type: .gz
>   Content-Length: 86856256
>   Connection: keep-alive
>   Date: Sat, 19 Sep 2015 08:21:20 GMT
>   Last-Modified: Fri, 29 Jun 2012 16:04:12 GMT
>   ETag: "bbbc5fda27ce7f35a0660269c11e93d6"
>   Accept-Ranges: bytes
>   Server: AmazonS3
>   X-Cache: Miss from cloudfront
>   Via: 1.1 d2fa707728d9947a31db9f8dc3e9e56c.cloudfront.net (CloudFront)
>   X-Amz-Cf-Id: HSTrtLUzjdqLxCh9_ZoNDe5WGkZcCF7-gs9mGYBYe32i3ADvttP9gA==
> ~~~~~~
>
> “Content-Type: .gz” is what trips up “guix download”.  What follows
> “Content-Type:” should be a mime type and I suppose “.gz” is not a valid
> mime type.  Would it make sense for the HTTP client to be a little more
> tolerant about this?

No, upstream needs to fix their invalid Content-Type header.  We've
had this problem a few times, most recently with rubygems.org, and in
all cases we've gotten upstream to fix it.  Strict header parsing can
seem like an issue at times, but it's really a very good feature that
the rest of the world seems to ignore. [0]

Hope this helps.  MARS looks fun.  On the subject of games, we should
get more games that can be played over the network and make a little
Guix gaming club.  Xonotic is my #1 request.

[0] https://www.gnu.org/software/guile/manual/html_node/Types-and-the-Web.html

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

* Re: [PATCH] Add MARS shooter.
  2015-09-18 19:25 [PATCH] Add MARS shooter Ricardo Wurmus
  2015-09-19  8:25 ` Ricardo Wurmus
@ 2015-09-19 17:17 ` Eric Bavier
  2015-09-20 10:08   ` Ricardo Wurmus
  2015-09-20 16:30   ` Version strings for VCS snapshots Ludovic Courtès
  2015-09-20 15:49 ` [PATCH] Add MARS shooter Ricardo Wurmus
  2 siblings, 2 replies; 18+ messages in thread
From: Eric Bavier @ 2015-09-19 17:17 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Fri, 18 Sep 2015 21:25:00 +0200
Ricardo Wurmus <rekado@elephly.net> wrote:

> attached is a patch to add MARS.  This is really a fun game and you can
> play it with a friend on the same machine.

Yay!  I was pleased to find that it even plays nicely on my i686
netbook :)

> 
> I could not get sound to work, unfortunately, because /dev/dsp does not
> exist on my machine.  It’s not a problem with the package, but maybe
> someone could give me a hint about what kernel module to load to get
> this device.

Same on my machine.  I learned about the ossdp software, which may
help.  http://sourceforge.net/projects/osspd/

> From 75019485e0090a9c4169a55005232689efa70c2f Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <rekado@elephly.net>
> Date: Mon, 31 Aug 2015 10:09:40 +0200
> Subject: [PATCH] gnu: Add MARS.
> 
> * gnu/packages/games.scm (mars): New variable.
> * gnu/packages/patches/mars-install.patch: New file.
> * gnu/packages/patches/mars-sfml-2.3.patch: New file.
> * gnu-system.am (dist_patch_DATA): Add them.
> ---
>  gnu-system.am                            |   2 +
>  gnu/packages/games.scm                   |  54 +++++++++++
>  gnu/packages/patches/mars-install.patch  |  17 ++++
>  gnu/packages/patches/mars-sfml-2.3.patch | 151 +++++++++++++++++++++++++++++++
>  4 files changed, 224 insertions(+)
>  create mode 100644 gnu/packages/patches/mars-install.patch
>  create mode 100644 gnu/packages/patches/mars-sfml-2.3.patch
[...]
> +(define-public mars
> +  ;; The latest release on SourceForge relies on an unreleased version of SFML
> +  ;; with a different API, so we take the latest version from the official
> +  ;; repository on Github.
> +  (let ((commit "c855d04409"))
> +    (package
> +      (name "mars")
> +      (version (string-append "0.7.5-c" commit ))

I realize we have no guidelines in the manual concerning the version
field for git checkouts, but I wonder whether we should, as it comes up
a bit.  Several existing packages use (string-append "1.2.3." commit),
where "1.2.3" is the version of the corresponding source.  One other
package uses the (string-append "1.2.3-c" commit) method, and another
uses (string-append "1.2.3-" commit.  I personally prefer the "-"
notation, since it distinguishes the commit hash from the version
number (does it confuse any internal logic that assumes a package
version number is the last component of the store path following a
dash?).  In this case, the "-c" seems confusing because the commit hash
itself begins with a 'c'.

I recall some discussion previously about how it would be nice for
git-checkout package versions to still "sort" nicely.

> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/thelaui/M.A.R.S..git")
> +                      (commit commit)))

guix lint should warn now about the 'file-name' of the origin.

> +                (sha256
> +                 (base32
> +                  "1r4c5gap1z2zsv4yjd34qriqkxaq4lb4rykapyzkkdf4g36lc3nh"))
> +                (patches (list (search-patch "mars-sfml-2.3.patch")

As mentioned on IRC, I had trouble applying this patch because some DOS
line-endings went missing somewhere.  We just need to make sure they
are preserved by git.

> +                               (search-patch "mars-install.patch")))))
> +      (build-system cmake-build-system)
> +      (arguments
> +       `(#:tests? #f        ; There are no tests
> +         #:phases
> +         (modify-phases %standard-phases
> +           (add-after 'unpack 'fix-install-path
> +            (lambda _
> +              (substitute* "src/CMakeLists.txt"
> +                (("\\$\\{CMAKE_INSTALL_PREFIX\\}/games")
> +                 "${CMAKE_INSTALL_PREFIX}/bin"))))

As in the following phase, could you return #t after the 'substitute*'?

> +           (add-after 'unpack 'fix-data-path
> +            (lambda* (#:key outputs #:allow-other-keys)
> +              (substitute* "src/System/settings.cpp"
> +                (("C_dataPath = \"./data/\";")
> +                 (string-append "C_dataPath = \""
> +                                (assoc-ref outputs "out")
> +                                "/share/games/marsshooter/\";")))
> +              #t)))))
> +      (inputs
> +       `(("mesa" ,mesa)
> +         ("fribidi" ,fribidi)
> +         ("taglib" ,taglib)
> +         ("sfml" ,sfml)))

Our sfml package has been failing to build on hydra for a few weeks
because of receiving unexpected hashes from the source downloads.  It
appears the authors may have changed the zip file in place when they
released the latest version, and you simply had the previous zip in
your store from before.  Hydra seems to not be serving the correct zip
file either.

`~Eric

> +      (home-page "http://marsshooter.org")
> +      (synopsis "2D space shooter")
> +      (description
> +       "M.A.R.S. is a 2D space shooter with awesome visual effects and
> +attractive physics.  Players can battle each other or computer controlled
> +enemies in exciting game modes.")
> +      (license license:gpl3+))))
> +
>  (define minetest-data
>    (package
>      (name "minetest-data")

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

* Re: [PATCH] Add MARS shooter.
  2015-09-19 15:44   ` Thompson, David
@ 2015-09-19 20:06     ` Ricardo Wurmus
  2015-09-19 20:33       ` Thompson, David
  2015-09-25 22:30     ` Christopher Allan Webber
  1 sibling, 1 reply; 18+ messages in thread
From: Ricardo Wurmus @ 2015-09-19 20:06 UTC (permalink / raw)
  To: Thompson, David; +Cc: guix-devel


Thompson, David <dthompson2@worcester.edu> writes:

>> “Content-Type: .gz” is what trips up “guix download”.  What follows
>> “Content-Type:” should be a mime type and I suppose “.gz” is not a valid
>> mime type.  Would it make sense for the HTTP client to be a little more
>> tolerant about this?
>
> No, upstream needs to fix their invalid Content-Type header.  We've
> had this problem a few times, most recently with rubygems.org, and in
> all cases we've gotten upstream to fix it.  Strict header parsing can
> seem like an issue at times, but it's really a very good feature that
> the rest of the world seems to ignore. [0]

I wonder what a correct Content-Type header would look like in this
case.  I would like to submit a helpful report containing what I got and
what it should have been.

However, this is independent from the patch itself where I’m using a git
reference.

~~ Ricardo

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

* Re: [PATCH] Add MARS shooter.
  2015-09-19 20:06     ` Ricardo Wurmus
@ 2015-09-19 20:33       ` Thompson, David
  2015-09-20  7:51         ` Ricardo Wurmus
  0 siblings, 1 reply; 18+ messages in thread
From: Thompson, David @ 2015-09-19 20:33 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Sat, Sep 19, 2015 at 4:06 PM, Ricardo Wurmus <rekado@elephly.net> wrote:
>
> Thompson, David <dthompson2@worcester.edu> writes:
>
>>> “Content-Type: .gz” is what trips up “guix download”.  What follows
>>> “Content-Type:” should be a mime type and I suppose “.gz” is not a valid
>>> mime type.  Would it make sense for the HTTP client to be a little more
>>> tolerant about this?
>>
>> No, upstream needs to fix their invalid Content-Type header.  We've
>> had this problem a few times, most recently with rubygems.org, and in
>> all cases we've gotten upstream to fix it.  Strict header parsing can
>> seem like an issue at times, but it's really a very good feature that
>> the rest of the world seems to ignore. [0]
>
> I wonder what a correct Content-Type header would look like in this
> case.  I would like to submit a helpful report containing what I got and
> what it should have been.

In this case, application/x-gzip or application/octet-stream would be
appropriate.  Less specifically, the media type needs to match the
syntax as defined by the W3C spec. [0]

> However, this is independent from the patch itself where I’m using a git
> reference.

Ah yes, you are right. :)

- Dave

[0] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7

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

* Re: [PATCH] Add MARS shooter.
  2015-09-19 20:33       ` Thompson, David
@ 2015-09-20  7:51         ` Ricardo Wurmus
  2015-09-20  9:46           ` Ricardo Wurmus
  0 siblings, 1 reply; 18+ messages in thread
From: Ricardo Wurmus @ 2015-09-20  7:51 UTC (permalink / raw)
  To: Thompson, David; +Cc: guix-devel

>>> No, upstream needs to fix their invalid Content-Type header.  We've
>>> had this problem a few times, most recently with rubygems.org, and in
>>> all cases we've gotten upstream to fix it.  Strict header parsing can
>>> seem like an issue at times, but it's really a very good feature that
>>> the rest of the world seems to ignore. [0]
>>
>> I wonder what a correct Content-Type header would look like in this
>> case.  I would like to submit a helpful report containing what I got and
>> what it should have been.
>
> In this case, application/x-gzip or application/octet-stream would be
> appropriate.  Less specifically, the media type needs to match the
> syntax as defined by the W3C spec. [0]

Thanks, I opened a support ticket with Github.com.

~~ Ricardo

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

* Re: [PATCH] Add MARS shooter.
  2015-09-20  7:51         ` Ricardo Wurmus
@ 2015-09-20  9:46           ` Ricardo Wurmus
  0 siblings, 0 replies; 18+ messages in thread
From: Ricardo Wurmus @ 2015-09-20  9:46 UTC (permalink / raw)
  To: Thompson, David; +Cc: guix-devel


Ricardo Wurmus <rekado@elephly.net> writes:

>>>> No, upstream needs to fix their invalid Content-Type header.  We've
>>>> had this problem a few times, most recently with rubygems.org, and in
>>>> all cases we've gotten upstream to fix it.  Strict header parsing can
>>>> seem like an issue at times, but it's really a very good feature that
>>>> the rest of the world seems to ignore. [0]
>>>
>>> I wonder what a correct Content-Type header would look like in this
>>> case.  I would like to submit a helpful report containing what I got and
>>> what it should have been.
>>
>> In this case, application/x-gzip or application/octet-stream would be
>> appropriate.  Less specifically, the media type needs to match the
>> syntax as defined by the W3C spec. [0]
>
> Thanks, I opened a support ticket with Github.com.

And the response from Github is that it won’t be fixed as this is a
deprecated downloads endpont,

   “meaning there wont' be any changes like this made to that.

    https://github.com/blog/1302-goodbye-uploads

    These endpoints were deprecated on December 12, 2012.”

So, fetching the sources from there won’t work.  That’s okay, though, as
we can continue to use the git reference.

~~ Ricardo

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

* Re: [PATCH] Add MARS shooter.
  2015-09-19 17:17 ` Eric Bavier
@ 2015-09-20 10:08   ` Ricardo Wurmus
  2015-09-20 16:30   ` Version strings for VCS snapshots Ludovic Courtès
  1 sibling, 0 replies; 18+ messages in thread
From: Ricardo Wurmus @ 2015-09-20 10:08 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel


Eric Bavier <ericbavier@openmailbox.org> writes:

>> I could not get sound to work, unfortunately, because /dev/dsp does not
>> exist on my machine.  It’s not a problem with the package, but maybe
>> someone could give me a hint about what kernel module to load to get
>> this device.
>
> Same on my machine.  I learned about the ossdp software, which may
> help.  http://sourceforge.net/projects/osspd/

Yes, this would help, but I think it’s unnecessary.  OpenAL was built
with ALSA and Pulseaudio backends, yet neither seems to work:

~~~~~~~~~
rekado@banana $  ALSOFT_LOGLEVEL=3 /gnu/store/hgx7fddl7ss45jhv4bns2837nd4x1h0f-mars-0.7.5-cc855d04409/bin/mars 
AL lib: (II) alc_initconfig: Supported backends: pulse, alsa, oss, null, wave
...
AL lib: (II) GetConfigValue: Key general:rt-prio not found
AL lib: (II) GetConfigValue: Key general:resampler not found
AL lib: (II) GetConfigValue: Key general:trap-al-error not found
AL lib: (II) GetConfigValue: Key general:trap-alc-error not found
AL lib: (II) GetConfigValue: Key reverb:boost not found
AL lib: (II) GetConfigValue: Key reverb:emulate-eax not found
AL lib: (II) GetConfigValue: Key general:drivers not found
AL lib: (WW) alc_initconfig: Failed to initialize backend "pulse"
AL lib: (WW) alc_initconfig: Failed to initialize backend "alsa"
AL lib: (II) GetConfigValue: Key oss:device not found
AL lib: (II) GetConfigValue: Key oss:capture not found
AL lib: (II) alc_initconfig: Initialized backend "oss"
AL lib: (II) alc_initconfig: Added "oss" for playback
AL lib: (II) alc_initconfig: Added "oss" for capture
...
AL lib: (EE) oss_open_playback: Could not open /dev/dsp: No such file or directory
Failed to open the audio device
...
~~~~~~~~~

I’ll try to get some more information about the failure to initialise
the “alsa” backend, but it seems to me that this is a problem with our
“openal” package.

>> +(define-public mars
>> +  ;; The latest release on SourceForge relies on an unreleased version of SFML
>> +  ;; with a different API, so we take the latest version from the official
>> +  ;; repository on Github.
>> +  (let ((commit "c855d04409"))
>> +    (package
>> +      (name "mars")
>> +      (version (string-append "0.7.5-c" commit ))
>
> I realize we have no guidelines in the manual concerning the version
> field for git checkouts, but I wonder whether we should, as it comes up
> a bit.  Several existing packages use (string-append "1.2.3." commit),
> where "1.2.3" is the version of the corresponding source.  One other
> package uses the (string-append "1.2.3-c" commit) method, and another
> uses (string-append "1.2.3-" commit.  I personally prefer the "-"
> notation, since it distinguishes the commit hash from the version
> number (does it confuse any internal logic that assumes a package
> version number is the last component of the store path following a
> dash?).  In this case, the "-c" seems confusing because the commit hash
> itself begins with a 'c'.

True.  I have no real preference.  If an update to a more recent commit
makes the introduction of an ordering character necessary it could still
be introduced to force a particular ordering.

>> +      (source (origin
>> +                (method git-fetch)
>> +                (uri (git-reference
>> +                      (url "https://github.com/thelaui/M.A.R.S..git")
>> +                      (commit commit)))
>
> guix lint should warn now about the 'file-name' of the origin.

Oh, right.  I’ll fix it.

>> +                (sha256
>> +                 (base32
>> +                  "1r4c5gap1z2zsv4yjd34qriqkxaq4lb4rykapyzkkdf4g36lc3nh"))
>> +                (patches (list (search-patch "mars-sfml-2.3.patch")
>
> As mentioned on IRC, I had trouble applying this patch because some DOS
> line-endings went missing somewhere.  We just need to make sure they
> are preserved by git.

The patch looks fine when I inspect the commit.  It still has the DOS
line-endings, so I don’t think this will be a problem when I push it.

>> +                               (search-patch "mars-install.patch")))))
>> +      (build-system cmake-build-system)
>> +      (arguments
>> +       `(#:tests? #f        ; There are no tests
>> +         #:phases
>> +         (modify-phases %standard-phases
>> +           (add-after 'unpack 'fix-install-path
>> +            (lambda _
>> +              (substitute* "src/CMakeLists.txt"
>> +                (("\\$\\{CMAKE_INSTALL_PREFIX\\}/games")
>> +                 "${CMAKE_INSTALL_PREFIX}/bin"))))
>
> As in the following phase, could you return #t after the 'substitute*'?

Yes, I forgot this when I broke this up into two phases.

>> +           (add-after 'unpack 'fix-data-path
>> +            (lambda* (#:key outputs #:allow-other-keys)
>> +              (substitute* "src/System/settings.cpp"
>> +                (("C_dataPath = \"./data/\";")
>> +                 (string-append "C_dataPath = \""
>> +                                (assoc-ref outputs "out")
>> +                                "/share/games/marsshooter/\";")))
>> +              #t)))))
>> +      (inputs
>> +       `(("mesa" ,mesa)
>> +         ("fribidi" ,fribidi)
>> +         ("taglib" ,taglib)
>> +         ("sfml" ,sfml)))
>
> Our sfml package has been failing to build on hydra for a few weeks
> because of receiving unexpected hashes from the source downloads.  It
> appears the authors may have changed the zip file in place when they
> released the latest version, and you simply had the previous zip in
> your store from before.  Hydra seems to not be serving the correct zip
> file either.

I updated our sfml package about an hour ago.  It now downloads the
sources from the Github tags/releases, which are (almost) immutable.

~~ Ricardo

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

* Re: [PATCH] Add MARS shooter.
  2015-09-18 19:25 [PATCH] Add MARS shooter Ricardo Wurmus
  2015-09-19  8:25 ` Ricardo Wurmus
  2015-09-19 17:17 ` Eric Bavier
@ 2015-09-20 15:49 ` Ricardo Wurmus
  2015-09-20 20:19   ` Eric Bavier
  2 siblings, 1 reply; 18+ messages in thread
From: Ricardo Wurmus @ 2015-09-20 15:49 UTC (permalink / raw)
  To: guix-devel

On IRC I was told that the description wasn’t quite as neutral as it
should have been, so here’s another attempt:

       "M.A.R.S. is a 2D space shooter with pretty visual effects and
attractive physics.  Players can battle each other or computer controlled
enemies in different game modes such as space ball, death match, team death
match, cannon keep, and grave-itation pit."

* “pretty visual effects” rather than “awesome visual effects”.
* “attractive physics” — I could not think of a more appropriate term; it
  surely is not “realistic”.
* “exciting game modes” has become “different game modes such as ...”

What do you think?

~~ Ricardo

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

* Version strings for VCS snapshots
  2015-09-19 17:17 ` Eric Bavier
  2015-09-20 10:08   ` Ricardo Wurmus
@ 2015-09-20 16:30   ` Ludovic Courtès
  2015-09-23  6:13     ` Ricardo Wurmus
  2015-09-23 23:35     ` Mark H Weaver
  1 sibling, 2 replies; 18+ messages in thread
From: Ludovic Courtès @ 2015-09-20 16:30 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

Eric Bavier <ericbavier@openmailbox.org> skribis:

> I realize we have no guidelines in the manual concerning the version
> field for git checkouts, but I wonder whether we should, as it comes up
> a bit.  Several existing packages use (string-append "1.2.3." commit),
> where "1.2.3" is the version of the corresponding source.  One other
> package uses the (string-append "1.2.3-c" commit) method, and another
> uses (string-append "1.2.3-" commit.  I personally prefer the "-"
> notation, since it distinguishes the commit hash from the version
> number (does it confuse any internal logic that assumes a package
> version number is the last component of the store path following a
> dash?).  In this case, the "-c" seems confusing because the commit hash
> itself begins with a 'c'.
>
> I recall some discussion previously about how it would be nice for
> git-checkout package versions to still "sort" nicely.

I think the goal should be to ensure lexicographic ordering, such that
‘guix package --upgrade’ DTRT.

In practice, that means the (string-append "1.2.3." commit) should be
avoided.

Instead we should use (string-append "1.2.3." REV "." commit) where REV
would be an integer we manually increment every time we upgrade to a
newer snapshot.

I don’t think adding “-” or “-c” before the commit is useful, but I
don’t have a strong opinion.

WDYT?

Ludo’.

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

* Re: [PATCH] Add MARS shooter.
  2015-09-20 15:49 ` [PATCH] Add MARS shooter Ricardo Wurmus
@ 2015-09-20 20:19   ` Eric Bavier
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Bavier @ 2015-09-20 20:19 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Sun, 20 Sep 2015 17:49:44 +0200
Ricardo Wurmus <rekado@elephly.net> wrote:

> On IRC I was told that the description wasn’t quite as neutral as it
> should have been, so here’s another attempt:
> 
>        "M.A.R.S. is a 2D space shooter with pretty visual effects and
> attractive physics.  Players can battle each other or computer controlled
> enemies in different game modes such as space ball, death match, team death
> match, cannon keep, and grave-itation pit."
> 
> * “pretty visual effects” rather than “awesome visual effects”.
> * “attractive physics” — I could not think of a more appropriate term; it
>   surely is not “realistic”.
> * “exciting game modes” has become “different game modes such as ...”
> 
> What do you think?

This version seems more appropriate to me.  Thanks!

`~Eric

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

* Re: Version strings for VCS snapshots
  2015-09-20 16:30   ` Version strings for VCS snapshots Ludovic Courtès
@ 2015-09-23  6:13     ` Ricardo Wurmus
  2015-09-23 23:35     ` Mark H Weaver
  1 sibling, 0 replies; 18+ messages in thread
From: Ricardo Wurmus @ 2015-09-23  6:13 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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


Ludovic Courtès <ludo@gnu.org> writes:
> Instead we should use (string-append "1.2.3." REV "." commit) where REV
> would be an integer we manually increment every time we upgrade to a
> newer snapshot.
>
> I don’t think adding “-” or “-c” before the commit is useful, but I
> don’t have a strong opinion.

Good idea.  Attached is an updated patch.


[-- Attachment #2: 0001-gnu-Add-MARS.patch --]
[-- Type: text/x-patch, Size: 12223 bytes --]

From 0886320967eefbdc814cf62ec661495e76e33f8b Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Mon, 31 Aug 2015 10:09:40 +0200
Subject: [PATCH] gnu: Add MARS.

* gnu/packages/games.scm (mars): New variable.
* gnu/packages/patches/mars-install.patch: New file.
* gnu/packages/patches/mars-sfml-2.3.patch: New file.
* gnu-system.am (dist_patch_DATA): Add them.
---
 gnu-system.am                            |   2 +
 gnu/packages/games.scm                   |  58 ++++++++++++
 gnu/packages/patches/mars-install.patch  |  17 ++++
 gnu/packages/patches/mars-sfml-2.3.patch | 151 +++++++++++++++++++++++++++++++
 4 files changed, 228 insertions(+)
 create mode 100644 gnu/packages/patches/mars-install.patch
 create mode 100644 gnu/packages/patches/mars-sfml-2.3.patch

diff --git a/gnu-system.am b/gnu-system.am
index 2d26131..afd405c 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -559,6 +559,8 @@ dist_patch_DATA =						\
   gnu/packages/patches/luit-posix.patch				\
   gnu/packages/patches/m4-gets-undeclared.patch			\
   gnu/packages/patches/make-impure-dirs.patch			\
+  gnu/packages/patches/mars-install.patch			\
+  gnu/packages/patches/mars-sfml-2.3.patch			\
   gnu/packages/patches/maxima-defsystem-mkdir.patch		\
   gnu/packages/patches/mc-fix-ncurses-build.patch		\
   gnu/packages/patches/mcron-install.patch			\
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 7eb65bb..3f1f5a9 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 Ricardo Wurmus <rekado@elephly.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,11 +32,14 @@
   #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages fribidi)
+  #:use-module (gnu packages game-development)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
@@ -44,6 +48,7 @@
   #:use-module (gnu packages guile)
   #:use-module (gnu packages libcanberra)
   #:use-module (gnu packages libunwind)
+  #:use-module (gnu packages mp3)
   #:use-module (gnu packages image)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages python)
@@ -573,6 +578,59 @@ for common mesh file formats, and collision detection.")
     (home-page "http://irrlicht.sourceforge.net/")
     (license license:zlib)))
 
+(define-public mars
+  ;; The latest release on SourceForge relies on an unreleased version of SFML
+  ;; with a different API, so we take the latest version from the official
+  ;; repository on Github.
+  (let ((commit   "c855d04409")
+        (revision "1"))
+    (package
+      (name "mars")
+      (version (string-append "0.7.5." revision "." commit ))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/thelaui/M.A.R.S..git")
+                      (commit commit)))
+                (file-name (string-append name "-" version))
+                (sha256
+                 (base32
+                  "1r4c5gap1z2zsv4yjd34qriqkxaq4lb4rykapyzkkdf4g36lc3nh"))
+                (patches (list (search-patch "mars-sfml-2.3.patch")
+                               (search-patch "mars-install.patch")))))
+      (build-system cmake-build-system)
+      (arguments
+       `(#:tests? #f        ; There are no tests
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'fix-install-path
+            (lambda _
+              (substitute* "src/CMakeLists.txt"
+                (("\\$\\{CMAKE_INSTALL_PREFIX\\}/games")
+                 "${CMAKE_INSTALL_PREFIX}/bin"))
+              #t))
+           (add-after 'unpack 'fix-data-path
+            (lambda* (#:key outputs #:allow-other-keys)
+              (substitute* "src/System/settings.cpp"
+                (("C_dataPath = \"./data/\";")
+                 (string-append "C_dataPath = \""
+                                (assoc-ref outputs "out")
+                                "/share/games/marsshooter/\";")))
+              #t)))))
+      (inputs
+       `(("mesa" ,mesa)
+         ("fribidi" ,fribidi)
+         ("taglib" ,taglib)
+         ("sfml" ,sfml)))
+      (home-page "http://marsshooter.org")
+      (synopsis "2D space shooter")
+      (description
+       "M.A.R.S. is a 2D space shooter with pretty visual effects and
+attractive physics.  Players can battle each other or computer controlled
+enemies in different game modes such as space ball, death match, team death
+match, cannon keep, and grave-itation pit.")
+      (license license:gpl3+))))
+
 (define minetest-data
   (package
     (name "minetest-data")
diff --git a/gnu/packages/patches/mars-install.patch b/gnu/packages/patches/mars-install.patch
new file mode 100644
index 0000000..1e3964c
--- /dev/null
+++ b/gnu/packages/patches/mars-install.patch
@@ -0,0 +1,17 @@
+Remove install target for non-existant directory.
+
+--- a/src/CMakeLists.txt	2015-09-13 20:52:28.517344327 +0200
++++ b/src/CMakeLists.txt	2015-09-13 20:53:04.842453987 +0200
+@@ -122,12 +122,6 @@
+ 		DESTINATION
+ 			${CMAKE_INSTALL_PREFIX}/share/applications
+ 	)
+-	install(
+-		FILES
+-			${MARS_SOURCE_DIR}/resources/mars
+-		DESTINATION
+-			${CMAKE_INSTALL_PREFIX}/share/menu
+-	)
+ 
+ else(UNIX)
+ 	# executable
diff --git a/gnu/packages/patches/mars-sfml-2.3.patch b/gnu/packages/patches/mars-sfml-2.3.patch
new file mode 100644
index 0000000..01ec05f
--- /dev/null
+++ b/gnu/packages/patches/mars-sfml-2.3.patch
@@ -0,0 +1,151 @@
+This is a concatenation of the following two patches:
+
+  https://github.com/jcowgill/M.A.R.S./commit/33d5affabf8ff84f2c028b9303c6a9e83cc824ad.patch
+  https://patch-diff.githubusercontent.com/raw/thelaui/M.A.R.S./pull/2.patch
+
+Their purpose is to allow Mars to be built against the latest version of SFML.
+
+From 33d5affabf8ff84f2c028b9303c6a9e83cc824ad Mon Sep 17 00:00:00 2001
+From: James Cowgill <james410@cowgill.org.uk>
+Date: Sat, 9 May 2015 01:54:14 +0100
+Subject: [PATCH] Remove dependency on GLU - fixes build with SFML 2.3
+
+---
+ premake4.lua           |  8 ++++----
+ src/Shaders/postFX.cpp |  2 +-
+ src/System/window.cpp  | 12 ++++++------
+ 3 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/premake4.lua b/premake4.lua
+index 023dddd..5af4495 100755
+--- a/premake4.lua
++++ b/premake4.lua
+@@ -11,11 +11,11 @@ project "mars"
+     defines { "NDEBUG" }
+     flags   { "Optimize" }
+     if os.get() == "windows" then
+-      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "glu32", "opengl32", "fribidi-0", "tag" }
++      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "opengl32", "fribidi-0", "tag" }
+     elseif os.get() == "macosx" then
+       links { "sfml-graphics.framework", "sfml-audio.framework", "sfml-system.framework", "sfml-window.framework", "opengl.framework", "fribidi", "tag" }
+     else
+-      links { "GLU", "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
++      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
+       libdirs { "/usr/lib", "/usr/local/lib" }
+     end
+     
+@@ -23,10 +23,10 @@ project "mars"
+     defines { "_DEBUG", "DEBUG" }
+     flags   { "Symbols" }
+     if os.get() == "windows" then
+-      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "glu32", "opengl32", "fribidi-0", "tag" }
++      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "opengl32", "fribidi-0", "tag" }
+     elseif os.get() == "macosx" then
+       links { "sfml-graphics.framework", "sfml-audio.framework", "sfml-system.framework", "sfml-window.framework", "opengl.framework", "fribidi", "tag" }
+     else
+-      links { "GLU", "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
++      links { "sfml-graphics", "sfml-audio", "sfml-system", "sfml-window", "fribidi", "tag" }
+       libdirs { "/usr/lib", "/usr/local/lib" }
+     end
+diff --git a/src/Shaders/postFX.cpp b/src/Shaders/postFX.cpp
+index 987f411..f767a47 100644
+--- a/src/Shaders/postFX.cpp
++++ b/src/Shaders/postFX.cpp
+@@ -78,7 +78,7 @@ namespace postFX {
+             postFX_.loadFromFile(settings::C_dataPath + "shaders/bump.frag", sf::Shader::Fragment);
+             bumpMap_.create(SPACE_X_RESOLUTION*0.5f, SPACE_Y_RESOLUTION*0.5f);
+             glViewport(0,0,SPACE_X_RESOLUTION*0.5f,SPACE_Y_RESOLUTION*0.5f);
+-            gluOrtho2D(0, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0);
++            glOrtho(0, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0, -1, 1);
+             glEnable(GL_BLEND);
+             glMatrixMode(GL_MODELVIEW);
+             postFX_.setParameter("BumpMap", bumpMap_.getTexture());
+diff --git a/src/System/window.cpp b/src/System/window.cpp
+index e9a099a..8e12dcc 100644
+--- a/src/System/window.cpp
++++ b/src/System/window.cpp
+@@ -222,7 +222,7 @@ namespace window {
+         glLoadIdentity();
+ 
+         // Setup translation (according to left-upper corner)
+-        gluOrtho2D(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f);
++        glOrtho(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f, -1, 1);
+ 
+         // probably improves performance...
+         glDisable(GL_LIGHTING);
+@@ -247,7 +247,7 @@ namespace window {
+ 
+         glMatrixMode(GL_PROJECTION);
+         glLoadIdentity();
+-        gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
++        glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
+         glMatrixMode(GL_MODELVIEW);
+         glLoadIdentity();
+ 
+@@ -255,7 +255,7 @@ namespace window {
+ 
+         glMatrixMode(GL_PROJECTION);
+         glLoadIdentity();
+-        gluOrtho2D(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f);
++        glOrtho(0.f, SPACE_X_RESOLUTION, SPACE_Y_RESOLUTION, 0.f, -1, 1);
+         glMatrixMode(GL_MODELVIEW);
+         glLoadIdentity();
+     }
+@@ -270,7 +270,7 @@ namespace window {
+             glLoadIdentity();
+             setViewPort();
+ 
+-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
++            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
+ 
+             glMatrixMode(GL_MODELVIEW);
+             glLoadIdentity();
+@@ -284,7 +284,7 @@ namespace window {
+             glLoadIdentity();
+             setViewPort();
+ 
+-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
++            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
+ 
+             glMatrixMode(GL_MODELVIEW);
+             glLoadIdentity();
+@@ -294,7 +294,7 @@ namespace window {
+         else {
+             glMatrixMode(GL_PROJECTION);
+             glLoadIdentity();
+-            gluOrtho2D(0.f, viewPort_.x_, viewPort_.y_, 0.f);
++            glOrtho(0.f, viewPort_.x_, viewPort_.y_, 0.f, -1, 1);
+             glMatrixMode(GL_MODELVIEW);
+             glLoadIdentity();
+         }
+
+From a97d0d6a19b5b43e3c53081e36f1f1747b6674e6 Mon Sep 17 00:00:00 2001
+From: Sylvain BOILARD <boilard@crans.org>
+Date: Wed, 23 Jan 2013 02:02:47 +0100
+Subject: [PATCH] Use sf::Shader::Bind() correctly after latest update of the
+ SFML's API.
+
+---
+ src/System/window.cpp | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/src/System/window.cpp b/src/System/window.cpp
+index e9a099a..3ffcf65 100644
+--- a/src/System/window.cpp
++++ b/src/System/window.cpp
+@@ -307,13 +307,11 @@ namespace window {
+         window_.setActive(true);
+         glEnable(GL_TEXTURE_2D);
+ 
+-        if (shader)
+-            shader->bind();
++        sf::Shader::bind(shader);
+ 
+         window_.draw(toBeDrawn, states);
+ 
+-        if (shader)
+-            shader->unbind();
++        sf::Shader::bind(NULL);
+ 
+         window_.popGLStates();
+         glPopMatrix();
-- 
2.5.0


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

* Re: Version strings for VCS snapshots
  2015-09-20 16:30   ` Version strings for VCS snapshots Ludovic Courtès
  2015-09-23  6:13     ` Ricardo Wurmus
@ 2015-09-23 23:35     ` Mark H Weaver
  2015-09-24  8:11       ` Andreas Enge
  2015-09-24 11:12       ` Ludovic Courtès
  1 sibling, 2 replies; 18+ messages in thread
From: Mark H Weaver @ 2015-09-23 23:35 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

ludo@gnu.org (Ludovic Courtès) writes:

> Eric Bavier <ericbavier@openmailbox.org> skribis:
>
>> I realize we have no guidelines in the manual concerning the version
>> field for git checkouts, but I wonder whether we should, as it comes up
>> a bit.  Several existing packages use (string-append "1.2.3." commit),
>> where "1.2.3" is the version of the corresponding source.  One other
>> package uses the (string-append "1.2.3-c" commit) method, and another
>> uses (string-append "1.2.3-" commit.  I personally prefer the "-"
>> notation, since it distinguishes the commit hash from the version
>> number (does it confuse any internal logic that assumes a package
>> version number is the last component of the store path following a
>> dash?).  In this case, the "-c" seems confusing because the commit hash
>> itself begins with a 'c'.
>>
>> I recall some discussion previously about how it would be nice for
>> git-checkout package versions to still "sort" nicely.
>
> I think the goal should be to ensure lexicographic ordering, such that
> ‘guix package --upgrade’ DTRT.
>
> In practice, that means the (string-append "1.2.3." commit) should be
> avoided.
>
> Instead we should use (string-append "1.2.3." REV "." commit) where REV
> would be an integer we manually increment every time we upgrade to a
> newer snapshot.

I'd like to propose another alternative, which I used for 'grub' on the
'wip-loongson2f' branch.  There, the version string is simply the output
of "git describe".  This gives us lexicographic ordering, and the commit
id can be extracted with (last (string-split version #\g)).

So, it ends up looking like this:

--8<---------------cut here---------------start------------->8---
(define-public grub
  (package
    (name "grub")
    (version "2.02-beta2-502-gc93d3e6")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "git://git.savannah.gnu.org/grub.git")
                    (commit (last (string-split version #\g)))))
              (file-name (string-append name "-" version "-checkout"))
              (sha256
               (base32
                "14xsqx3b8rqr0i2xn5vrf8mnxlajw8msi1r6h2vgpl2j0zgjc1m0"))))
--8<---------------cut here---------------end--------------->8---

What do you think?

      Mark

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

* Re: Version strings for VCS snapshots
  2015-09-23 23:35     ` Mark H Weaver
@ 2015-09-24  8:11       ` Andreas Enge
  2015-09-24 11:12       ` Ludovic Courtès
  1 sibling, 0 replies; 18+ messages in thread
From: Andreas Enge @ 2015-09-24  8:11 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

On Wed, Sep 23, 2015 at 07:35:41PM -0400, Mark H Weaver wrote:
> I'd like to propose another alternative, which I used for 'grub' on the
> 'wip-loongson2f' branch.  There, the version string is simply the output
> of "git describe".  This gives us lexicographic ordering, and the commit
> id can be extracted with (last (string-split version #\g)).

This looks like the perfect solution to me.

Andreas

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

* Re: Version strings for VCS snapshots
  2015-09-23 23:35     ` Mark H Weaver
  2015-09-24  8:11       ` Andreas Enge
@ 2015-09-24 11:12       ` Ludovic Courtès
  1 sibling, 0 replies; 18+ messages in thread
From: Ludovic Courtès @ 2015-09-24 11:12 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Eric Bavier <ericbavier@openmailbox.org> skribis:
>>
>>> I realize we have no guidelines in the manual concerning the version
>>> field for git checkouts, but I wonder whether we should, as it comes up
>>> a bit.  Several existing packages use (string-append "1.2.3." commit),
>>> where "1.2.3" is the version of the corresponding source.  One other
>>> package uses the (string-append "1.2.3-c" commit) method, and another
>>> uses (string-append "1.2.3-" commit.  I personally prefer the "-"
>>> notation, since it distinguishes the commit hash from the version
>>> number (does it confuse any internal logic that assumes a package
>>> version number is the last component of the store path following a
>>> dash?).  In this case, the "-c" seems confusing because the commit hash
>>> itself begins with a 'c'.
>>>
>>> I recall some discussion previously about how it would be nice for
>>> git-checkout package versions to still "sort" nicely.
>>
>> I think the goal should be to ensure lexicographic ordering, such that
>> ‘guix package --upgrade’ DTRT.
>>
>> In practice, that means the (string-append "1.2.3." commit) should be
>> avoided.
>>
>> Instead we should use (string-append "1.2.3." REV "." commit) where REV
>> would be an integer we manually increment every time we upgrade to a
>> newer snapshot.
>
> I'd like to propose another alternative, which I used for 'grub' on the
> 'wip-loongson2f' branch.  There, the version string is simply the output
> of "git describe".  This gives us lexicographic ordering, and the commit
> id can be extracted with (last (string-split version #\g)).
>
> So, it ends up looking like this:
>
> (define-public grub
>   (package
>     (name "grub")
>     (version "2.02-beta2-502-gc93d3e6")

Sure, that’s even better, and it works with ‘version>?’.  (I would
remove ‘beta2’ in this example, though.)

The solution I suggested can still be used for repos that have zero
tags, where ‘git describe’ doesn’t work (yes, it exists!).

Ludo’.

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

* Re: [PATCH] Add MARS shooter.
  2015-09-19 15:44   ` Thompson, David
  2015-09-19 20:06     ` Ricardo Wurmus
@ 2015-09-25 22:30     ` Christopher Allan Webber
  2015-09-26 13:04       ` Ludovic Courtès
  1 sibling, 1 reply; 18+ messages in thread
From: Christopher Allan Webber @ 2015-09-25 22:30 UTC (permalink / raw)
  To: Thompson, David; +Cc: guix-devel

Thompson, David writes:

> No, upstream needs to fix their invalid Content-Type header.  We've
> had this problem a few times, most recently with rubygems.org, and in
> all cases we've gotten upstream to fix it.  Strict header parsing can
> seem like an issue at times, but it's really a very good feature that
> the rest of the world seems to ignore. [0]

So this is less about this package itself but rather this general issue
of parsing Content-Type headers, which has come up repeatedly...

"Be conservative in what you do, be liberal in what you accept from
others"... when it comes to the web, we should follow the Robustness
Principle:

  https://en.wikipedia.org/wiki/Robustness_principle

It's absolutely true that Guile should enforce producing correct HTTP
requests and responses.  But as much as it's irritating as schemers,
probably the ultimate group of "do the right thing" if there ever was
one in the programming world, if we cut off sites that do the
slightly-wrong thing, we're cutting a lot of potential users from a lot
of the web... making Guile a lot less attractive of a language for
scraping, etc...

We should at least provide some sort of option to permit fuzziness, or
to convert incoming http requests to fill in some default value, or etc?

 - Chris

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

* Re: [PATCH] Add MARS shooter.
  2015-09-25 22:30     ` Christopher Allan Webber
@ 2015-09-26 13:04       ` Ludovic Courtès
  0 siblings, 0 replies; 18+ messages in thread
From: Ludovic Courtès @ 2015-09-26 13:04 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: guix-devel

Christopher Allan Webber <cwebber@dustycloud.org> skribis:

> Thompson, David writes:
>
>> No, upstream needs to fix their invalid Content-Type header.  We've
>> had this problem a few times, most recently with rubygems.org, and in
>> all cases we've gotten upstream to fix it.  Strict header parsing can
>> seem like an issue at times, but it's really a very good feature that
>> the rest of the world seems to ignore. [0]
>
> So this is less about this package itself but rather this general issue
> of parsing Content-Type headers, which has come up repeatedly...
>
> "Be conservative in what you do, be liberal in what you accept from
> others"... when it comes to the web, we should follow the Robustness
> Principle:

I agree with that.  Now, if it turns out that in practice we encounter
few misbehaving servers, as seems to be the case here, then I think it
makes sense to contact their operators and see if they can fix it.

Ludo’.

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

end of thread, other threads:[~2015-09-26 13:04 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-18 19:25 [PATCH] Add MARS shooter Ricardo Wurmus
2015-09-19  8:25 ` Ricardo Wurmus
2015-09-19 15:44   ` Thompson, David
2015-09-19 20:06     ` Ricardo Wurmus
2015-09-19 20:33       ` Thompson, David
2015-09-20  7:51         ` Ricardo Wurmus
2015-09-20  9:46           ` Ricardo Wurmus
2015-09-25 22:30     ` Christopher Allan Webber
2015-09-26 13:04       ` Ludovic Courtès
2015-09-19 17:17 ` Eric Bavier
2015-09-20 10:08   ` Ricardo Wurmus
2015-09-20 16:30   ` Version strings for VCS snapshots Ludovic Courtès
2015-09-23  6:13     ` Ricardo Wurmus
2015-09-23 23:35     ` Mark H Weaver
2015-09-24  8:11       ` Andreas Enge
2015-09-24 11:12       ` Ludovic Courtès
2015-09-20 15:49 ` [PATCH] Add MARS shooter Ricardo Wurmus
2015-09-20 20:19   ` Eric Bavier

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.