# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=exiv2
pkgver=0.28.2
pkgrel=4
pkgdesc="Exif, Iptc and XMP metadata manipulation library and tools"
url="https://exiv2.org"
arch=('x86_64')
license=('GPL2')
depends=(brotli libbrotlidec.so
         curl
         expat libexpat.so
         gcc-libs # libgcc_s.so libstdc++.so
         gettext
         glibc # libc.so libm.so
         libcurl.so
         libinih libINIReader.so
         zlib libz.so)
makedepends=('cmake' 'gtest' 'ninja')
checkdepends=('python')
provides=('libexiv2.so')
source=(https://github.com/Exiv2/exiv2/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('197cc607c0271b5731714713283756250031cef81ba7ed5d9c3e222b4c2397966cc2bbdbceaae706598329dde6f8a9729597d0ae4c36ac264c76546942e4e37b')
b2sums=('9d1d05c99804032dfb9b740e543d1e3cceae011b17853c8565ccad87e726ce1d0f410c13bf4fa8839bc8e0fecdf170a3acac568f14aad4628b3b844f6c21dd7e')

build() {
  cd ${pkgname}-${pkgver}
  cmake -B build \
    -GNinja \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_SKIP_RPATH=ON \
    -DEXIV2_BUILD_SAMPLES=ON \
    -DEXIV2_BUILD_UNIT_TESTS=ON \
    -DEXIV2_ENABLE_VIDEO=ON \
    -DEXIV2_ENABLE_NLS=ON \
    -DEXIV2_ENABLE_XMP=ON \
    -DEXIV2_ENABLE_CURL=ON \
    -DEXIV2_ENABLE_WEBREADY=ON \
    -DEXIV2_ENABLE_BMFF=ON
  ninja -C build
}

check() {
  cd ${pkgname}-${pkgver}
  LD_LIBRARY_PATH="$PWD"/build/lib \
  ninja -C build test
}

package() {
  cd ${pkgname}-${pkgver}
  # remove samples instal which are only needed for unit tests
  sed '/samples\/cmake_install.cmake/d' -i build/cmake_install.cmake
  DESTDIR="${pkgdir}" ninja -C build install
}

# vim: ts=2 sw=2 et:
