guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#27691] [PATCH 2/2] gnu: Add t-engine.


From: Oleg Pykhalov
Subject: [bug#27691] [PATCH 2/2] gnu: Add t-engine.
Date: Fri, 14 Jul 2017 15:41:08 +0300

* gnu/packages/games.scm (t-engine): New variable.
---
 gnu/packages/games.scm                             | 90 ++++++++++++++++++++++
 .../patches/t-engine-add-desktop-file.patch        | 27 +++++++
 .../t-engine-add-shell-wrapper-for-launching.patch | 23 ++++++
 gnu/packages/patches/t-engine-fix-sdl-h-path.patch | 39 ++++++++++
 4 files changed, 179 insertions(+)
 create mode 100644 gnu/packages/patches/t-engine-add-desktop-file.patch
 create mode 100644 
gnu/packages/patches/t-engine-add-shell-wrapper-for-launching.patch
 create mode 100644 gnu/packages/patches/t-engine-fix-sdl-h-path.patch

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 2bef92b93..fe08ffe5d 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -4578,3 +4578,93 @@ 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 "t-engine-fix-sdl-h-path.patch"
+                               "t-engine-add-shell-wrapper-for-launching.patch"
+                               "t-engine-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/t-engine-add-desktop-file.patch 
b/gnu/packages/patches/t-engine-add-desktop-file.patch
new file mode 100644
index 000000000..80fd82478
--- /dev/null
+++ b/gnu/packages/patches/t-engine-add-desktop-file.patch
@@ -0,0 +1,27 @@
+From b8e207e145938f7a0f23d1c5107d532ebb9de720 Mon Sep 17 00:00:00 2001
+From: Oleg Pykhalov <address@hidden>
+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/t-engine-add-shell-wrapper-for-launching.patch 
b/gnu/packages/patches/t-engine-add-shell-wrapper-for-launching.patch
new file mode 100644
index 000000000..4df93c057
--- /dev/null
+++ b/gnu/packages/patches/t-engine-add-shell-wrapper-for-launching.patch
@@ -0,0 +1,23 @@
+From f10d89912989e0f071855ab2c20d62b318d313fc Mon Sep 17 00:00:00 2001
+From: Oleg Pykhalov <address@hidden>
+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/t-engine-fix-sdl-h-path.patch 
b/gnu/packages/patches/t-engine-fix-sdl-h-path.patch
new file mode 100644
index 000000000..dd550632d
--- /dev/null
+++ b/gnu/packages/patches/t-engine-fix-sdl-h-path.patch
@@ -0,0 +1,39 @@
+From 2c3eedcccf2da85cffa08baefa6e437c819276e6 Mon Sep 17 00:00:00 2001
+From: Oleg Pykhalov <address@hidden>
+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 <vorbis/vorbisfile.h>
+ #include <SDL2/SDL.h>
+ #include <SDL2/SDL_thread.h>
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__) || defined(__GNUC__)
+ #include <AL/al.h>
+ #include <AL/alc.h>
+ #include <vorbis/vorbisfile.h>
+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 <SDL2_ttf/SDL_ttf.h>
+ //#include <SDL2_mixer/SDL_mixer.h>
+ #include <SDL2_image/SDL_image.h>
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__) || defined(__GNUC__)
+ #include <SDL2/SDL.h>
+ #include <SDL2/SDL_ttf.h>
+ //#include <SDL2/SDL_mixer.h>
+-- 
+2.13.2
+
-- 
2.13.2






reply via email to

[Prev in Thread] Current Thread [Next in Thread]