summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorKei Kebreau <kkebreau@posteo.net>2019-05-24 20:50:31 -0400
committerKei Kebreau <kkebreau@posteo.net>2019-05-24 21:00:15 -0400
commit8698d986db21d6399fb57f1af1e38d6223bf9b92 (patch)
tree815c3736f860bfb6402ebc0f03aafd0d455f0a4c /gnu/packages
parent608d148c50962bc217b6481f60507873801464cf (diff)
downloadguix-8698d986db21d6399fb57f1af1e38d6223bf9b92.tar.gz
gnu: supertux: Update to 0.6.0.
* gnu/packages/games.scm (supertux): Update to 0.6.0.
[source]: Add patches.
[arguments]: Add -DUSE_SYSTEM_PHYSFS=ON. Add 'patch-squirrel-path' phase.
[inputs]: Add freetype and squirrel.
* gnu/packages/patches/supertux-fix-build-with-gcc5.patch,
gnu/packages/patches/supertux-unbundle-squirrel.patch: New files.
* gnu/local.mk (dist_patch_DATA): Add them.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/games.scm28
-rw-r--r--gnu/packages/patches/supertux-fix-build-with-gcc5.patch75
-rw-r--r--gnu/packages/patches/supertux-unbundle-squirrel.patch53
3 files changed, 152 insertions, 4 deletions
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 541587e059..4fdc9b01e6 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -141,6 +141,7 @@
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages squirrel)
   #:use-module (gnu packages swig)
   #:use-module (gnu packages tcl)
   #:use-module (gnu packages terminals)
@@ -3495,19 +3496,36 @@ with the \"Stamp\" tool within Tux Paint.")
 (define-public supertux
   (package
    (name "supertux")
-   (version "0.5.1")
+   (version "0.6.0")
    (source (origin
             (method url-fetch)
             (uri (string-append "https://github.com/SuperTux/supertux/"
                                 "releases/download/v" version "/SuperTux-v"
                                 version "-Source.tar.gz"))
+            (file-name (string-append name "-" version ".tar.gz"))
             (sha256
              (base32
-              "1i8avad7w7ikj870z519j383ldy29r6f956bs38cbr8wk513pp69"))))
+              "1h1s4abirkdv4ag22zvyk6zkk64skqbjmcnnba67ps4hdzxfbhy4"))
+            (patches
+             (search-patches "supertux-fix-build-with-gcc5.patch"
+                             "supertux-unbundle-squirrel.patch"))))
    (arguments
     '(#:tests? #f
       #:configure-flags '("-DINSTALL_SUBDIR_BIN=bin"
-                          "-DENABLE_BOOST_STATIC_LIBS=OFF")))
+                          "-DENABLE_BOOST_STATIC_LIBS=OFF"
+                          "-DUSE_SYSTEM_PHYSFS=ON")
+      #:phases
+      (modify-phases %standard-phases
+        (add-after 'unpack 'patch-squirrel-path
+          (lambda* (#:key inputs #:allow-other-keys)
+            (let ((squirrel (assoc-ref inputs "squirrel")))
+              (substitute* "CMakeLists.txt"
+                (("set\\(SQUIRREL_PREFIX.*")
+                 (string-append "set(SQUIRREL_PREFIX " squirrel ")"))
+                (("add_dependencies\\(supertux2_lib squirrel\\)") "")
+                (("\\$\\{SQUIRREL_PREFIX\\}/include")
+                 (string-append "${SQUIRREL_PREFIX}/include/squirrel"))))
+            #t)))))
    (build-system cmake-build-system)
    (inputs `(("sdl2" ,sdl2)
              ("sdl2-image" ,sdl2-image)
@@ -3519,7 +3537,9 @@ with the \"Stamp\" tool within Tux Paint.")
              ("libogg" ,libogg)
              ("physfs" ,physfs)
              ("curl" ,curl)
-             ("boost" ,boost)))
+             ("boost" ,boost)
+             ("freetype" ,freetype)
+             ("squirrel" ,squirrel)))
    (native-inputs `(("pkg-config" ,pkg-config)))
    (synopsis "2D platformer game")
    (description "SuperTux is a free classic 2D jump'n run sidescroller game
diff --git a/gnu/packages/patches/supertux-fix-build-with-gcc5.patch b/gnu/packages/patches/supertux-fix-build-with-gcc5.patch
new file mode 100644
index 0000000000..6393215ca1
--- /dev/null
+++ b/gnu/packages/patches/supertux-fix-build-with-gcc5.patch
@@ -0,0 +1,75 @@
+Taken from https://github.com/SuperTux/supertux/commit/a75317ef0a94847d9b6a7833b9c6652ef29edde3.
+This patch fixes building with gcc versions earlier than 6.
+
+From a75317ef0a94847d9b6a7833b9c6652ef29edde3 Mon Sep 17 00:00:00 2001
+From: Ingo Ruhnke <grumbel@gmail.com>
+Date: Fri, 28 Dec 2018 22:45:35 +0100
+Subject: [PATCH] Add workaround for backwards compatibilty with gcc5
+
+Fixes #1014
+---
+ src/video/gl/gl_painter.cpp | 11 ++++++-----
+ src/video/ttf_surface.cpp   | 16 +++++++++-------
+ 2 files changed, 15 insertions(+), 12 deletions(-)
+
+diff --git a/src/video/gl/gl_painter.cpp b/src/video/gl/gl_painter.cpp
+index 5e0d1e7b1e..32fb7a09b6 100644
+--- a/src/video/gl/gl_painter.cpp
++++ b/src/video/gl/gl_painter.cpp
+@@ -37,12 +37,13 @@ namespace {
+ 
+ inline std::tuple<GLenum, GLenum> blend_factor(Blend blend)
+ {
++  using B = std::tuple<GLenum, GLenum>;
+   switch(blend) {
+-    case Blend::NONE: return {GL_ONE, GL_ZERO};
+-    case Blend::BLEND: return {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA};
+-    case Blend::ADD: return {GL_SRC_ALPHA, GL_ONE};
+-    case Blend::MOD: return {GL_DST_COLOR, GL_ZERO};
+-    default: return {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA};
++    case Blend::NONE: return B(GL_ONE, GL_ZERO);
++    case Blend::BLEND: return B(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
++    case Blend::ADD: return B(GL_SRC_ALPHA, GL_ONE);
++    case Blend::MOD: return B(GL_DST_COLOR, GL_ZERO);
++    default: return B(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+   }
+ }
+ 
+diff --git a/src/video/ttf_surface.cpp b/src/video/ttf_surface.cpp
+index 7c9505004f..b41d67b2c8 100644
+--- a/src/video/ttf_surface.cpp
++++ b/src/video/ttf_surface.cpp
+@@ -55,12 +55,13 @@ TTFSurface::create(const TTFFont& font, const std::string& text)
+     SDL_SetSurfaceColorMod(text_surface.get(), 0, 0, 0);
+     SDL_SetSurfaceBlendMode(text_surface.get(), SDL_BLENDMODE_BLEND);
+ 
++    using P = std::tuple<int, int>;
+     const std::initializer_list<std::tuple<int, int> > positions[] = {
+       {},
+-      {{0, 0}},
+-      {{-1, 0}, {1, 0}, {0, -1}, {0, 1}},
+-      {{-2, 0}, {2, 0}, {0, -2}, {0, 2},
+-       {-1, -1}, {1, -1}, {-1, 1}, {1, 1}}
++      {P{0, 0}},
++      {P{-1, 0}, P{1, 0}, P{0, -1}, P{0, 1}},
++      {P{-2, 0}, P{2, 0}, P{0, -2}, P{0, 2},
++       P{-1, -1}, P{1, -1}, P{-1, 1}, P{1, 1}}
+     };
+ 
+     int shadow_size = std::min(2, font.get_shadow_size());
+@@ -77,11 +78,12 @@ TTFSurface::create(const TTFFont& font, const std::string& text)
+     SDL_SetSurfaceColorMod(text_surface.get(), 0, 0, 0);
+     SDL_SetSurfaceBlendMode(text_surface.get(), SDL_BLENDMODE_BLEND);
+ 
++    using P = std::tuple<int, int>;
+     const std::initializer_list<std::tuple<int, int> > positions[] = {
+       {},
+-      {{-1, 0}, {1, 0}, {0, -1}, {0, 1}},
+-      {{-2, 0}, {2, 0}, {0, -2}, {0, 2},
+-       {-1, -1}, {1, -1}, {-1, 1}, {1, 1}}
++      {P{-1, 0}, P{1, 0}, P{0, -1}, P{0, 1}},
++      {P{-2, 0}, P{2, 0}, P{0, -2}, P{0, 2},
++       P{-1, -1}, P{1, -1}, P{-1, 1}, P{1, 1}}
+     };
+ 
+     int border = std::min(2, font.get_border());
diff --git a/gnu/packages/patches/supertux-unbundle-squirrel.patch b/gnu/packages/patches/supertux-unbundle-squirrel.patch
new file mode 100644
index 0000000000..054183b75f
--- /dev/null
+++ b/gnu/packages/patches/supertux-unbundle-squirrel.patch
@@ -0,0 +1,53 @@
+diff -ur a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt	2019-05-24 17:58:19.693090158 -0400
++++ b/CMakeLists.txt	2019-05-24 17:57:43.349473252 -0400
+@@ -375,44 +375,15 @@
+ 
+ include(ConfigureChecks)
+ 
+-
+-## Also build external/squirrel
+-
+-if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/squirrel/CMakeLists.txt)
+-  message(FATAL_ERROR "squirrel submodule is not checked out or ${CMAKE_CURRENT_SOURCE_DIR}/external/squirrel/CMakeLists.txt is missing")
+-endif()
+-
+ set(SQUIRREL_PREFIX ${CMAKE_BINARY_DIR}/squirrel/ex)
+-ExternalProject_Add(squirrel
+-  SOURCE_DIR "${CMAKE_SOURCE_DIR}/external/squirrel/"
+-  CMAKE_ARGS
+-  -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+-  -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+-  -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
+-  -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+-  -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
+-  -DCMAKE_INSTALL_PREFIX=${SQUIRREL_PREFIX}
+-  -DINSTALL_INC_DIR=include)
+-
+-if(WIN32)
+-  add_library(squirrel_lib SHARED IMPORTED)
+-  set_target_properties(squirrel_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/bin/${CMAKE_SHARED_LIBRARY_PREFIX}squirrel${CMAKE_SHARED_LIBRARY_SUFFIX}")
+-  set_target_properties(squirrel_lib PROPERTIES IMPORTED_IMPLIB "${SQUIRREL_PREFIX}/lib/squirrel${CMAKE_LINK_LIBRARY_SUFFIX}")
+-  add_library(sqstdlib_lib SHARED IMPORTED)
+-  set_target_properties(sqstdlib_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/bin/${CMAKE_SHARED_LIBRARY_PREFIX}sqstdlib${CMAKE_SHARED_LIBRARY_SUFFIX}")
+-  set_target_properties(sqstdlib_lib PROPERTIES IMPORTED_IMPLIB "${SQUIRREL_PREFIX}/lib/sqstdlib${CMAKE_LINK_LIBRARY_SUFFIX}")
+-
+-  #For debug run purposes
+-  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mk/msvc/run_supertux.bat.in" "${PROJECT_BINARY_DIR}/run_supertux.bat")
+-else()
+-  add_library(squirrel_lib STATIC IMPORTED)
+-  set_target_properties(squirrel_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}squirrel_static${CMAKE_STATIC_LIBRARY_SUFFIX}")
+-  add_library(sqstdlib_lib STATIC IMPORTED)
+-  set_target_properties(sqstdlib_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}sqstdlib_static${CMAKE_STATIC_LIBRARY_SUFFIX}")
+-endif()
+ 
+ include_directories(SYSTEM ${SQUIRREL_PREFIX}/include)
+ 
++add_library(squirrel_lib SHARED IMPORTED)
++set_target_properties(squirrel_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}squirrel${CMAKE_SHARED_LIBRARY_SUFFIX}")
++add_library(sqstdlib_lib SHARED IMPORTED)
++set_target_properties(sqstdlib_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}sqstdlib${CMAKE_SHARED_LIBRARY_SUFFIX}")
++
+ ## Also build external/tinygettext
+ 
+ if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/tinygettext/CMakeLists.txt)