# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Carl Smedstad <carsme@archlinux.org>
# Contributor: Daniel Isenmann <daniel@archlinux.org>

pkgname=libgdiplus
pkgver=6.2
pkgrel=1
url='https://gitlab.winehq.org/mono/libgdiplus'
pkgdesc='C-based implementation of the GDI+ API'
arch=('x86_64' 'aarch64')
license=(MIT)
depends=(
  'cairo'
  'fontconfig'
  'glib2'
  'glibc'
  'harfbuzz'
  'libexif'
  'libjpeg-turbo'
  'libpng'
  'libtiff'
  'libx11'
  'pango'
)
makedepends=('giflib')
source=("$url/-/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('2b5407a19f8d827986c64d32f61b4a0f9c1825e7873e254c510dca2a0dbb11f65e68f527873b6866ceb2f93fbcda12f33f7be1a1a153c20754c65535250277d8')
b2sums=('f9d604934c566cb3bab16793fba18b4da088b7d63c132e5ca74ab5b8119d80c76508425436fadd43767ab666729a1f91ecba253a1aaed4271371e017024dc4a7')

prepare() {
  cd $pkgname-$pkgver
  # do not update the submodule, gtest based tests are broken anyways
  sed -e 's/: update_submodules/:/' -i Makefile.am
  autoreconf -fiv
}

build() {
  cd $pkgname-$pkgver
  ./configure \
    --prefix=/usr \
    --with-pango

  # prevent excessive overlinking due to libtool
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  depends+=('giflib' 'libgif.so')

  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" \
    NEWS README.md TODO AUTHORS ChangeLog
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}

# vim: ts=2 sw=2 et:
