From 31919486254117d95c43711595a9de5e0bae134d Mon Sep 17 00:00:00 2001 From: Liliana Marie Prikler Date: Sat, 4 Oct 2025 11:52:54 +0200 Subject: [PATCH] gnu: stepmania: Update to 5.1.0-b2-1.d55acb1. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/patches/stepmania-ffmpeg-compat.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it here. * gnu/packages/games.scm (stepmania): Update to 5.1.0-b2-1.d55acb1. [source]: Add “stepmania-ffmpeg-compat.patch”. : Adjust unbundling. [arguments]<#:configure-flags>: Add “-DWITH_SYSTEM_GLEW=1”, “-DWITH_SYSTEM_JSONCPP=1”, “-DWITH_SYSTEM_JPEG=1”, “-DWITH_SYSTEM_MAD=1”, “-DWITH_SYSTEM_OGG=1”, “-DWITH_SYSTEM_PCRE=1”, “-DWITH_SYSTEM_PNG=1”, “-DWITH_SYSTEM_TOMMATH=1”, “-DWITH_SYSTEM_TOMCRYPT=1” and “-DWITH_SYSTEM_ZLIB=1”. <#:phases>: Remove ‘unbundle-libpng’. [inputs]: Drop labels. Sort alphabetically. Replace ffmpeg-for-stepmania with ffmpeg-6. Add libtommath and libtomcrypt. Change-Id: I577fe1c15f906c3c67d1ae71a1e085e3fd05aef2 Signed-off-by: 宋文武 --- gnu/local.mk | 1 + gnu/packages/games.scm | 320 ++++++++++-------- .../patches/stepmania-ffmpeg-compat.patch | 49 +++ 3 files changed, 227 insertions(+), 143 deletions(-) create mode 100644 gnu/packages/patches/stepmania-ffmpeg-compat.patch diff --git a/gnu/local.mk b/gnu/local.mk index bfbb0ea0ce87bcf99e0c5cdd36eb88ff270a3178..85c194d4e338b3efda695529d8c356f36fd91910 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2084,6 +2084,7 @@ dist_patch_DATA = \ %D%/packages/patches/smalltalk-multiplication-overflow.patch \ %D%/packages/patches/soci-mysql-ddl-types.patch \ %D%/packages/patches/sqlite-hurd.patch \ + %D%/packages/patches/stepmania-ffmpeg-compat.patch \ %D%/packages/patches/stk-5.0.1-fix-typo.patch \ %D%/packages/patches/strace-readlink-tests.patch \ %D%/packages/patches/sunxi-tools-remove-sys-io.patch \ diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index 7ebfc11e659c53bacec80db9b7f193f2b99ae219..4b24223c932dd0080d6330a2be703171883eb7fa 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -10293,154 +10293,188 @@ via the in-game download manager.") (license (list license:gpl2+)))) (define-public stepmania - (package - (name "stepmania") - (version "5.1.0-b2") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/stepmania/stepmania") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "0a7y9l7xm510vgnpmj1is7p9m6d6yd0fcaxrjcickz295k5w3rdn")) - (modules '((guix build utils))) - (snippet - '(begin - ;; Remove song files, which are licensed under a non-commercial - ;; clause, and a course pointing to them. - (for-each delete-file-recursively - '("Songs/StepMania 5/Goin' Under" - "Songs/StepMania 5/MechaTribe Assault" - "Songs/StepMania 5/Springtime")) - (for-each delete-file '("Courses/Default/Jupiter.crs" - "Courses/Default/Jupiter.png")) - ;; Unbundle libpng. - (substitute* "extern/CMakeLists.txt" - (("include\\(CMakeProject-png.cmake\\)") "")) - (delete-file-recursively "extern/libpng") - ;; Include missing header. - (substitute* "src/arch/ArchHooks/ArchHooks.h" - (("#define ARCH_HOOKS_H" all) - (string-append all "\n#include // struct tm"))))))) - (build-system cmake-build-system) - (arguments - `(#:tests? #f ;FIXME: couldn't find how to run tests - #:build-type "Release" - #:out-of-source? #f ;for the 'install-desktop' phase - #:configure-flags - (list "-DWITH_SYSTEM_FFMPEG=1" - ;; SSE instructions are available on Intel systems only. - ,@(if (any (cute string-prefix? <> (or (%current-target-system) - (%current-system))) - '("x86_64" "i686")) - '() - '("-DWITH_SSE2=NO")) - ;; Configuration cannot find GTK2 without the two following - ;; flags. - (string-append "-DGTK2_GDKCONFIG_INCLUDE_DIR=" - (assoc-ref %build-inputs "gtk+") - "/lib/gtk-2.0/include") - (string-append "-DGTK2_GLIBCONFIG_INCLUDE_DIR=" - (assoc-ref %build-inputs "glib") - "/lib/glib-2.0/include")) - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'ensure-application-files-can-be-found - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out"))) - (substitute* "src/arch/LoadingWindow/LoadingWindow_Gtk.cpp" - (("RageFileManagerUtil::sDirOfExecutable \\+ \"/\" \\+ \"GtkModule.so\"") - (string-append "\"" out - "/share/stepmania/GtkModule.so\""))) - (substitute* "src/arch/ArchHooks/ArchHooks_Unix.cpp" - (("Root = sDirOfExecutable") - (string-append "Root = \"" out "/share/stepmania/\"")) - (("sDirOfExecutable \\+ \"/(Packages|Songs)\"" _ dir) - (string-append "\"" out "/share/stepmania/" dir "\""))) - (substitute* "src/RageFileManager.cpp" - (("RageFileManagerUtil::sDirOfExecutable \\+ \"/\"") - (string-append "\"" out "/share/stepmania/\"")))) - #t)) - (add-after 'unpack 'fix-install-subdir - ;; Installation would be done in "%out/stepmania-X.Y", but we - ;; prefer the more common layout "%out/share/stepmania". - (lambda _ - (substitute* "src/CMakeLists.txt" - (("\"stepmania-.*?\"") "\"share/stepmania\"")) - #t)) - (add-after 'unpack 'unbundle-libpng - (lambda* (#:key inputs #:allow-other-keys) - (substitute* "src/CMakeLists.txt" - (("\\$\\{SM_EXTERN_DIR\\}/libpng/include") - (string-append (assoc-ref inputs "libpng") "/include"))) - #t)) - (add-after 'install 'install-executable - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (bin (string-append out "/bin")) - (exe (string-append out "/share/stepmania/stepmania"))) - (mkdir-p bin) - (symlink exe (string-append bin "/stepmania")) - #t))) - (add-after 'install-executable 'install-desktop - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (share (string-append out "/share")) - (applications (string-append share "/applications")) - (icons (string-append share "/icons"))) - (install-file "stepmania.desktop" applications) - (mkdir-p icons) - (copy-recursively "icons" icons) - #t))) - ;; Move documentation in a more usual place, i.e., - ;; "%out/share/doc/stepmania/". - (add-after 'install-desktop 'install-doc - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (share (string-append out "/share"))) - (with-directory-excursion share - (mkdir-p "doc") - (symlink "../stepmania/Docs" "doc/stepmania")) - #t)))))) - (native-inputs - (list pkg-config yasm)) - (inputs - `(("alsa-lib" ,alsa-lib) - ;; Per upstream, StepMania is only guaranteed to work with a very - ;; specific FFmpeg version, which is included in the repository as - ;; a Git submodule. This particular version requirement usually - ;; changes every few years. - ("ffmpeg" ,ffmpeg-for-stepmania) - ("glib" ,glib) - ("glew" ,glew) - ("gtk+" ,gtk+-2) - ("jsoncpp" ,jsoncpp) - ("libpng" ,libpng) - ("libjpeg" ,libjpeg-turbo) - ("libmad" ,libmad) - ("libogg" ,libogg) - ("libva" ,libva) - ("libvorbis" ,libvorbis) - ("libxinerama" ,libxinerama) - ("libxrandr" ,libxrandr) - ("mesa" ,mesa) - ("pcre" ,pcre) - ("pulseaudio" ,pulseaudio) - ("sdl" ,sdl2) - ("udev" ,eudev) - ("zlib" ,zlib))) - (synopsis "Advanced rhythm game designed for both home and arcade use") - (description "StepMania is a dance and rhythm game. It features 3D + ;; Last release on July 24, 2018. + (let ((commit "d55acb1ba26f1c5b5e3048d6d6c0bd116625216f") + (revision "1")) + (package + (name "stepmania") + (version (git-version "5.1.0-b2" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/stepmania/stepmania") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "00fxwlfvsmsyll1wp5dp05dxwi81w8l8rb7ms735zqjimm1zdlg3")) + (patches (search-patches "stepmania-ffmpeg-compat.patch")) + (modules '((guix build utils) + (ice-9 ftw))) + (snippet + '(begin + ;; Remove song files, which are licensed under a non-commercial + ;; clause, and a course pointing to them. + (for-each delete-file-recursively + '("Songs/StepMania 5/Goin' Under" + "Songs/StepMania 5/MechaTribe Assault" + "Songs/StepMania 5/Springtime")) + (for-each delete-file '("Courses/Default/Jupiter.crs" + "Courses/Default/Jupiter.png")) + ;; Unbundle external sources, keep CMakeProject-* files for + ;; compatibility, lua and libmmmagic. + (with-directory-excursion "extern" + (for-each + (lambda (f) + (unless (member f '("." ".." + "CMakeLists.txt" + "CMakeProject-glew.cmake" + "CMakeProject-json.cmake" + "CMakeProject-jpeg.cmake" + "CMakeProject-lua.cmake" + "CMakeProject-mad.cmake" + "CMakeProject-mmmagic.cmake" + "CMakeProject-pcre.cmake" + "CMakeProject-png.cmake" + "CMakeProject-tomcrypt.cmake" + "CMakeProject-tommath.cmake" + "CMakeProject-zlib.cmake" + "libmmmagic" + "lua-5.1")) + (delete-file-recursively f))) + (scandir "."))) + ;; Fix up #include directives. + (substitute* "src/RageUtil.cpp" + (("\\.\\./extern/pcre/pcre\\.h") "pcre.h")) + ;; Include missing header. + (substitute* "src/arch/ArchHooks/ArchHooks.h" + (("#define ARCH_HOOKS_H" all) + (string-append all "\n#include // struct tm"))))))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ;FIXME: couldn't find how to run tests + #:build-type "Release" + #:out-of-source? #f ;for the 'install-desktop' phase + #:configure-flags + (list "-DWITH_SYSTEM_FFMPEG=1" + "-DWITH_SYSTEM_GLEW=1" + "-DWITH_SYSTEM_JSONCPP=1" + "-DWITH_SYSTEM_JPEG=1" + "-DWITH_SYSTEM_MAD=1" + "-DWITH_SYSTEM_OGG=1" + "-DWITH_SYSTEM_PCRE=1" + "-DWITH_SYSTEM_PNG=1" + "-DWITH_SYSTEM_TOMMATH=1" + "-DWITH_SYSTEM_TOMCRYPT=1" + "-DWITH_SYSTEM_ZLIB=1" + ;; SSE instructions are available on Intel systems only. + ,@(if (any (cute string-prefix? <> (or (%current-target-system) + (%current-system))) + '("x86_64" "i686")) + '() + '("-DWITH_SSE2=NO")) + ;; Configuration cannot find GTK2 without the two following + ;; flags. + (string-append "-DGTK2_GDKCONFIG_INCLUDE_DIR=" + (assoc-ref %build-inputs "gtk+") + "/lib/gtk-2.0/include") + (string-append "-DGTK2_GLIBCONFIG_INCLUDE_DIR=" + (assoc-ref %build-inputs "glib") + "/lib/glib-2.0/include")) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'ensure-application-files-can-be-found + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (substitute* "src/arch/LoadingWindow/LoadingWindow_Gtk.cpp" + (("RageFileManagerUtil::sDirOfExecutable \\+ \"/\" \\+ \"GtkModule.so\"") + (string-append "\"" out + "/share/stepmania/GtkModule.so\""))) + (substitute* "src/arch/ArchHooks/ArchHooks_Unix.cpp" + (("Root = sDirOfExecutable") + (string-append "Root = \"" out "/share/stepmania/\"")) + (("sDirOfExecutable \\+ \"/(Packages|Songs)\"" _ dir) + (string-append "\"" out "/share/stepmania/" dir "\""))) + (substitute* "src/RageFileManager.cpp" + (("RageFileManagerUtil::sDirOfExecutable \\+ \"/\"") + (string-append "\"" out "/share/stepmania/\"")))) + #t)) + (add-after 'unpack 'fix-install-subdir + ;; Installation would be done in "%out/stepmania-X.Y", but we + ;; prefer the more common layout "%out/share/stepmania". + (lambda _ + (substitute* "src/CMakeLists.txt" + (("\"stepmania-.*?\"") "\"share/stepmania\"")) + #t)) + (add-after 'unpack 'unbundle-libpng + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/CMakeLists.txt" + (("\\$\\{SM_EXTERN_DIR\\}/libpng/include") + (string-append (assoc-ref inputs "libpng") "/include"))) + #t)) + (add-after 'install 'install-executable + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin")) + (exe (string-append out "/share/stepmania/stepmania"))) + (mkdir-p bin) + (symlink exe (string-append bin "/stepmania")) + #t))) + (add-after 'install-executable 'install-desktop + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (share (string-append out "/share")) + (applications (string-append share "/applications")) + (icons (string-append share "/icons"))) + (install-file "stepmania.desktop" applications) + (mkdir-p icons) + (copy-recursively "icons" icons) + #t))) + ;; Move documentation in a more usual place, i.e., + ;; "%out/share/doc/stepmania/". + (add-after 'install-desktop 'install-doc + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (share (string-append out "/share"))) + (with-directory-excursion share + (mkdir-p "doc") + (symlink "../stepmania/Docs" "doc/stepmania")) + #t)))))) + (native-inputs + (list pkg-config yasm)) + (inputs + (list alsa-lib + eudev + ffmpeg-6 + glib + glew + gtk+-2 + jsoncpp + libpng + libjpeg-turbo + libmad + libogg + libtommath + libtomcrypt + libva + libvorbis + libxinerama + libxrandr + mesa + pcre + pulseaudio + sdl2 + zlib)) + (synopsis "Advanced rhythm game designed for both home and arcade use") + (description "StepMania is a dance and rhythm game. It features 3D graphics, keyboard and dance pad support, and an editor for creating your own steps. This package provides the core application, but no song is shipped. You need to download and install them in @file{$HOME/.stepmania-X.Y/Songs} directory.") - (home-page "https://www.stepmania.com") - (license license:expat))) + (home-page "https://www.stepmania.com") + (license license:expat)))) (define-public oshu (package diff --git a/gnu/packages/patches/stepmania-ffmpeg-compat.patch b/gnu/packages/patches/stepmania-ffmpeg-compat.patch new file mode 100644 index 0000000000000000000000000000000000000000..b5b9bcd8f2467d674467f1252bd300beabb19499 --- /dev/null +++ b/gnu/packages/patches/stepmania-ffmpeg-compat.patch @@ -0,0 +1,49 @@ +See [6] and [7]. +[6] https://github.com/Tatsh/tatsh-overlay/blob/master/games-arcade/stepmania/files/stepmania-ffmpeg-6.patch +[7] https://github.com/Tatsh/tatsh-overlay/blob/master/games-arcade/stepmania/files/stepmania-ffmpeg-7.patch + +diff --git a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +index 935ddf324b0..d4eed01d599 100644 +--- a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp ++++ b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +@@ -9,6 +9,10 @@ + + #include + ++#if LIBAVCODEC_VERSION_MAJOR > 59 ++#define frame_number frame_num ++#endif ++ + static void FixLilEndian() + { + #if defined(ENDIAN_LITTLE) +@@ -405,7 +405,7 @@ void MovieTexture_FFMpeg::RegisterProtocols() + return; + Done = true; + +-#if !FF_API_NEXT ++#if LIBAVCODEC_VERSION_MAJOR < 58 + avcodec::avcodec_register_all(); + avcodec::av_register_all(); + #endif +@@ -508,7 +508,7 @@ RString MovieDecoder_FFMpeg::OpenCodec() + if( m_pStreamCodec->codec ) + avcodec::avcodec_close( m_pStreamCodec ); + +- avcodec::AVCodec *pCodec = avcodec::avcodec_find_decoder( m_pStreamCodec->codec_id ); ++ const avcodec::AVCodec *pCodec = avcodec::avcodec_find_decoder( m_pStreamCodec->codec_id ); + if( pCodec == nullptr ) + return ssprintf( "Couldn't find decoder %i", m_pStreamCodec->codec_id ); + +diff --git a/src/arch/MovieTexture/MovieTexture_FFMpeg.h b/src/arch/MovieTexture/MovieTexture_FFMpeg.h +index c092b765fc2..99f5ffcb1be 100644 +--- a/src/arch/MovieTexture/MovieTexture_FFMpeg.h ++++ b/src/arch/MovieTexture/MovieTexture_FFMpeg.h +@@ -13,6 +13,7 @@ namespace avcodec + #include + #include + #include ++ #include + + #if LIBAVCODEC_VERSION_MAJOR >= 58 + #define av_free_packet av_packet_unref \ No newline at end of file