Files
horizon-packages/srcpkgs/yt-dlp/template
T
2026-08-21 14:59:59 +02:00

58 lines
2.0 KiB
Bash

# Template file for 'yt-dlp'
pkgname=yt-dlp
version=2026.08.19
revision=1
# XXX: keep python3-yt-dlp-ejs in sync with pyproject.toml
_ejs_ver=0.8.0
build_style=python3-pep517
make_check_args="-k not((download)or(test_socks))"
hostmakedepends="hatchling"
depends="python3-Brotli python3-certifi python3-mutagen python3-pycryptodomex
python3-urllib3 python3-requests python3-websockets"
checkdepends="python3-pytest python3-pytest-rerunfailures ${depends}"
short_desc="CLI program to download videos from YouTube and other sites"
maintainer="classabbyamp <void@placeviolette.net>"
license="Unlicense"
homepage="https://github.com/yt-dlp/yt-dlp"
changelog="https://raw.githubusercontent.com/yt-dlp/yt-dlp/master/Changelog.md"
distfiles="https://github.com/yt-dlp/yt-dlp/releases/download/${version}/yt-dlp.tar.gz>yt-dlp-$version.tar.gz"
checksum=072aad4f2a7604e92155f61a275a4752dc64046c8f6d90df3710525d94cd37c1
replaces="python3-youtube-dl>=0"
if [ "$XBPS_WORDSIZE" -eq "$XBPS_TARGET_WORDSIZE" ]; then
# nodejs can only be built for this platform combination
depends+=" python3-yt-dlp-ejs>=${_ejs_ver}_1<=${_ejs_ver}_9999"
checkdepends+=" python3-yt-dlp-ejs"
fi
post_extract() {
if [ "$XBPS_WORDSIZE" -eq "$XBPS_TARGET_WORDSIZE" ]; then
_req_ejs="$(grep -o '"yt-dlp-ejs==.*"' "$wrksrc/pyproject.toml" | sed -e 's/^.*==\(.*\)"$/\1/' | head -1)"
if [ "$_ejs_ver" != "$_req_ejs" ]; then
msg_error "python3-yt-dlp-ejs version mismatch ($_ejs_ver != $_req_ejs): update python3-yt-dlp-ejs and \$_ejs_ver to match yt-dlp's pyproject.toml\n"
fi
fi
}
post_install() {
cat <<- "EOF" > youtube-dl
#!/bin/sh
exec yt-dlp --compat-options youtube-dl "$@"
EOF
vbin youtube-dl
}
youtube-dl_package() {
depends="${sourcepkg}>=${version}_${revision}"
short_desc+=" (transitional compatibility package)"
pkg_install() {
vmove usr/bin/youtube-dl
}
}
python3-youtube-dl_package() {
depends="${sourcepkg}>=${version}_${revision}"
short_desc+=" (transitional dummy package)"
metapackage=yes
}