# Maintainer: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: arjan <arjan@archlinux.org>
# Contributor: Jason Chu <jchu@xentac.net>

pkgname=libshout
pkgver=2.4.6
pkgrel=5
epoch=1
pkgdesc="Library for accessing a shoutcast/icecast server"
arch=('x86_64')
depends=('libvorbis' 'libtheora' 'speex' 'openssl')
makedepends=('git')
url="https://www.icecast.org/"
options=('!emptydirs')
license=('LGPL')
source=("git+https://gitlab.xiph.org/xiph/icecast-libshout.git#tag=v${pkgver}"
        "git+https://gitlab.xiph.org/xiph/icecast-common.git"
        "git+https://gitlab.xiph.org/xiph/icecast-m4.git")
sha512sums=('758b779c67f1377ce4b3d1bced1a9de7702752365193931f0d75a0995957c9ea05479bacaef77321a94ff1f0cee1242962e7c0446d5f65a01f060609430e4b6a'
            'SKIP'
            'SKIP')

prepare() {
  cd icecast-${pkgname}

  git submodule init
  git config submodule.m4.url "${srcdir}/icecast-m4"
  git config submodule.src/common.url "${srcdir}/icecast-common"
  git -c protocol.file.allow=always submodule update

  autoreconf -fiv
}

build() {
  cd icecast-${pkgname}
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var
  make
}

package() {
  cd icecast-${pkgname}
  make DESTDIR="${pkgdir}" install
}
