# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=lcms2
pkgver=2.13
pkgrel=2
pkgdesc='Small-footprint color management engine, version 2'
arch=('x86_64')
url='http://www.littlecms.com/'
license=('MIT')
depends=('libtiff')
provides=('liblcms2.so')
source=("https://github.com/mm2/Little-CMS/releases/download/lcms${pkgver}/${pkgname}-${pkgver}.tar.gz"
        '0001-fix-for-optimisation-error-on-grayscale.patch')
sha256sums=('0c67a5cc144029cfa34647a52809ec399aae488db4258a6a66fba318474a070f'
            'efb68be0ad7bec92fb60d477ec1ba143feeba198e6e78fa0fc52d44bb4c2f9b4')

prepare() {
  cd "${pkgname}-${pkgver}"

  patch -Np1 < ../0001-fix-for-optimisation-error-on-grayscale.patch
}

build() {
  cd "${pkgname}-${pkgver}"

  ./configure \
    --prefix=/usr
  make
}

check() {
  cd "${pkgname}-${pkgver}"

  make check
}

package() {
  cd "${pkgname}-${pkgver}"

  make DESTDIR="${pkgdir}" install
  install -D -m0644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
