#Maintainer: George Vlahavas (vlahavas~at~gmail~dot~com)

pkgname=libquicktime
pkgver=1.2.4
pkgrel=4gv
source=(
		"http://downloads.sourceforge.net/libquicktime/libquicktime-$pkgver.tar.gz"
		"libquicktime-1.2.4-CVE-2016-2399.patch"
		"libquicktime-1.2.4-CVE-2017-9122_et_al.patch"
		"libquicktime-1.2.4-faad2.patch"
		"libquicktime-1.2.4-ffmpeg-codecs.patch"
		"libquicktime-1.2.4-ffmpeg2.patch"
		"libquicktime-1.2.4-ffmpeg29.patch"
		"libquicktime-1.2.4-ffmpeg4.patch"
		"libquicktime-1.2.4-libavutil.patch"
		)
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo" "maintainers" "about-nls")
url=http://libquicktime.sourceforge.net/

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"libquicktime (a library for reading and writing quicktime files)"
"libquicktime provides convenient access to quicktime files with a"
"variety of supported codecs."
)


build() {
	cd $startdir/src/$pkgname-$pkgver

	patch -p1 < $startdir/src/libquicktime-1.2.4-CVE-2016-2399.patch || exit 1
	patch -p1 < $startdir/src/libquicktime-1.2.4-CVE-2017-9122_et_al.patch || exit 1
	# checks for faad2 are broken in configure.ac || exit 1
	patch -p1 < $startdir/src/libquicktime-1.2.4-faad2.patch || exit 1
	# ffmpeg compatibility is very ancient || exit 1
	patch -p1 < $startdir/src/libquicktime-1.2.4-ffmpeg2.patch || exit 1
	patch -p1 < $startdir/src/libquicktime-1.2.4-ffmpeg29.patch || exit 1
	patch -p1 < $startdir/src/libquicktime-1.2.4-ffmpeg4.patch || exit 1
	patch -p1 < $startdir/src/libquicktime-1.2.4-libavutil.patch || exit 1
	patch -p1 < $startdir/src/libquicktime-1.2.4-ffmpeg-codecs.patch || exit 1

	echo "echo \"$CFLAGS\"" > cpuinfo.sh
	./configure --prefix=/usr \
		--libdir=/usr/lib${LIBDIRSUFFIX} \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--enable-gpl \
		--without-doxygen
	make -j $numjobs || return 1
	make install DESTDIR=$startdir/pkg
}