* gnu/packages/patches/lierolibre-check-unaligned-access.patch, gnu/packages/patches/lierolibre-is-free-software.patch, gnu/packages/patches/lierolibre-remove-arch-warning.patch, gnu/packages/patches/lierolibre-try-building-other-arch.patch, gnu/packages/patches/lierolibre-newer-libconfig.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/games.scm (lierolibre): New variable. --- gnu/local.mk | 5 + gnu/packages/games.scm | 65 +++++++ .../lierolibre-check-unaligned-access.patch | 30 ++++ .../patches/lierolibre-is-free-software.patch | 38 +++++ .../patches/lierolibre-newer-libconfig.patch | 190 +++++++++++++++++++++ .../patches/lierolibre-remove-arch-warning.patch | 30 ++++ .../lierolibre-try-building-other-arch.patch | 56 ++++++ 7 files changed, 414 insertions(+) create mode 100644 gnu/packages/patches/lierolibre-check-unaligned-access.patch create mode 100644 gnu/packages/patches/lierolibre-is-free-software.patch create mode 100644 gnu/packages/patches/lierolibre-newer-libconfig.patch create mode 100644 gnu/packages/patches/lierolibre-remove-arch-warning.patch create mode 100644 gnu/packages/patches/lierolibre-try-building-other-arch.patch diff --git a/gnu/local.mk b/gnu/local.mk index 201786889..17be3812f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -765,6 +765,11 @@ dist_patch_DATA = \ %D%/packages/patches/libxslt-generated-ids.patch \ %D%/packages/patches/libxslt-CVE-2016-4738.patch \ %D%/packages/patches/libxt-guix-search-paths.patch \ + %D%/packages/patches/lierolibre-check-unaligned-access.patch \ + %D%/packages/patches/lierolibre-is-free-software.patch \ + %D%/packages/patches/lierolibre-newer-libconfig.patch \ + %D%/packages/patches/lierolibre-remove-arch-warning.patch \ + %D%/packages/patches/lierolibre-try-building-other-arch.patch \ %D%/packages/patches/linux-pam-no-setfsuid.patch \ %D%/packages/patches/lirc-localstatedir.patch \ %D%/packages/patches/llvm-for-extempore.patch \ diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index b31bb93db..a20001217 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -28,6 +28,7 @@ ;;; Copyright © 2017 Arun Isaac ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2017 nee +;;; Copyright © 2017 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -88,6 +89,7 @@ #:use-module (gnu packages ocaml) #:use-module (gnu packages python) #:use-module (gnu packages readline) + #:use-module (gnu packages textutils) #:use-module (gnu packages xorg) #:use-module (gnu packages pkg-config) #:use-module (gnu packages databases) @@ -2687,6 +2689,69 @@ your way through an underground cave system in search of the Grue. Can you capture it and get out alive?") (license license:agpl3+))) +(define-public lierolibre + (package + (name "lierolibre") + (version "0.5") + (source (origin + (method url-fetch) + (uri (string-append "https://launchpad.net/lierolibre/trunk/" + version "/+download/lierolibre-" + version ".tar.xz")) + (sha256 + (base32 + "1cf1gvsn4qq190lrf9k5bpjnqwlcfw7pajvdnh7z5r4jqw0rsbl9")) + (patches + (search-patches "lierolibre-check-unaligned-access.patch" + "lierolibre-try-building-other-arch.patch" + "lierolibre-remove-arch-warning.patch" + "lierolibre-newer-libconfig.patch" + "lierolibre-is-free-software.patch")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Delete pre-compiled files. + (delete-file "data/LIERO.CHR") + (delete-file "data/LIERO.SND") + #t)))) + (build-system gnu-build-system) + (native-inputs + `(("imagemagick" ,imagemagick) + ("pkg-config" ,pkg-config) + ("util-linux" ,util-linux) + ("sox" ,sox))) + (inputs + `(("boost" ,boost) + ("libconfig" ,libconfig) + ("sdl-union" ,(sdl-union (list sdl sdl-image sdl-mixer))) + ("zlib" ,zlib))) + (home-page "https://gitlab.com/lierolibre/lierolibre") + (synopsis "Old-school earthworm action game") + (description + "lierolibre is an earthworm action game where you fight another player +(or the computer) underground using a wide array of weapons. + +Features: +@itemize +@item 2 worms, 40 weapons, great playability, two game modes: Kill'em All +and Game of Tag, plus AI-players without true intelligence! +@item Dat nostalgia. +@item Extensions via a hidden F1 menu: +@itemize +@item Replays +@item Game controller support +@item Powerlevel palettes +@end itemize +@item Ability to write game variables to plain text files. +@item Ability to load game variables from both EXE and plain text files. +@item Scripts to extract and repack graphics, sounds and levels. +@end itemize + +To switch between different window sizes, use F6, F7 and F8, to switch to +fullscreen, use F5 or Alt+Enter.") + ;; Code mainly BSD-2, some parts under Boost 1.0. All assets are WTFPL2. + (license (list license:bsd-2 license:boost1.0 license:wtfpl2)))) + (define-public warzone2100 (package (name "warzone2100") diff --git a/gnu/packages/patches/lierolibre-check-unaligned-access.patch b/gnu/packages/patches/lierolibre-check-unaligned-access.patch new file mode 100644 index 000000000..b720c9eb3 --- /dev/null +++ b/gnu/packages/patches/lierolibre-check-unaligned-access.patch @@ -0,0 +1,30 @@ +Patch copied from Debian: + +https://anonscm.debian.org/cgit/pkg-games/lierolibre.git/tree/debian/patches/0001-Use-unaligned-access-define-over-checking-arch.patch?id=82910748906855f6e6bfe30b3f077e8c793ae424 + +From 396f19b6b7743d394307f70f0c0108419824437b Mon Sep 17 00:00:00 2001 +From: Martin Erik Werner +Date: Sun, 28 Jun 2015 16:31:34 +0200 +Subject: [PATCH 1/3] Use unaligned access define over checking arch + +This todo item seems like it done, and just needed implementing... +--- + io/encoding.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/gvl/io/encoding.hpp b/src/gvl/io/encoding.hpp +index c491677..89bb612 100644 +--- a/src/gvl/io/encoding.hpp ++++ b/src/gvl/io/encoding.hpp +@@ -374,7 +374,7 @@ struct octet_stream_writer + // inlining of the common case + if(std::size_t(end_ - cur_) >= len) + { +-#if GVL_X86 || GVL_X86_64 // TODO: A define that says whether unaligned access is allowed ++#if GVL_UNALIGNED_ACCESS + if(len < 64) // TODO: Tweak this limit + { + while(len > 4) +-- +2.4.6 + diff --git a/gnu/packages/patches/lierolibre-is-free-software.patch b/gnu/packages/patches/lierolibre-is-free-software.patch new file mode 100644 index 000000000..626a24dd8 --- /dev/null +++ b/gnu/packages/patches/lierolibre-is-free-software.patch @@ -0,0 +1,38 @@ +Remove outdated license text. See COPYING and the description +at http://liero.be/ for more information. + +--- a/data/LIEROENG.TXT ++++ b/data/LIEROENG.TXT +@@ -11,14 +11,6 @@ + ----------------------------------------------------------------------------- + + GENERAL STUFF +- +- Liero is freeware. What that means is that you don't have to pay +- for it and using it has not been restricted in any way. You may +- distribute it to anyone and anyhow WITHOUT ANY CHANGES MADE TO IT'S +- CONTAINMENTS. +- +- The source code of this game is not distributed freely (neither +- commercially). So if you thought that maybe you could... forget it. + + Liero is a wormgame with weapons for 2 players. The object of the + game is definately what you think it is. Liero is excellent for +--- a/data/LIERO.TXT ++++ b/data/LIERO.TXT +@@ -12,15 +12,6 @@ + + YLEISTŽ + +- Liero on freeware, mik„ tarkoittaa ett„ sen k„yt”st„ ei tarvitse +- maksaa mit„„n eik„ k„ytt”„ ole rajoitettu mitenk„„n. Lieroa saa +- kopioida kelle tahansa ja miten tahansa SISŽLT™Ž MITENKŽŽN +- MUUTTAMATTA. +- +- Todettakoon t„ss„ ett„ Lieron l„hdekoodi ei ole vapaassa (sen +- enenp„„ kuin kaupallisessakaan) jakelussa. Joten jos ajattelit +- ett„... niin j„t„ ajatukset sikseen. +- + Liero on kahden pelattava aseellinen matosimulaatiopeli. Pelin + p„„m„„r„n„ on ep„ilem„tt„ se mit„ luuletkin. Liero sopii + erinomaisen hyvin aggressioiden purkuun ja kaverin rokitt„miseen diff --git a/gnu/packages/patches/lierolibre-newer-libconfig.patch b/gnu/packages/patches/lierolibre-newer-libconfig.patch new file mode 100644 index 000000000..662d0f90f --- /dev/null +++ b/gnu/packages/patches/lierolibre-newer-libconfig.patch @@ -0,0 +1,190 @@ +Fix compatibility with newer libconfig. + +Patch copied from upstream source repository: + +https://gitlab.com/lierolibre/lierolibre/commit/b27e3604aa6bfbfcc50db1000b394d06c87ae2f2 + +diff --git a/src/common.cpp b/src/common.cpp +index 2d6ada5..4942b05 100644 +--- a/src/common.cpp ++++ b/src/common.cpp +@@ -162,7 +162,7 @@ void Texts::loadFromCFG(std::string cfgFilePath) + const libconfig::Setting &sgmodes = texts["gameModes"]; + for(int i = 0; i < 4; ++i) + { +- gameModes[i] = (char const*)sgmodes["gameModes" + to_string(i)]; ++ gameModes[i] = (char const*)sgmodes[("gameModes" + to_string(i)).c_str()]; + } + + const libconfig::Setting &sgmspec = texts["gameModeSpec"]; +@@ -181,13 +181,13 @@ void Texts::loadFromCFG(std::string cfgFilePath) + const libconfig::Setting &swstates = texts["weapStates"]; + for(int i = 0; i < 3; ++i) + { +- weapStates[i] = (char const*)swstates["weapStates" + to_string(i)]; ++ weapStates[i] = (char const*)swstates[("weapStates" + to_string(i)).c_str()]; + } + + const libconfig::Setting &sknames = texts["keyNames"]; + for(int i = 1; i < 177; ++i) // First key starts at 1 + { +- keyNames[i] = (char const*)sknames["keyNames" + to_string(i)]; ++ keyNames[i] = (char const*)sknames[("keyNames" + to_string(i)).c_str()]; + } + + selWeap = (char const*)texts["selWeap"]; +@@ -315,8 +315,8 @@ void Common::loadPaletteFromCFG(std::string cfgFilePath) + const libconfig::Setting &scanim = palette["colorAnim"]; + for(int i = 0; i < 4; ++i) + { +- colorAnim[i].from = (int)scanim["colorAnim" + to_string(i) + "from"]; +- colorAnim[i].to = (int)scanim["colorAnim" + to_string(i) + "to"]; ++ colorAnim[i].from = (int)scanim[("colorAnim" + to_string(i) + "from").c_str()]; ++ colorAnim[i].to = (int)scanim[("colorAnim" + to_string(i) + "to").c_str()]; + } + } + +@@ -383,7 +383,7 @@ void Common::loadMaterialsFromCFG(std::string cfgFilePath) + + for(int i = 0; i < 256; ++i) + { +- const libconfig::Setting &smflags = smaterials["flags" + to_string(i)]; ++ const libconfig::Setting &smflags = smaterials[("flags" + to_string(i)).c_str()]; + materials[i].flags = smflags; + } + } +diff --git a/src/configCompat.cpp b/src/configCompat.cpp +index 1aeb262..a72c40f 100644 +--- a/src/configCompat.cpp ++++ b/src/configCompat.cpp +@@ -160,19 +160,19 @@ void Common::loadConstantsFromCFGVer0(string cfgFilePath) + const Setting &vconstants = constants["Values"]; + for(int i = 0; i < MaxC; ++i) + { +- C[i] = (int)vconstants[valueConstantsNamesCFGVer0[i]]; ++ C[i] = (int)vconstants[valueConstantsNamesCFGVer0[i].c_str()]; + } + + const Setting &sconstants = constants["Strings"]; + for(int i = 0; i < MaxS; ++i) + { +- S[i]= (char const*)sconstants[stringConstantsNamesCFGVer0[i]]; ++ S[i]= (char const*)sconstants[stringConstantsNamesCFGVer0[i].c_str()]; + } + + const Setting &hconstants = constants["Hacks"]; + for(int i = 0; i < MaxH; ++i) + { +- H[i] = (bool)hconstants[hackConstantsNamesVer0[i]]; ++ H[i] = (bool)hconstants[hackConstantsNamesVer0[i].c_str()]; + } + } + +diff --git a/src/configHelper.cpp b/src/configHelper.cpp +index fcd1f3f..a63bddc 100644 +--- a/src/configHelper.cpp ++++ b/src/configHelper.cpp +@@ -54,15 +54,11 @@ template Uint8 ConfigHelper::getValue(const Setting & + + template Uint8 ConfigHelper::getValue(const Setting &node, char const* index); + +-template Uint8 ConfigHelper::getValue(const Setting &node, string index); +- + // Non-const + template Uint8 ConfigHelper::getValue(Setting &node, int index); + + template Uint8 ConfigHelper::getValue(Setting &node, char const* index); + +-template Uint8 ConfigHelper::getValue(Setting &node, string index); +- + + // Since we still need specialisation per value type (Setting::Type), + // no need to templateify these +@@ -72,7 +68,7 @@ void ConfigHelper::put(Setting &node, string variable, string value) + { + node.add(variable, Setting::TypeString) = value; + } else { +- Setting &var = node[variable]; ++ Setting &var = node[variable.c_str()]; + var = value; + } + } +@@ -83,7 +79,7 @@ void ConfigHelper::put(Setting &node, string variable, int value) + { + node.add(variable, Setting::TypeInt) = value; + } else { +- Setting &var = node[variable]; ++ Setting &var = node[variable.c_str()]; + var = value; + } + } +@@ -94,7 +90,7 @@ void ConfigHelper::put(Setting &node, string variable, Uint8 value) + { + node.add(variable, Setting::TypeInt) = value; + } else { +- Setting &var = node[variable]; ++ Setting &var = node[variable.c_str()]; + var = value; + } + } +@@ -105,7 +101,7 @@ void ConfigHelper::put(Setting &node, string variable, bool value) + { + node.add(variable, Setting::TypeBoolean) = value; + } else { +- Setting &var = node[variable]; ++ Setting &var = node[variable.c_str()]; + var = value; + } + } +@@ -135,6 +131,6 @@ Setting& ConfigHelper::getSubgroup(Setting &node, string groupName) + { + node.add(groupName, Setting::TypeGroup); + } +- return node[groupName]; ++ return node[groupName.c_str()]; + } + +diff --git a/src/constants.cpp b/src/constants.cpp +index 7fced6a..cf7bbfc 100644 +--- a/src/constants.cpp ++++ b/src/constants.cpp +@@ -523,19 +523,19 @@ void Common::loadConstantsFromCFG(std::string cfgFilePath) + const libconfig::Setting &vconstants = constants["Values"]; + for(int i = 0; i < MaxC; ++i) + { +- C[i] = (int)vconstants[valueConstantsNames[i]]; ++ C[i] = (int)vconstants[valueConstantsNames[i].c_str()]; + } + + const libconfig::Setting &sconstants = constants["Strings"]; + for(int i = 0; i < MaxS; ++i) + { +- S[i]= (char const*)sconstants[stringConstantsNames[i]]; ++ S[i]= (char const*)sconstants[stringConstantsNames[i].c_str()]; + } + + const libconfig::Setting &hconstants = constants["Hacks"]; + for(int i = 0; i < MaxH; ++i) + { +- H[i] = (bool)hconstants[hackConstantsNames[i]]; ++ H[i] = (bool)hconstants[hackConstantsNames[i].c_str()]; + } + } + +diff --git a/src/gfx/palette.cpp b/src/gfx/palette.cpp +index 3fd08c4..3d3bf22 100644 +--- a/src/gfx/palette.cpp ++++ b/src/gfx/palette.cpp +@@ -124,9 +124,9 @@ void Palette::readFromCFG(std::string cfgFilePath) + + for(int i = 0; i < 256; ++i) + { +- entries[i].r = cfgHelp.getValue(spentries, "entries" + to_string(i) + "r"); +- entries[i].g = cfgHelp.getValue(spentries, "entries" + to_string(i) + "g"); +- entries[i].b = cfgHelp.getValue(spentries, "entries" + to_string(i) + "b"); ++ entries[i].r = cfgHelp.getValue(spentries, ("entries" + to_string(i) + "r").c_str()); ++ entries[i].g = cfgHelp.getValue(spentries, ("entries" + to_string(i) + "g").c_str()); ++ entries[i].b = cfgHelp.getValue(spentries, ("entries" + to_string(i) + "b").c_str()); + } + } + diff --git a/gnu/packages/patches/lierolibre-remove-arch-warning.patch b/gnu/packages/patches/lierolibre-remove-arch-warning.patch new file mode 100644 index 000000000..ca92b7254 --- /dev/null +++ b/gnu/packages/patches/lierolibre-remove-arch-warning.patch @@ -0,0 +1,30 @@ +Copied from Debian: + +https://anonscm.debian.org/cgit/pkg-games/lierolibre.git/tree/debian/patches/0003-Remove-unknown-arch-warning.patch?id=82910748906855f6e6bfe30b3f077e8c793ae424 + +From a9592533eeabed075b13d11c64f63f503dc13343 Mon Sep 17 00:00:00 2001 +From: Martin Erik Werner +Date: Sun, 28 Jun 2015 19:31:30 +0200 +Subject: [PATCH 3/3] Remove unknown arch warning + +The warning was just excessivley spammy, remove it. +--- + support/platform.h | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/gvl/support/platform.h b/src/gvl/support/platform.h +index 1857b7c..ff6a7d2 100644 +--- a/src/gvl/support/platform.h ++++ b/src/gvl/support/platform.h +@@ -87,8 +87,6 @@ + # define GVL_X86_64 1 + # elif defined(__i386__) || defined(_M_IX86) || defined(i386) || defined(i486) || defined(intel) || defined(x86) || defined(i86pc) + # define GVL_X86 1 +-# else +-# warning "Unknown architecture, please add it" + # endif + #endif + +-- +2.4.6 + diff --git a/gnu/packages/patches/lierolibre-try-building-other-arch.patch b/gnu/packages/patches/lierolibre-try-building-other-arch.patch new file mode 100644 index 000000000..a40dfe611 --- /dev/null +++ b/gnu/packages/patches/lierolibre-try-building-other-arch.patch @@ -0,0 +1,56 @@ +Copied from Debian: + +https://anonscm.debian.org/cgit/pkg-games/lierolibre.git/tree/debian/patches/0001-Use-unaligned-access-define-over-checking-arch.patch?id=82910748906855f6e6bfe30b3f077e8c793ae424 + +From a70691fb003cae1a33f06d682269285f9baa2dd9 Mon Sep 17 00:00:00 2001 +From: Martin Erik Werner +Date: Sun, 28 Jun 2015 19:00:23 +0200 +Subject: [PATCH 2/3] At least try building for other archs than x86* + +Allow attempting to build for other architectures than x86 and x86_64, +whether or not the build will succeed or produce sane output is another +question... It emits plenty of warnings about it now though... + +Configuration of the FPU controller is disabled on all but x86*, and the +uninformed hope and prayer is that defaults will be fine without messing +with them. +--- + math/ieee.cpp | 2 ++ + support/platform.h | 4 ++-- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/gvl/math/ieee.cpp b/src/gvl/math/ieee.cpp +index 8b740d4..e0803d2 100644 +--- a/src/gvl/math/ieee.cpp ++++ b/src/gvl/math/ieee.cpp +@@ -54,6 +54,8 @@ void gvl_init_ieee() + { + #if GVL_MSVCPP + // Nothing needs to be done, TODO: we should however check that the x87 state is right ++#elif !GVL_X86 && !GVL_X86_64 ++// No idea what to do, but run with defaults and pray it doesn't mess things up + #elif GVL_GCC && GVL_WIN32 + unsigned int const flags = _RC_NEAR | _PC_53 | _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW | _EM_UNDERFLOW | _EM_INEXACT; + _control87(flags, _MCW_EM | _MCW_PC | _MCW_RC); +diff --git a/src/gvl/support/platform.h b/src/gvl/support/platform.h +index 86dcaa6..1857b7c 100644 +--- a/src/gvl/support/platform.h ++++ b/src/gvl/support/platform.h +@@ -88,12 +88,12 @@ + # elif defined(__i386__) || defined(_M_IX86) || defined(i386) || defined(i486) || defined(intel) || defined(x86) || defined(i86pc) + # define GVL_X86 1 + # else +-# error "Unknown architecture, please add it" ++# warning "Unknown architecture, please add it" + # endif + #endif + + #if !GVL_LITTLE_ENDIAN && !GVL_BIG_ENDIAN +-# if GVL_X86 || GVL_X86_64 ++# if GVL_X86 || GVL_X86_64 || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN + # define GVL_LITTLE_ENDIAN 1 + # else + # define GVL_BIG_ENDIAN 1 +-- +2.4.6 + -- 2.12.2