Subject: [PATCH] Add openclonk

From: Nicolas Goaziou <[email-masked]>
Date: Fri, 29 Mar 2019 01:26:07 +0100

Hello,

The following patch adds OpenClonk game.

Caveat: due to bad interaction with Wayland, I cannot run this game, but
nkcx on IRC successfully ran it. So I guess the package itself is fine.

Feedback welcome.

Regards,

-- 
Nicolas Goaziou
>From 5778fc0c37bcf544dbf91ae90fdabf1d3d263ce4 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <[email-masked]>
Date: Fri, 29 Mar 2019 01:22:35 +0100
Subject: [PATCH] gnu: Add openclonk.

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

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 23dbbca4f7..4221d5870d 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -6551,3 +6551,77 @@ a fortress beyond the forbidden swamp.")
 
 (define-public edgar
   (deprecated-package "edgar" the-legend-of-edgar))
+
+(define-public openclonk
+  (package
+    (name "openclonk")
+    (version "8.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://www.openclonk.org/builds/release/" version "/"
+                    "openclonk-" version "-src.tar.bz2"))
+              (sha256
+               (base32
+                "0imkqjp8lww5p0cnqf4k4mb2v682mnsas63qmiz17rspakr7fxik"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f                      ;require Gmock/Gtest
+       #:configure-flags '("-DAudio_TK=OpenAL")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'add-libiberty
+           ;; Build fails upon linking executables without this.
+           (lambda _
+             (substitute* "thirdparty/backward-cpp/BackwardConfig.cmake"
+               (("set\\(LIBBFD_LIBRARIES (.*?)\\)" _ libraries)
+                (string-append "set(LIBBFD_LIBRARIES " libraries " iberty)")))
+             #t))
+         (add-after 'add-libiberty 'lax-freealut-requirement
+           ;; We provide freealut 1.1.0, but pkg-config somehow
+           ;; detects it as 1.0.1.  Force minimal version.
+           (lambda _
+             (substitute* "cmake/FindAudio.cmake"
+               (("freealut>=1.1.0") "freealut>=1.0.1"))
+             #t))
+         (add-after 'lax-freealut-requirement 'fix-directories
+           ;; Prefer "$out/share/openclonk" over
+           ;; "$out/share/games/openclonk". Also install "openclonk"
+           ;; binary in "bin/", not "games/".
+           (lambda _
+             (substitute* "CMakeLists.txt"
+               (("share/games/openclonk") "share/openclonk")
+               (("TARGETS openclonk DESTINATION games")
+                "TARGETS openclonk DESTINATION bin"))
+             #t)))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("freealut" ,freealut)
+       ("freetype" ,freetype)
+       ("glew" ,glew)
+       ("libiberty" ,libiberty)
+       ("libjpeg" ,libjpeg-turbo)
+       ("libogg" ,libogg)
+       ("libpng" ,libpng)
+       ("libvorbis" ,libvorbis)
+       ("libxrandr" ,libxrandr)
+       ("mesa" ,mesa)
+       ("miniupnpc" ,miniupnpc)
+       ("openal" ,openal)
+       ("qtbase" ,qtbase)
+       ("readline" ,readline)
+       ("sdl" ,sdl2)
+       ("tinyxml" ,tinyxml)
+       ("zlib" ,zlib)))
+    (home-page "https://www.openclonk.org/")
+    (synopsis
+     "Multiplayer action game where you control small and nimble humanoids")
+    (description "OpenClonk is a multiplayer-action-tactics-skill game.  It is
+often referred to as a mixture of The Settlers and Worms.  In a simple 2D
+antfarm-style landscape, the player controls his crew of Clonks, small but
+robust humanoid beings.  The game encourages free play but the normal goal is
+to either exploit valuable resources from the earth by building a mine or
+fight each other on an arena-like map.")
+    ;; Software as a whole is licensed under ISC, artwork under CC-by.
+    (license (list license:isc license:cc-by3.0))))
-- 
2.21.0