# Maintainer (arch): Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Alessio 'mOLOk' Bolognino <themolok@gmail.com>
# Contributor: 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=21.1.0
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=('glibc' 'qt5-script' 'qt5-base' 'mpv' 'libx11' 'zlib' 'gcc-libs' 'hicolor-icon-theme')
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)
sha512sums=('94030ddba63355403f14ce70a3b7719eaa0b006017148039bcc691159c33bbb6c8a947bff10dab9fecc0daa7106ac1b9f3ac7d7ea4263d622240636743c90553'
            'cbe4e873596abb175721ae737dc078e78074c50f4e96165a26849348138304fdbbef3a68655fa6f1be79dcd5d55c587c150e97650d76b832ab2a0dbaffd92ea4')
b2sums=('593ceae2ceeeea6a9689c8e92a1a15fcdd7e2e3f04a6982f0fc36864ced157ff4cb59a26cc9941931aef8e31eef1d580fd606cd2ae396ba1e998233a1e30e74d'
        '9ba5864153e95a7192631945b8d95ec86f5f4817a57fcc8dbb0b7701eceabe8721d9858083ab91993f6eb8c7b2142057383d5d682b663b97d0df1304dabdc141')

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:
