# Maintainer for Arch: Melvin Vermeeren <mail@mel.vin>
# Modified for Slint by Didier Spaier <didier~at~slint~dot~fr>
pkgname=mpd-sacd
pkgver=0.20.18
pkgrel=2slint
slackdesc=\
(
 #|-----handy-ruler------------------------------------------------------|
"$pkgname ( Music Player Daemon with SACD and DVDA ISO playback."

"MPD is designed for integrating a computer into a stereo system that"
"provides control for music playback over a local network.  It is also"
"a great music player using one of many available clients."

"URL: https://sourceforge.net/p/sacddecoder/mpd/MPD.git/ci/master/tree/"
)
license=('GPL')
depends=('libao' 'ffmpeg' 'libmodplug' 'audiofile' 'libshout' 'libmad' 'curl' 'faad2'
	'sqlite' 'jack' 'libmms' 'wavpack' 'avahi' 'libid3tag' 'yajl' 'libmpdclient'
	'icu' 'libupnp' 'libnfs' 'libsamplerate' 'libsoxr' 'smbclient' 'libcdio-paranoia'
	'libgme' 'zziplib')
makedepends=('boost' 'meson' 'python-sphinx')
Homepage=https://www.musicpd.org/
conflicts=('mpd')
docs=("AUTHORS" "COPYING" "NEWS")
# I build this with Sphinx installed as user by pip.
# I am hesitating to ship it as this needs a lot of package to add
# to the respository. - Didier

PATH=$PATH:/home/didier/.local/bin
export PATH

export giturl=https://git.code.sf.net/p/sacddecoder/mpd/MPD.git
export commit=0ebeaa9ac266ed112f21c0f961b76d441f422e4f

build() {
	cd $SRC
	rm -rf MPD
	git clone $giturl
	cd MPD
	git checkout $commit
#adding LDFLAGS="-lnsl" for libwrap, part of tcp_wrappers package
autoreconf -if
LDFLAGS="-L/usr/lib${LIBDIRSUFFIX} -lnsl" \
./configure \
  --prefix=/usr \
  --sysconfdir=/etc \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --mandir=/usr/man \
  --enable-documentation \
  --enable-database \
  --enable-pulse \
  --disable-upnp \
  --enable-iso9660 \
  --disable-zzip \
  --enable-cdio-paranoia \
  --disable-dependency-tracking \
  --docdir=/usr/doc/${pkgname}-${pkgver} \
  --build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG
	# I won't ship the api doc that's really huge. Rebuild the package
	# commenting out or removeing following line if you want it.
	rm -r $PKG/usr/doc/${pkgname}-${pkgver}/api
	pandoc -s -f gfm -t html5 \
	-o $PKG/usr/doc/${pkgname}-${pkgver}/README.html README.md
	install -Dm644 doc/mpdconf.example $PKG/etc/mpd.conf
	cp $startdir/README.Slint $PKG/usr/doc/${pkgname}-${pkgver}/
}

