unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#62550] [PATCH] gnu: Add alienblaster.
@ 2023-03-30 19:26 Yovan Naumovski via Guix-patches via
  2023-03-31 10:41 ` Bruno Victal
  2023-03-31 16:03 ` [bug#62550] [PATCH v2] " Yovan Naumovski via Guix-patches via
  0 siblings, 2 replies; 4+ messages in thread
From: Yovan Naumovski via Guix-patches via @ 2023-03-30 19:26 UTC (permalink / raw)
  To: 62550; +Cc: Yovan Naumovski

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

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 5825b8d936..be42a6a51a 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -3705,6 +3705,64 @@ (define-public mars
 match, cannon keep, and grave-itation pit.")
       (license license:gpl3+))))
 
+(define-public alienblaster
+  (package
+   (name "alienblaster")
+   (version "1.1.0")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (string-append "http://www.schwardtnet.de/alienblaster/archives/"
+                         name "-" version ".tgz"))
+     (sha256
+      (base32
+       "104rfsfsv446n4y52p5zw9h8mhgjyrbca8fpyhnxkkasq141a264"))))
+   (build-system gnu-build-system)
+   (inputs (list sdl sdl-mixer))
+   (arguments
+    '(#:tests? #f ;; no tests
+      #:phases
+      (modify-phases %standard-phases
+        (add-after 'unpack 'fix-sdl-paths
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (let* ((out (assoc-ref outputs "out"))
+                   (share (string-append out "/share"))
+                   (sdl-mixer (assoc-ref inputs "sdl-mixer")))
+
+              ;; fix name and append path to SDL_mixer.h
+              (substitute* "src/Makefile"
+                (("GAME_NAME=alienBlaster")
+                 "GAME_NAME=alienblaster")
+                (("SDL_FLAGS=\\$\\(shell sdl-config --cflags\\)" line)
+                 (string-append line " -I" sdl-mixer "/include/SDL")))
+
+              ;; substitute relative paths in .cfg and source/header files
+              (substitute* (find-files "./cfg")
+                (("(\\./)?images") (string-append share "/images")))
+              (substitute* (list "src/global.h" "src/global.cc")
+                (("./images") (string-append share "/images"))
+                (("./sound") (string-append share "/sound"))
+                (("./cfg") (string-append share "/cfg"))))))
+
+        (delete 'configure)
+
+        (replace 'install
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let* ((out (assoc-ref outputs "out"))
+                   (bin (string-append out "/bin")))
+              (install-file "alienblaster" bin)
+              (for-each
+               (lambda (dir)
+                 (copy-recursively dir (string-append out "/share/" dir)))
+               '("images" "sound" "cfg")))
+            #t)))))
+   (home-page "http://www.schwardtnet.de/alienblaster/")
+   (synopsis "Action-loaded 2D arcade shooter game")
+   (description "Alien Blaster is an action-loaded 2D arcade shooter
+game. Your mission in the game is simple: stop the invasion of the aliens by
+blasting them. Simultaneous two-player mode is available.")
+   (license license:gpl2)))
+
 (define glkterm
   (package
    (name "glkterm")
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#62550] [PATCH] gnu: Add alienblaster.
  2023-03-30 19:26 [bug#62550] [PATCH] gnu: Add alienblaster Yovan Naumovski via Guix-patches via
@ 2023-03-31 10:41 ` Bruno Victal
  2023-03-31 16:03 ` [bug#62550] [PATCH v2] " Yovan Naumovski via Guix-patches via
  1 sibling, 0 replies; 4+ messages in thread
From: Bruno Victal @ 2023-03-31 10:41 UTC (permalink / raw)
  To: Yovan Naumovski; +Cc: 62550

Hi Yovan,

On 2023-03-30 20:26, Yovan Naumovski via Guix-patches via wrote:
> +   (arguments
> +    '(#:tests? #f ;; no tests
> +      #:phases
> +      (modify-phases %standard-phases
> +        (add-after 'unpack 'fix-sdl-paths
> +          (lambda* (#:key inputs outputs #:allow-other-keys)
> +            (let* ((out (assoc-ref outputs "out"))
> +                   (share (string-append out "/share"))
> +                   (sdl-mixer (assoc-ref inputs "sdl-mixer")))
> +
> +              ;; fix name and append path to SDL_mixer.h
> +              (substitute* "src/Makefile"
> +                (("GAME_NAME=alienBlaster")
> +                 "GAME_NAME=alienblaster")
> +                (("SDL_FLAGS=\\$\\(shell sdl-config --cflags\\)" line)
> +                 (string-append line " -I" sdl-mixer "/include/SDL")))
> +
> +              ;; substitute relative paths in .cfg and source/header files
> +              (substitute* (find-files "./cfg")
> +                (("(\\./)?images") (string-append share "/images")))
> +              (substitute* (list "src/global.h" "src/global.cc")
> +                (("./images") (string-append share "/images"))
> +                (("./sound") (string-append share "/sound"))
> +                (("./cfg") (string-append share "/cfg"))))))
> +
> +        (delete 'configure)
> +
> +        (replace 'install
> +          (lambda* (#:key outputs #:allow-other-keys)
> +            (let* ((out (assoc-ref outputs "out"))
> +                   (bin (string-append out "/bin")))
> +              (install-file "alienblaster" bin)
> +              (for-each
> +               (lambda (dir)
> +                 (copy-recursively dir (string-append out "/share/" dir)))
> +               '("images" "sound" "cfg")))
> +            #t)))))

You should use G-Expressions here, i.e.

(arguments
 (list
  #:tests? #f  ; no tests
  #:phases
  #~(modify-phases %standard-phases
        (add-after 'unpack 'fix-sdl-paths
          (lambda* (#:key inputs #:allow-other-keys)
            (let ((out (assoc-ref outputs "out"))
                   (share (string-append #$output "/share"))
                   (sdl-mixer (assoc-ref inputs "sdl-mixer")))
              ;; fix name and append path to SDL_mixer.h
              (substitute* "src/Makefile"
                (("GAME_NAME=alienBlaster")
                 "GAME_NAME=alienblaster")
                (("SDL_FLAGS=\\$\\(shell sdl-config --cflags\\)" line)
                 (string-append line " -I" sdl-mixer "/include/SDL")))

              ;; substitute relative paths in .cfg and source/header files
              (substitute* (find-files "./cfg")
                (("(\\./)?images") (string-append share "/images")))
              (substitute* (list "src/global.h" "src/global.cc")
                (("./images") (string-append share "/images"))
                (("./sound") (string-append share "/sound"))
                (("./cfg") (string-append share "/cfg"))))))
… )


Take a look at the existing packages that use G-Expressions for inspiration.
(examples that come to mind are mympd, libavif, autokey, rng-tools,
dropwatch, nvme-cli, …)

> +   (home-page "http://www.schwardtnet.de/alienblaster/")
> +   (synopsis "Action-loaded 2D arcade shooter game")
> +   (description "Alien Blaster is an action-loaded 2D arcade shooter
> +game. Your mission in the game is simple: stop the invasion of the aliens by
> +blasting them. Simultaneous two-player mode is available.")

Keep the sentences separated with two spaces between them. (Texinfo syntax)


Thanks,
Bruno




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#62550] [PATCH v2] gnu: Add alienblaster.
  2023-03-30 19:26 [bug#62550] [PATCH] gnu: Add alienblaster Yovan Naumovski via Guix-patches via
  2023-03-31 10:41 ` Bruno Victal
@ 2023-03-31 16:03 ` Yovan Naumovski via Guix-patches via
  2023-04-21  8:59   ` Nicolas Goaziou
  1 sibling, 1 reply; 4+ messages in thread
From: Yovan Naumovski via Guix-patches via @ 2023-03-31 16:03 UTC (permalink / raw)
  To: 62550; +Cc: mirai, Yovan Naumovski

Thank you for your tips and feedback Bruno!

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

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 5825b8d936..394f68cd50 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -3705,6 +3705,61 @@ (define-public mars
 match, cannon keep, and grave-itation pit.")
       (license license:gpl3+))))
 
+(define-public alienblaster
+  (package
+    (name "alienblaster")
+    (version "1.1.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://www.schwardtnet.de/alienblaster/archives/"
+                           name "-" version ".tgz"))
+       (sha256
+        (base32
+         "104rfsfsv446n4y52p5zw9h8mhgjyrbca8fpyhnxkkasq141a264"))))
+    (build-system gnu-build-system)
+    (inputs (list sdl sdl-mixer))
+    (arguments
+     (list
+      #:tests? #f  ; no tests
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'fix-sdl-paths
+            (lambda _
+              (let ((share (string-append #$output "/share")))
+                ;; fix name and append path to SDL_mixer.h
+                (substitute* "src/Makefile"
+                  (("GAME_NAME=alienBlaster")
+                   "GAME_NAME=alienblaster")
+                  (("SDL_FLAGS=\\$\\(shell sdl-config --cflags\\)" line)
+                   (string-append line " -I" #$sdl-mixer "/include/SDL")))
+
+                ;; substitute relative paths in .cfg and source/header files
+                (substitute* (find-files "./cfg")
+                  (("(\\./)?images") (string-append share "/images")))
+                (substitute* (list "src/global.h" "src/global.cc")
+                  (("./images") (string-append share "/images"))
+                  (("./sound") (string-append share "/sound"))
+                  (("./cfg") (string-append share "/cfg"))))))
+
+          (delete 'configure)
+
+          (replace 'install
+            (lambda _
+              (let ((bin (string-append #$output "/bin")))
+                (install-file "alienblaster" bin)
+                (for-each
+                 (lambda (dir)
+                   (copy-recursively dir (string-append #$output "/share/" dir)))
+                 '("images" "sound" "cfg")))
+              #t)))))
+    (home-page "http://www.schwardtnet.de/alienblaster/")
+    (synopsis "Action-loaded 2D arcade shooter game")
+    (description "Alien Blaster is an action-loaded 2D arcade shooter
+game.  Your mission in the game is simple: stop the invasion of the aliens by
+blasting them.  Simultaneous two-player mode is available.")
+    (license license:gpl2)))
+
 (define glkterm
   (package
    (name "glkterm")
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#62550] [PATCH v2] gnu: Add alienblaster.
  2023-03-31 16:03 ` [bug#62550] [PATCH v2] " Yovan Naumovski via Guix-patches via
@ 2023-04-21  8:59   ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2023-04-21  8:59 UTC (permalink / raw)
  To: 62550; +Cc: 62550-done, mirai, Yovan Naumovski

Hello,

Yovan Naumovski via Guix-patches via <guix-patches@gnu.org> writes:

> * gnu/packages/games.scm (alienblaster): New variable.

Thank you. I applied your patch with the following changes.

> +       (uri (string-append "http://www.schwardtnet.de/alienblaster/archives/"
> +                           name "-" version ".tgz"))

I replaced name with alienblaster.

> +       (sha256
> +        (base32
> +         "104rfsfsv446n4y52p5zw9h8mhgjyrbca8fpyhnxkkasq141a264"))))
> +    (build-system gnu-build-system)
> +    (inputs (list sdl sdl-mixer))

Nitpick: I moved inputs after arguments… out of habit.

> +    (arguments
> +     (list
> +      #:tests? #f  ; no tests
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'fix-sdl-paths
> +            (lambda _
> +              (let ((share (string-append #$output "/share")))
> +                ;; fix name and append path to SDL_mixer.h

Nitpick: I used proper capitalization and typography (missing final
full stop).

> +                (substitute* "src/Makefile"
> +                  (("GAME_NAME=alienBlaster")
> +                   "GAME_NAME=alienblaster")
> +                  (("SDL_FLAGS=\\$\\(shell sdl-config --cflags\\)" line)
> +                   (string-append line " -I" #$sdl-mixer "/include/SDL")))

I replace #$sdl-mixer with #$(this-package-inputs "sdl-mixer") for
compatibility with package transformations.

> +                ;; substitute relative paths in .cfg and source/header files

Nitpick: Here too, I slightly reformatted the comment.

> +                (substitute* (find-files "./cfg")
> +                  (("(\\./)?images") (string-append share "/images")))
> +                (substitute* (list "src/global.h" "src/global.cc")
> +                  (("./images") (string-append share "/images"))
> +                  (("./sound") (string-append share "/sound"))
> +                  (("./cfg") (string-append share "/cfg"))))))
> +
> +          (delete 'configure)
> +
> +          (replace 'install
> +            (lambda _
> +              (let ((bin (string-append #$output "/bin")))
> +                (install-file "alienblaster" bin)
> +                (for-each
> +                 (lambda (dir)
> +                   (copy-recursively dir (string-append #$output "/share/" dir)))
> +                 '("images" "sound" "cfg")))
> +              #t)))))

I removed the trailing #T, which is not necessary in new package style.

Regards,
-- 
Nicolas Goaziou




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-21  9:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-30 19:26 [bug#62550] [PATCH] gnu: Add alienblaster Yovan Naumovski via Guix-patches via
2023-03-31 10:41 ` Bruno Victal
2023-03-31 16:03 ` [bug#62550] [PATCH v2] " Yovan Naumovski via Guix-patches via
2023-04-21  8:59   ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).