[bug#57861] gnu: Add ultrastar-deluxe.
Commit Message
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
Comments
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.
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.
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.
@@ -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 \
@@ -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")
new file mode 100644
@@ -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