all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c.
       [not found] <20170326200643.5256-1-kei@openmailbox.org>
@ 2017-03-27 19:11 ` Leo Famulari
  2017-03-27 20:42   ` Kei Kebreau
  2017-03-27 20:40 ` Kei Kebreau
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Leo Famulari @ 2017-03-27 19:11 UTC (permalink / raw)
  To: Kei Kebreau; +Cc: 26267

On Sun, Mar 26, 2017 at 04:06:43PM -0400, Kei Kebreau wrote:
> * gnu/packages/games.scm (hyperrogue): Update to 9.4c.

Can you complete the changelog and send a revised patch?

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

* bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c.
       [not found] <20170326200643.5256-1-kei@openmailbox.org>
  2017-03-27 19:11 ` bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c Leo Famulari
@ 2017-03-27 20:40 ` Kei Kebreau
  2017-03-27 21:29   ` Marius Bakke
  2017-03-28 11:36 ` Kei Kebreau
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Kei Kebreau @ 2017-03-27 20:40 UTC (permalink / raw)
  To: 26267; +Cc: Kei Kebreau

* gnu/packages/games.scm (hyperrogue): Update to 9.4c.
[source]: Remove snippet.
[arguments]: Remove #:make-flags; adjust configure and install phases; add
install-data phase.
[inputs]: Add hyperrogue-data.
---
 gnu/packages/games.scm | 89 ++++++++++++++++++++++++++++++++------------------
 1 file changed, 58 insertions(+), 31 deletions(-)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 67fcb7b49..fcfa656e3 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -3163,23 +3163,19 @@ throwing people around in pseudo-randomly generated buildings.")
 (define-public hyperrogue
   (package
     (name "hyperrogue")
-    (version "8.3j")
+    (version "9.4c")
     (source (origin
               (method url-fetch)
               (uri (string-append
                     "http://www.roguetemple.com/z/hyper/"
-                    name "-83j.zip"))
+                    name (string-join (string-split version #\.) "")
+                    "-src.tgz"))
               (sha256
                (base32
-                "1ag95d84m4j0rqyn9hj7655znixw2j57bpf93nk14nfy02xz1g6p"))
-              (modules '((guix build utils)))
-              ;; Remove .exe and .dll files.
-              (snippet
-               '(for-each delete-file (find-files "." "\\.(exe|dll)$")))))
+                "1ri5fllnhqjm3dlnl1xbb9mlv79iigc940vbvcnk0v5k6p58pavq"))))
     (build-system gnu-build-system)
     (arguments
      '(#:tests? #f ; no check target
-       #:make-flags '("-Csrc")
        #:phases
        (modify-phases %standard-phases
          (add-after 'set-paths 'set-sdl-paths
@@ -3190,21 +3186,24 @@ throwing people around in pseudo-randomly generated buildings.")
          ;; Fix font and music paths.
          (replace 'configure
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (dejavu-dir (string-append
-                                (assoc-ref inputs "font-dejavu")
-                                "/share/fonts/truetype"))
-                   (dejavu-font "DejaVuSans-Bold.ttf")
-                   (music-file "hyperrogue-music.txt"))
-               (with-directory-excursion "src"
-                 (substitute* "graph.cpp"
-                   ((dejavu-font)
-                    (string-append dejavu-dir "/" dejavu-font))
-                   (((string-append "\\./" music-file))
-                    (string-append out "/share/hyperrogue/" music-file)))
-                 (substitute* music-file
-                   (("\\*/")
-                    (string-append out "/share/hyperrogue/")))))
+             (let* ((out (assoc-ref outputs "out"))
+                    (share-dir (string-append out "/share/hyperrogue"))
+                    (dejavu-dir (string-append
+                                 (assoc-ref inputs "font-dejavu")
+                                 "/share/fonts/truetype"))
+                    (dejavu-font "DejaVuSans-Bold.ttf")
+                    (music-file "hyperrogue-music.txt"))
+               (substitute* "graph.cpp"
+                 ((dejavu-font)
+                  (string-append dejavu-dir "/" dejavu-font)))
+               (substitute* "sound.cpp"
+                 (((string-append "\\./" music-file))
+                  (string-append share-dir "/" music-file))
+                 (("sounds/")
+                  (string-append share-dir "/sounds/")))
+               (substitute* music-file
+                 (("\\*/")
+                  (string-append share-dir "/sounds/"))))
              #t))
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
@@ -3212,13 +3211,25 @@ throwing people around in pseudo-randomly generated buildings.")
                     (bin (string-append out "/bin"))
                     (share-dir (string-append out "/share/hyperrogue")))
                (mkdir-p bin)
-               (copy-file "src/hyper" (string-append bin "/hyperrogue"))
-               (mkdir-p share-dir)
-               (copy-file "src/hyperrogue-music.txt"
-                          (string-append share-dir "/hyperrogue-music.txt"))
-               (for-each (lambda (file)
-                           (copy-file file (string-append share-dir "/" file)))
-                         (find-files "." "\\.ogg$")))
+               (copy-file "hyper" (string-append bin "/hyperrogue"))
+               (install-file "hyperrogue-music.txt" share-dir))
+             #t))
+         (add-after 'install 'install-data
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((data (assoc-ref inputs "hyperrogue-data"))
+                    (out (assoc-ref outputs "out"))
+                    (share-dir (string-append out "/share/hyperrogue")))
+               (system* "tar" "xvf" data "-C" ".")
+               (with-directory-excursion "hyperrogue94c-win"
+                 (for-each
+                  (lambda (file)
+                    (install-file file (string-append share-dir "/sounds")))
+                  (append (find-files "." "\\.ogg$")
+                          (find-files "sounds" ".*$")))
+                 (for-each
+                  (lambda (file)
+                    (install-file file share-dir))
+                  '("papermodeldata.txt" "papermodeldata-help.txt"))))
              #t)))))
     (inputs
      `(("font-dejavu" ,font-dejavu)
@@ -3227,7 +3238,23 @@ throwing people around in pseudo-randomly generated buildings.")
        ("sdl-union" ,(sdl-union (list sdl
                                       sdl-gfx
                                       sdl-mixer
-                                      sdl-ttf)))))
+                                      sdl-ttf)))
+       ("hyperrogue-data"
+        ,(origin
+           (method url-fetch)
+           (uri
+            (string-append
+             "http://www.roguetemple.com/z/hyper/" name
+             (string-join (string-split version #\.) "")
+             "-win.zip"))
+           (sha256
+            (base32
+             "1cyyrsnrixygg3zyz97hpsm6jzwbhydiwk3kl0lm7qjnw2nzkhhh"))
+           (modules '((guix build utils)))
+           (snippet
+            '(begin
+               ;; Remove .exe and .dll files.
+               (for-each delete-file (find-files "." "\\.(exe|dll)$"))))))))
     (home-page "http://www.roguetemple.com/z/hyper/")
     (synopsis "Non-euclidean graphical rogue-like game")
     (description
-- 
2.12.0

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

* bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c.
  2017-03-27 19:11 ` bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c Leo Famulari
@ 2017-03-27 20:42   ` Kei Kebreau
  0 siblings, 0 replies; 11+ messages in thread
From: Kei Kebreau @ 2017-03-27 20:42 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 26267

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]

Leo Famulari <leo@famulari.name> writes:

> On Sun, Mar 26, 2017 at 04:06:43PM -0400, Kei Kebreau wrote:
>> * gnu/packages/games.scm (hyperrogue): Update to 9.4c.
>
> Can you complete the changelog and send a revised patch?

The new patch is submitted.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c.
  2017-03-27 20:40 ` Kei Kebreau
@ 2017-03-27 21:29   ` Marius Bakke
  2017-03-28 11:37     ` Kei Kebreau
  0 siblings, 1 reply; 11+ messages in thread
From: Marius Bakke @ 2017-03-27 21:29 UTC (permalink / raw)
  To: Kei Kebreau, 26267

[-- Attachment #1: Type: text/plain, Size: 3398 bytes --]

Kei Kebreau <kei@openmailbox.org> writes:

> * gnu/packages/games.scm (hyperrogue): Update to 9.4c.
> [source]: Remove snippet.
> [arguments]: Remove #:make-flags; adjust configure and install phases; add
> install-data phase.
> [inputs]: Add hyperrogue-data.

Thanks!

[...]

> +         (add-after 'install 'install-data
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (let* ((data (assoc-ref inputs "hyperrogue-data"))
> +                    (out (assoc-ref outputs "out"))
> +                    (share-dir (string-append out "/share/hyperrogue")))
> +               (system* "tar" "xvf" data "-C" ".")
> +               (with-directory-excursion "hyperrogue94c-win"

You can access the "version" variable here by "unquoting" it (with
comma). Another approach is skipping the "top folder" of the tarball
with "--strip-components=1". Maybe the "sounds" subdirectory can be
extracted directly to "out/share/sounds"? See e.g.
"font-adobe-source-code-pro" for some tar trickery.

> +                 (for-each
> +                  (lambda (file)
> +                    (install-file file (string-append share-dir "/sounds")))
> +                  (append (find-files "." "\\.ogg$")
> +                          (find-files "sounds" ".*$")))
> +                 (for-each
> +                  (lambda (file)
> +                    (install-file file share-dir))
> +                  '("papermodeldata.txt" "papermodeldata-help.txt"))))
>               #t)))))
>      (inputs
>       `(("font-dejavu" ,font-dejavu)
> @@ -3227,7 +3238,23 @@ throwing people around in pseudo-randomly generated buildings.")
>         ("sdl-union" ,(sdl-union (list sdl
>                                        sdl-gfx
>                                        sdl-mixer
> -                                      sdl-ttf)))))
> +                                      sdl-ttf)))
> +       ("hyperrogue-data"
> +        ,(origin
> +           (method url-fetch)
> +           (uri
> +            (string-append
> +             "http://www.roguetemple.com/z/hyper/" name
> +             (string-join (string-split version #\.) "")
> +             "-win.zip"))
> +           (sha256
> +            (base32
> +             "1cyyrsnrixygg3zyz97hpsm6jzwbhydiwk3kl0lm7qjnw2nzkhhh"))

It would be good to have a comment near the source stating "remember to
update hyperrogue-data as well". Otherwise, if the enterprising Guix
contributor already have the old tarball in their store, they may not
notice the impending version/hash mismatch.

Also, this can be a "native-input" since it's downloaded, extracted and
thrown away, and only carry platform-independent data (for us, anyway).

> +           (modules '((guix build utils)))
> +           (snippet
> +            '(begin
> +               ;; Remove .exe and .dll files.
> +               (for-each delete-file (find-files "." "\\.(exe|dll)$"))))))))

...for the same reason, I don't think this is necessary, especially if
we can avoid extracting these files to begin with. It will just use up
*more* space in the store, since it creates a derivation in addition to
the tarball. :-)

The rest LGTM, thanks!

>      (home-page "http://www.roguetemple.com/z/hyper/")
>      (synopsis "Non-euclidean graphical rogue-like game")
>      (description
> -- 
> 2.12.0

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c.
       [not found] <20170326200643.5256-1-kei@openmailbox.org>
  2017-03-27 19:11 ` bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c Leo Famulari
  2017-03-27 20:40 ` Kei Kebreau
@ 2017-03-28 11:36 ` Kei Kebreau
  2017-03-28 15:31 ` Kei Kebreau
  2017-03-29  3:40 ` Kei Kebreau
  4 siblings, 0 replies; 11+ messages in thread
From: Kei Kebreau @ 2017-03-28 11:36 UTC (permalink / raw)
  To: 26267

* gnu/packages/games.scm (hyperrogue): Update to 9.4c.
[source]: Remove snippet.
[arguments]: Remove #:make-flags; adjust configure and install phases; add
install-data phase.
[native-inputs]: Add hyperrogue-data and unzip.
---
 gnu/packages/games.scm | 94 +++++++++++++++++++++++++++++++++-----------------
 1 file changed, 62 insertions(+), 32 deletions(-)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 67fcb7b49..6c92cffd2 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -3163,23 +3163,21 @@ throwing people around in pseudo-randomly generated buildings.")
 (define-public hyperrogue
   (package
     (name "hyperrogue")
-    (version "8.3j")
+    (version "9.4c")
+    ;; When updating this package, be sure to update the "hyperrogue-data"
+    ;; origin in native-inputs.
     (source (origin
               (method url-fetch)
               (uri (string-append
                     "http://www.roguetemple.com/z/hyper/"
-                    name "-83j.zip"))
+                    name (string-join (string-split version #\.) "")
+                    "-src.tgz"))
               (sha256
                (base32
-                "1ag95d84m4j0rqyn9hj7655znixw2j57bpf93nk14nfy02xz1g6p"))
-              (modules '((guix build utils)))
-              ;; Remove .exe and .dll files.
-              (snippet
-               '(for-each delete-file (find-files "." "\\.(exe|dll)$")))))
+                "1ri5fllnhqjm3dlnl1xbb9mlv79iigc940vbvcnk0v5k6p58pavq"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:tests? #f ; no check target
-       #:make-flags '("-Csrc")
+     `(#:tests? #f ; no check target
        #:phases
        (modify-phases %standard-phases
          (add-after 'set-paths 'set-sdl-paths
@@ -3190,21 +3188,24 @@ throwing people around in pseudo-randomly generated buildings.")
          ;; Fix font and music paths.
          (replace 'configure
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (dejavu-dir (string-append
-                                (assoc-ref inputs "font-dejavu")
-                                "/share/fonts/truetype"))
-                   (dejavu-font "DejaVuSans-Bold.ttf")
-                   (music-file "hyperrogue-music.txt"))
-               (with-directory-excursion "src"
-                 (substitute* "graph.cpp"
-                   ((dejavu-font)
-                    (string-append dejavu-dir "/" dejavu-font))
-                   (((string-append "\\./" music-file))
-                    (string-append out "/share/hyperrogue/" music-file)))
-                 (substitute* music-file
-                   (("\\*/")
-                    (string-append out "/share/hyperrogue/")))))
+             (let* ((out (assoc-ref outputs "out"))
+                    (share-dir (string-append out "/share/hyperrogue"))
+                    (dejavu-dir (string-append
+                                 (assoc-ref inputs "font-dejavu")
+                                 "/share/fonts/truetype"))
+                    (dejavu-font "DejaVuSans-Bold.ttf")
+                    (music-file "hyperrogue-music.txt"))
+               (substitute* "graph.cpp"
+                 ((dejavu-font)
+                  (string-append dejavu-dir "/" dejavu-font)))
+               (substitute* "sound.cpp"
+                 (((string-append "\\./" music-file))
+                  (string-append share-dir "/" music-file))
+                 (("sounds/")
+                  (string-append share-dir "/sounds/")))
+               (substitute* music-file
+                 (("\\*/")
+                  (string-append share-dir "/sounds/"))))
              #t))
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
@@ -3212,14 +3213,43 @@ throwing people around in pseudo-randomly generated buildings.")
                     (bin (string-append out "/bin"))
                     (share-dir (string-append out "/share/hyperrogue")))
                (mkdir-p bin)
-               (copy-file "src/hyper" (string-append bin "/hyperrogue"))
-               (mkdir-p share-dir)
-               (copy-file "src/hyperrogue-music.txt"
-                          (string-append share-dir "/hyperrogue-music.txt"))
-               (for-each (lambda (file)
-                           (copy-file file (string-append share-dir "/" file)))
-                         (find-files "." "\\.ogg$")))
-             #t)))))
+               (copy-file "hyper" (string-append bin "/hyperrogue"))
+               (install-file "hyperrogue-music.txt" share-dir))
+             #t))
+         (add-after 'install 'install-data
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((data (assoc-ref inputs "hyperrogue-data"))
+                    (out (assoc-ref outputs "out"))
+                    (sounds (string-append out "/share/hyperrogue/sounds"))
+                    (unzip (string-append (assoc-ref inputs "unzip") "/bin/unzip")))
+               (and
+                ;; Extract music into sounds directory.
+                (zero?
+                 (system* unzip "-j" data
+                          (string-append
+                           "'hyperrogue"
+                           (string-join (string-split ,version #\.) "")
+                           "-win/sounds/*'") "-d" sounds))
+                ;; Extract sounds into sounds directory.
+                (zero?
+                 (system* "unzip" "-j" data
+                          (string-append
+                           "'hyperrogue"
+                           (string-join (string-split ,version #\.) "")
+                           "-win/*.ogg'") "-d" sounds)))))))))
+    (native-inputs
+     `(("hyperrogue-data"
+        ,(origin
+           (method url-fetch)
+           (uri
+            (string-append
+             "http://www.roguetemple.com/z/hyper/" name
+             (string-join (string-split version #\.) "")
+             "-win.zip"))
+           (sha256
+            (base32
+             "1cyyrsnrixygg3zyz97hpsm6jzwbhydiwk3kl0lm7qjnw2nzkhhh"))))
+       ("unzip" ,unzip)))
     (inputs
      `(("font-dejavu" ,font-dejavu)
        ("glew" ,glew)
-- 
2.12.0

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

* bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c.
  2017-03-27 21:29   ` Marius Bakke
@ 2017-03-28 11:37     ` Kei Kebreau
  2017-03-28 13:35       ` Marius Bakke
  0 siblings, 1 reply; 11+ messages in thread
From: Kei Kebreau @ 2017-03-28 11:37 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 26267

[-- Attachment #1: Type: text/plain, Size: 3715 bytes --]

Marius Bakke <mbakke@fastmail.com> writes:

> Kei Kebreau <kei@openmailbox.org> writes:
>
>> * gnu/packages/games.scm (hyperrogue): Update to 9.4c.
>> [source]: Remove snippet.
>> [arguments]: Remove #:make-flags; adjust configure and install phases; add
>> install-data phase.
>> [inputs]: Add hyperrogue-data.
>
> Thanks!
>
> [...]
>
>> +         (add-after 'install 'install-data
>> +           (lambda* (#:key inputs outputs #:allow-other-keys)
>> +             (let* ((data (assoc-ref inputs "hyperrogue-data"))
>> +                    (out (assoc-ref outputs "out"))
>> +                    (share-dir (string-append out "/share/hyperrogue")))
>> +               (system* "tar" "xvf" data "-C" ".")
>> +               (with-directory-excursion "hyperrogue94c-win"
>
> You can access the "version" variable here by "unquoting" it (with
> comma). Another approach is skipping the "top folder" of the tarball
> with "--strip-components=1". Maybe the "sounds" subdirectory can be
> extracted directly to "out/share/sounds"? See e.g.
> "font-adobe-source-code-pro" for some tar trickery.
>
>> +                 (for-each
>> +                  (lambda (file)
>> +                    (install-file file (string-append share-dir "/sounds")))
>> +                  (append (find-files "." "\\.ogg$")
>> +                          (find-files "sounds" ".*$")))
>> +                 (for-each
>> +                  (lambda (file)
>> +                    (install-file file share-dir))
>> +                  '("papermodeldata.txt" "papermodeldata-help.txt"))))
>>               #t)))))
>>      (inputs
>>       `(("font-dejavu" ,font-dejavu)
>> @@ -3227,7 +3238,23 @@ throwing people around in pseudo-randomly generated buildings.")
>>         ("sdl-union" ,(sdl-union (list sdl
>>                                        sdl-gfx
>>                                        sdl-mixer
>> -                                      sdl-ttf)))))
>> +                                      sdl-ttf)))
>> +       ("hyperrogue-data"
>> +        ,(origin
>> +           (method url-fetch)
>> +           (uri
>> +            (string-append
>> +             "http://www.roguetemple.com/z/hyper/" name
>> +             (string-join (string-split version #\.) "")
>> +             "-win.zip"))
>> +           (sha256
>> +            (base32
>> +             "1cyyrsnrixygg3zyz97hpsm6jzwbhydiwk3kl0lm7qjnw2nzkhhh"))
>
> It would be good to have a comment near the source stating "remember to
> update hyperrogue-data as well". Otherwise, if the enterprising Guix
> contributor already have the old tarball in their store, they may not
> notice the impending version/hash mismatch.
>
> Also, this can be a "native-input" since it's downloaded, extracted and
> thrown away, and only carry platform-independent data (for us, anyway).
>
>> +           (modules '((guix build utils)))
>> +           (snippet
>> +            '(begin
>> +               ;; Remove .exe and .dll files.
>> +               (for-each delete-file (find-files "." "\\.(exe|dll)$"))))))))
>
> ...for the same reason, I don't think this is necessary, especially if
> we can avoid extracting these files to begin with. It will just use up
> *more* space in the store, since it creates a derivation in addition to
> the tarball. :-)
>
> The rest LGTM, thanks!
>
>>      (home-page "http://www.roguetemple.com/z/hyper/")
>>      (synopsis "Non-euclidean graphical rogue-like game")
>>      (description
>> -- 
>> 2.12.0

The new patch that I sent attempts to take care of these issues, but the
unzip pattern matching in the install-data phase is not working for some
reason. Any ideas?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c.
  2017-03-28 11:37     ` Kei Kebreau
@ 2017-03-28 13:35       ` Marius Bakke
  2017-03-28 15:35         ` Kei Kebreau
  0 siblings, 1 reply; 11+ messages in thread
From: Marius Bakke @ 2017-03-28 13:35 UTC (permalink / raw)
  To: Kei Kebreau; +Cc: 26267

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

Kei Kebreau <kei@openmailbox.org> writes:

> The new patch that I sent attempts to take care of these issues, but the
> unzip pattern matching in the install-data phase is not working for some
> reason. Any ideas?

I was able to extract it by removing the single quotes (these strings
are already 'quoted' when passed to the unzip command). However the
second extraction seems to match some files from the first, perhaps an
additional filter needs to be passed to avoid descending into sounds/.

The example for the '-x' option in the manual looks like it should do
the job.

LGTM and HTH! :-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c.
       [not found] <20170326200643.5256-1-kei@openmailbox.org>
                   ` (2 preceding siblings ...)
  2017-03-28 11:36 ` Kei Kebreau
@ 2017-03-28 15:31 ` Kei Kebreau
  2017-03-29  3:40 ` Kei Kebreau
  4 siblings, 0 replies; 11+ messages in thread
From: Kei Kebreau @ 2017-03-28 15:31 UTC (permalink / raw)
  To: 26267

[-- Attachment #1: Type: text/plain, Size: 7413 bytes --]

* gnu/packages/games.scm (hyperrogue): Update to 9.4c.
[source]: Remove snippet.
[arguments]: Remove #:make-flags; adjust configure and install phases; add
install-data phase.
[native-inputs]: Add hyperrogue-data and unzip.
[license]: Add cc-by-sa4.0 and cc0 licenses for sounds.
---
 gnu/packages/games.scm | 104 ++++++++++++++++++++++++++++++++-----------------
 1 file changed, 68 insertions(+), 36 deletions(-)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 67fcb7b49..19f9c9d39 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -3163,23 +3163,21 @@ throwing people around in pseudo-randomly generated buildings.")
 (define-public hyperrogue
   (package
     (name "hyperrogue")
-    (version "8.3j")
+    (version "9.4c")
+    ;; When updating this package, be sure to update the "hyperrogue-data"
+    ;; origin in native-inputs.
     (source (origin
               (method url-fetch)
               (uri (string-append
                     "http://www.roguetemple.com/z/hyper/"
-                    name "-83j.zip"))
+                    name (string-join (string-split version #\.) "")
+                    "-src.tgz"))
               (sha256
                (base32
-                "1ag95d84m4j0rqyn9hj7655znixw2j57bpf93nk14nfy02xz1g6p"))
-              (modules '((guix build utils)))
-              ;; Remove .exe and .dll files.
-              (snippet
-               '(for-each delete-file (find-files "." "\\.(exe|dll)$")))))
+                "1ri5fllnhqjm3dlnl1xbb9mlv79iigc940vbvcnk0v5k6p58pavq"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:tests? #f ; no check target
-       #:make-flags '("-Csrc")
+     `(#:tests? #f ; no check target
        #:phases
        (modify-phases %standard-phases
          (add-after 'set-paths 'set-sdl-paths
@@ -3190,21 +3188,24 @@ throwing people around in pseudo-randomly generated buildings.")
          ;; Fix font and music paths.
          (replace 'configure
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (dejavu-dir (string-append
-                                (assoc-ref inputs "font-dejavu")
-                                "/share/fonts/truetype"))
-                   (dejavu-font "DejaVuSans-Bold.ttf")
-                   (music-file "hyperrogue-music.txt"))
-               (with-directory-excursion "src"
-                 (substitute* "graph.cpp"
-                   ((dejavu-font)
-                    (string-append dejavu-dir "/" dejavu-font))
-                   (((string-append "\\./" music-file))
-                    (string-append out "/share/hyperrogue/" music-file)))
-                 (substitute* music-file
-                   (("\\*/")
-                    (string-append out "/share/hyperrogue/")))))
+             (let* ((out (assoc-ref outputs "out"))
+                    (share-dir (string-append out "/share/hyperrogue"))
+                    (dejavu-dir (string-append
+                                 (assoc-ref inputs "font-dejavu")
+                                 "/share/fonts/truetype"))
+                    (dejavu-font "DejaVuSans-Bold.ttf")
+                    (music-file "hyperrogue-music.txt"))
+               (substitute* "graph.cpp"
+                 ((dejavu-font)
+                  (string-append dejavu-dir "/" dejavu-font)))
+               (substitute* "sound.cpp"
+                 (((string-append "\\./" music-file))
+                  (string-append share-dir "/" music-file))
+                 (("sounds/")
+                  (string-append share-dir "/sounds/")))
+               (substitute* music-file
+                 (("\\*/")
+                  (string-append share-dir "/sounds/"))))
              #t))
          (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
@@ -3212,14 +3213,43 @@ throwing people around in pseudo-randomly generated buildings.")
                     (bin (string-append out "/bin"))
                     (share-dir (string-append out "/share/hyperrogue")))
                (mkdir-p bin)
-               (copy-file "src/hyper" (string-append bin "/hyperrogue"))
-               (mkdir-p share-dir)
-               (copy-file "src/hyperrogue-music.txt"
-                          (string-append share-dir "/hyperrogue-music.txt"))
-               (for-each (lambda (file)
-                           (copy-file file (string-append share-dir "/" file)))
-                         (find-files "." "\\.ogg$")))
-             #t)))))
+               (copy-file "hyper" (string-append bin "/hyperrogue"))
+               (install-file "hyperrogue-music.txt" share-dir))
+             #t))
+         (add-after 'install 'install-data
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((data (assoc-ref inputs "hyperrogue-data"))
+                    (out (assoc-ref outputs "out"))
+                    (sounds (string-append out "/share/hyperrogue/sounds"))
+                    (unzip (string-append (assoc-ref inputs "unzip") "/bin/unzip")))
+               (and
+                ;; Extract media license information into sounds directory.
+                (zero?
+                 (system* unzip "-j" data
+                          (string-append
+                           "hyperrogue"
+                           (string-join (string-split ,version #\.) "")
+                           "-win/sounds/credits.txt") "-d" sounds))
+                ;; Extract sounds and music into sounds directory.
+                (zero?
+                 (system* "unzip" "-j" data
+                          (string-append
+                           "hyperrogue"
+                           (string-join (string-split ,version #\.) "")
+                           "-win/*.ogg") "-d" sounds)))))))))
+    (native-inputs
+     `(("hyperrogue-data"
+        ,(origin
+           (method url-fetch)
+           (uri
+            (string-append
+             "http://www.roguetemple.com/z/hyper/" name
+             (string-join (string-split version #\.) "")
+             "-win.zip"))
+           (sha256
+            (base32
+             "1cyyrsnrixygg3zyz97hpsm6jzwbhydiwk3kl0lm7qjnw2nzkhhh"))))
+       ("unzip" ,unzip)))
     (inputs
      `(("font-dejavu" ,font-dejavu)
        ("glew" ,glew)
@@ -3240,10 +3270,12 @@ are home to particular creatures and may be subject to own rules of \"physics\".
 
 While it can use ASCII characters to display the world the classical rogue
 symbols, the game needs graphics to render the non-euclidean world.")
-    (license (list license:bsd-3         ; src/glew.c, src/mtrand.*
-                   license:cc-by-sa3.0   ; *.ogg
-                   license:public-domain ; src/direntx.*
-                   license:zlib          ; src/savepng.*
+    (license (list license:bsd-3         ; glew.c, mtrand.*
+                   license:cc-by-sa3.0   ; music
+                   license:cc-by-sa4.0   ; sounds
+                   license:cc0
+                   license:public-domain ; direntx.*, some sounds
+                   license:zlib          ; savepng.*
                    license:gpl2+))))     ; remaining files
 
 (define-public kobodeluxe
-- 
2.12.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c.
  2017-03-28 13:35       ` Marius Bakke
@ 2017-03-28 15:35         ` Kei Kebreau
  2017-03-29  1:16           ` Marius Bakke
  0 siblings, 1 reply; 11+ messages in thread
From: Kei Kebreau @ 2017-03-28 15:35 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 26267

[-- Attachment #1: Type: text/plain, Size: 717 bytes --]

Marius Bakke <mbakke@fastmail.com> writes:

> I was able to extract it by removing the single quotes (these strings
> are already 'quoted' when passed to the unzip command).

I learned something new today. :-P

> However the
> second extraction seems to match some files from the first, perhaps an
> additional filter needs to be passed to avoid descending into sounds/.
>
> The example for the '-x' option in the manual looks like it should do
> the job.
>

I only needed to include the credits.txt file in the sounds directory,
so I just used "extract all .ogg files + the credits.txt file."

> LGTM and HTH! :-)

I submitted one last patch in case I missed anything obvious. Thanks to
you and Leo for the reviews.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c.
  2017-03-28 15:35         ` Kei Kebreau
@ 2017-03-29  1:16           ` Marius Bakke
  0 siblings, 0 replies; 11+ messages in thread
From: Marius Bakke @ 2017-03-29  1:16 UTC (permalink / raw)
  To: Kei Kebreau; +Cc: 26267

[-- Attachment #1: Type: text/plain, Size: 808 bytes --]

Kei Kebreau <kei@openmailbox.org> writes:

> Marius Bakke <mbakke@fastmail.com> writes:
>
>> I was able to extract it by removing the single quotes (these strings
>> are already 'quoted' when passed to the unzip command).
>
> I learned something new today. :-P
>
>> However the
>> second extraction seems to match some files from the first, perhaps an
>> additional filter needs to be passed to avoid descending into sounds/.
>>
>> The example for the '-x' option in the manual looks like it should do
>> the job.
>>
>
> I only needed to include the credits.txt file in the sounds directory,
> so I just used "extract all .ogg files + the credits.txt file."

Great. :-)

>
>> LGTM and HTH! :-)
>
> I submitted one last patch in case I missed anything obvious. Thanks to
> you and Leo for the reviews.

LGTM!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

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

* bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c.
       [not found] <20170326200643.5256-1-kei@openmailbox.org>
                   ` (3 preceding siblings ...)
  2017-03-28 15:31 ` Kei Kebreau
@ 2017-03-29  3:40 ` Kei Kebreau
  4 siblings, 0 replies; 11+ messages in thread
From: Kei Kebreau @ 2017-03-29  3:40 UTC (permalink / raw)
  To: 26267-done

[-- Attachment #1: Type: text/plain, Size: 63 bytes --]


Pushed to master as f8279ba46baa5a1ad7e6c32546d71819eff72e4e.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

end of thread, other threads:[~2017-03-29  3:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170326200643.5256-1-kei@openmailbox.org>
2017-03-27 19:11 ` bug#26267: [PATCH] gnu: hyperrogue: Update to 9.4c Leo Famulari
2017-03-27 20:42   ` Kei Kebreau
2017-03-27 20:40 ` Kei Kebreau
2017-03-27 21:29   ` Marius Bakke
2017-03-28 11:37     ` Kei Kebreau
2017-03-28 13:35       ` Marius Bakke
2017-03-28 15:35         ` Kei Kebreau
2017-03-29  1:16           ` Marius Bakke
2017-03-28 11:36 ` Kei Kebreau
2017-03-28 15:31 ` Kei Kebreau
2017-03-29  3:40 ` Kei Kebreau

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.