summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d1b541553821b27109421f8bba066e2895452e26 (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
97
# Maintainer: willemw <willemw12@gmail.com>
# Contributor: Francois Menning <f.menning@pm.me>
# Contributor: Dan Ziemba <zman0900@gmail.com>
# Contributor: Benjamin Hedrich <kiwisauce (a) pagenotfound (dot) de>

pkgname=tvheadend-git
pkgver=4.3.r2354.gadef81b
pkgrel=1
pkgdesc='TV streaming server and DVR'
#arch=(x86_64)
arch=(aarch64 arm armv6h armv7h i686 x86_64)
url=https://tvheadend.org/
license=(GPL-3.0-or-later)
depends=(
  avahi ffmpeg libdvbcsa libfdk-aac libogg libtheora libvorbis libvpx
  openssl opus pcre2 pngquant uriparser x264 x265)
makedepends=(git python)
optdepends=(
  'libhdhomerun: HDHomeRun support'
  'xmltv: alternative source of programme listings')
options=(!buildflags !strip emptydirs)
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=(
  "$pkgname::git+https://github.com/tvheadend/tvheadend.git"
  tmpfile.conf
  tvheadend.service
  user.conf)
sha256sums=('SKIP'
            'b01fa913421e67e40bc1aa5da079e30cb1d8c20913133ded1ad651d6ce84b9b6'
            'a8e95cd2ec5626a47f49c0aa1f8524d6e155809cfbf6504b9a1484afdf62cfb7'
            '35786e211d4cbf6de213f28e7382378f27f3bef17458e8533ad43fed06e7f202')

_print_libav_option() {
  local ffmpeg_supported ffmpeg_installed libav_option

  # Compare major version numbers of ffmpeg
  # Check the maximum known supported version and the version used by the makefile
  ffmpeg_supported="$(awk '$1 == "FFMPEG" { print $3 }' Makefile.ffmpeg | sed 's/^ffmpeg-//' | cut -d'.' -f1)"
  ffmpeg_installed="$(pacman -Q ffmpeg | awk '{ print $2 }' | sed 's/^ *//;s/r.*[.]//;s/.*://' | cut -d'.' -f1)"
  if ((ffmpeg_installed <= 7)) || ((ffmpeg_supported > 0 && ffmpeg_supported == ffmpeg_installed)); then
    libav_option='--enable-libav'
  else
    libav_option='--disable-libav'
  fi

  echo -n "$libav_option"
}

pkgver() {
  git -C $pkgname describe --long --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd $pkgname

  local libav_option
  libav_option="$(_print_libav_option)"
  printf 'Checking for libav (ffmpeg transcoding) support: %s\n' "$libav_option"

  local libhdhomerun_option=
  if pacman -Q libhdhomerun >/dev/null 2>&1; then
    libhdhomerun_option='--enable-hdhomerun_client'
  fi

  ./configure \
    --datadir=/var/lib \
    --disable-ffmpeg_static \
    --disable-hdhomerun_static \
    --disable-libfdkaac_static \
    --disable-libogg_static \
    --disable-libopus_static \
    --disable-libtheora_static \
    --disable-libvorbis_static \
    --disable-libvpx_static \
    --disable-libx264_static \
    --disable-libx265_static \
    "$libav_option" \
    $libhdhomerun_option \
    --enable-avahi \
    --enable-pngquant \
    --enable-vaapi \
    --enable-zlib \
    --mandir=/usr/share/man/man1 \
    --prefix=/usr \
    --python=python3

  make
}

package() {
  make -C $pkgname DESTDIR="$pkgdir/" install

  install -Dm644 tmpfile.conf "$pkgdir/usr/lib/tmpfiles.d/tvheadend.conf"
  install -Dm644 tvheadend.service -t "$pkgdir/usr/lib/systemd/system"
  install -Dm644 user.conf "$pkgdir/usr/lib/sysusers.d/tvheadend.conf"
}