# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Michael Mason <ms13sp@gmail.com>
setvar pkgname = 'tiff'
setvar pkgver = '4.0.8'
setvar pkgrel = '1'
setvar pkgdesc = ""Provides support for the Tag Image File Format or TIFF""
setvar url = ""http://www.libtiff.org/""
setvar arch = ""all""
setvar license = ""GPL""
setvar depends = ''
setvar depends_dev = ""zlib-dev libjpeg-turbo-dev""
setvar makedepends = ""libtool autoconf automake $depends_dev""
setvar subpackages = ""$pkgname-doc $pkgname-dev $pkgname-tools""
setvar builddir = ""$srcdir/$pkgname-$pkgver""
setvar source = ""http://download.osgeo.org/libtiff/$pkgname-$pkgver.tar.gz
	CVE-2017-9936.patch
	CVE-2017-10688.patch
	""
# secfixes:
#   4.0.8-r1:
#     - CVE-2017-9936
#     - CVE-2017-10688
#   4.0.7-r2:
#     - CVE-2017-7592
#     - CVE-2017-7593
#     - CVE-2017-7594
#     - CVE-2017-7595
#     - CVE-2017-7596
#     - CVE-2017-7598
#     - CVE-2017-7601
#     - CVE-2017-7602
#   4.0.7-r1:
#     - CVE-2017-5225

proc prepare {
	cd $builddir
	update_config_sub
	default_prepare
}

proc build {
	cd $builddir
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-cxx
	make
}

proc check {
	cd $builddir
	make check
}

proc package {
	cd $builddir
	make DESTDIR="$pkgdir" install
}

proc tools {
	setvar pkgdesc = ""Command-line utility programs for manipulating TIFF files""
	mkdir -p "$subpkgdir"/usr/
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

setvar sha512sums = ""5d010ec4ce37aca733f7ab7db9f432987b0cd21664bd9d99452a146833c40f0d1e7309d1870b0395e947964134d5cfeb1366181e761fe353ad585803ff3d6be6  tiff-4.0.8.tar.gz
8adb7023e121f0210f404b8db913435fc5afdb34ff57767ab318a1436d9afff81990a282539e99f5cc53a7cd790af5be1d1c516649f3f9a14ff1e86a3726ca5d  CVE-2017-9936.patch
e45fe7d08ef8152c1145e8d7b918b5c9f65eec6ecba643d5b94851b37e3b7c43733bdd04112f90887795a28df82bd6d540ea4d96ecb12018c858778bc3702fac  CVE-2017-10688.patch""