diff mbox series

[bug#62550] gnu: Add alienblaster.

Message ID 20230330192629.31655-1-yovan@gorski.stream
State New
Headers show
Series [bug#62550] gnu: Add alienblaster. | expand

Commit Message

Yovan Naumovski March 30, 2023, 7:26 p.m. UTC
* gnu/packages/games.scm (alienblaster): New variable.
---
 gnu/packages/games.scm | 58 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

Comments

Bruno Victal March 31, 2023, 10:41 a.m. UTC | #1
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
diff mbox series

Patch

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")