Subject: [bug#34523] Add tetrinet

From: <[email-masked]>
Date: Tue, 19 Feb 2019 07:51:30 +0000 (GMT)

I've attached an updated patch with the modifications suggested so far:

 - Changed license from expat to public-domain
 - Changed "No tests" to lowercase "no tests"
 - Added "no configure file" comment
 - Install Readme files

I indent the package definition in emacs by marking the package definition (CTRL+Space) and running `M-x indent-region`, I'm not sure what indentation was wrong with the original patch I submitted, but I ran indent-region on it again anyway.

On Mon, 18 Feb 2019 15:11:37 +0100, Tobias Geerinckx-Rice <[email-masked]> wrote:

> pkill -9, Ricardo,
> 
> Ricardo Wurmus wrote:
> > [email-masked] writes:
> >> +     `(#:tests? #f ; No tests.
> 
> Only nitpicks:
> 
> +     `(#:tests? #f                      ; no tests
> 
> If you're using emacs, running C-M-q on the whole definition will 
> automatically indent your code.  There's a way to do the same 
> without emacs, but I forget how.
> 
> >> +       #:phases (modify-phases %standard-phases
> >> +                  (delete 'configure)
> 
> +                  (delete 'configure)   ; no configure script
> 
> >> +                  (add-after 'unpack 'fix-install-dir
> >> +                    (lambda* (#:key outputs 
> >> #:allow-other-keys)
> >> +                      (let ((out (assoc-ref outputs "out")))
> >> +                        (mkdir-p (string-append out "/bin"))
> >> +                        (substitute* "Makefile"
> >> +                          (("/usr/games") (string-append out 
> >> "/bin")))))))))
> >
> > Can this patching be avoided by passing a make flag instead?
> 
> Nope, it's hard-coded in the Makefile target :-(
> 
> Considering the lack of a man(ual) page, how about adding 
> something like:
> 
>   (add-after 'install 'install-documentation
>     (lambda* (#:key outputs #:allow-other-keys)
>       (let* ((out (assoc-ref outputs "out"))
>              (doc (string-append out "/share/doc/"
>                                  ,name "-" ,version)))
>         (for-each (lambda (file)
>                     (install-file file doc))
>                   (list "README" "tetrinet.txt"))
>         #t))))))
> 
> Thanks!
> 
> T G-R

From b82be816ed92afd3988ffdee1206edfe9a19616a Mon Sep 17 00:00:00 2001
From: Pkill -9 <[email-masked]>
Date: Tue, 19 Feb 2019 07:46:29 +0000
Subject: [PATCH] gnu: Add tetrinet.

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

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index f82af0e8c..e6f7f7b79 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -36,6 +36,7 @@
 ;;; Copyright © 2018 Madalin Ionel-Patrascu <[email-masked]>
 ;;; Copyright © 2018 Benjamin Slade <[email-masked]>
 ;;; Copyright © 2018 Alex Vong <[email-masked]>
+;;; Copyright © 2019 Pkill -9 <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -6102,3 +6103,44 @@ to download and install them in @file{$HOME/.stepmania-X.Y/Songs} directory.")
     (home-page "https://www.stepmania.com")
     (license license:expat)))
 
+(define-public tetrinet
+  (package
+    (name "tetrinet")
+    (version "0.11")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "http://tetrinet.or.cz/download/tetrinet-"
+             version
+             ".tar.bz2"))
+       (sha256
+        (base32
+         "0b4pddqz6is1771qmvcj8qqlr4in2djdbkk13agvp9yhfah2v8x7"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("ncurses" ,ncurses)))
+    (arguments
+     `(#:tests? #f ; no tests.
+       #:make-flags '("CC=gcc")
+       #:phases (modify-phases %standard-phases
+                  (delete 'configure) ; no configure script.
+                  (add-after 'unpack 'fix-install-dir
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out (assoc-ref outputs "out")))
+                        (mkdir-p (string-append out "/bin"))
+                        (substitute* "Makefile"
+                          (("/usr/games") (string-append out "/bin"))))))
+                  (add-after 'install 'install-documentation
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let* ((out (assoc-ref outputs "out"))
+                             (doc (string-append out "/share/doc/" ,name "-" ,version)))
+                        (for-each (lambda (file)
+                                    (install-file file doc))
+                                  (list "README" "tetrinet.txt"))
+                        #t))))))
+    (home-page "http://tetrinet.or.cz")
+    (synopsis "Multiplayer tetris")
+    (description "Tetrinet is a multiplayer tetris game with powerups and
+attacks you can use on opponents.")
+    (license license:public-domain)))
-- 
2.20.1