# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=freetype
pkgver=2.8.1
pkgrel=2
pkgdesc="TrueType font rendering library"
url="https://www.freetype.org/"
arch="all"
license="GPL"
options="!check"
depends=""
depends_dev=""
makedepends="$depends_dev zlib-dev libpng-dev bzip2-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="http://download.savannah.gnu.org/releases/freetype/freetype-$pkgver.tar.bz2
	40-memcpy-fix.patch
	0001-Enable-table-validation-modules.patch
	0003-Enable-infinality-subpixel-hinting.patch
	0004-Enable-long-PCF-family-names.patch

	freetype-profile.sh
	"

# secfixes:
#   2.7.1-r1:
#     - CVE-2017-8105
#     - CVE-2017-8287

builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-static \
		--with-bzip2 \
		--with-png
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install

	install -Dm644 "$srcdir"/freetype-profile.sh \
		"$pkgdir"/etc/profile.d/freetype.sh
}

sha512sums="ca59e47f0fceeeb9b8032be2671072604d0c79094675df24187829c05e99757d0a48a0f8062d4d688e056f783aa8f6090d732ad116562e94784fccf1339eb823  freetype-2.8.1.tar.bz2
9981be8a3ea6f2cf856860b87a4e895e4610c9d5ea4beb611815e757e6080e060f6853ace02dd8ea55e5888cdf4bae5ad5eadd2d8a123754bb3c0bfe7ef41dea  40-memcpy-fix.patch
41a84be2631b53072a76b78c582575aa48b650ee7b00017d018381002bc25df10cf33da4954c95ef50db39f1fa566678e3b4ae9bfee1dfd705423fb53e53e494  0001-Enable-table-validation-modules.patch
7b52a3d67750d59b2c98e83dab4e0a0ab263142c2ca7bd5f8be5f8fe9cd1dc1f4debad44111c7886665329d8d2a3163756455618a6615df8f85d82bb0372d4dd  0003-Enable-infinality-subpixel-hinting.patch
64c20fbcbf48372ea35fe2e0dae8fec4be8c601c899a4a71913060c6ea4082a2f41d69701da511e09fee126bf198d560986469e2356bd088d2dd5961f437df63  0004-Enable-long-PCF-family-names.patch
829dff39fc98e341cf88433758d9288fe9f824c1a1644ac7777ed274133df0fd0ee65606b7dab69acdb12ebf516d89da063df8850114e0c4e16a28bcc5de215d  freetype-profile.sh"
