unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
@ 2022-09-16 13:37 Lars-Dominik Braun
  2022-09-18  9:39 ` Maxime Devos
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Lars-Dominik Braun @ 2022-09-16 13:37 UTC (permalink / raw)
  To: 57861

Hi,

this patch adds UltraStar Deluxe (USDX), a karaoke game. The top-level
directory includes a copy of the GPL and the game sources also bear GPL
headers, but there is no explicit license for assets, so it’s hard to
tell whether they are actually free or not. Any opinions?
If not, we could move this to the Guix games channel.

Cheers,
Lars

---
 gnu/local.mk                                  |  1 +
 gnu/packages/games.scm                        | 91 +++++++++++++++++++
 .../ultrastar-deluxe-no-freesans.patch        | 31 +++++++
 3 files changed, 123 insertions(+)
 create mode 100644 gnu/packages/patches/ultrastar-deluxe-no-freesans.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index cd41e6794d..9d9f6b3406 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1900,6 +1900,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
   %D%/packages/patches/u-boot-rk3399-enable-emmc-phy.patch	\
   %D%/packages/patches/ucx-tcp-iface-ioctl.patch		\
+  %D%/packages/patches/ultrastar-deluxe-no-freesans.patch		\
   %D%/packages/patches/ungoogled-chromium-extension-search-path.patch	\
   %D%/packages/patches/ungoogled-chromium-ffmpeg-compat.patch	\
   %D%/packages/patches/ungoogled-chromium-RUNPATH.patch		\
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 60ce0167a6..4712d9c4ca 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -11169,6 +11169,97 @@ (define-public freerct
 and unsafe rides.  Which path will you take?")
     (license license:gpl2)))
 
+;; Lazily resolve to avoid a circular dependency.
+(define fpc*
+  (delay (module-ref (resolve-interface '(gnu packages pascal))
+                     'fpc)))
+
+(define-public ultrastar-deluxe
+  ;; The last release is quite old and does not support recent versions of ffmpeg.
+  (let ((commit "43484b0a10ce6aae339e19d81ae2f7b37caf6baa")
+        (revision "1"))
+    (package
+      (name "ultrastar-deluxe")
+      (version (git-version "2020.4.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/UltraStar-Deluxe/USDX.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "078g1rbm1ympmwq9s64v68sxvcms7rr0qid12d2wgm4r04ana47r"))
+                (patches (search-patches "ultrastar-deluxe-no-freesans.patch"))
+                (modules '((guix build utils)))
+                (snippet
+                 `(begin
+                    ;; Remove Windows binaries.
+                    (for-each delete-file (find-files "game" "\\.dll$"))
+                    ;; Remove font blobs.
+                    (let ((font-directories (list "DejaVu" "FreeSans" "NotoSans"
+                                                  "wqy-microhei")))
+                      (for-each
+                        (lambda (d) (delete-file-recursively
+                                      (string-append "game/fonts/" d)))
+                        font-directories))))))
+      (build-system gnu-build-system)
+      (arguments
+        (list
+         #:tests? #f ; No tests.
+         #:phases
+         #~(modify-phases %standard-phases
+           (add-after 'unpack 'fix-configure
+             (lambda* (#:key inputs configure-flags outputs #:allow-other-keys)
+               ;; The configure script looks for lua$version, but we provide lua-$version.
+               (substitute* "configure.ac"
+                 (("lua\\$i") "lua-$i"))
+               ;; fpc does not pass -lfoo to the linker, but uses its own linker script,
+               ;; which references libs. Pass the libraries listed in that linker script,
+               ;; so our custom linker adds a correct rpath.
+               (substitute* "src/Makefile.in"
+                 (("linkflags\\s+:= ")
+                  (string-append "linkflags := -lpthread -lsqlite3 -lSDL2 "
+                                 " -lSDL2_image -ldl "
+                                 "-lz -lfreetype -lportaudio -lavcodec "
+                                 "-lavformat -lavutil -lswresample "
+                                 "-lswscale -llua -ldl -lX11 -lportmidi "
+                                 "-L" #$zlib "/lib "
+                                 "-L" #$libx11 "/lib "
+                                 "-L" #$portmidi "/lib ")))))
+           (add-after 'install 'font-paths
+             (lambda* (#:key outputs #:allow-other-keys)
+               (substitute* (string-append
+                              (assoc-ref outputs "out")
+                              "/share/ultrastardx/fonts/fonts.ini")
+                 (("=NotoSans/") (string-append "=" #$font-google-noto
+                                                "/share/fonts/truetype/"))
+                 (("=DejaVu/") (string-append "=" #$font-dejavu
+                                              "/share/fonts/truetype/"))))))))
+      (inputs (list ffmpeg
+                    font-dejavu
+                    font-google-noto
+                    ; Not needed, since we don’t have freesans.
+                    ;font-wqy-microhei
+                    freetype
+                    libx11
+                    lua
+                    portaudio
+                    portmidi
+                    sdl2
+                    sdl2-image
+                    sqlite
+                    zlib))
+      (native-inputs (list pkg-config (force fpc*) autoconf automake))
+      (synopsis "Karaoke game")
+      (description
+       "UltraStar Deluxe (USDX) is a free and open source karaoke game.  It
+allows up to six players to sing along with music using microphones
+in order to score points, depending on the pitch of the voice and the
+rhythm of singing.")
+      (home-page "https://usdx.eu/")
+      (license license:gpl2+))))
+
 (define-public steam-devices-udev-rules
   ;; Last release from 2019-04-10
   (let ((commit "d87ef558408c5e7a1a793d738db4c9dc2cb5f8fa")
diff --git a/gnu/packages/patches/ultrastar-deluxe-no-freesans.patch b/gnu/packages/patches/ultrastar-deluxe-no-freesans.patch
new file mode 100644
index 0000000000..7beba80774
--- /dev/null
+++ b/gnu/packages/patches/ultrastar-deluxe-no-freesans.patch
@@ -0,0 +1,31 @@
+Remove references to FreeSans font, which is not packaged for Guix.
+
+--- a/game/fonts/fonts.ini	1970-01-01 01:00:01.000000000 +0100
++++ b/game/fonts/fonts.ini	2022-09-16 14:31:51.483096847 +0200
+@@ -116,26 +116,6 @@
+ BoldHighResPreCache=0
+ BoldHighResOutline=0.02
+ 
+-[Font_FreeSans]
+-Name=Free Sans
+-RegularFile=FreeSans/FreeSans.ttf
+-RegularFallbackFile1=wqy-microhei/wqy-microhei.ttc
+-;RegularGlyphSpacing=1.4
+-;RegularStretch=1.2
+-BoldFile=FreeSans/FreeSansBold.ttf
+-BoldFallbackFile1=wqy-microhei/wqy-microhei.ttc
+-;BoldEmbolden=0.06
+-OutlineFile=FreeSans/FreeSansBold.ttf
+-OutlineOutline=0.06
+-;OutlineColorR=0.3
+-;OutlineColorG=0.3
+-;OutlineColorB=0.3
+-;OutlineColorA=0.3
+-BoldHighResFile=FreeSans/FreeSansBold.ttf
+-BoldHighResMaxResolution=256
+-BoldHighResPreCache=0
+-BoldHighResOutline=0.02
+-
+ [Font_DejaVuSans]
+ Name=DejaVu Sans
+ RegularFile=DejaVu/DejaVuSans.ttf
-- 
2.35.1





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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-09-16 13:37 [bug#57861] [PATCH] gnu: Add ultrastar-deluxe Lars-Dominik Braun
@ 2022-09-18  9:39 ` Maxime Devos
  2022-09-21 11:52   ` [bug#57861] [PATCH v2] " Lars-Dominik Braun
  2022-09-18 12:26 ` Maxime Devos
  2022-11-07 21:41 ` Jonathan Brielmaier
  2 siblings, 1 reply; 17+ messages in thread
From: Maxime Devos @ 2022-09-18  9:39 UTC (permalink / raw)
  To: Lars-Dominik Braun, 57861


[-- Attachment #1.1.1: Type: text/plain, Size: 769 bytes --]



On 16-09-2022 15:37, Lars-Dominik Braun wrote:
> +                                 " -lSDL2_image -ldl "
> +                                 "-lz -lfreetype -lportaudio -lavcodec "
> +                                 "-lavformat -lavutil -lswresample "
> +                                 "-lswscale -llua -ldl -lX11 -lportmidi "
> +                                 "-L" #$zlib "/lib "
> +                                 "-L" #$libx11 "/lib "
> +                                 "-L" #$portmidi "/lib ")))))

To make --with-input transformations work, these #$foo need to be 
replaced by #$(this-package-input "zlib").  To avoid input labels,
you can replace #$zlib "/lib" by
(dirname (search-input-file inputs "lib/libz.so")).

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-09-16 13:37 [bug#57861] [PATCH] gnu: Add ultrastar-deluxe Lars-Dominik Braun
  2022-09-18  9:39 ` Maxime Devos
@ 2022-09-18 12:26 ` Maxime Devos
  2022-11-07 21:41 ` Jonathan Brielmaier
  2 siblings, 0 replies; 17+ messages in thread
From: Maxime Devos @ 2022-09-18 12:26 UTC (permalink / raw)
  To: Lars-Dominik Braun, 57861


[-- Attachment #1.1.1: Type: text/plain, Size: 769 bytes --]



On 16-09-2022 15:37, Lars-Dominik Braun wrote:
> +                                 " -lSDL2_image -ldl "
> +                                 "-lz -lfreetype -lportaudio -lavcodec "
> +                                 "-lavformat -lavutil -lswresample "
> +                                 "-lswscale -llua -ldl -lX11 -lportmidi "
> +                                 "-L" #$zlib "/lib "
> +                                 "-L" #$libx11 "/lib "
> +                                 "-L" #$portmidi "/lib ")))))

To make --with-input transformations work, these #$foo need to be 
replaced by #$(this-package-input "zlib").  To avoid input labels,
you can replace #$zlib "/lib" by
(dirname (search-input-file inputs "lib/libz.so")).

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* [bug#57861] [PATCH v2] gnu: Add ultrastar-deluxe.
  2022-09-18  9:39 ` Maxime Devos
@ 2022-09-21 11:52   ` Lars-Dominik Braun
  2022-10-17  8:33     ` [bug#57861] [PATCH] " Ludovic Courtès
  2022-10-17  8:35     ` Ludovic Courtès
  0 siblings, 2 replies; 17+ messages in thread
From: Lars-Dominik Braun @ 2022-09-21 11:52 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 57861

Hi Maxime,

oh, I didn’t know gexp’s wouldn’t play nicely with input transformations. Fixed in v2.

Cheers,
Lars

---
 gnu/local.mk                                  |  1 +
 gnu/packages/games.scm                        | 91 +++++++++++++++++++
 .../ultrastar-deluxe-no-freesans.patch        | 31 +++++++
 3 files changed, 123 insertions(+)
 create mode 100644 gnu/packages/patches/ultrastar-deluxe-no-freesans.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index cd41e6794d..9d9f6b3406 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1900,6 +1900,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
   %D%/packages/patches/u-boot-rk3399-enable-emmc-phy.patch	\
   %D%/packages/patches/ucx-tcp-iface-ioctl.patch		\
+  %D%/packages/patches/ultrastar-deluxe-no-freesans.patch		\
   %D%/packages/patches/ungoogled-chromium-extension-search-path.patch	\
   %D%/packages/patches/ungoogled-chromium-ffmpeg-compat.patch	\
   %D%/packages/patches/ungoogled-chromium-RUNPATH.patch		\
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 60ce0167a6..30ac153c9a 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -11169,6 +11169,97 @@ (define-public freerct
 and unsafe rides.  Which path will you take?")
     (license license:gpl2)))
 
+;; Lazily resolve to avoid a circular dependency.
+(define fpc*
+  (delay (module-ref (resolve-interface '(gnu packages pascal))
+                     'fpc)))
+
+(define-public ultrastar-deluxe
+  ;; The last release is quite old and does not support recent versions of ffmpeg.
+  (let ((commit "43484b0a10ce6aae339e19d81ae2f7b37caf6baa")
+        (revision "1"))
+    (package
+      (name "ultrastar-deluxe")
+      (version (git-version "2020.4.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/UltraStar-Deluxe/USDX.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "078g1rbm1ympmwq9s64v68sxvcms7rr0qid12d2wgm4r04ana47r"))
+                (patches (search-patches "ultrastar-deluxe-no-freesans.patch"))
+                (modules '((guix build utils)))
+                (snippet
+                 `(begin
+                    ;; Remove Windows binaries.
+                    (for-each delete-file (find-files "game" "\\.dll$"))
+                    ;; Remove font blobs.
+                    (let ((font-directories (list "DejaVu" "FreeSans" "NotoSans"
+                                                  "wqy-microhei")))
+                      (for-each
+                        (lambda (d) (delete-file-recursively
+                                      (string-append "game/fonts/" d)))
+                        font-directories))))))
+      (build-system gnu-build-system)
+      (arguments
+        (list
+         #:tests? #f ; No tests.
+         #:phases
+         #~(modify-phases %standard-phases
+           (add-after 'unpack 'fix-configure
+             (lambda* (#:key inputs configure-flags outputs #:allow-other-keys)
+               ;; The configure script looks for lua$version, but we provide lua-$version.
+               (substitute* "configure.ac"
+                 (("lua\\$i") "lua-$i"))
+               ;; fpc does not pass -lfoo to the linker, but uses its own linker script,
+               ;; which references libs. Pass the libraries listed in that linker script,
+               ;; so our custom linker adds a correct rpath.
+               (substitute* "src/Makefile.in"
+                 (("linkflags\\s+:= ")
+                  (string-append "linkflags := -lpthread -lsqlite3 -lSDL2"
+                                 " -lSDL2_image -ldl "
+                                 " -lz -lfreetype -lportaudio -lavcodec"
+                                 " -lavformat -lavutil -lswresample"
+                                 " -lswscale -llua -ldl -lX11 -lportmidi"
+                                 " -L" (dirname (search-input-file inputs "lib/libz.so"))
+                                 " -L" (dirname (search-input-file inputs "lib/libX11.so"))
+                                 " -L" (dirname (search-input-file inputs "lib/libportmidi.so")))))))
+           (add-after 'install 'font-paths
+             (lambda* (#:key outputs #:allow-other-keys)
+               (substitute* (string-append
+                              (assoc-ref outputs "out")
+                              "/share/ultrastardx/fonts/fonts.ini")
+                 (("=NotoSans/") (string-append "=" #$font-google-noto
+                                                "/share/fonts/truetype/"))
+                 (("=DejaVu/") (string-append "=" #$font-dejavu
+                                              "/share/fonts/truetype/"))))))))
+      (inputs (list ffmpeg
+                    font-dejavu
+                    font-google-noto
+                    ; Not needed, since we don’t have freesans.
+                    ;font-wqy-microhei
+                    freetype
+                    libx11
+                    lua
+                    portaudio
+                    portmidi
+                    sdl2
+                    sdl2-image
+                    sqlite
+                    zlib))
+      (native-inputs (list pkg-config (force fpc*) autoconf automake))
+      (synopsis "Karaoke game")
+      (description
+       "UltraStar Deluxe (USDX) is a free and open source karaoke game.  It
+allows up to six players to sing along with music using microphones
+in order to score points, depending on the pitch of the voice and the
+rhythm of singing.")
+      (home-page "https://usdx.eu/")
+      (license license:gpl2+))))
+
 (define-public steam-devices-udev-rules
   ;; Last release from 2019-04-10
   (let ((commit "d87ef558408c5e7a1a793d738db4c9dc2cb5f8fa")
diff --git a/gnu/packages/patches/ultrastar-deluxe-no-freesans.patch b/gnu/packages/patches/ultrastar-deluxe-no-freesans.patch
new file mode 100644
index 0000000000..7beba80774
--- /dev/null
+++ b/gnu/packages/patches/ultrastar-deluxe-no-freesans.patch
@@ -0,0 +1,31 @@
+Remove references to FreeSans font, which is not packaged for Guix.
+
+--- a/game/fonts/fonts.ini	1970-01-01 01:00:01.000000000 +0100
++++ b/game/fonts/fonts.ini	2022-09-16 14:31:51.483096847 +0200
+@@ -116,26 +116,6 @@
+ BoldHighResPreCache=0
+ BoldHighResOutline=0.02
+ 
+-[Font_FreeSans]
+-Name=Free Sans
+-RegularFile=FreeSans/FreeSans.ttf
+-RegularFallbackFile1=wqy-microhei/wqy-microhei.ttc
+-;RegularGlyphSpacing=1.4
+-;RegularStretch=1.2
+-BoldFile=FreeSans/FreeSansBold.ttf
+-BoldFallbackFile1=wqy-microhei/wqy-microhei.ttc
+-;BoldEmbolden=0.06
+-OutlineFile=FreeSans/FreeSansBold.ttf
+-OutlineOutline=0.06
+-;OutlineColorR=0.3
+-;OutlineColorG=0.3
+-;OutlineColorB=0.3
+-;OutlineColorA=0.3
+-BoldHighResFile=FreeSans/FreeSansBold.ttf
+-BoldHighResMaxResolution=256
+-BoldHighResPreCache=0
+-BoldHighResOutline=0.02
+-
+ [Font_DejaVuSans]
+ Name=DejaVu Sans
+ RegularFile=DejaVu/DejaVuSans.ttf
-- 
2.35.1





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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-09-21 11:52   ` [bug#57861] [PATCH v2] " Lars-Dominik Braun
@ 2022-10-17  8:33     ` Ludovic Courtès
  2022-10-17 13:25       ` Maxime Devos
  2022-10-17  8:35     ` Ludovic Courtès
  1 sibling, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2022-10-17  8:33 UTC (permalink / raw)
  To: Lars-Dominik Braun; +Cc: 57861, Maxime Devos

Hello!

Lars-Dominik Braun <lars@6xq.net> skribis:

> +;; Lazily resolve to avoid a circular dependency.
> +(define fpc*
> +  (delay (module-ref (resolve-interface '(gnu packages pascal))
> +                     'fpc)))

I think this is unnecessary: you can just #:use-module (gnu packages
pascal) and have ‘fpc’ in ‘native-inputs’.  Everything will be fine
because ‘inputs’ is a thunked field (IOW, its evaluation is delayed).

Apart from that LGTM!

Thanks,
Ludo’.




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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-09-21 11:52   ` [bug#57861] [PATCH v2] " Lars-Dominik Braun
  2022-10-17  8:33     ` [bug#57861] [PATCH] " Ludovic Courtès
@ 2022-10-17  8:35     ` Ludovic Courtès
  2022-10-18  7:56       ` Lars-Dominik Braun
  1 sibling, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2022-10-17  8:35 UTC (permalink / raw)
  To: Lars-Dominik Braun; +Cc: 57861, Maxime Devos

Hello!

Lars-Dominik Braun <lars@6xq.net> skribis:

> +;; Lazily resolve to avoid a circular dependency.
> +(define fpc*
> +  (delay (module-ref (resolve-interface '(gnu packages pascal))
> +                     'fpc)))

I think this is unnecessary: you can just #:use-module (gnu packages
pascal) and have ‘fpc’ in ‘native-inputs’.  Everything will be fine
because ‘inputs’ is a thunked field (IOW, its evaluation is delayed).

Apart from that LGTM!

Thanks,
Ludo’.




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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-10-17  8:33     ` [bug#57861] [PATCH] " Ludovic Courtès
@ 2022-10-17 13:25       ` Maxime Devos
  2022-10-17 13:28         ` ( via Guix-patches via
  2022-10-17 16:44         ` Ludovic Courtès
  0 siblings, 2 replies; 17+ messages in thread
From: Maxime Devos @ 2022-10-17 13:25 UTC (permalink / raw)
  To: Ludovic Courtès, Lars-Dominik Braun; +Cc: 57861


[-- Attachment #1.1.1: Type: text/plain, Size: 805 bytes --]



On 17-10-2022 10:33, Ludovic Courtès wrote:
> Hello!
> 
> Lars-Dominik Braun <lars@6xq.net> skribis:
> 
>> +;; Lazily resolve to avoid a circular dependency.
>> +(define fpc*
>> +  (delay (module-ref (resolve-interface '(gnu packages pascal))
>> +                     'fpc)))
> 
> I think this is unnecessary: you can just #:use-module (gnu packages
> pascal) and have ‘fpc’ in ‘native-inputs’.  Everything will be fine
> because ‘inputs’ is a thunked field (IOW, its evaluation is delayed).

That's still a circular dependency.  Why import (gnu packages pascal) 
when you don't need it (e.g. when installing another, non-pascal, 
package)?  There is some bug report on the excessive dependencies among 
Guix modules with some proposed solutions.

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-10-17 13:25       ` Maxime Devos
@ 2022-10-17 13:28         ` ( via Guix-patches via
  2022-10-17 13:37           ` Maxime Devos
  2022-10-17 16:44         ` Ludovic Courtès
  1 sibling, 1 reply; 17+ messages in thread
From: ( via Guix-patches via @ 2022-10-17 13:28 UTC (permalink / raw)
  To: Maxime Devos, Ludovic Courtès, Lars-Dominik Braun; +Cc: 57861

On Mon Oct 17, 2022 at 2:25 PM BST, Maxime Devos wrote:
> That's still a circular dependency.  Why import (gnu packages pascal) 
> when you don't need it (e.g. when installing another, non-pascal, 
> package)?  There is some bug report on the excessive dependencies among 
> Guix modules with some proposed solutions.

Wouldn't using #:autoload be a cleaner way that still lazily resolves the variables?

    -- (




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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-10-17 13:28         ` ( via Guix-patches via
@ 2022-10-17 13:37           ` Maxime Devos
  0 siblings, 0 replies; 17+ messages in thread
From: Maxime Devos @ 2022-10-17 13:37 UTC (permalink / raw)
  To: (, Ludovic Courtès, Lars-Dominik Braun; +Cc: 57861


[-- Attachment #1.1.1: Type: text/plain, Size: 892 bytes --]



On 17-10-2022 15:28, ( wrote:
> On Mon Oct 17, 2022 at 2:25 PM BST, Maxime Devos wrote:
>> That's still a circular dependency.  Why import (gnu packages pascal)
>> when you don't need it (e.g. when installing another, non-pascal,
>> package)?  There is some bug report on the excessive dependencies among
>> Guix modules with some proposed solutions.
> 
> Wouldn't using #:autoload be a cleaner way that still lazily resolves the variables?
> 
>      -- (

Possibly, I proposed this in
<https://issues.guix.gnu.org/54539#28>.  I tried this in 
<https://issues.guix.gnu.org/54539#62> for a few package modules, with a 
relatively small but noticable improvement (presumably it would be more 
improved by doing it for all package modules instead of only a selection 
and presumably it would be more noticable on a spinning disk instead of 
an SSD).

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-10-17 13:25       ` Maxime Devos
  2022-10-17 13:28         ` ( via Guix-patches via
@ 2022-10-17 16:44         ` Ludovic Courtès
  2022-10-17 17:26           ` Maxime Devos
  1 sibling, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2022-10-17 16:44 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 57861, Lars-Dominik Braun

Maxime Devos <maximedevos@telenet.be> skribis:

> On 17-10-2022 10:33, Ludovic Courtès wrote:
>> Hello!
>> Lars-Dominik Braun <lars@6xq.net> skribis:
>> 
>>> +;; Lazily resolve to avoid a circular dependency.
>>> +(define fpc*
>>> +  (delay (module-ref (resolve-interface '(gnu packages pascal))
>>> +                     'fpc)))
>> I think this is unnecessary: you can just #:use-module (gnu packages
>> pascal) and have ‘fpc’ in ‘native-inputs’.  Everything will be fine
>> because ‘inputs’ is a thunked field (IOW, its evaluation is delayed).
>
> That's still a circular dependency.  Why import (gnu packages pascal)
> when you don't need it

That’s what every package module does.

We can discuss the drawbacks of this and ways to avoid it, but this
particular patch and review is not the right place to do that IMO.

Thanks,
Ludo’.




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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-10-17 16:44         ` Ludovic Courtès
@ 2022-10-17 17:26           ` Maxime Devos
  0 siblings, 0 replies; 17+ messages in thread
From: Maxime Devos @ 2022-10-17 17:26 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 57861, Lars-Dominik Braun


[-- Attachment #1.1.1: Type: text/plain, Size: 525 bytes --]



On 17-10-2022 18:44, Ludovic Courtès wrote:
> Maxime Devos <maximedevos@telenet.be> skribis:
>[...]
>> That's still a circular dependency.  Why import (gnu packages pascal)
>> when you don't need it
> 
> That’s what every package module does.
> 
> We can discuss the drawbacks of this and ways to avoid it, but this
> particular patch and review is not the right place to do that IMO.

I tried to do that, in https://issues.guix.gnu.org/54539, but there were 
no further responses.

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-10-17  8:35     ` Ludovic Courtès
@ 2022-10-18  7:56       ` Lars-Dominik Braun
  2022-10-18 12:44         ` Maxime Devos
  2022-10-18 12:49         ` [bug#57861] " Maxime Devos
  0 siblings, 2 replies; 17+ messages in thread
From: Lars-Dominik Braun @ 2022-10-18  7:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 57861, Maxime Devos

Hi Ludo and Maxim,

> I think this is unnecessary: you can just #:use-module (gnu packages
> pascal) and have ‘fpc’ in ‘native-inputs’.  Everything will be fine
> because ‘inputs’ is a thunked field (IOW, its evaluation is delayed).
the problem is that `make` fails with an error in that case. For me it’s

    ice-9/eval.scm:293:34: error: gash: unbound variable
    hint: Did you forget a `use-modules' form?

but YMMV. With #:autoload `make` succeeds, but throws similar
errors/warnings(?) in the process:

    ;;; Failed to autoload fpc in (gnu packages pascal):
    ;;; Throw to key `unbound-variable' with args `("resolve-interface" "no binding `~A' in module ~A" (fpc (gnu packages pascal)) #f)'.

That’s why I went for the route implemented in the initial patch. What
do we do now?

Lars





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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-10-18  7:56       ` Lars-Dominik Braun
@ 2022-10-18 12:44         ` Maxime Devos
  2022-10-19 11:09           ` [bug#57861] [PATCH v2] " Lars-Dominik Braun
  2022-10-18 12:49         ` [bug#57861] " Maxime Devos
  1 sibling, 1 reply; 17+ messages in thread
From: Maxime Devos @ 2022-10-18 12:44 UTC (permalink / raw)
  To: Lars-Dominik Braun, Ludovic Courtès; +Cc: 57861


[-- Attachment #1.1.1: Type: text/plain, Size: 1500 bytes --]

On 18-10-2022 09:56, Lars-Dominik Braun wrote:
> [...]
> the problem is that `make` fails with an error in that case. For me it’s
> 
>      ice-9/eval.scm:293:34: error: gash: unbound variable
>      hint: Did you forget a `use-modules' form?
> 
> but YMMV. With #:autoload `make` succeeds, but throws similar
> errors/warnings(?) in the process:
> 
>      ;;; Failed to autoload fpc in (gnu packages pascal):
>      ;;; Throw to key `unbound-variable' with args `("resolve-interface" "no binding `~A' in module ~A" (fpc (gnu packages pascal)) #f)'

Don't know what's up with that, maybe when compiling (gnu packages 
pascal) is imported anyway because 'fpc' might be a macro?

But if I try that in a REPL:

(define-module (foo) #:autoload (bar) ( baz))
;;; Failed to determine exported bindings from module (bar):
;;; no code for module (bar)
;;; Failed to determine exported bindings from module (bar):
;;; no code for module (bar)
$1 = #<directory (foo) 7f31caf71820>

I get other messages (warnings, in this case), so maybe an incorrect 
hypothesis.

> 
> That’s why I went for the route implemented in the initial patch. What
> do we do now?

I think the issue is that (gnu packages pascal) imports (gnu packages 
commencement), even though according to the comment in (gnu packages 
commencement), you aren't supposed to do that (because of cycles).

You could give doing the resolve-module trick in (gnu packages pascal) a 
try.

Greetings,
Maxime

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-10-18  7:56       ` Lars-Dominik Braun
  2022-10-18 12:44         ` Maxime Devos
@ 2022-10-18 12:49         ` Maxime Devos
  1 sibling, 0 replies; 17+ messages in thread
From: Maxime Devos @ 2022-10-18 12:49 UTC (permalink / raw)
  To: Lars-Dominik Braun, Ludovic Courtès; +Cc: 57861


[-- Attachment #1.1.1: Type: text/plain, Size: 861 bytes --]

(To add to my previous reply):

It appears that other package modules may need a similar change, 
according to a "git grep -F":

gnu/packages/engineering.scm:  #:use-module (gnu packages commencement)
gnu/packages/instrumentation.scm:  #:use-module (gnu packages commencement)
gnu/packages/pascal.scm:  #:use-module (gnu packages commencement)
gnu/packages/raspberry-pi.scm:  #:use-module (gnu packages commencement)

Alternatively, importing commencement could be accepted though the 
indirect dependency on 'games' from 'commencement' may need to be broken 
to resolve the error (?) message,  as done in 
<https://issues.guix.gnu.org/54539#62>

I don't remember if (gnu packages games) was one of the modules that was 
removed from the dependencies, though, and I'm not sure if this change 
would resolve things here.

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* [bug#57861] [PATCH v2] gnu: Add ultrastar-deluxe.
  2022-10-18 12:44         ` Maxime Devos
@ 2022-10-19 11:09           ` Lars-Dominik Braun
  2022-11-07 22:59             ` bug#57861: [PATCH] " Ludovic Courtès
  0 siblings, 1 reply; 17+ messages in thread
From: Lars-Dominik Braun @ 2022-10-19 11:09 UTC (permalink / raw)
  To: Maxime Devos; +Cc: Ludovic Courtès, 57861

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

Hi Maxime,

> You could give doing the resolve-module trick in (gnu packages pascal) a 
> try.
or just #:autoload? The attached v2 seems to work at least.

Lars


[-- Attachment #2: 0002-gnu-Add-ultrastar-deluxe.patch --]
[-- Type: text/plain, Size: 7526 bytes --]

From c542fd020cbf69fa319ea13301b80eedd35f34a3 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <lars@6xq.net>
Date: Wed, 19 Oct 2022 13:05:25 +0200
Subject: [PATCH v2 2/2] gnu: Add ultrastar-deluxe.

* gnu/packages/games.scm (ultrastar-deluxe): New variable.
* gnu/packages/patches/ultrastar-deluxe-no-freesans.patch: New file.
* gnu/local.mk: Add it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/games.scm                        | 87 +++++++++++++++++++
 .../ultrastar-deluxe-no-freesans.patch        | 31 +++++++
 3 files changed, 119 insertions(+)
 create mode 100644 gnu/packages/patches/ultrastar-deluxe-no-freesans.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index db76aa21e0..b94270e999 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1914,6 +1914,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/u-boot-sifive-prevent-reloc-initrd-fdt.patch	\
   %D%/packages/patches/u-boot-rk3399-enable-emmc-phy.patch	\
   %D%/packages/patches/ucx-tcp-iface-ioctl.patch		\
+  %D%/packages/patches/ultrastar-deluxe-no-freesans.patch		\
   %D%/packages/patches/ungoogled-chromium-extension-search-path.patch	\
   %D%/packages/patches/ungoogled-chromium-ffmpeg-compat.patch	\
   %D%/packages/patches/ungoogled-chromium-RUNPATH.patch		\
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 05901df782..a2d2d7db95 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -177,6 +177,7 @@ (define-module (gnu packages games)
   #:use-module (gnu packages ocaml)
   #:use-module (gnu packages opencl)
   #:use-module (gnu packages pcre)
+  #:autoload (gnu packages pascal) (fpc)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages perl-compression)
@@ -11159,6 +11160,92 @@ (define-public freerct
 and unsafe rides.  Which path will you take?")
     (license license:gpl2)))
 
+(define-public ultrastar-deluxe
+  ;; The last release is quite old and does not support recent versions of ffmpeg.
+  (let ((commit "43484b0a10ce6aae339e19d81ae2f7b37caf6baa")
+        (revision "1"))
+    (package
+      (name "ultrastar-deluxe")
+      (version (git-version "2020.4.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/UltraStar-Deluxe/USDX.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "078g1rbm1ympmwq9s64v68sxvcms7rr0qid12d2wgm4r04ana47r"))
+                (patches (search-patches "ultrastar-deluxe-no-freesans.patch"))
+                (modules '((guix build utils)))
+                (snippet
+                 `(begin
+                    ;; Remove Windows binaries.
+                    (for-each delete-file (find-files "game" "\\.dll$"))
+                    ;; Remove font blobs.
+                    (let ((font-directories (list "DejaVu" "FreeSans" "NotoSans"
+                                                  "wqy-microhei")))
+                      (for-each
+                        (lambda (d) (delete-file-recursively
+                                      (string-append "game/fonts/" d)))
+                        font-directories))))))
+      (build-system gnu-build-system)
+      (arguments
+        (list
+         #:tests? #f ; No tests.
+         #:phases
+         #~(modify-phases %standard-phases
+           (add-after 'unpack 'fix-configure
+             (lambda* (#:key inputs configure-flags outputs #:allow-other-keys)
+               ;; The configure script looks for lua$version, but we provide lua-$version.
+               (substitute* "configure.ac"
+                 (("lua\\$i") "lua-$i"))
+               ;; fpc does not pass -lfoo to the linker, but uses its own linker script,
+               ;; which references libs. Pass the libraries listed in that linker script,
+               ;; so our custom linker adds a correct rpath.
+               (substitute* "src/Makefile.in"
+                 (("linkflags\\s+:= ")
+                  (string-append "linkflags := -lpthread -lsqlite3 -lSDL2"
+                                 " -lSDL2_image -ldl "
+                                 " -lz -lfreetype -lportaudio -lavcodec"
+                                 " -lavformat -lavutil -lswresample"
+                                 " -lswscale -llua -ldl -lX11 -lportmidi"
+                                 " -L" (dirname (search-input-file inputs "lib/libz.so"))
+                                 " -L" (dirname (search-input-file inputs "lib/libX11.so"))
+                                 " -L" (dirname (search-input-file inputs "lib/libportmidi.so")))))))
+           (add-after 'install 'font-paths
+             (lambda* (#:key outputs #:allow-other-keys)
+               (substitute* (string-append
+                              (assoc-ref outputs "out")
+                              "/share/ultrastardx/fonts/fonts.ini")
+                 (("=NotoSans/") (string-append "=" #$font-google-noto
+                                                "/share/fonts/truetype/"))
+                 (("=DejaVu/") (string-append "=" #$font-dejavu
+                                              "/share/fonts/truetype/"))))))))
+      (inputs (list ffmpeg
+                    font-dejavu
+                    font-google-noto
+                    ; Not needed, since we don’t have freesans.
+                    ;font-wqy-microhei
+                    freetype
+                    libx11
+                    lua
+                    portaudio
+                    portmidi
+                    sdl2
+                    sdl2-image
+                    sqlite
+                    zlib))
+      (native-inputs (list pkg-config fpc autoconf automake))
+      (synopsis "Karaoke game")
+      (description
+       "UltraStar Deluxe (USDX) is a free and open source karaoke game.  It
+allows up to six players to sing along with music using microphones
+in order to score points, depending on the pitch of the voice and the
+rhythm of singing.")
+      (home-page "https://usdx.eu/")
+      (license license:gpl2+))))
+
 (define-public steam-devices-udev-rules
   ;; Last release from 2019-04-10
   (let ((commit "d87ef558408c5e7a1a793d738db4c9dc2cb5f8fa")
diff --git a/gnu/packages/patches/ultrastar-deluxe-no-freesans.patch b/gnu/packages/patches/ultrastar-deluxe-no-freesans.patch
new file mode 100644
index 0000000000..7beba80774
--- /dev/null
+++ b/gnu/packages/patches/ultrastar-deluxe-no-freesans.patch
@@ -0,0 +1,31 @@
+Remove references to FreeSans font, which is not packaged for Guix.
+
+--- a/game/fonts/fonts.ini	1970-01-01 01:00:01.000000000 +0100
++++ b/game/fonts/fonts.ini	2022-09-16 14:31:51.483096847 +0200
+@@ -116,26 +116,6 @@
+ BoldHighResPreCache=0
+ BoldHighResOutline=0.02
+ 
+-[Font_FreeSans]
+-Name=Free Sans
+-RegularFile=FreeSans/FreeSans.ttf
+-RegularFallbackFile1=wqy-microhei/wqy-microhei.ttc
+-;RegularGlyphSpacing=1.4
+-;RegularStretch=1.2
+-BoldFile=FreeSans/FreeSansBold.ttf
+-BoldFallbackFile1=wqy-microhei/wqy-microhei.ttc
+-;BoldEmbolden=0.06
+-OutlineFile=FreeSans/FreeSansBold.ttf
+-OutlineOutline=0.06
+-;OutlineColorR=0.3
+-;OutlineColorG=0.3
+-;OutlineColorB=0.3
+-;OutlineColorA=0.3
+-BoldHighResFile=FreeSans/FreeSansBold.ttf
+-BoldHighResMaxResolution=256
+-BoldHighResPreCache=0
+-BoldHighResOutline=0.02
+-
+ [Font_DejaVuSans]
+ Name=DejaVu Sans
+ RegularFile=DejaVu/DejaVuSans.ttf
-- 
2.37.3


[-- Attachment #3: 0001-gnu-fpc-Autoload-ld-wrapper.patch --]
[-- Type: text/plain, Size: 897 bytes --]

From 14ef2dcce25c47f05d8319edbcaf5de7b634bb39 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <lars@6xq.net>
Date: Wed, 19 Oct 2022 13:04:18 +0200
Subject: [PATCH v2 1/2] gnu: fpc: Autoload ld-wrapper.

* gnu/packages/pascal.scm: Use #:autoload for ld-wrapper.
---
 gnu/packages/pascal.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/pascal.scm b/gnu/packages/pascal.scm
index af7857f084..6749488f3f 100644
--- a/gnu/packages/pascal.scm
+++ b/gnu/packages/pascal.scm
@@ -28,7 +28,7 @@ (define-module (gnu packages pascal)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bootstrap)
-  #:use-module (gnu packages commencement)
+  #:autoload (gnu packages commencement) (ld-wrapper)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages ncurses)
-- 
2.37.3


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

* [bug#57861] [PATCH] gnu: Add ultrastar-deluxe.
  2022-09-16 13:37 [bug#57861] [PATCH] gnu: Add ultrastar-deluxe Lars-Dominik Braun
  2022-09-18  9:39 ` Maxime Devos
  2022-09-18 12:26 ` Maxime Devos
@ 2022-11-07 21:41 ` Jonathan Brielmaier
  2 siblings, 0 replies; 17+ messages in thread
From: Jonathan Brielmaier @ 2022-11-07 21:41 UTC (permalink / raw)
  To: 57861

Thanks Lars for the patch.

I checked the latest version of the patch series out and
ultrastar-deluxe runs fine.
Even with my rather big (2000 songs) library.




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

* bug#57861: [PATCH] gnu: Add ultrastar-deluxe.
  2022-10-19 11:09           ` [bug#57861] [PATCH v2] " Lars-Dominik Braun
@ 2022-11-07 22:59             ` Ludovic Courtès
  0 siblings, 0 replies; 17+ messages in thread
From: Ludovic Courtès @ 2022-11-07 22:59 UTC (permalink / raw)
  To: Lars-Dominik Braun; +Cc: 57861-done, Maxime Devos

Hi,

Lars-Dominik Braun <lars@6xq.net> skribis:

>>From c542fd020cbf69fa319ea13301b80eedd35f34a3 Mon Sep 17 00:00:00 2001
> From: Lars-Dominik Braun <lars@6xq.net>
> Date: Wed, 19 Oct 2022 13:05:25 +0200
> Subject: [PATCH v2 2/2] gnu: Add ultrastar-deluxe.
>
> * gnu/packages/games.scm (ultrastar-deluxe): New variable.
> * gnu/packages/patches/ultrastar-deluxe-no-freesans.patch: New file.
> * gnu/local.mk: Add it.

Applied on your behalf.

Turns out pascal.scm didn’t need to include (gnu packages
commencement) so I did that first.

Next step is a fix for <https://issues.guix.gnu.org/55968>, which
affects this package too…

Thanks,
Ludo’.




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

end of thread, other threads:[~2022-11-07 23:11 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 13:37 [bug#57861] [PATCH] gnu: Add ultrastar-deluxe Lars-Dominik Braun
2022-09-18  9:39 ` Maxime Devos
2022-09-21 11:52   ` [bug#57861] [PATCH v2] " Lars-Dominik Braun
2022-10-17  8:33     ` [bug#57861] [PATCH] " Ludovic Courtès
2022-10-17 13:25       ` Maxime Devos
2022-10-17 13:28         ` ( via Guix-patches via
2022-10-17 13:37           ` Maxime Devos
2022-10-17 16:44         ` Ludovic Courtès
2022-10-17 17:26           ` Maxime Devos
2022-10-17  8:35     ` Ludovic Courtès
2022-10-18  7:56       ` Lars-Dominik Braun
2022-10-18 12:44         ` Maxime Devos
2022-10-19 11:09           ` [bug#57861] [PATCH v2] " Lars-Dominik Braun
2022-11-07 22:59             ` bug#57861: [PATCH] " Ludovic Courtès
2022-10-18 12:49         ` [bug#57861] " Maxime Devos
2022-09-18 12:26 ` Maxime Devos
2022-11-07 21:41 ` Jonathan Brielmaier

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