summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 64b8b300642f8b839e5f777178f01f520f74c390 (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
# Maintainer: Max Harmathy <harmathy@mailbox.org>
# Contributor: David Runge <dvzrv@archlinux.org>

_name=MediathekView
_pkgname=mediathekview
pkgname=${_pkgname}-xdg
pkgver=14.1.0
pkgrel=3
pkgdesc="Access the Mediathek of many German TV stations (store data in XDG_DATA_HOME)"
arch=(any)
url="https://github.com/mediathekview/mediathekview"
license=(GPL-3.0-or-later)
_java_version=${JAVA_VERSION:-23}
depends=(
  bash
  hicolor-icon-theme
  java-runtime-openjdk="$_java_version"
  xdg-user-dirs
)
makedepends=(
  maven
  strip-nondeterminism
  java-environment-openjdk="$_java_version"
)
conflicts=(mediathek)
provides=(mediathek)
replaces=(mediathek)
optdepends=(
  'libnotify: to use desktop notifications'
  'mplayer: for recording streams'
  'vlc: for stream playback'
)
source=(
  "$_pkgname-$pkgver.tar.gz::$url/archive/refs/tags/$pkgver.tar.gz"
  "de.$_pkgname.$_name.desktop"
  "$_pkgname.sh"
)
sha512sums=('0498c3d6d0ec671fa2efcdc9ef91be97dcc9a4776ceb398668d70808f10c7065e2597ed72b950422e3f45d976cfb575281d8e9b8074a0dfb38917b340b0556b2'
            '0591f9ca8a79539c3b4bdf81980d83500267f03d6c657e6694f705bf504a2b9b3d846a0ba3c3e750d422812c38d8504c424a86362cbce1229cd603b98afcbee2'
            '1cdae5a1311cacb7b9b16d2f34d9d2ae38a3ba730253244208663654670760dfac80a93c56b22cf327e60e25402fbe0d64fd6012f821762d2ec5e2943b52f50a')
b2sums=('c3323197322d81959644e7fbe0dacf6286e600144b3070d50bd3ee415a7c7de99e5f8fd0f7cb58c35d636b3cdebdef219b143f4d060ab56c110fba8bf85f357b'
        'c00c4621c1de5ea82760d337e26f0b5287577144a1ff50f010b6148f88161d39778b42d70755d96f43dff13ce1329d069f04f9a74be90e7dd5f520be043d576f'
        'd6e7e7acfa09c76a7439b173d55fd1c5470535356d7d307674f76c0f3cb5c201ebdd570d1c8ec5506b276b5c5c215e645aa7e9d253d02ff785f9b0c584aeb725')

prepare() {
  # check for correct java version
  local status=''
  read -ra javac_version < <(javac --version) || status='failed'
  if [ -n "$status" ] || [ ! "${javac_version[1]%%.*}" = "$_java_version" ]; then
    echo "Please set your java version to openjdk $_java_version unsing \"archlinux-java\"" >&2
    return 1
  fi

  # set java version for wrapper script
  sed "s/JAVA_VERSION/$_java_version/" "$_pkgname.sh" > "$_pkgname"
}

build() {
  cd $_name-$pkgver
  ./mvnw clean install
  # Timestamps in JAR files generated by Maven do not honour SOURCE_DATE_EPOCH
  # (https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=74682318)
  (
    PATH=$PATH:/usr/bin/vendor_perl
    shopt -s globstar
    for file in **/*.jar; do
      echo -n "[stripping] $file ..."
      strip-nondeterminism --timestamp "$SOURCE_DATE_EPOCH" "$file"
      echo "done"
    done
   )
}

package() {
  local _size

  cd $_name-$pkgver
  # jar
  install -vDm 644 target/$_name.jar -t "$pkgdir/usr/share/java/$_pkgname/"
  # script
  install -vDm 755 ../$_pkgname -t "$pkgdir/usr/bin/"
  # XDG desktop file
  install -vDm 644 ../de.mediathekview.$_name.desktop -t "$pkgdir/usr/share/applications/"
  # icons
  for _size in 16 32 48 128; do
    install -vDm 644 target/${_name}@x$_size.png "$pkgdir/usr/share/icons/hicolor/${_size}x$_size/apps/$_pkgname.png"
  done
  install -vDm 644 res/$_name.svg -t "$pkgdir/usr/share/icons/hicolor/scalable/apps/$_pkgname.svg"
  # docs
  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$_pkgname/"
}