SUMMARY="The popular cross-plattform media player"
DESCRIPTION="VLC is a free and open source cross-platform multimedia player \
and framework that plays most multimedia files as well as DVDs, Audio CDs, \
VCDs, and various streaming protocols."
HOMEPAGE="http://www.videolan.org/vlc/" 
COPYRIGHT="1998-2015"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="http://download.videolan.org/pub/videolan/vlc/2.2.1/vlc-2.2.1.tar.xz"
CHECKSUM_SHA256="543d9d7e378ec0fa1ee2e7f7f5acf8c456c7d0ecc32037171523197ef3cf1fcb"
PATCHES="vlc-2.2.1.patch"

ARCHITECTURES="x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	vlc$secondaryArchSuffix = $portVersion
	cmd:vlc_wrapper$secondaryArchSuffix
	cmd:vlc$secondaryArchSuffix
	cmd:rvlc$secondaryArchSuffix
	cmd:qvlc$secondaryArchSuffix
	cmd:cvlc$secondaryArchSuffix
	lib:libvlc$secondaryArchSuffix
	lib:libvlccore$secondaryArchSuffix
	"
REQUIRES="
	haiku${secondaryArchSuffix}
	libqt4${secondaryArchSuffix} >= 4.8
	lib:liba52$secondaryArchSuffix
	lib:libass$secondaryArchSuffix
	lib:libavcodec$secondaryArchSuffix
	lib:libavformat$secondaryArchSuffix
	lib:libavutil$secondaryArchSuffix
	lib:libbluray$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libcaca$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libdca$secondaryArchSuffix
	lib:libdevice$secondaryArchSuffix
	lib:libdvbpsi$secondaryArchSuffix
	lib:libdvdnav$secondaryArchSuffix
	lib:libdvdread$secondaryArchSuffix
	lib:libebml$secondaryArchSuffix
	lib:libenca$secondaryArchSuffix
	lib:libfaad$secondaryArchSuffix
	lib:libflac$secondaryArchSuffix
#	lib:libfluidsynth$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libfribidi$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	lib:libgcrypt$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
#	lib:libgnutls$secondaryArchSuffix
	lib:libgpg_error$secondaryArchSuffix
	lib:libharfbuzz$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libixml$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libmad$secondaryArchSuffix
	lib:libmatroska$secondaryArchSuffix
	lib:libmodplug$secondaryArchSuffix
	lib:libmpcdec$secondaryArchSuffix
	lib:libmpeg2$secondaryArchSuffix
#	lib:libmtp$secondaryArchSuffix
	lib:libncursesw$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libopus$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libpostproc$secondaryArchSuffix
	lib:libsamplerate$secondaryArchSuffix
#	lib:libschroedinger$secondaryArchSuffix
	lib:libsdl_1.2$secondaryArchSuffix
	lib:libsdl_image_1.2$secondaryArchSuffix
#	lib:libsmbclient$secondaryArchSuffix
	lib:libspeex$secondaryArchSuffix
	lib:libspeexdsp$secondaryArchSuffix
	lib:libssh2$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libswscale$secondaryArchSuffix
	lib:libtag$secondaryArchSuffix
	lib:libtheoradec$secondaryArchSuffix
	lib:libtheoraenc$secondaryArchSuffix
	lib:libthreadutil$secondaryArchSuffix
	lib:libtwolame$secondaryArchSuffix
	lib:libupnp$secondaryArchSuffix
	lib:libvlccore$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libvorbisenc$secondaryArchSuffix
	lib:libvpx$secondaryArchSuffix
	lib:libx264$secondaryArchSuffix
	lib:libx265$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	libqt4${secondaryArchSuffix}_devel >= 4.8
	devel:liba52$secondaryArchSuffix
	devel:libass$secondaryArchSuffix
	devel:libbluray$secondaryArchSuffix
	devel:libcaca$secondaryArchSuffix
	devel:libcddb$secondaryArchSuffix
	devel:libdca$secondaryArchSuffix
	devel:libdvbpsi$secondaryArchSuffix
	devel:libdvdcss$secondaryArchSuffix
	devel:libdvdnav$secondaryArchSuffix
	devel:libdvdread$secondaryArchSuffix
	devel:libebml$secondaryArchSuffix
	devel:libenca$secondaryArchSuffix
	devel:libfaad$secondaryArchSuffix
	devel:libflac$secondaryArchSuffix
#	devel:libfluidsynth$secondaryArchSuffix
	devel:libfontconfig$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	devel:libgcrypt$secondaryArchSuffix
	devel:libgl$secondaryArchSuffix
#	devel:libgnutls$secondaryArchSuffix
	devel:libgpg_error$secondaryArchSuffix
	devel:libharfbuzz$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libmad$secondaryArchSuffix
	devel:libmatroska$secondaryArchSuffix
	devel:libmodplug$secondaryArchSuffix
	devel:libmpcdec$secondaryArchSuffix
	devel:libmpeg2$secondaryArchSuffix
#	devel:libmtp$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libopus$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libpthread_stubs$secondaryArchSuffix
	devel:libsamplerate$secondaryArchSuffix
#	devel:libschroedinger$secondaryArchSuffix
	devel:libsdl_1.2$secondaryArchSuffix
	devel:libsdl_image_1.2$secondaryArchSuffix
#	devel:libsmbclient$secondaryArchSuffix
	devel:libspeex$secondaryArchSuffix
	devel:libssh2$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libswscale$secondaryArchSuffix
	devel:libtag$secondaryArchSuffix
	devel:libtheora$secondaryArchSuffix
	devel:libtwolame$secondaryArchSuffix
	devel:libupnp$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libvpx$secondaryArchSuffix
	devel:libx264$secondaryArchSuffix
	devel:libx265$secondaryArchSuffix
	devel:libxcb$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:g++${secondaryArchSuffix}
	cmd:gettext$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:xargs
	"

BUILD()
{
	bootstrap
	runConfigure ./configure --disable-rpath --disable-lua --disable-xcb \
	--with-default-font=/system/data/fonts/ttfonts/DejaVuSans.ttf \
	--with-default-font-family=Sans \
	--with-default-monospace-font-family=Monospace --disable-update-check \
	--disable-dependency-tracking --enable-run-as-root
	#--bindir=$appsDir/VLC --libdir=$appsDir/VLC/lib

	make $jobArgs
}

INSTALL()
{
	make install-strip
	
	rm -rf $dataDir/{applications,icons,kde4,vlc}

	# Punt useless libtool's .la files
	find $libDir -name '*.la' -delete

	addResourcesToBinaries $portDir/additional-files/vlc.rdef $binDir/vlc
	addAppDeskbarSymlink $binDir/vlc "VLC media player"

#	prepareInstalledDevelLibs libvlc libvlccore

#	packageEntries devel \
#		$developDir
}
