From 335d4f548cd77b24e1fe24bce5a66e5b1793b63d Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 14 Jul 2024 09:27:31 +0100 Subject: [PATCH] moc: 2.5.2 -> 2.6-alpha3-unstable-2019-09-14 Includes upstream fixes for FFmpeg 4(!), and downstream ones from Cygwin for FFmpeg 6 and 7. If anyone really like this player, there are a bunch more patches here: * * But you should maybe, like, fork it and apply all of these rather than having downstreams carry even more of them. --- pkgs/applications/audio/moc/default.nix | 48 +++++++++++++------ pkgs/applications/audio/moc/moc-ffmpeg4.patch | 33 ------------- .../audio/moc/use-ax-check-compile-flag.patch | 43 +++++++++++++++++ 3 files changed, 76 insertions(+), 48 deletions(-) delete mode 100644 pkgs/applications/audio/moc/moc-ffmpeg4.patch create mode 100644 pkgs/applications/audio/moc/use-ax-check-compile-flag.patch diff --git a/pkgs/applications/audio/moc/default.nix b/pkgs/applications/audio/moc/default.nix index e81382f34405..a7ad6590aa6b 100644 --- a/pkgs/applications/audio/moc/default.nix +++ b/pkgs/applications/audio/moc/default.nix @@ -1,9 +1,10 @@ -{ lib, stdenv, fetchurl, pkg-config +{ lib, stdenv, fetchsvn, fetchpatch2, pkg-config +, autoreconfHook, autoconf-archive , ncurses, db , popt, libtool , libiconv, CoreServices # Sound sub-systems , alsaSupport ? (!stdenv.isDarwin), alsa-lib -, pulseSupport ? true, libpulseaudio, autoreconfHook +, pulseSupport ? true, libpulseaudio , jackSupport ? true, libjack2 , ossSupport ? true # Audio formats @@ -15,7 +16,7 @@ , musepackSupport ? true, libmpc, libmpcdec, taglib , vorbisSupport ? true, libvorbis , speexSupport ? true, speex -, ffmpegSupport ? true, ffmpeg_4 +, ffmpegSupport ? true, ffmpeg_7 , sndfileSupport ? true, libsndfile , wavpackSupport ? true, wavpack # Misc @@ -24,22 +25,39 @@ , withDebug ? false }: -stdenv.mkDerivation rec { - +stdenv.mkDerivation { pname = "moc"; - version = "2.5.2"; + version = "2.6-alpha3-unstable-2019-09-14"; - src = fetchurl { - url = "http://ftp.daper.net/pub/soft/moc/stable/moc-${version}.tar.bz2"; - sha256 = "026v977kwb0wbmlmf6mnik328plxg8wykfx9ryvqhirac0aq39pk"; + src = fetchsvn { + url = "svn://svn.daper.net/moc/trunk"; + rev = "3005"; + hash = "sha256-JksJxHQgQ8hPTFtLvEvZuFh2lflDNrEmDTMWWwVnjZQ="; }; - patches = [] - ++ lib.optional ffmpegSupport ./moc-ffmpeg4.patch - ++ lib.optional pulseSupport ./pulseaudio.patch; + patches = [ + # FFmpeg 6 support + (fetchpatch2 { + url = "https://cygwin.com/cgit/cygwin-packages/moc/plain/Support-for-recent-ffmpeg-change.patch?id=ab70f1306b8416852915be4347003aac3bdc216"; + hash = "sha256-5hLEFBJ+7Nvxn6pNj4bngcg2qJsCzxiuP6yEj+7tvs0="; + stripLen = 1; + }) - nativeBuildInputs = [ pkg-config ] - ++ lib.optional pulseSupport autoreconfHook; + # FFmpeg 7 support + (fetchpatch2 { + url = "https://cygwin.com/cgit/cygwin-packages/moc/plain/ffmpeg-7.0.patch?id=ab70f1306b8416852915be4347003aac3bdc216e"; + hash = "sha256-dYw6DNyw61MGfv+GdBz5Dtrr9fVph1tf7vxexWONwF8="; + stripLen = 1; + }) + + ./use-ax-check-compile-flag.patch + ] ++ lib.optional pulseSupport ./pulseaudio.patch; + + postPatch = '' + rm m4/* + ''; + + nativeBuildInputs = [ pkg-config autoreconfHook autoconf-archive ]; buildInputs = [ ncurses db popt libtool ] # Sound sub-systems @@ -56,7 +74,7 @@ stdenv.mkDerivation rec { ++ lib.optionals musepackSupport [ libmpc libmpcdec taglib ] ++ lib.optional vorbisSupport libvorbis ++ lib.optional speexSupport speex - ++ lib.optional ffmpegSupport ffmpeg_4 + ++ lib.optional ffmpegSupport ffmpeg_7 ++ lib.optional sndfileSupport libsndfile ++ lib.optional wavpackSupport wavpack # Misc diff --git a/pkgs/applications/audio/moc/moc-ffmpeg4.patch b/pkgs/applications/audio/moc/moc-ffmpeg4.patch deleted file mode 100644 index 7499f9c539bc..000000000000 --- a/pkgs/applications/audio/moc/moc-ffmpeg4.patch +++ /dev/null @@ -1,33 +0,0 @@ -Index: decoder_plugins/ffmpeg/ffmpeg.c -=================================================================== ---- /decoder_plugins/ffmpeg/ffmpeg.c (revisión: 2963) -+++ /decoder_plugins/ffmpeg/ffmpeg.c (copia de trabajo) -@@ -697,7 +697,7 @@ - * FFmpeg/LibAV in use. For some versions this will be caught in - * *_find_stream_info() above and misreported as an unfound codec - * parameters error. */ -- if (data->codec->capabilities & CODEC_CAP_EXPERIMENTAL) { -+ if (data->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) { - decoder_error (&data->error, ERROR_FATAL, 0, - "The codec is experimental and may damage MOC: %s", - data->codec->name); -@@ -705,8 +705,8 @@ - } - - set_downmixing (data); -- if (data->codec->capabilities & CODEC_CAP_TRUNCATED) -- data->enc->flags |= CODEC_FLAG_TRUNCATED; -+ if (data->codec->capabilities & AV_CODEC_CAP_TRUNCATED) -+ data->enc->flags |= AV_CODEC_FLAG_TRUNCATED; - - if (avcodec_open2 (data->enc, data->codec, NULL) < 0) - { -@@ -725,7 +725,7 @@ - - data->sample_width = sfmt_Bps (data->fmt); - -- if (data->codec->capabilities & CODEC_CAP_DELAY) -+ if (data->codec->capabilities & AV_CODEC_CAP_DELAY) - data->delay = true; - data->seek_broken = is_seek_broken (data); - data->timing_broken = is_timing_broken (data->ic); diff --git a/pkgs/applications/audio/moc/use-ax-check-compile-flag.patch b/pkgs/applications/audio/moc/use-ax-check-compile-flag.patch new file mode 100644 index 000000000000..90dadf092bb7 --- /dev/null +++ b/pkgs/applications/audio/moc/use-ax-check-compile-flag.patch @@ -0,0 +1,43 @@ +diff --git a/configure.in b/configure.in +index eb71bdf0b0...342baf10c5 100644 +--- a/configure.in ++++ b/configure.in +@@ -102,16 +102,16 @@ + + AC_C_CONST + AC_TYPE_INTPTR_T +-AX_CFLAGS_GCC_OPTION(-Wall) +-AX_CFLAGS_GCC_OPTION(-Wextra) ++AX_CHECK_COMPILE_FLAG(-Wall) ++AX_CHECK_COMPILE_FLAG(-Wextra) + + dnl Overly-enthusiastic warning suppression. + save_CFLAGS="$CFLAGS" +-AX_CFLAGS_GCC_OPTION([-Wgnu-zero-variadic-macro-arguments], , ++AX_CHECK_COMPILE_FLAG([-Wgnu-zero-variadic-macro-arguments], + AC_DEFINE([HAVE_VARIADIC_MACRO_WARNING], 1, + [Define if compiler recognises warning option])) +-AX_CFLAGS_GCC_OPTION([-Werror=unknown-warning-option]) +-AX_CFLAGS_GCC_OPTION([-Wformat-truncation], , ++AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option]) ++AX_CHECK_COMPILE_FLAG([-Wformat-truncation], + AC_DEFINE([HAVE_FORMAT_TRUNCATION_WARNING], 1, + [Define if compiler recognises warning option])) + CFLAGS="$save_CFLAGS" +@@ -242,13 +242,13 @@ + else + if test "x$enable_debug" = "xgdb" + then +- AX_CFLAGS_GCC_OPTION([-ggdb]) +- AX_CFLAGS_GCC_OPTION([-O0]) ++ AX_CHECK_COMPILE_FLAG([-ggdb]) ++ AX_CHECK_COMPILE_FLAG([-O0]) + COMPILE_DEBUG='gdb' + fi + if test "x$ac_cv_cflags_gcc_option__ggdb" = "x" + then +- AX_CFLAGS_GCC_OPTION([-g]) ++ AX_CHECK_COMPILE_FLAG([-g]) + COMPILE_DEBUG='yes' + fi + EXTRA_OBJS="$EXTRA_OBJS null_out.o md5.o"