diff --git a/cmus/PKGBUILD b/cmus/PKGBUILD new file mode 100644 index 0000000..ffc060d --- /dev/null +++ b/cmus/PKGBUILD @@ -0,0 +1,88 @@ +#!/usr/bin/bash +# JOBoRun : Jwm OpenBox Obarun RUNit +# Maintainer : Joe Bo Run +# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname" +# Website : https://pozol.eu +#-----------------------------------------| DESCRIPTION |--------------------------------------- + +pkgname=cmus +_pkgver=v2.11.0.r0.g5f4e941 +pkgver=2.11.0.r0.g5f4e941 +pkgrel=02 +pkgdesc="Small, fast and powerful console music player for Unix-like operating systems w/o systemd" +url="https://cmus.github.io/" +depends=('libdiscid' 'ncurses') +makedepends=('git' + 'faad2' + 'ffmpeg' + 'flac' + 'jack' + 'libao' + 'libcdio-paranoia' + 'libmad' + 'libmodplug' + 'libmp4v2' + 'libmpcdec' + 'libpulse' + 'libsamplerate' + 'libvorbis' + 'opusfile>=0.12' + 'wavpack') +optdepends=('alsa-lib: for ALSA output plugin support' + 'libao: for AO output plugin support' + 'libpulse: for PulseAudio output plugin support' + 'faad2: for AAC input plugin support' + 'ffmpeg: for ffmpeg input plugin support' + 'flac: for flac input plugin support' + 'jack: for jack plugin support' + 'libmad: for mp3 input plugin support' + 'libmodplug: for modplug input plugin support' + 'libmp4v2: for mp4 input plugin support' + 'libmpcdec: for musepack input plugin support' + 'libsamplerate: for sampe rate converter support' + 'libvorbis: for vorbis input plugin support' + 'libcdio-paranoia: for cdio support' + 'opusfile: for opus input plugin support' + 'wavpack: for wavpack input plugin support') +conflicts=('cmus-git') +provides=('cmus') +#_commit=ade6e2a7253d7a256e87fdac3da17c9158e6700e +#source=("git+https://github.com/cmus/cmus.git#commit=$_commit") +source=('git+https://github.com/cmus/cmus.git') +# ffmpeg6.patch) +#_gitname=cmus + +_pkgver() { + cd "$pkgname" + git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' +} + +prepare() { + cd $pkgname +# patch -p1 -i ../ffmpeg6.patch # Fix build with FFmpeg 6 +} + +build() { + cd $pkgname + ./configure prefix=/usr + make +} + +package() { + cd $pkgname + make DESTDIR="$pkgdir" install + install -Dm644 contrib/cmus.bash-completion "$pkgdir"/usr/share/bash-completion/completions/cmus + install -Dm644 contrib/_cmus "$pkgdir"/usr/share/zsh/site-functions/_cmus +} + +#---- arch license gpg-key & sha256sums ---- + +arch=(x86_64) + +license=(GPL) + +sha256sums=(SKIP) +# f076b87b38d7d642672287a34b8b077ea7c82ddd703378b2a07b6c4b2fe45432) # ffmpeg6.patch + +## 8b61517e668e9691224b807ec336ae6868ea304e5be626cbbd3142e61a12747a cmus-2.11.0.r0.g5f4e941-02-x86_64.pkg.tar.lz + diff --git a/cmus/PKGBUILD-arch b/cmus/PKGBUILD-arch new file mode 100644 index 0000000..b5b6848 --- /dev/null +++ b/cmus/PKGBUILD-arch @@ -0,0 +1,69 @@ +# Maintainer: Xyne +# Contributor: Bartłomiej Piotrowski +# Contributor: Aaron Griffin +# Contributor: dorphell +# Contributor: Alexander F. Rødseth + +pkgname=cmus +pkgver=2.10.0 +pkgrel=5 +pkgdesc='Feature-rich ncurses-based music player' +arch=('x86_64') +url='https://cmus.github.io/' +license=('GPL') +depends=('libdiscid' 'ncurses') +makedepends=( + 'faad2' + 'ffmpeg' + 'flac' + 'jack' + 'libao' + 'libcdio-paranoia' + 'libmad' + 'libmodplug' + 'libmp4v2' + 'libmpcdec' + 'libpulse' + 'libsamplerate' + 'libvorbis' + 'opusfile>=0.12' + 'wavpack' +) +optdepends=('alsa-lib: for ALSA output plugin support' + 'libao: for AO output plugin support' + 'libpulse: for PulseAudio output plugin support' + 'faad2: for AAC input plugin support' + 'ffmpeg: for ffmpeg input plugin support' + 'flac: for flac input plugin support' + 'jack: for jack plugin support' + 'libmad: for mp3 input plugin support' + 'libmodplug: for modplug input plugin support' + 'libmp4v2: for mp4 input plugin support' + 'libmpcdec: for musepack input plugin support' + 'libsamplerate: for sampe rate converter support' + 'libvorbis: for vorbis input plugin support' + 'libcdio-paranoia: for cdio support' + 'opusfile: for opus input plugin support' + 'wavpack: for wavpack input plugin support') +source=("$pkgname-$pkgver.tar.gz::https://github.com/cmus/cmus/archive/v${pkgver}.tar.gz" + ffmpeg6.patch) +sha256sums=('ff40068574810a7de3990f4f69c9c47ef49e37bd31d298d372e8bcdafb973fff' + 'f076b87b38d7d642672287a34b8b077ea7c82ddd703378b2a07b6c4b2fe45432') + +prepare() { + cd $pkgname-$pkgver + patch -p1 -i ../ffmpeg6.patch # Fix build with FFmpeg 6 +} + +build() { + cd "$pkgname-$pkgver" + ./configure prefix=/usr + make +} + +package() { + cd "$pkgname-$pkgver" + make DESTDIR="$pkgdir" install + install -Dm644 contrib/_cmus "$pkgdir"/usr/share/zsh/site-functions/_cmus +} +## diff --git a/cmus/PKGBUILD-aur b/cmus/PKGBUILD-aur new file mode 100644 index 0000000..87415d7 --- /dev/null +++ b/cmus/PKGBUILD-aur @@ -0,0 +1,65 @@ +# Maintainer: Kamran Mackey + +pkgname=cmus-git +pkgver=v2.9.1.r25.g54d7213 +pkgrel=2 +pkgdesc="Small, fast and powerful console music player for Unix-like operating systems." +arch=('x86_64' 'aarch64') +url="https://cmus.github.io/" +depends=('ncurses' 'libdiscid') +makedepends=('git' + 'faad2' + 'ffmpeg' + 'flac' + 'jack' + 'libao' + 'libcdio-paranoia' + 'libmad' + 'libmodplug' + 'libmp4v2' + 'libmpcdec' + 'libpulse' + 'libsamplerate' + 'libvorbis' + 'opusfile' + 'wavpack') +optdepends=('alsa-lib: for ALSA output plugin support' + 'libao: for AO output plugin support' + 'libpulse: for PulseAudio output plugin support' + 'faad2: for AAC input plugin support' + 'ffmpeg: for ffmpeg input plugin support' + 'flac: for flac input plugin support' + 'jack: for jack plugin support' + 'libmad: for mp3 input plugin support' + 'libmodplug: for modplug input plugin support' + 'libmp4v2: for mp4 input plugin support' + 'libmpcdec: for musepack input plugin support' + 'libsamplerate: for sampe rate converter support' + 'libvorbis: for vorbis input plugin support' + 'libcdio-paranoia: for cdio support' + 'opusfile: for opus input plugin support' + 'wavpack: for wavpack input plugin support') +conflicts=('cmus') +provides=('cmus') +license=('GPL') +source=('git+https://github.com/cmus/cmus.git') +sha512sums=('SKIP') +_gitname=cmus + +pkgver() { + cd "$_gitname" + git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' +} + +build() { + cd "$_gitname" + ./configure prefix=/usr + make +} + +package() { + cd "$_gitname" + make DESTDIR="$pkgdir" install + install -Dm644 contrib/cmus.bash-completion "$pkgdir"/usr/share/bash-completion/completions/cmus + install -Dm644 contrib/_cmus "$pkgdir"/usr/share/zsh/site-functions/_cmus +} diff --git a/cmus/clean b/cmus/clean new file mode 100644 index 0000000..aa28e90 --- /dev/null +++ b/cmus/clean @@ -0,0 +1 @@ +rm -rf {src,pkg,cmus} diff --git a/cmus/deps b/cmus/deps new file mode 100644 index 0000000..a8a26f8 --- /dev/null +++ b/cmus/deps @@ -0,0 +1,18 @@ +libdiscid +git +faad2 +ffmpeg +flac +jack2 +libao +libcdio-paranoia +libmad +libmodplug +libmp4v2 +libmpcdec +libpulse +libsamplerate +libvorbis +opusfile +wavpack +libglvnd diff --git a/cmus/ffmpeg6.patch b/cmus/ffmpeg6.patch new file mode 100644 index 0000000..ba8fc6d --- /dev/null +++ b/cmus/ffmpeg6.patch @@ -0,0 +1,14 @@ +diff --git a/ip/ffmpeg.c b/ip/ffmpeg.c +index 09ed3fc..ea0b26f 100644 +--- a/ip/ffmpeg.c ++++ b/ip/ffmpeg.c +@@ -202,9 +202,6 @@ static int ffmpeg_open(struct input_plugin_data *ip_data) + break; + } + +- if (codec->capabilities & AV_CODEC_CAP_TRUNCATED) +- cc->flags |= AV_CODEC_FLAG_TRUNCATED; +- + if (avcodec_open2(cc, codec, NULL) < 0) { + d_print("could not open codec: %d, %s\n", cc->codec_id, avcodec_get_name(cc->codec_id)); + err = -IP_ERROR_UNSUPPORTED_FILE_TYPE; diff --git a/cmus/time b/cmus/time new file mode 100644 index 0000000..b77345b --- /dev/null +++ b/cmus/time @@ -0,0 +1,3 @@ +real 0m12.920s +user 0m22.504s +sys 0m1.719s diff --git a/doxygen/10891-fix-buffer-overflow.patch b/doxygen/10891-fix-buffer-overflow.patch new file mode 100644 index 0000000..c5d5b3d --- /dev/null +++ b/doxygen/10891-fix-buffer-overflow.patch @@ -0,0 +1,42 @@ +From 53cdbc09aa3d1dcc83bccf2af0d9c349eb4d3c0b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= + <1289205+lahwaacz@users.noreply.github.com> +Date: Thu, 23 May 2024 21:05:56 +0200 +Subject: [PATCH] Fix buffer overflow in Markdown parser + +This fixes a buffer overflow that happened when parsing a bad Markdown +file with an unclosed emphasis nested in other elements, such as + +```markdown +> __af_err af_flip(af_array *out, const af_array in, const unsigned dim)__ +``` + +This snippet comes from the ArrayFire repository [1]. The problem was +found after the refactoring [2] that introduced std::string_view in the +code. The `std::string_view::operator[]` has bounds checking enabled +when the macro `_GLIBCXX_ASSERTIONS` is defined, which is the case of +Arch Linux build system. + +[1] https://github.com/arrayfire/arrayfire/blob/0a25d36238aa1eee3b775d3584937ca65b0a1807/docs/pages/matrix_manipulation.md +[2] https://github.com/doxygen/doxygen/commit/f4e37514325abe4aa6aeecbc96e9e3e027885aef +--- + src/markdown.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/markdown.cpp b/src/markdown.cpp +index 10429edd57..f25d1b4c50 100644 +--- a/src/markdown.cpp ++++ b/src/markdown.cpp +@@ -691,6 +691,12 @@ size_t Markdown::Private::findEmphasisChar(std::string_view data, char c, size_t + } + } + ++ // avoid overflow (unclosed emph token) ++ if (i==size) ++ { ++ return 0; ++ } ++ + // skipping a code span + if (data[i]=='`') + { diff --git a/doxygen/PKGBUILD b/doxygen/PKGBUILD index 81a8e89..78d35c2 100644 --- a/doxygen/PKGBUILD +++ b/doxygen/PKGBUILD @@ -9,12 +9,13 @@ pkgbase=doxygen #pkgname=('doxygen' 'doxygen-docs') pkgname=doxygen pkgver=1.11.0 -pkgrel=01 +pkgrel=02 pkgdesc='Documentation system for C++, C, Java, IDL and PHP' url='http://www.doxygen.nl' makedepends=(clang cmake flex fmt gcc-libs ghostscript glibc graphviz llvm python qt6-base spdlog sqlite texlive-fontsrecommended texlive-fontutils texlive-latexextra texlive-plaingeneric) -source=(${pkgname}-${pkgver}.tar.gz::https://github.com/doxygen/doxygen/archive/Release_${pkgver//./_}.tar.gz) +source=(${pkgname}-${pkgver}.tar.gz::https://github.com/doxygen/doxygen/archive/Release_${pkgver//./_}.tar.gz + 10891-fix-buffer-overflow.patch) _pick() { local p="$1" f d; shift @@ -31,6 +32,9 @@ prepare() { # Install the man pages in the right place sed -i 's:DESTINATION man/man1:DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1":g' \ doc/CMakeLists.txt + + # Fix buffer overflow in Markdown parser https://github.com/doxygen/doxygen/pull/10891 + patch -Np1 -i ../10891-fix-buffer-overflow.patch } build() { @@ -89,9 +93,12 @@ arch=(x86_64) license=(GPL-2.0-or-later) -sha512sums=('68ab2c8cf570216a7e917f686ec79361179cdc9868966fcc2722ebab49032e2bc9ac60192f101793f978ad2d7236d83c461ab4d2477f7704cf32a003b87311fb') -b2sums=('e98254aeec8ea7cedf6ec537e3d82cb898f55d435b95e58108c433f920432789fb7feba290b9a365f90ee56eec9120376b18ff26e31b1e4219b8f89f351daa8f') -sha256sums=(1fea49c69e51fec3dd2599947f6d48d9b1268bd5115b1bb08dffefc1fd5d19ee) # doxygen-1.11.0.tar.gz +sha512sums=('68ab2c8cf570216a7e917f686ec79361179cdc9868966fcc2722ebab49032e2bc9ac60192f101793f978ad2d7236d83c461ab4d2477f7704cf32a003b87311fb' + '58fa168b709a5371db8fcaea4fff39809b4e81088f960d719ae05124f8fa8f574f5edc268e16cf5c3e5f5393251e467a163c9e99b1a7c719ba9b0e59a1b69518') +b2sums=('e98254aeec8ea7cedf6ec537e3d82cb898f55d435b95e58108c433f920432789fb7feba290b9a365f90ee56eec9120376b18ff26e31b1e4219b8f89f351daa8f' + 'c85889d6166c213b244134b668932aad8a879671e52be9e832926780a0216fbee66be331b62a84b994311c1d87bbba10c906acf1e436840fa540750e471229b5') +sha256sums=(1fea49c69e51fec3dd2599947f6d48d9b1268bd5115b1bb08dffefc1fd5d19ee # doxygen-1.11.0.tar.gz + acd9941c658444cee91b3ce30519bce6b1fd1c0db71999b7172bfd788f5a6c98) # 10891-fix-buffer-overflow.patch -## 976a85a6ac36ed3dd43fd1aa5c0ed7a2c96808e48445191967d5db788e5b3779 doxygen-1.11.0-01-x86_64.pkg.tar.lz +## 5c0d300e30c4bde919aab8f57bd30368ed155573ef00663a28f0bc3d8b4e13ad doxygen-1.11.0-02-x86_64.pkg.tar.lz diff --git a/doxygen/PKGBUILD-arch b/doxygen/PKGBUILD-arch index c428229..ebe2847 100644 --- a/doxygen/PKGBUILD-arch +++ b/doxygen/PKGBUILD-arch @@ -5,7 +5,7 @@ pkgbase=doxygen pkgname=(doxygen doxygen-docs) pkgver=1.11.0 -pkgrel=1 +pkgrel=2 pkgdesc='Documentation system for C++, C, Java, IDL and PHP' url='http://www.doxygen.nl' arch=(x86_64) @@ -29,9 +29,12 @@ makedepends=( texlive-latexextra texlive-plaingeneric ) -source=(${pkgbase}-${pkgver}.tar.gz::https://github.com/doxygen/doxygen/archive/Release_${pkgver//./_}.tar.gz) -sha512sums=('68ab2c8cf570216a7e917f686ec79361179cdc9868966fcc2722ebab49032e2bc9ac60192f101793f978ad2d7236d83c461ab4d2477f7704cf32a003b87311fb') -b2sums=('e98254aeec8ea7cedf6ec537e3d82cb898f55d435b95e58108c433f920432789fb7feba290b9a365f90ee56eec9120376b18ff26e31b1e4219b8f89f351daa8f') +source=(${pkgbase}-${pkgver}.tar.gz::https://github.com/doxygen/doxygen/archive/Release_${pkgver//./_}.tar.gz + 10891-fix-buffer-overflow.patch) +sha512sums=('68ab2c8cf570216a7e917f686ec79361179cdc9868966fcc2722ebab49032e2bc9ac60192f101793f978ad2d7236d83c461ab4d2477f7704cf32a003b87311fb' + '58fa168b709a5371db8fcaea4fff39809b4e81088f960d719ae05124f8fa8f574f5edc268e16cf5c3e5f5393251e467a163c9e99b1a7c719ba9b0e59a1b69518') +b2sums=('e98254aeec8ea7cedf6ec537e3d82cb898f55d435b95e58108c433f920432789fb7feba290b9a365f90ee56eec9120376b18ff26e31b1e4219b8f89f351daa8f' + 'c85889d6166c213b244134b668932aad8a879671e52be9e832926780a0216fbee66be331b62a84b994311c1d87bbba10c906acf1e436840fa540750e471229b5') _pick() { local p="$1" f d; shift @@ -48,6 +51,9 @@ prepare() { # Install the man pages in the right place sed -i 's:DESTINATION man/man1:DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1":g' \ doc/CMakeLists.txt + + # Fix buffer overflow in Markdown parser https://github.com/doxygen/doxygen/pull/10891 + patch -Np1 -i ../10891-fix-buffer-overflow.patch } build() { diff --git a/libvirt/PKGBUILD b/libvirt/PKGBUILD index 9f2d0f7..5a84721 100644 --- a/libvirt/PKGBUILD +++ b/libvirt/PKGBUILD @@ -23,7 +23,8 @@ optdepends=('libvirt-storage-rbd: RBD storage backend' 'dnsmasq: required for default NAT/DHCP for guests' 'iptables-nft: required for default NAT networking' 'qemu: QEMU/KVM support' - 'lvm2: Logical Volume Manager support') + 'lvm2: Logical Volume Manager support' + 'libnbd-light: Lighter version of libnbd') backup=( 'etc/libvirt/libvirt-admin.conf' 'etc/libvirt/libvirt.conf' @@ -222,10 +223,9 @@ sha256sums=(2af5a50b6b1027822b6344e35080fa78cc8266f821a3ae6f8f372f18dd049018 # 6dc7907d6d4d883ac5ea15c195af673c97cff13f4c0493d23196e94bc87f04db # libvirt.sysusers 465a3e535cdc5549beaf82b41f53b27d5352aab1313277fd0c2f33004d0d59ba) # libvirt.tmpfiles -## + ## ## Connecting to download.libvirt.org (download.libvirt.org)|91.121.203.120|:443... connected. ## ERROR: The certificate of ‘download.libvirt.org’ is not trusted. ## ERROR: The certificate of ‘download.libvirt.org’ has expired. ## -## diff --git a/libvirt/deps b/libvirt/deps index 3faf63a..ac5f3fb 100644 --- a/libvirt/deps +++ b/libvirt/deps @@ -13,7 +13,7 @@ bash-completion dnsmasq gettext qemu-base -libnbd +libnbd-light dbus diff --git a/mpv/PKGBUILD b/mpv/PKGBUILD index 04c3d63..943aed6 100644 --- a/mpv/PKGBUILD +++ b/mpv/PKGBUILD @@ -8,7 +8,7 @@ pkgname=mpv epoch=1 pkgver=0.38.0 -pkgrel=02 +pkgrel=05 pkgdesc='a free, open source, and cross-platform media player - alsa no-pipew' url='https://mpv.io/' depends=('alsa-lib' 'libasound.so' 'desktop-file-utils' 'ffmpeg' 'libavcodec.so' 'libavdevice.so' @@ -32,7 +32,19 @@ options=('!emptydirs') #install=mpv.install #_tag='807b9343ef911d138950411cdb83c16a151d2018' # git rev-parse v${pkgver} #source=("git+https://github.com/mpv-player/mpv.git#tag=${_tag}?signed") -source=("git+https://github.com/mpv-player/mpv.git#tag=v${pkgver}?signed") +source=("git+https://github.com/mpv-player/mpv.git#tag=v${pkgver}?signed" + "dynamically_generate_desktop_file_protocols.patch") + +prepare() { + cd "${pkgname}" + # Patch to dynamically generate protocols in the mpv.desktop file + # Taken from https://github.com/mpv-player/mpv/pull/14145 + # Fixes: + # - https://github.com/mpv-player/mpv/issues/8731 + # - https://github.com/mpv-player/mpv/issues/14124 + # - https://gitlab.archlinux.org/archlinux/packaging/packages/mpv/-/issues/10 + patch -Np1 < "${srcdir}/dynamically_generate_desktop_file_protocols.patch" +} build() { local _meson_options=( @@ -82,12 +94,12 @@ validpgpkeys=('145077D82501AA20152CACCE8D769208D5E31419') # sfan5 # not to be used with git # # only with signed releases -sha256sums=(b37b91d0ae4518594b22338ebe979f13bdc56b6fa26d589e5c3f7b96a31bab3d) # mpv +sha256sums=(b37b91d0ae4518594b22338ebe979f13bdc56b6fa26d589e5c3f7b96a31bab3d # mpv + 88acf97cbc8e0fe745f09bd0bd7f65e0437adcb549dadf3588fd0724d01298e9) # dynamically_generate_desktop_file_protocols.patch # Note to packager: #ls -l *pkg.tar.lz #echo "you must rename this package to meet SF naming before you move to the repo" #mv $(ls -l $pkgname*pkg.tar.lz) $pkgname-$epoch_$pkgver-$pkgrel-$arch.pkg.tar.lz >pkg-mv.log -## e2d193cd5ce310ccc83a740e8a066ce822c5f3ac576653bc345f9dab51ff074b mpv-1:0.38.0-02-x86_64.pkg.tar.lz - +## 5b2d756a0253b34c303eaf03d2690c8c57f3e423d919a7a5305646465cb0d751 mpv-1_0.38.0-05-x86_64.pkg.tar.lz diff --git a/mpv/PKGBUILD-arch b/mpv/PKGBUILD-arch index 7546b8d..565d0c9 100644 --- a/mpv/PKGBUILD-arch +++ b/mpv/PKGBUILD-arch @@ -6,7 +6,7 @@ pkgname=mpv epoch=1 pkgver=0.38.0 -pkgrel=2 +pkgrel=5 pkgdesc='a free, open source, and cross-platform media player' arch=('x86_64') license=('GPL-2.0-or-later AND LGPL-2.1-or-later') @@ -23,13 +23,25 @@ depends=('alsa-lib' 'libasound.so' 'desktop-file-utils' 'ffmpeg' 'libavcodec.so' 'openal' 'uchardet' 'vapoursynth' 'vulkan-icd-loader' 'wayland' 'zlib') makedepends=('git' 'meson' 'python-docutils' 'ladspa' 'wayland-protocols' 'ffnvcodec-headers' 'vulkan-headers') -optdepends=('yt-dlp: for video-sharing websites playback' - 'youtube-dl: for video-sharing websites playback') +optdepends=('yt-dlp: for video-sharing websites playback') provides=('libmpv.so') options=('!emptydirs') validpgpkeys=('145077D82501AA20152CACCE8D769208D5E31419') # sfan5 -source=("git+https://github.com/mpv-player/mpv.git#tag=v${pkgver}?signed") -sha256sums=('b37b91d0ae4518594b22338ebe979f13bdc56b6fa26d589e5c3f7b96a31bab3d') +source=("git+https://github.com/mpv-player/mpv.git#tag=v${pkgver}?signed" + "dynamically_generate_desktop_file_protocols.patch") +sha256sums=('b37b91d0ae4518594b22338ebe979f13bdc56b6fa26d589e5c3f7b96a31bab3d' + '88acf97cbc8e0fe745f09bd0bd7f65e0437adcb549dadf3588fd0724d01298e9') + +prepare() { + cd "${pkgname}" + # Patch to dynamically generate protocols in the mpv.desktop file + # Taken from https://github.com/mpv-player/mpv/pull/14145 + # Fixes: + # - https://github.com/mpv-player/mpv/issues/8731 + # - https://github.com/mpv-player/mpv/issues/14124 + # - https://gitlab.archlinux.org/archlinux/packaging/packages/mpv/-/issues/10 + patch -Np1 < "${srcdir}/dynamically_generate_desktop_file_protocols.patch" +} build() { local _meson_options=( diff --git a/mpv/dynamically_generate_desktop_file_protocols.patch b/mpv/dynamically_generate_desktop_file_protocols.patch new file mode 100644 index 0000000..33320e1 --- /dev/null +++ b/mpv/dynamically_generate_desktop_file_protocols.patch @@ -0,0 +1,462 @@ +From f59d358752c2a63c94635511cd963bebb2706d64 Mon Sep 17 00:00:00 2001 +From: Dudemanguy +Date: Wed, 15 May 2024 09:03:14 -0500 +Subject: [PATCH 1/4] av_common: parent mp_get_lavf_demuxer contents to the + list + +The only usage of this function is freed in mpv's generic property code, +so no other changes are needed. +--- + common/av_common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/common/av_common.c b/common/av_common.c +index 1a23d766b365..142699d4b4c6 100644 +--- a/common/av_common.c ++++ b/common/av_common.c +@@ -265,7 +265,7 @@ char **mp_get_lavf_demuxers(void) + const AVInputFormat *cur = av_demuxer_iterate(&iter); + if (!cur) + break; +- MP_TARRAY_APPEND(NULL, list, num, talloc_strdup(NULL, cur->name)); ++ MP_TARRAY_APPEND(NULL, list, num, talloc_strdup(list, cur->name)); + } + MP_TARRAY_APPEND(NULL, list, num, NULL); + return list; + +From 6692f87b61d48e1523d6e0ef3d311ffff6e89a6e Mon Sep 17 00:00:00 2001 +From: Dudemanguy +Date: Wed, 15 May 2024 19:22:32 -0500 +Subject: [PATCH 2/4] stream: implement get_protocols method for stream_lavf + +Previously, all stream protocols were a static list in mpv. This is okay +for own builtin stuff, but for protocols that depend on ffmpeg it's not +so great. Support for certain protocols may or may not be enabled in a +user's ffmpeg and the protocol list that mpv generates should ideally +match this. Fix this by implementing a get_protocols method for +stream_lavf that will have different results depending on the ffmpeg mpv +is built against. We keep the safe and unsafe protocols separation. The +former is essentially a whitelist. Any protocol that is found in ffmpeg +but is not in the safe whitelist is considered unsafe. In the stream +list, ffmpeg is moved to the bottom so any possible protocols that are +added in the future don't automatically take precedence over any builtin +mpv ones. +--- + common/av_common.c | 12 +++++ + common/av_common.h | 1 + + stream/stream.c | 44 ++++++++++++------- + stream/stream.h | 2 + + stream/stream_lavf.c | 102 ++++++++++++++++++++++++++++++++++++++----- + 5 files changed, 136 insertions(+), 25 deletions(-) + +diff --git a/common/av_common.c b/common/av_common.c +index 142699d4b4c6..a4fa5981ff9f 100644 +--- a/common/av_common.c ++++ b/common/av_common.c +@@ -271,6 +271,18 @@ char **mp_get_lavf_demuxers(void) + return list; + } + ++char **mp_get_lavf_protocols(void) ++{ ++ char **list = NULL; ++ int num = 0; ++ void *opaque = NULL; ++ const char *name; ++ while ((name = avio_enum_protocols(&opaque, 0))) ++ MP_TARRAY_APPEND(NULL, list, num, talloc_strdup(list, name)); ++ MP_TARRAY_APPEND(NULL, list, num, NULL); ++ return list; ++} ++ + int mp_codec_to_av_codec_id(const char *codec) + { + int id = AV_CODEC_ID_NONE; +diff --git a/common/av_common.h b/common/av_common.h +index c584085890c2..b019aa88e17a 100644 +--- a/common/av_common.h ++++ b/common/av_common.h +@@ -42,6 +42,7 @@ void mp_set_avcodec_threads(struct mp_log *l, AVCodecContext *avctx, int threads + void mp_add_lavc_decoders(struct mp_decoder_list *list, enum AVMediaType type); + void mp_add_lavc_encoders(struct mp_decoder_list *list); + char **mp_get_lavf_demuxers(void); ++char **mp_get_lavf_protocols(void); + int mp_codec_to_av_codec_id(const char *codec); + const char *mp_codec_from_av_codec_id(int codec_id); + bool mp_codec_is_lossless(const char *codec); +diff --git a/stream/stream.c b/stream/stream.c +index 06dd92930c01..eca44e4afb37 100644 +--- a/stream/stream.c ++++ b/stream/stream.c +@@ -66,8 +66,6 @@ static const stream_info_t *const stream_list[] = { + #if HAVE_CDDA + &stream_info_cdda, + #endif +- &stream_info_ffmpeg, +- &stream_info_ffmpeg_unsafe, + &stream_info_avdevice, + #if HAVE_DVBIN + &stream_info_dvb, +@@ -92,6 +90,8 @@ static const stream_info_t *const stream_list[] = { + &stream_info_slice, + &stream_info_fd, + &stream_info_cb, ++ &stream_info_ffmpeg, ++ &stream_info_ffmpeg_unsafe, + }; + + // Because of guarantees documented on STREAM_BUFFER_SIZE. +@@ -325,12 +325,17 @@ static int stream_create_instance(const stream_info_t *sinfo, + if (!sinfo->local_fs) + return STREAM_NO_MATCH; + } else { +- for (int n = 0; sinfo->protocols && sinfo->protocols[n]; n++) { +- path = match_proto(url, sinfo->protocols[n]); ++ char **get_protocols = sinfo->get_protocols ? sinfo->get_protocols() : NULL; ++ char **protocols = get_protocols ? get_protocols : (char **)sinfo->protocols; ++ ++ for (int n = 0; protocols && protocols[n]; n++) { ++ path = match_proto(url, protocols[n]); + if (path) + break; + } + ++ talloc_free(get_protocols); ++ + if (!path) + return STREAM_NO_MATCH; + } +@@ -864,16 +869,17 @@ char **stream_get_proto_list(void) + for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) { + const stream_info_t *stream_info = stream_list[i]; + +- if (!stream_info->protocols) +- continue; ++ char **get_protocols = stream_info->get_protocols ? stream_info->get_protocols() : NULL; ++ char **protocols = get_protocols ? get_protocols : (char **)stream_info->protocols; + +- for (int j = 0; stream_info->protocols[j]; j++) { +- if (*stream_info->protocols[j] == '\0') +- continue; ++ for (int j = 0; protocols && protocols[j]; j++) { ++ if (*protocols[j] == '\0') ++ continue; + +- MP_TARRAY_APPEND(NULL, list, num, +- talloc_strdup(NULL, stream_info->protocols[j])); ++ MP_TARRAY_APPEND(NULL, list, num, talloc_strdup(list, protocols[j])); + } ++ ++ talloc_free(get_protocols); + } + MP_TARRAY_APPEND(NULL, list, num, NULL); + return list; +@@ -888,7 +894,6 @@ void stream_print_proto_list(struct mp_log *log) + for (int i = 0; list[i]; i++) { + mp_info(log, " %s://\n", list[i]); + count++; +- talloc_free(list[i]); + } + talloc_free(list); + mp_info(log, "\nTotal: %d protocols\n", count); +@@ -899,10 +904,19 @@ bool stream_has_proto(const char *proto) + for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) { + const stream_info_t *stream_info = stream_list[i]; + +- for (int j = 0; stream_info->protocols && stream_info->protocols[j]; j++) { +- if (strcmp(stream_info->protocols[j], proto) == 0) +- return true; ++ bool match = false; ++ char **get_protocols = stream_info->get_protocols ? stream_info->get_protocols() : NULL; ++ char **protocols = get_protocols ? get_protocols : (char **)stream_info->protocols; ++ ++ for (int j = 0; protocols && protocols[j]; j++) { ++ if (strcmp(protocols[j], proto) == 0) { ++ match = true; ++ break; ++ } + } ++ ++ talloc_free(get_protocols); ++ return match; + } + + return false; +diff --git a/stream/stream.h b/stream/stream.h +index 58b55e1a43ca..866affe1fef0 100644 +--- a/stream/stream.h ++++ b/stream/stream.h +@@ -114,6 +114,8 @@ typedef struct stream_info_st { + // Alternative to open(). Only either open() or open2() can be set. + int (*open2)(struct stream *st, const struct stream_open_args *args); + const char *const *protocols; ++ // Alternative to protocols. For stream_lavf. ++ char **(*get_protocols)(void); + bool can_write; // correctly checks for READ/WRITE modes + bool local_fs; // supports STREAM_LOCAL_FS_ONLY + int stream_origin; // 0 or set of STREAM_ORIGIN_*; if 0, the same origin +diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c +index a2db55146668..30c823c58f62 100644 +--- a/stream/stream_lavf.c ++++ b/stream/stream_lavf.c +@@ -238,6 +238,96 @@ void mp_setup_av_network_options(AVDictionary **dict, const char *target_fmt, + talloc_free(temp); + } + ++#define PROTO(...) (const char *[]){__VA_ARGS__, NULL} ++ ++// List of safe protocols and their aliases ++static const char **safe_protos[] = { ++ PROTO("data"), ++ PROTO("gopher"), ++ PROTO("gophers"), ++ PROTO("http", "dav", "webdav"), ++ PROTO("httpproxy"), ++ PROTO("https", "davs", "webdavs"), ++ PROTO("ipfs"), ++ PROTO("ipns"), ++ PROTO("mmsh", "mms", "mmshttp"), ++ PROTO("mmst"), ++ PROTO("rist"), ++ PROTO("rtmp"), ++ PROTO("rtmpe"), ++ PROTO("rtmps"), ++ PROTO("rtmpt"), ++ PROTO("rtmpte"), ++ PROTO("rtmpts"), ++ PROTO("rtp"), ++ PROTO("srt"), ++ PROTO("srtp"), ++ NULL, ++}; ++ ++static char **get_safe_protocols(void) ++{ ++ int num = 0; ++ char **protocols = NULL; ++ char **ffmpeg_demuxers = mp_get_lavf_demuxers(); ++ char **ffmpeg_protos = mp_get_lavf_protocols(); ++ ++ for (int i = 0; ffmpeg_protos[i]; i++) { ++ for (int j = 0; safe_protos[j]; j++) { ++ if (strcmp(ffmpeg_protos[i], safe_protos[j][0]) != 0) ++ continue; ++ for (int k = 0; safe_protos[j][k]; k++) ++ MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, safe_protos[j][k])); ++ break; ++ } ++ } ++ ++ // rtsp is a demuxer not protocol in ffmpeg so it is handled separately ++ for (int i = 0; ffmpeg_demuxers[i]; i++) { ++ if (strcmp("rtsp", ffmpeg_demuxers[i]) == 0) { ++ MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, "rtsp")); ++ MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, "rtsps")); ++ break; ++ } ++ } ++ ++ MP_TARRAY_APPEND(NULL, protocols, num, NULL); ++ ++ talloc_free(ffmpeg_demuxers); ++ talloc_free(ffmpeg_protos); ++ ++ return protocols; ++} ++ ++static char **get_unsafe_protocols(void) ++{ ++ int num = 0; ++ char **protocols = NULL; ++ char **safe_protocols = get_safe_protocols(); ++ char **ffmpeg_protos = mp_get_lavf_protocols(); ++ ++ for (int i = 0; ffmpeg_protos[i]; i++) { ++ bool safe_protocol = false; ++ for (int j = 0; safe_protocols[j]; j++) { ++ if (strcmp(ffmpeg_protos[i], safe_protocols[j]) == 0) { ++ safe_protocol = true; ++ break; ++ } ++ } ++ if (!safe_protocol) ++ MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, ffmpeg_protos[i])); ++ } ++ ++ MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, "ffmpeg")); ++ MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, "lavf")); ++ ++ MP_TARRAY_APPEND(NULL, protocols, num, NULL); ++ ++ talloc_free(ffmpeg_protos); ++ talloc_free(safe_protocols); ++ return protocols; ++} ++ + // Escape http URLs with unescaped, invalid characters in them. + // libavformat's http protocol does not do this, and a patch to add this + // in a 100% safe case (spaces only) was rejected. +@@ -431,12 +431,7 @@ done: + const stream_info_t stream_info_ffmpeg = { + .name = "ffmpeg", + .open = open_f, +- .protocols = (const char *const[]){ +- "rtmp", "rtsp", "rtsps", "http", "https", "mms", "mmst", "mmsh", "mmshttp", +- "rtp", "httpproxy", "rtmpe", "rtmps", "rtmpt", "rtmpte", "rtmpts", "srt", +- "rist", "srtp", "gopher", "gophers", "data", "ipfs", "ipns", "dav", +- "davs", "webdav", "webdavs", +- NULL }, ++ .get_protocols = get_safe_protocols, + .can_write = true, + .stream_origin = STREAM_ORIGIN_NET, + }; +@@ -448,10 +443,7 @@ const stream_info_t stream_info_ffmpeg = { + const stream_info_t stream_info_ffmpeg_unsafe = { + .name = "ffmpeg", + .open = open_f, +- .protocols = (const char *const[]){ +- "lavf", "ffmpeg", "udp", "ftp", "tcp", "tls", "unix", "sftp", "md5", +- "concat", "smb", +- NULL }, ++ .get_protocols = get_unsafe_protocols, + .stream_origin = STREAM_ORIGIN_UNSAFE, + .can_write = true, + }; + +From 0f4fa329357f27d0c57f8f13b426d7450a29cfa4 Mon Sep 17 00:00:00 2001 +From: Dudemanguy +Date: Tue, 14 May 2024 13:32:18 -0500 +Subject: [PATCH 3/4] build: dynamically generate mpv.desktop file protocols + +If we can run the built mpv binary, then it is possible to use a custom +target that reads the protocols we have available in mpv and write the +mpv.desktop file based on the output. For cases where this is not +possible (e.g. cross compiling), then just install the unmodified +mpv.desktop file like before. Fixes #8731 and fixes #14124. +--- + TOOLS/gen-mpv-desktop.py | 45 ++++++++++++++++++++++++++++++++++++++++ + meson.build | 17 ++++++++++++++- + 2 files changed, 61 insertions(+), 1 deletion(-) + create mode 100755 TOOLS/gen-mpv-desktop.py + +diff --git a/TOOLS/gen-mpv-desktop.py b/TOOLS/gen-mpv-desktop.py +new file mode 100755 +index 000000000000..2b05de1ec4cc +--- /dev/null ++++ b/TOOLS/gen-mpv-desktop.py +@@ -0,0 +1,45 @@ ++#!/usr/bin/env python3 ++ ++# Modify X-KDE-Protocols in the mpv.desktop file based on output from ++# mpv --list-protocols. ++ ++# ++# This file is part of mpv. ++# ++# mpv is free software; you can redistribute it and/or ++# modify it under the terms of the GNU Lesser General Public ++# License as published by the Free Software Foundation; either ++# version 2.1 of the License, or (at your option) any later version. ++# ++# mpv is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU Lesser General Public License for more details. ++# ++# You should have received a copy of the GNU Lesser General Public ++# License along with mpv. If not, see . ++# ++ ++import sys ++from subprocess import check_output ++ ++if __name__ == "__main__": ++ with open(sys.argv[1], "r", encoding="UTF-8") as f: ++ next(f) ++ mpv_desktop = dict([line.split("=", 1) for line in f]) ++ ++ if not mpv_desktop["X-KDE-Protocols"]: ++ raise ValueError("Missing X-KDE-Protocols entry in mpv.desktop file") ++ ++ mpv_protocols = check_output([sys.argv[2], "--list-protocols"], encoding="UTF-8") ++ mpv_protocols = set(line.strip(" :/") for line in mpv_protocols.splitlines() if "://" in line) ++ if len(mpv_protocols) == 0: ++ raise ValueError("Unable to parse any protocols from mpv '--list-protocols'") ++ ++ protocol_list = set(mpv_desktop["X-KDE-Protocols"].strip().split(",")) ++ mpv_desktop["X-KDE-Protocols"] = ",".join(sorted(mpv_protocols & protocol_list)) + "\n" ++ ++ with open(sys.argv[3], "w", encoding="UTF-8") as f: ++ f.write("[Desktop Entry]" + "\n") ++ for key, value in mpv_desktop.items(): ++ f.write(f"{key}={value}") +diff --git a/meson.build b/meson.build +index c14bf47d5614..ae1eb9cfd903 100644 +--- a/meson.build ++++ b/meson.build +@@ -581,6 +581,7 @@ tools_directory = join_paths(source_root, 'TOOLS') + docutils_wrapper = find_program(join_paths(tools_directory, 'docutils-wrapper.py')) + file2string = find_program(join_paths(tools_directory, 'file2string.py')) + matroska = find_program(join_paths(tools_directory, 'matroska.py')) ++mpv_desktop = find_program(join_paths(tools_directory, 'gen-mpv-desktop.py')) + + ebml_defs = custom_target('ebml_defs.inc', + output: 'ebml_defs.inc', +@@ -1796,7 +1797,6 @@ if get_option('cplayer') + zsh_install_dir = join_paths(datadir, 'zsh', 'site-functions') + install_data('etc/_mpv.zsh', install_dir: zsh_install_dir, rename: '_mpv') + +- install_data('etc/mpv.desktop', install_dir: join_paths(datadir, 'applications')) + install_data('etc/mpv.metainfo.xml', install_dir: join_paths(datadir, 'metainfo')) + install_data('etc/encoding-profiles.conf', install_dir: join_paths(confdir, 'mpv')) + +@@ -1827,6 +1827,21 @@ if get_option('cplayer') + command: [osxbundle, mpv.full_path(), '@SOURCE_ROOT@'], + ) + endif ++ ++ if not win32 and not darwin ++ if meson.can_run_host_binaries() ++ mpv_desktop_path = join_paths(source_root, 'etc', 'mpv.desktop') ++ custom_target('mpv.desktop', ++ depends: mpv, ++ output: 'mpv.desktop', ++ command: [mpv_desktop, mpv_desktop_path, mpv.full_path(), '@OUTPUT@'], ++ install: true, ++ install_dir: join_paths(datadir, 'applications'), ++ ) ++ else ++ install_data('etc/mpv.desktop', install_dir: join_paths(datadir, 'applications')) ++ endif ++ endif + endif + + if get_option('tests') + +From 00506d51892c48cd91d3c88423f31df7b9328499 Mon Sep 17 00:00:00 2001 +From: Dudemanguy +Date: Wed, 22 May 2024 10:27:40 -0500 +Subject: [PATCH 4/4] stream_lavf: don't add ffmpeg bluray or dvd protocols + +The naming of these conflict with existing mpv protocols, so skip if we +get them. Users can still use them via lavf://bluray: or lavf://dvd: if +they wish. +--- + stream/stream_lavf.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c +index 30c823c58f62..369f9cecc402 100644 +--- a/stream/stream_lavf.c ++++ b/stream/stream_lavf.c +@@ -314,6 +314,10 @@ static char **get_unsafe_protocols(void) + break; + } + } ++ // Skip to avoid name conflict with builtin mpv protocol. ++ if (strcmp(ffmpeg_protos[i], "bluray") == 0 || strcmp(ffmpeg_protos[i], "dvd") == 0) ++ continue; ++ + if (!safe_protocol) + MP_TARRAY_APPEND(NULL, protocols, num, talloc_strdup(protocols, ffmpeg_protos[i])); + }