Package Details: stepmania 5.1.0.b2.r627.d55acb1ba2-4

Git Clone URL: https://aur.archlinux.org/stepmania.git (read-only, click to copy)
Package Base: stepmania
Description: Advanced rhythm game. Designed for both home and arcade use.
Upstream URL: http://www.stepmania.com/
Keywords: arcade game
Licenses: MIT AND CC-BY-NC-4.0
Submitter: Nascher
Maintainer: neeshy (snailman153624)
Last Packager: neeshy
Votes: 29
Popularity: 0.153640
First Submitted: 2015-08-12 13:57 (UTC)
Last Updated: 2024-12-16 03:18 (UTC)

Required by (1)

Sources (6)

Latest Comments

1 2 3 4 5 6 7 Next › Last »

kqr commented on 2024-12-15 01:59 (UTC)

make: CMakeFiles/ffmpeg.dir/build.make: No such file or directory
make: *** No rule to make target 'CMakeFiles/ffmpeg.dir/build.make'.  Stop.
==> ERROR: A failure occurred in prepare().
    Aborting...
 -> error making: stepmania-exit status 4

snailman153624 commented on 2024-12-05 12:25 (UTC)

OK, I incorporated all of my comments below regarding building with FFMpeg 2.1.3 into the PKGBUILD; I'll leave the comments for reference, but the latest snapshot should be all fixed up.

snailman153624 commented on 2024-12-04 05:14 (UTC)

So, to build/link against FFMpeg 2.1.3, create the two patch files from the comments below, e.g.:


$srcdir/ffmpeg-misc.patch
$srcdir/ffmpeg-mathops.patch

Edit the indicated portions of PKGBUILD to something like this (the asm requirement patch is not wrong...it won't do anything impactful in this config anyway):


prepare() {
   cd "$srcdir/$pkgname-$_pkgver"
#  patch -Np1 -i "$srcdir/3fef5ef60b7674d6431f4e1e4ba8c69b0c21c023.patch"
#  patch -Np1 -i "$srcdir/ffmpeg-7.patch"
   patch -Np1 -i "$srcdir/ffmpeg-remove-asm-requirement.patch"
   patch -Np1 -i "$srcdir/ffmpeg-mathops.patch"
   patch -Np1 -i "$srcdir/ffmpeg-misc.patch"
 }

...likewise, enable building with the bundled FFMpeg:


build() {
...
    -DWITH_SYSTEM_FFMPEG=NO \
...
 }

If you are doing this on your own, you of course have to download/extract the package (don't build it yet), then make the modifications, then perform a build without clean/re-extraction (or it will overwrite your changes).

Also, I'm guessing the above will require you to run the build 2x (I didn't try this from a clean download after I got it working...I ran the build numerous times as I hand-patched files), because the ffmpeg-2.1.3 is not handled as a normal dependency for the package, but rather in a nested CMake file during the actual build process, not during extraction (thus, the ffmpeg patches will have nothing to apply to on the first attempt...as prepare()/patches are run before build()).. This is an area where the Stepmania and AUR build processes overlap/conflict slightly in terms of who's responsible for what. You could either patch the FFMpeg CMake to apply the patches, or perhaps move the download/extraction of ffmpeg-2.1.3 up to the PKGBUILD.

snailman153624 commented on 2024-12-04 04:59 (UTC)

I ran into some issues with Stepmania crashing since the package was updated to use the system FFMpeg. It compiles and runs, but crashes when attempting to play a song that has a video file present (which is when FFMpeg would get invoked at runtime). This is a long standing issue with Stepmania (the volatility of the FFMpeg version dependence), and hence why it can be built against a specific version of FFMpeg (which is also statically linked).

In order to get the original/intended version of FFMpeg (2.1.3) to compile on a modern system, I had to patch several files, as modern compilers are more strict in their detection and enforcement of various things (some of these may be legit bugs in FFMpeg, but it only needs to work for the intended use case here).

For starters, none of the current patches in the PKGBUILD are applicable to an FFMpeg 2.1.3 build, as all of them are [attempted] workarounds to get it to compile with FFMpeg 4+. If you want to keep it robust to both configurations, you could add some #ifdef's in there (ideally in the prepare()), but I just commented them out.

Next, the mathops.h patch that's detailed in one of my comments from 2024-01-27 is still needed.

Additionally, several .c and .h files needed patches, mainly to force some otherwise invalid pointer type conversions. I combined these into a single patch file:

--- a/extern/ffmpeg-linux-2.1.3/libavcodec/mpegvideo_enc.c
+++ b/extern/ffmpeg-linux-2.1.3/libavcodec/mpegvideo_enc.c
@@ -1437,7 +1437,7 @@
 }

 int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
-                          AVFrame *pic_arg, int *got_packet)
+                          const AVFrame *pic_arg, int *got_packet)
 {
     MpegEncContext *s = avctx->priv_data;
     int i, stuffing_count, ret;

--- a/extern/ffmpeg-linux-2.1.3/libavcodec/mpegvideo.h
+++ b/extern/ffmpeg-linux-2.1.3/libavcodec/mpegvideo.h
@@ -803,7 +803,7 @@
 int ff_MPV_encode_init(AVCodecContext *avctx);
 int ff_MPV_encode_end(AVCodecContext *avctx);
 int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
-                          AVFrame *frame, int *got_packet);
+                          const AVFrame *frame, int *got_packet);
 void ff_dct_encode_init_x86(MpegEncContext *s);
 void ff_MPV_common_init_x86(MpegEncContext *s);
 void ff_MPV_common_init_axp(MpegEncContext *s);

--- a/extern/ffmpeg-linux-2.1.3/libavcodec/qpeg.c
+++ b/extern/ffmpeg-linux-2.1.3/libavcodec/qpeg.c
@@ -325,8 +325,8 @@
 static av_cold int decode_init(AVCodecContext *avctx){
     QpegContext * const a = avctx->priv_data;

-    avcodec_get_frame_defaults(&a->pic);
-    avcodec_get_frame_defaults(&a->ref);
+    avcodec_get_frame_defaults(a->pic);
+    avcodec_get_frame_defaults(a->ref);
     a->avctx = avctx;
     avctx->pix_fmt= AV_PIX_FMT_PAL8;

--- a/extern/ffmpeg-linux-2.1.3/libavcodec/snowenc.c
+++ b/extern/ffmpeg-linux-2.1.3/libavcodec/snowenc.c
@@ -1549,7 +1549,7 @@
 }

 static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
-                        AVFrame *pict, int *got_packet)
+                        const AVFrame *pict, int *got_packet)
 {
     SnowContext *s = avctx->priv_data;
     RangeCoder * const c= &s->c;

--- a/extern/ffmpeg-linux-2.1.3/libavcodec/utils.c
+++ b/extern/ffmpeg-linux-2.1.3/libavcodec/utils.c
@@ -976,7 +976,7 @@
         return ret;
     }

-    av_image_copy(frame->data, frame->linesize, tmp.data, tmp.linesize,
+    av_image_copy(frame->data, frame->linesize, (const uint8_t **)tmp.data, tmp.linesize,
                   frame->format, frame->width, frame->height);

     av_frame_unref(&tmp);

--- a/extern/ffmpeg-linux-2.1.3/libavutil/frame.c
+++ b/extern/ffmpeg-linux-2.1.3/libavutil/frame.c
@@ -271,7 +271,7 @@
             av_samples_copy(dst->extended_data, src->extended_data, 0, 0,
                             dst->nb_samples, ch, dst->format);
         } else {
-            av_image_copy(dst->data, dst->linesize, src->data, src->linesize,
+            av_image_copy(dst->data, dst->linesize, (const uint8_t **)src->data, src->linesize,
                           dst->format, dst->width, dst->height);
         }
         return 0;
@@ -424,7 +424,7 @@
         av_samples_copy(tmp.extended_data, frame->extended_data, 0, 0,
                         frame->nb_samples, ch, frame->format);
     } else {
-        av_image_copy(tmp.data, tmp.linesize, frame->data, frame->linesize,
+        av_image_copy(tmp.data, tmp.linesize, (const uint8_t **)frame->data, frame->linesize,
                       frame->format, frame->width, frame->height);
     }


snailman153624 commented on 2024-01-28 05:53 (UTC) (edited on 2024-01-28 05:57 (UTC) by snailman153624)

Here's the mathops.h patch contents:


--- a/libavcodec/x86/mathops.h
+++ b/libavcodec/x86/mathops.h
@@ -35,12 +35,20 @@
 static av_always_inline av_const int MULL(int a, int b, unsigned shift)
 {
     int rt, dummy;
+    if (__builtin_constant_p(shift))
     __asm__ (
         "imull %3               \n\t"
         "shrdl %4, %%edx, %%eax \n\t"
         :"=a"(rt), "=d"(dummy)
-        :"a"(a), "rm"(b), "ci"((uint8_t)shift)
+        :"a"(a), "rm"(b), "i"(shift & 0x1F)
     );
+    else
+        __asm__ (
+            "imull %3               \n\t"
+            "shrdl %4, %%edx, %%eax \n\t"
+            :"=a"(rt), "=d"(dummy)
+            :"a"(a), "rm"(b), "c"((uint8_t)shift)
+        );
     return rt;
 }

@@ -113,19 +121,31 @@ __asm__ volatile(\
 // avoid +32 for shift optimization (gcc should do that ...)
 #define NEG_SSR32 NEG_SSR32
 static inline  int32_t NEG_SSR32( int32_t a, int8_t s){
+    if (__builtin_constant_p(s))
     __asm__ ("sarl %1, %0\n\t"
          : "+r" (a)
-         : "ic" ((uint8_t)(-s))
+         : "i" (-s & 0x1F)
     );
+    else
+        __asm__ ("sarl %1, %0\n\t"
+               : "+r" (a)
+               : "c" ((uint8_t)(-s))
+        );
     return a;
 }

 #define NEG_USR32 NEG_USR32
 static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
+    if (__builtin_constant_p(s))
     __asm__ ("shrl %1, %0\n\t"
          : "+r" (a)
-         : "ic" ((uint8_t)(-s))
+         : "i" (-s & 0x1F)
     );
+    else
+        __asm__ ("shrl %1, %0\n\t"
+               : "+r" (a)
+               : "c" ((uint8_t)(-s))
+        );
     return a;
 }
 

snailman153624 commented on 2024-01-28 05:46 (UTC) (edited on 2024-01-28 06:03 (UTC) by snailman153624)

I had to patch a few files to make it build, as follows:

1. git to https suggestion below (tweaked) resolved the long pause followed by error (due to fail/timeout of ffmpeg retrieval)...I added the following to prepare() in the PKGBUILD:

sed -i 's/git:/https:/g' ${srcdir}/${pkgname}-${pkgver}/CMake/SetupFfmpeg.cmake

2. Error regarding "tm" having incomplete type is due to a missing include to <ctime>...I patched it with sed in prepare() also, but more properly this would be done with a patch file...

sed -i 's/#define ARCH_HOOKS_H/#define ARCH_HOOKS_H\n#include <ctime>/g' ${srcdir}/${pkgname}-${pkgver}/src/arch/ArchHooks/ArchHooks.h

3. I got some invalid arg to some asm code in ffmpeg...the version of ffmpeg used is really old. I tried flipping the flag in the PKGBUILD to use my native ffmpeg, but this ran into other compile and link issues (due to API changes in the newer version). After some digging, invalid opcodes were used in the asm for x86 in mathops.h...I found the patch and it matched this header file exactly, resolving this issue. I simply put the relevant portion of the patchfile in a file I created called "mathops.patch" in a subdirectory "my_patches" in the package folder (not in src, as this will get wiped when makepkg extracts), and added it prepare():

 cd "$srcdir/$pkgname-$pkgver/extern/ffmpeg-linux-2.1.3"
    patch --forward -p1 --input="${srcdir}/../my_patches/mathops.patch"

My resultant prepare() looks like this (incorporating all of the above):

prepare() {  
    cd "$srcdir/$pkgname-$pkgver/"
    patch --forward -p1 --input="${srcdir}/0001-GtkModule-Add-harfbuzz-dependency.patch"
    patch --forward -p1 --input="${srcdir}/0002-MessagemanCrashPatch.patch"

    sed -i 's/git:/https:/g' ${srcdir}/${pkgname}-${pkgver}/CMake/SetupFfmpeg.cmake
    sed -i 's/#define ARCH_HOOKS_H/#define ARCH_HOOKS_H\n#include <ctime>/g' ${srcdir}/${pkgname}-${pkgver}/src/arch/ArchHooks/ArchHooks.h

    cd "$srcdir/$pkgname-$pkgver/extern/ffmpeg-linux-2.1.3"
    patch --forward -p1 --input="${srcdir}/../my_patches/mathops.patch"
}

After all of this, the makepkg -s, followed by makepkg install worked, and stepmania runs! Been using it with Wii/Gamecube DDR mats, coupled with a USB Gamecube->USB adapter I got for $7.

griffin commented on 2022-11-28 21:41 (UTC)

Also getting the ffmpeg git failure error.

whynothugo commented on 2022-10-04 00:00 (UTC)

Builds fine for me in a clean chroot.

Heterology commented on 2022-09-27 06:29 (UTC)

Gah, another error now. I'll run a full system update and see what's going on.

In file included from /home/user/.cache/pikaur/build/stepmania/src/stepmania-5.0.12/src/arch/ArchHooks/ArchHooks.cpp:2:
/home/user/.cache/pikaur/build/stepmania/src/stepmania-5.0.12/src/arch/ArchHooks/ArchHooks.h:37:31: error: ‘<anonymous>’ has incomplete type
   37 |         virtual void SetTime( tm ) { }
      |                               ^~