pkgname=libpng
pkgver=1.6.51
_verstr="${pkgver%%.*}${pkgver#*.}"
_verstr="${_verstr%%.*}"
apngver=1.6.51
pkgdesc='A collection of routines used to create PNG format graphics files'
arch=('x86_64')
homepage='http://www.libpng.org/pub/png/libpng.html'
license=('libpng-2.0')
depends=('zlib' 'sh')
makedepends=('git')
sources=("${pkgname}-${pkgver}.tar.xz"
  "${pkgname}-${apngver}-apng.patch.gz"
)
urls=("https://downloads.sourceforge.net/libpng/${sources[0]}"
  "https://downloads.sourceforge.net/libpng-apng/${pkgname}${_verstr}/${sources[1]}"
)
md5sums=("8781d5eb8285ac70100b75a1d2a5fc5e"
  "c0e913c8f84b3ea64577e11bb7f93cb5"
)

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  gzip -cd ${distdir}/${sources[1]} | patch -p1
}

src_build() {
  ./configure \
    --prefix=/usr \
    --disable-static \
    --enable-instal-sse
  make
}

src_check() {
  make check
}

src_install() {
  make DESTDIR="$pkgdir" install

  install -D -m0644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim:ft=sh syn=sh et sw=2:
