#### this file is sourced not run
PKGVER=1.5
PKGBUILD=1
PKGARCH=x86_64

# source: BLFS 7.5 updated 6-17-2018 updated to BLFS 11.3
TARBALL=MPlayer-$PKGVER.tar.xz
MD5SUM=0419b64db24b6db0943dbc6afece7c44
SRC_URL=http://www.mplayerhq.hu/MPlayer/releases/$TARBALL
BUNDLE=

SKINS_TARBALL=Clearlooks-2.0.tar.bz2
SKINS_MD5SUM=c82d4dbd7f0c36dfecd63dff972807c5
SKINS_SRC=http://www.mplayerhq.hu/MPlayer/skins/$SKINS_TARBALL

SLACKREQ='gtk2 libdvdread libdvdnav libdvdcss librtmp \
alsa-lib libSDL libjack2 giflib libjpeg-turbo libpng libopenjpeg2 libmad \
libspeex libtheora liba52 libfaac libxvidcore libvpx lame twolame \
libopencore-amr libx264 libx265 libschroedinger libfaad2 \
fontconfig freetype2 libfribidi unrar libvdpau openal' # ladspa, libgsm is compile-only
SLACKDESC="mplayer-static: mplayer-static $PKGVER (Media player)  
mplayer-static:  
mplayer-static: MPlayer is a powerful audio/video player controlled via the 
mplayer-static: command line or a graphical interface that is able to play 
mplayer-static: almost every popular audio and video file format. With 
mplayer-static: supported video hardware and additional drivers, MPlayer can 
mplayer-static: play video files without an X Window System installed. 
mplayer-static: This is  the version that includes statically-linked ffmpeg, 
mplayer-static: it does not use system ffmpeg.  
mplayer-static: 
mplayer-static: 
"
SLACKCON='mplayer'

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cp ./tmp/pkg/ladspa.h usr/include &&
	cd tmp/MPlayer* &&
	#sed -i 's:libsmbclient.h:samba-4.0/&:' configure stream/stream_smb.c && # support samba4
	
	SRC_URL=$SKINS_SRC && 
	pkg_check $SRC_DIR $SKINS_TARBALL $SKINS_MD5SUM	
}

### package
pkg_package() {
	mkdir -p usr/share/mplayer/skins &&
	tar -xvf $SRC_DIR/$SKINS_TARBALL \
		   -C usr/share/mplayer/skins &&
	ln -sfv Clearlooks usr/share/mplayer/skins/default &&
	rm -f usr/include/ladspa.h
}

### build
pkg_build() {
	cd /tmp/MPlayer*
		
	./configure --prefix=/usr --libdir=/usr/$LIBDIR \
    --confdir=/etc/mplayer   \
    --enable-dynamic-plugins \
    --enable-menu            \
    --enable-gui             \
    --disable-ffmpeg_so      \
    --enable-libgsm          \
    --extra-cflags=-I/usr/include/openjpeg-2.5 \
    --enable-vdpau \
    --enable-gif \
    &&
    make $MAKEINSTALL &&
    make install &&
	pkg_build_slackdesc &&

	# docs
	install -v -m755 -d /usr/share/doc/mplayer-$PKGVER &&
	install -v -m644    DOCS/HTML/en/* \
						/usr/share/doc/mplayer-$PKGVER &&
	install -v -m644 etc/codecs.conf /etc/mplayer &&
	install -v -m644 etc/*.conf /etc/mplayer
}
