From 39f61dbcc0b7b09a325536149eee6c69c7526b4e Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Fri, 14 Jul 2017 15:34:33 +0300 Subject: [PATCH] gnu: Add tome4. * gnu/packages/games.scm (tome4): New variable. --- gnu/packages/games.scm | 99 ++++++++++++++++++++++ gnu/packages/patches/tome4-add-desktop-file.patch | 27 ++++++ .../tome4-add-shell-wrapper-for-launching.patch | 23 +++++ gnu/packages/patches/tome4-fix-sdl-h-path.patch | 39 +++++++++ 4 files changed, 188 insertions(+) create mode 100644 gnu/packages/patches/tome4-add-desktop-file.patch create mode 100644 gnu/packages/patches/tome4-add-shell-wrapper-for-launching.patch create mode 100644 gnu/packages/patches/tome4-fix-sdl-h-path.patch diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index 2dec9a395..834008be7 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -4579,3 +4579,102 @@ computer-hosted roleplaying games. This is the last version released by Crowther & Woods, its original authors, in 1995. It has been known as \"adventure 2.5\" and \"430-point adventure\".") (license license:bsd-2)))) + +(define-public tome4 + (package + (name "tome4") + (version "1.5.5") + (source + (origin + (method url-fetch) + (uri (string-append "https://te4.org/dl/t-engine/t-engine4-src-" + version ".tar.bz2")) + (sha256 + (base32 + "0v2qgdfpvdzd1bcbp9v8pfahj1bgczsq2d4xfhh5wg11jgjcwz03")) + (patches (search-patches "tome4-fix-sdl-h-path.patch" + "tome4-add-shell-wrapper-for-launching.patch" + "tome4-add-desktop-file.patch")))) + (build-system gnu-build-system) + (native-inputs + `(("unzip" ,unzip))) + (inputs + `(("sdl-union" ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf))) + ("glu" ,glu) + ("premake4" ,premake4) + ("openal" ,openal) + ("vorbis" ,libvorbis) + ("luajit" ,luajit))) + (arguments + `(#:make-flags '("CC=gcc" "config=release") + #:phases (modify-phases %standard-phases + (replace 'configure + (lambda _ + (zero? (system* "premake4" "gmake")))) + (add-after 'set-paths 'set-sdl-paths + (lambda* (#:key inputs #:allow-other-keys) + (setenv "CPATH" + (string-append (assoc-ref inputs "sdl-union") + "/include/SDL2")))) + (add-after 'unpack 'fix-path + (lambda* (#:key inputs outputs #:allow-other-keys) + (substitute* "tome4" + (("cd \"/opt") + (string-append "cd \"" + (assoc-ref outputs "out") + "/usr/games"))) + (substitute* "tome4.desktop" + (("Exec=/usr") + (string-append "Exec=" + (assoc-ref outputs "out") + "/usr"))) + #t)) + (delete 'check) + ;; premake4 doesn't provide install target + (replace 'install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (usr (string-append out "/usr")) + (bin (string-append out "/bin")) + (share (string-append usr "/share")) + (pixmaps (string-append share "/pixmaps")) + (data (string-append usr "/games/tome4")) + (unzip (string-append + (assoc-ref inputs "unzip") "/bin/unzip"))) + ;; icon + (mkdir-p pixmaps) + (system* unzip "-j" "game/engines/te4-1.5.5.teae" + "data/gfx/te4-icon.png" "-d" pixmaps) + ;; game executable + (install-file "t-engine" data) + ;; licenses + (for-each (lambda (file) + (install-file file (string-append + share "/licenses"))) + '("COPYING" "COPYING-MEDIA")) + ;; documents + (for-each (lambda (file) + (install-file file (string-append + share "/doc"))) + '("CONTRIBUTING" "CREDITS")) + ;; data + (copy-recursively "bootstrap" (string-append + data "/bootstrap")) + (copy-recursively "game" (string-append data "/game")) + ;; launcher + (install-file "tome4" bin) + (chmod (string-append bin "/tome4") #o555) + (install-file "tome4.desktop" (string-append + share "/applications"))) + #t))))) + (home-page "https://te4.org") + (synopsis "Roguelike RPG") + (description "Tales of Maj’Eyal (ToME) is a free, open source roguelike +RPG, featuring tactical turn-based combat and advanced character building. +Play as one of many unique races and classes in the lore-filled world of Eyal, +exploring random dungeons, facing challenging battles, and developing +characters with your own tailored mix of abilities and powers. With a modern +graphical and customisable interface, intuitive mouse control, streamlined +mechanics and deep, challenging combat, Tales of Maj’Eyal offers engaging +roguelike gameplay for the 21st century.") + (license license:gpl3+))) diff --git a/gnu/packages/patches/tome4-add-desktop-file.patch b/gnu/packages/patches/tome4-add-desktop-file.patch new file mode 100644 index 000000000..80fd82478 --- /dev/null +++ b/gnu/packages/patches/tome4-add-desktop-file.patch @@ -0,0 +1,27 @@ +From b8e207e145938f7a0f23d1c5107d532ebb9de720 Mon Sep 17 00:00:00 2001 +From: Oleg Pykhalov +Date: Fri, 14 Jul 2017 11:19:37 +0300 +Subject: [PATCH] Add desktop file. + +--- + tome4.desktop | 8 ++++++++ + 1 file changed, 8 insertions(+) + create mode 100644 tome4.desktop + +diff --git a/tome4.desktop b/tome4.desktop +new file mode 100644 +index 000000000..c5d67f0cf +--- /dev/null ++++ b/tome4.desktop +@@ -0,0 +1,8 @@ ++[Desktop Entry] ++Name=ToME4 ++Comment=An open-source, single-player, role-playing roguelike game set in the world of Eyal. ++Exec=/usr/bin/tome4 ++Icon=tome4.png ++Terminal=false ++Type=Application ++Categories=Game;RolePlaying; +-- +2.13.2 + diff --git a/gnu/packages/patches/tome4-add-shell-wrapper-for-launching.patch b/gnu/packages/patches/tome4-add-shell-wrapper-for-launching.patch new file mode 100644 index 000000000..4df93c057 --- /dev/null +++ b/gnu/packages/patches/tome4-add-shell-wrapper-for-launching.patch @@ -0,0 +1,23 @@ +From f10d89912989e0f071855ab2c20d62b318d313fc Mon Sep 17 00:00:00 2001 +From: Oleg Pykhalov +Date: Fri, 14 Jul 2017 11:17:26 +0300 +Subject: [PATCH] Add shell wrapper for launching. + +--- + tome4 | 4 ++++ + 1 file changed, 4 insertions(+) + create mode 100644 tome4 + +diff --git a/tome4 b/tome4 +new file mode 100644 +index 000000000..2b623e467 +--- /dev/null ++++ b/tome4 +@@ -0,0 +1,4 @@ ++#!/usr/bin/sh ++cd "/opt/tome4" ++./t-engine & ++exit +-- +2.13.2 + diff --git a/gnu/packages/patches/tome4-fix-sdl-h-path.patch b/gnu/packages/patches/tome4-fix-sdl-h-path.patch new file mode 100644 index 000000000..dd550632d --- /dev/null +++ b/gnu/packages/patches/tome4-fix-sdl-h-path.patch @@ -0,0 +1,39 @@ +From 2c3eedcccf2da85cffa08baefa6e437c819276e6 Mon Sep 17 00:00:00 2001 +From: Oleg Pykhalov +Date: Mon, 3 Apr 2017 16:20:48 +0300 +Subject: [PATCH] Fix make -k config=release for GNUC + +--- + src/music.h | 2 +- + src/tSDL.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/music.h b/src/music.h +index 894426cb8..c8490e456 100644 +--- a/src/music.h ++++ b/src/music.h +@@ -27,7 +27,7 @@ + #include + #include + #include +-#elif defined(__FreeBSD__) ++#elif defined(__FreeBSD__) || defined(__GNUC__) + #include + #include + #include +diff --git a/src/tSDL.h b/src/tSDL.h +index a7d36c92f..4f7690255 100644 +--- a/src/tSDL.h ++++ b/src/tSDL.h +@@ -3,7 +3,7 @@ + #include + //#include + #include +-#elif defined(__FreeBSD__) ++#elif defined(__FreeBSD__) || defined(__GNUC__) + #include + #include + //#include +-- +2.13.2 + -- 2.13.2