# Maintainer (Arch): Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor (Arch): Ionut Biru <ibiru@archlinux.org>
# Contributor (Arch): Allan McRae <allan@archlinux.org>
# Contributor (Arch): Alessio 'mOLOk' Bolognino <themolok@gmail.com>
# Contributor (Arch): shamrok <szamrok@gmail.com>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: Andreas Grapentin <andreas@grapentin.org>
# Contributor: André Silva <emulatorman@hyperbola.info>

# parabola changes and rationale:
#  - removed smtube support

pkgname=smplayer
pkgver=19.10.2
pkgrel=1
pkgrel+=.parabola1
pkgdesc='Media player with built-in codecs that can play virtually all video and audio formats'
pkgdesc+=', without nonfree smtube support'
url='https://www.smplayer.info/'
arch=('x86_64')
arch+=('i686' 'armv7h')
license=('GPL')
depends=('qt5-script' 'mpv' 'hicolor-icon-theme' 'libx11' 'zlib' 'gcc-libs')
makedepends=('qt5-tools')
optdepends=('smplayer-themes: icon themes collection'
            'smplayer-skins: skin themes collection'
            'youtube-dl: youtube videos and streaming'
            'mplayer: alternative multimedia engine')
source=(https://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2
        libre.patch)
sha256sums=('37ed9f9a051077b9bc1a68f06fd4ad37fdac2802f62c28fd177e91d97d094c44'
            '86d93ac8d06830c767903f5526177c73570715887113a9f4694360b0f1c3ffc6')
sha512sums=('46327a1f988cfe8fe4e04f456057c2395f5ad011513988c1ffecf5c91cf2fdedbe8095cfba15f0f61c3e1cabc7f34b78d676bce430a79fcf542d74e14a33ec62'
            'cbe4e873596abb175721ae737dc078e78074c50f4e96165a26849348138304fdbbef3a68655fa6f1be79dcd5d55c587c150e97650d76b832ab2a0dbaffd92ea4')

prepare() {
  cd ${pkgname}-${pkgver}
  # disable SMTube support
  patch -p1 -i $srcdir/libre.patch
  # fix GNU/Linux name
  sed -i 's|Linux|GNU/Linux|' src/smplayer.cpp
  # make build reproducible, we compress ourselves
  sed '/gzip -9/d' -i Makefile
}

build() {
  cd ${pkgname}-${pkgver}
  export CXXFLAGS="${CXXFLAGS} ${CPPFLAGS}"
  make PREFIX=/usr \
    DOC_PATH="\\\"/usr/share/doc/smplayer\\\"" \
    QMAKE_OPTS=DEFINES+=NO_DEBUG_ON_CONSOLE \
    CFLAGS_EXTRA="${CFLAGS} ${CPPFLAGS} ${LDFLAGS}"
}

package() {
  cd ${pkgname}-${pkgver}
  make DOC_PATH=/usr/share/doc/smplayer \
    DESTDIR="${pkgdir}" PREFIX=/usr -j1 install
}

# vim: ts=2 sw=2 et: