mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-29 11:38:52 +02:00
165 lines
5.3 KiB
Bash
165 lines
5.3 KiB
Bash
SUMMARY="A command-line program to download videos from various sites"
|
|
DESCRIPTION="A fork of youtube-dl with additional features and fixes. \
|
|
The program is usually invoked as youtube-dl followed by \
|
|
options and the video URL. Run 'yt-dlp --help' and get a summary \
|
|
of all options.
|
|
|
|
As of October/November of 2025, to be able to download from YouTube, yt-dlp \
|
|
requires a Javascript engine. Of the ones it supports, only a couple are available \
|
|
on Haiku at the moment (and only one on x86_32 bits: \"quickjs\").
|
|
|
|
So, for that use case, you'll need to:
|
|
|
|
* Install either the \"quickjs\" or \"node\" packages:
|
|
\"> pkgman install cmd:qjs\" or \"> pkgman install cmd:node\"
|
|
|
|
* Let yt-dlp know which one to use, for example:
|
|
\"> yt-dlp --js-runtime quickjs <youtube_url>\"
|
|
|
|
Note: you might also need to pass appropiate cookies (with \"--cookies-from-browser firefox\" \
|
|
and/or, \"--cookies <cookies_filename.txt>\". Consult the documentation for more details."
|
|
HOMEPAGE="https://github.com/yt-dlp/yt-dlp"
|
|
COPYRIGHT="2006-2026 youtube-dl and yt-dlp contributors"
|
|
LICENSE="Unlicense"
|
|
REVISION="1"
|
|
SOURCE_URI="https://github.com/yt-dlp/yt-dlp/releases/download/$portVersion/yt-dlp.tar.gz"
|
|
SOURCE_FILENAME="yt-dlp-$portVersion.tar.gz"
|
|
CHECKSUM_SHA256="c74f56fc88a7f9b7c995646f30538974a03dd7609f55257b20594fdeeb1e13df"
|
|
# This is needed if we need/want to avoid re-building the zimport/standalone yt-dlp:
|
|
# SOURCE_URI_2="https://github.com/yt-dlp/yt-dlp/releases/download/$portVersion/yt-dlp#noarchive"
|
|
# CHECKSUM_SHA256_2="aed043cabf6b352dfd5438afff595e31532538d5af7c8f4f95ced1e6f1b35c2a"
|
|
SOURCE_DIR="yt-dlp"
|
|
|
|
ARCHITECTURES="any"
|
|
|
|
pythonVersion=3.10
|
|
pythonPackage=python${pythonVersion//.}
|
|
|
|
PROVIDES="
|
|
yt_dlp = $portVersion
|
|
cmd:yt_dlp = $portVersion
|
|
"
|
|
# For cmd:yt_dlp, we require a bit more than the strict minimal dependencies,
|
|
# just to make the life of end users a bit simpler.
|
|
REQUIRES="
|
|
haiku
|
|
ffmpeg6_tools # should be: cmd:ffmpeg/cmd:ffprobe instead (optional, but pretty much needed)
|
|
# cmd:qjs # (or cmd:node) needed to download from YT.
|
|
cmd:python$pythonVersion
|
|
# These are listed as optional dependencies in yt_dlp's pyproject.toml:
|
|
# brotli_$pythonPackage
|
|
# certifi_$pythonPackage
|
|
# mutagen_$pythonPackage
|
|
# pycryptodomex_$pythonPackage
|
|
requests_$pythonPackage # >=2.32.2,<3 (needed if using https proxies)
|
|
# urllib3_$pythonPackage # >=2.0.2,<3
|
|
# websockets_$pythonPackage # >=13.0
|
|
# yt_dlp_ejs_$pythonPackage # ==0.3.1. Already included on the "standalone" (zipimport) yt_dlp.
|
|
"
|
|
|
|
# Allows using dot in sub-package names (eg: "_python3.10" vs "_python310"):
|
|
eval "PACKAGE_NAME_$pythonPackage=\"${portName}_python$pythonVersion\""
|
|
|
|
eval "SUMMARY_$pythonPackage=\"The yt-dlp Python module"\"
|
|
|
|
eval "DESCRIPTION_$pythonPackage=\"This package contains yt-dlp, as a Python module, \
|
|
for use by programmers or scripts that might require it.
|
|
|
|
This package does not contains the yt-dlp command line utility, and only has a minimal \
|
|
set of dependencies.
|
|
|
|
For regular yt-dlp usage, see/install the 'yt_dlp' package instead.
|
|
\""
|
|
|
|
eval "PROVIDES_$pythonPackage=\"
|
|
${portName}_python$pythonVersion = $portVersion
|
|
\""
|
|
# Only require hard dependencies for the python module.
|
|
# People using this should be able to install optional deps as needed.
|
|
eval "REQUIRES_$pythonPackage=\"
|
|
haiku
|
|
cmd:python$pythonVersion
|
|
\""
|
|
|
|
|
|
BUILD_REQUIRES="
|
|
haiku_devel
|
|
build_$pythonPackage
|
|
hatchling_$pythonPackage
|
|
installer_$pythonPackage
|
|
"
|
|
BUILD_PREREQUIRES="
|
|
cmd:find
|
|
cmd:make
|
|
cmd:python$pythonVersion
|
|
cmd:zip
|
|
"
|
|
TEST_REQUIRES="
|
|
pytest_$pythonPackage
|
|
"
|
|
|
|
PATCH()
|
|
{
|
|
# not strictly required, but speeds up repeated builds a bit.
|
|
sed -i -e 's|-m pip |-m pip --disable-pip-version-check |' Makefile
|
|
}
|
|
|
|
BUILD()
|
|
{
|
|
# Build the .whl we'll use to install the Python module.
|
|
python$pythonVersion -m build --wheel --skip-dependency-check --no-isolation
|
|
|
|
# We have two choices: either use the zimport/standalone yt-dlp from upstream release
|
|
# or re-build it ourselves (the one from the release tarball is not good, as it doesn't
|
|
# contains the "ejs" code).
|
|
|
|
# Method 1: rebuild yt-dlp from release tarball code.
|
|
# (needs pip to download ejs code, but it *does* enforces known hashes).
|
|
python$pythonVersion -m ensurepip --default-pip
|
|
make yt-dlp-extra PREFIX="$prefix" MANDIR="$manDir" SHAREDIR="$dataDir" \
|
|
PYTHON="python$pythonVersion" BINDIR="$binDir"
|
|
|
|
# Method 2: use yt-dlp file from upstream releases. See INSTALL
|
|
}
|
|
|
|
INSTALL()
|
|
{
|
|
# First we install and package the Python module:
|
|
python$pythonVersion -m installer -p $prefix dist/*.whl
|
|
|
|
packageEntries $pythonPackage \
|
|
$prefix/lib/python*
|
|
|
|
# And on the base package:
|
|
|
|
# Note: we can't use "make install" here, because it overwrites yt-dlp with one without ejs.
|
|
# make install PREFIX="$prefix" MANDIR="$manDir" SHAREDIR="$dataDir" \
|
|
# PYTHON="python$pythonVersion" BINDIR="$binDir"
|
|
|
|
# "Method 2", replace yt-dlp from releast tarball with the "standalone" one:
|
|
# rm $binDir/yt-dlp
|
|
# cp $sourceDir2/yt-dlp $binDir/yt-dlp
|
|
# chmod +x $binDir/yt-dlp
|
|
|
|
# Install the command:
|
|
install -t $binDir yt-dlp
|
|
|
|
# Install shell completions:
|
|
mv $prefix/share/bash-completion $dataDir
|
|
mv $prefix/share/fish $dataDir
|
|
mv $prefix/share/zsh $dataDir
|
|
|
|
# Install man page and Readme:
|
|
mkdir -p $docDir $manDir
|
|
mv $prefix/share/man/man1 $manDir
|
|
mv $prefix/share/doc/yt_dlp/README.txt $docDir
|
|
|
|
# Remove left over cruft:
|
|
rm -rf $prefix/share
|
|
}
|
|
|
|
TEST()
|
|
{
|
|
pytest-$pythonVersion -v -m "not download"
|
|
}
|