pkgname=libwebp
pkgver=1.6.0
pkgdesc="WebP image codec library"
homepage="https://developers.google.com/speed/webp/"
arch=(x86_64)
license=(BSD-3-Clause)
depends=(glibc)
makedepends=(
  libjpeg-turbo
  libpng
)
_patches=("libwebp-1.2.3-libpng-pkg-config.patch"
  "libwebp-1.6.0-configure-typo.patch"
)
_patchesums=("77b6bcc1313c330da70d6c6b0c7684a1"
  "793de17d81cec98905b88aa373cbd16d"
)
sources=("${pkgname}-${pkgver}.tar.gz"
  "${_patches[@]}"
)
urls=("https://storage.googleapis.com/downloads.webmproject.org/releases/webp/${sources[0]}"
  "${_patches[@]}"
)
md5sums=("cceb6447180f961473b181c9ef38b630"
  "${_patchesums[@]}"
)

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  for _patch in ${_patches[@]}; do
    patch -p1 -i ${filedir}/${_patch}
  done
  autoreconf
}

src_build() {
  local confargs=(
    --prefix=/usr
    --enable-libwebpmux
    --enable-libwebpdemux
    --enable-libwebpdecoder
    --disable-static
    --disable-swap-16bit-csp
    --enable-jpeg
    --enable-png
    --disable-gl
    --disable-tiff
    --enable-avx2
    --enable-sse2
    --enable-sse4.1
    --disable-gif
  )
  ./configure "${confargs[@]}"
  make
}

src_install() {
  make DESTDIR="${pkgdir}" install
  install -Dm 644 COPYING -t "${pkgdir}"/usr/share/licenses/${pkgname}
}

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