summary refs log tree commit diff
path: root/gnu/packages/games.scm
diff options
context:
space:
mode:
authorVitaliy Shatrov <D0dyBo0D0dyBo0@protonmail.com>2020-08-25 18:26:38 +0700
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2020-11-04 15:15:47 +0100
commit95024494f31c3176bcd2238662e7b7868acc2882 (patch)
tree634c55074ed9eb6342e147854cf9f215be2a3f43 /gnu/packages/games.scm
parentdd2330a89bb4e8c149916916ecc4cc669f733ee8 (diff)
downloadguix-95024494f31c3176bcd2238662e7b7868acc2882.tar.gz
gnu: Add bsd-games.
* gnu/packages/games.scm (bsd-games): New variable.

New patches, taken from Arch and Debian:
* gnu/packages/patches/bsd-games-2.17-64bit.patch
* gnu/packages/patches/bsd-games-bad-ntohl-cast.patch
* gnu/packages/patches/bsd-games-gamescreen.h.patch
* gnu/packages/patches/bsd-games-getline.patch
* gnu/packages/patches/bsd-games-null-check.patch
* gnu/packages/patches/bsd-games-number.c-and-test.patch
* gnu/packages/patches/bsd-games-prevent-name-collisions.patch
* gnu/packages/patches/bsd-games-stdio.h.patch

New patches with our customizations (configure-config built after Arch's):
* gnu/packages/patches/bsd-games-add-configure-config.patch
* gnu/packages/patches/bsd-games-add-wrapper.patch
* gnu/packages/patches/bsd-games-dont-install-empty-files.patch

Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Diffstat (limited to 'gnu/packages/games.scm')
-rw-r--r--gnu/packages/games.scm134
1 files changed, 134 insertions, 0 deletions
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 5f906d0a4e..eb29f2a8e5 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -116,6 +116,7 @@
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
+  #:use-module (gnu packages gnu-doc)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages gnuzilla)
   #:use-module (gnu packages gperf)
@@ -589,6 +590,139 @@ possible, while battling many vicious aliens.")
                    license:lgpl2.1+
                    license:bsd-2))))
 
+(define-public bsd-games
+  (package
+    (name "bsd-games")
+    (version "2.17.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri "https://ibiblio.org/pub/linux/games/bsd-games-2.17.tar.gz")
+       (sha256
+        (base32 "0q7zdyyfvn15y0w4g54kq3gza89h61py727m8slmw73cxx594vq6"))
+       (patches
+        (search-patches
+         ;; thanks Arch, and Debian
+         "bsd-games-2.17-64bit.patch"
+         "bsd-games-bad-ntohl-cast.patch"
+         "bsd-games-gamescreen.h.patch"
+         "bsd-games-getline.patch"
+         "bsd-games-null-check.patch"
+         "bsd-games-number.c-and-test.patch"
+         "bsd-games-stdio.h.patch"
+         "bsd-games-prevent-name-collisions.patch"
+         ;; Guix customizations
+         "bsd-games-add-configure-config.patch"
+         "bsd-games-dont-install-empty-files.patch"
+         "bsd-games-add-wrapper.patch"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("flex" ,flex)
+       ("bison" ,bison)))
+    (inputs
+     `(("curses" ,ncurses)
+       ("pager" ,less)
+       ("miscfiles" ,miscfiles)
+       ("openssl" ,openssl)))           ;used only by 'factor'
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (doc (string-append out "/share/doc/bsd-games-" ,version))
+                    (man (string-append out "/share/man"))
+                    (word-list (string-append (assoc-ref inputs "miscfiles")
+                                              "/share/web2"))
+                    (static-data (string-append out "/share/games/bsd-games"))
+                    ;; Not a "./" because of substitute* in 'patch-install
+                    ;; below.  The .// allow us not to mess with the games'
+                    ;; code any further: we just use a wrapper script that
+                    ;; cd's to a BSD_GAMES_DIR.  :]
+                    (save-files ".//"))
+               (substitute* "configure"
+                 (("/usr/share/man") man)
+                 (("/usr/share/doc/bsd-games") doc)
+                 (("/usr/share/[^\n/]*") static-data)
+                 (("/var/games") save-files)
+                 (("/usr/bin/less") (which "less"))
+                 (("(/usr/bin|/usr/games)") bin))
+               (substitute* "config.params" (("WORD_LIST") word-list))
+               (substitute* "wrapper" (("STATIC_DATA") static-data))
+               (invoke "./configure"))
+             #t))
+         (add-before 'install 'patch-install
+           ;; Some games need a writable directory containing pre-maded files.
+           ;; The files get installed to the Store.  Then the wrapper kicks in.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (static-data (string-append out "/share/games/bsd-games"))
+                    (save-files ".//"))
+               (substitute* "Makeconfig" ((save-files) static-data)))
+             #t))
+         (add-after 'install 'install-documents
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (string-append out "/share/doc/bsd-games-" ,version)))
+               (rename-file "phantasia/COPYRIGHT" "phantasia-COPYRIGHT")
+               (for-each
+                (lambda(file) (install-file file doc))
+                '("AUTHORS" "BUGS" "README" "SECURITY" "THANKS"
+                  "phantasia-COPYRIGHT")))
+             #t)))))
+    (home-page "https://github.com/vattam/BSDGames")
+    (synopsis "Collection of the old text-based games and amusements")
+    (description
+     "These are the BSD games.  See the fortune-mod package for fortunes.
+
+Action: atc (keep the airplanes safe), hack (explore the dangerous Dungeon),
+hunt (kill the others for the Pair of Boots, multi-player only), robots (avoid
+the evil robots), sail (game of naval warfare with wooden ships), snake (steal
+the $$ from the cave, anger the snake, and get out alive), tetris (game of
+lining up the falling bricks of different shapes), and worm (eat, grow big,
+and neither bite your tail, nor ram the wall).
+
+Amusements: banner (prints a large banner), bcd & morse & ppt (print a punch
+card, or paper tape, or Morse codes), caesar & rot13 (ciphers and deciphers
+the input), factor (factorizes a number), number (translates numbers into
+text), pig (translates from English to Pig Latin), pom (should print the
+Moon's phase), primes (generates primes), rain & worms (plays an screen-saver
+in terminal), random (prints randomly choosen lines from files, or returns a
+random exit-code), and wtf (explains what do some acronyms mean).
+
+Board: backgammon (lead the men out of board faster than the friend do),
+boggle (find the words in the square of letters), dab (game of dots and
+boxes), gomoku (game of five in a row), hangman (guess a word before man is
+hanged), and monop (game of monopoly, hot-seat only).  Also the card-games:
+canfield, cribbage, fish (juniors game), and mille.
+
+Quests: adventure (search for treasures with the help of wizard),
+battlestar (explore the world around, starting from dying spaceship),
+phantasia (role-play as an rogue), trek (hunt the Klingons, and save the
+Federation), and wump (hunt the big smelly Wumpus in a dark cave).
+
+Quizes: arithmetic, and quiz.")
+    ;; "Auxiliary and data files, distributed with the games in NetBSD, but
+    ;; not bearing copyright notices, probably fall under the terms of the UCB
+    ;; or NetBSD copyrights and licences.  The file "fortune/Notes" contains a
+    ;; warning in regard to the fortune databases."
+    (license (list
+              ;; Most games.  Files: countmail/countmail.6, dab/dab.6,
+              ;; lib/strlcpy.c, wargames/wargames.6
+              license:bsd-3
+              ;; dab and hunt.  Files: adventure/extern.h,
+              ;; backgammon/backgammon/backlocal.h, caesar/rot13.in,
+              ;; countmail/countmail, dm/utmpentry.c, dm/utmpentry.h,
+              ;; hack/extern.h, robots/auto.c, sail/display.h,
+              ;; sail/restart.h, wargames/wargames
+              license:bsd-4
+              ;; wtf (the game)
+              license:public-domain
+              ;; phantasia (all but phantasia/pathnames.h.in, which is bsd-3)
+              (license:fsf-free "file:///phantasia/COPYRIGHT")))))
+
+
 (define-public bzflag
   (package
     (name "bzflag")