### this file is sourced not run
pkgname=avidemux
PKGVER=2.8.0
PKGBUILD=1
PKGARCH=x86_64

# source: JakeSFR/kirk
TARBALL=${pkgname}-${PKGVER}.tar.gz
MD5SUM=ce57eb0c5955a79ca41bf5c781f74e50
SRC_URL=https://downloads.sourceforge.net/avidemux/${pkgname}_${PKGVER}.tar.gz
#SRC_URL=http://distro.ibiblio.org/fatdog/source/800/$TARBALL
BUNDLE=

SLACKDESC="${pkgname}: ${pkgname} ${PKGVER} (Video editor)
${pkgname}: 
${pkgname}: Avidemux is a free video editor designed for simple cutting,
${pkgname}: filtering and encoding tasks. It supports many file types,
${pkgname}: including AVI, DVD compatible MPEG files, MP4 and ASF,
${pkgname}: using a variety of codecs. Tasks can be automated using projects,
${pkgname}: job queue and powerful scripting capabilities.
${pkgname}: 
${pkgname}: http://avidemux.sourceforge.net/index.html
${pkgname}: 
${pkgname}:
"

SLACKREQ='qt5-common libmad libass liba52 libvdpau'

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/${pkgname}* &&
	patch -Np1 -i $CHROOT_DIR/tmp/pkg/avidemux-fix-crash-copying-clipboard.patch &&
	true
}
### default pkg_package
### build
pkg_build() {
	export PATH="$PATH:/opt/qt5/bin"
	export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/qt5/lib64"
	export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/qt5/lib64/pkgconfig"
	export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/opt/qt5/include"
	export QT5_PATH="/opt/qt5/bin"
	export QT5_LD_LIBRARY_PATH="/opt/qt5/lib64"
	export QT5_PKG_CONFIG_PATH="/opt/qt5/lib64/pkgconfig"
	export QT5_CPLUS_INCLUDE_PATH="/opt/qt5/include"
	export QT_XKB_CONFIG_ROOT="/usr/share/X11/xkb"

	cd tmp/${pkgname}* &&
	sed -i -e 's|do_cli=1|do_cli=0|' bootStrap.bash &&
	sed -i -e 's|external_libass=0|external_libass=1|' bootStrap.bash &&
	sed -i -e 's|external_liba52=0|external_liba52=1|' bootStrap.bash &&
	sed -i -e 's|external_libmad=0|external_libmad=1|' bootStrap.bash &&		
	bash bootStrap.bash &&
	mv install/usr/share/applications/org.avidemux.Avidemux.desktop install/usr/share/applications/avidemux.desktop &&
	cp -r install/usr/* /usr &&
	rm -r /usr/share/ADM6_addons && #MS Windows stuff
	
	#use 48x48 icon to make JWM happy
	install -m 644 /tmp/pkg/org.avidemux.Avidemux.png /usr/share/icons/hicolor/48x48/apps &&
	
	#copy in a config file to set the default audio device to "AlsaDefault"
	cp -r /tmp/pkg/avidemux6 /root/.avidemux6 &&
	
	pkg_build_slackdesc	
}
