aboutsummaryrefslogtreecommitdiff
path: root/network/yt-dlp/yt-dlp.SlackBuild
blob: dcac4acb1c569ec53df25560627c7e7496dac2aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash

# Slackware build script for yt-dlp

# Written by B. Watson (urchlay@slackware.uk)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# Note: I honestly prefer the standalone executable version of this,
# which I keep in ~/bin. It allows me to run "yt-dlp -U" as my user to
# get the latest version. However, since it's listed as a dependency
# for clipgrab, haruna, xdman, ytfzf, and an optional dependency for
# pipe-viewer, it has to exist on SBo.

# 20240802 bkw: updated for v2024.08.01.
# 20240711 bkw: updated for v2024.07.09.

# 20240313 bkw:
# - updated for v2024.03.10
# - build method changed (python3 -m build, rather than setup.py)
# - upstream managed to lose the man page, so include the man page
#   from the previous version (should be OK for now at least).
# - switch to github archive/ URL, since pythonhosted.org doesn't have
#   this version (yet?). filename still has the version number in it.

# 20240217 bkw: switched to pythonhosted.org source tarball, thanks
# to Jeremy Hansen for finding this. Filename now has the version
# number in it, so no more caching problems for the download. Build
# had to change slightly as there's no more CONTRIBUTING file.
# 20240216 bkw: updated for v2023.12.30
# 20231219 bkw: updated for v2023.11.16
# 20231031 bkw: updated for v2023.10.13
# 20230904 bkw: BUILD=2, silence complaints from 'pip3 check'
# 20230711 bkw: updated for v2023.07.06
# 20230623 bkw: updated for v2023.06.22, added version check
# 20230402 bkw: updated for v2023.03.04
# 20230222 bkw: updated for v2023.02.17
# 20230104 bkw: updated for v2023.01.02

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=yt-dlp
VERSION=${VERSION:-2024.08.01}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

# no need for CFLAGS or LIBDIRSUFFIX. actually this would be noarch,
# except for the lib vs. lib64 python problem.

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+

python3 -m build --wheel --no-isolation
python3 -m installer --destdir "$PKG" dist/*.whl

mkdir -p $PKG/usr/man/man1
gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz

# AUTHORS is 0 bytes in 2022.01.21 (still is, in 2023.03.04).
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a LICENSE *.md $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE