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

# BLFS 2014-07-13 + kirk
TARBALL=vlc-$PKGVER.tar.xz
MD5SUM=efc5f7331c033bf81536531c6eba5aa5
SRC_URL=http://download.videolan.org/vlc/$PKGVER/$TARBALL
BUNDLE=

SLACKREQ='ffmpeg alsa-lib liba52 libgnutls libgcrypt libmad lua \
libdvdread libdvdnav v4l-utils libogg libmodplug \
twolame libflac libvorbis libspeex libopus libtheora libschroedinger \
libpng libx264 libass libSDL freetype2 fontconfig libfribidi librsvg \
libportaudio libjack2 libsamplerate libfaad2 libxml2 xcb-util-keysyms \
libtaglib fluidsynth libmatroska'
SLACKDESC="vlc-curses: vlc-curses $PKGVER (Media player)  
vlc-curses:  
vlc-curses: VLC is a media player, streamer, and encoder. It can play from 
vlc-curses: many inputs like files, network streams, capture device, desktops, 
vlc-curses: or DVD, SVCD, VCD, and audio CD. It can play most audio and video 
vlc-curses: codecs (MPEG 1/2/4, H264, VC-1, DivX, WMV, Vorbis, AC3, AAC, 
vlc-curses: etc.), but can also convert to different formats and/or send 
vlc-curses: streams through the network. This package contains command-line 
vlc-curses: version of the player, there is no GUI.  
vlc-curses: 
vlc-curses:
"
SLACKSUG=libdvdcss

### default pkg_download
### defaulg pkg_prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/vlc* &&
	patch -Np1 -i $CHROOT_DIR/tmp/pkg/vlc-avcodec-threads.patch #Fix low FPS video, set default to 1 thread for FFmpeg. Can be changed in advanced preferences. 
}
### default pkg_package
### build
pkg_build() {
	cd /tmp/vlc*
	sed -i '/vlc_demux.h/a #define LUA_COMPAT_APIINTCASTS' modules/lua/vlc.h   &&
	sed -i '/DEPRECATED/s:^://:'  modules/text_renderer/freetype/text_layout.c &&
	sed -i '/#include <QString>/i#include <QButtonGroup>' \
        modules/gui/qt/components/simple_preferences.cpp                   &&
    sed -e 's/-Werror-implicit-function-declaration//' -i ./configure.ac &&
    ./bootstrap &&
	MAKEINSTALLFLAGS="docdir=/usr/share/doc/vlc-$PKGVER"
	export BUILDCC="gcc"
	export CFLAGS="-fPIC"
	CONFFLAGS="--prefix=/usr --libdir=/usr/$LIBDIR --with-x --enable-run-as-root \
	--enable-faad \
	--disable-bluray --disable-qt --disable-skins2 \
	--disable-dbus --disable-dc1394 --disable-dv1394 --disable-live555 --disable-vdpau --disable-aom" #Currently broken for libaom

	pkg_build_autoconf &&
	pkg_build_slackdesc &&
	rm -f /usr/share/icons/hicolor/icon-theme.cache &&
	#/usr/lib64/vlc/vlc-cache-gen /usr/lib64/vlc/plugins &&
	rm -f /usr/lib64/vlc/plugins/plugins.dat &&

	# remove all desktop file
	rm -f /usr/share/applications/vlc*
}
