# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>

pkgname=libsvgtiny
pkgver=0.1.8
pkgrel=1
pkgdesc='SVG Tiny library'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='https://www.netsurf-browser.org/projects/libsvgtiny/'
license=(MIT)
makedepends=(gperf libdom libwapcaplet netsurf-buildsystem)
depends=('libdom>=0.4.2')
source=("https://source.netsurf-browser.org/libsvgtiny.git/snapshot/libsvgtiny-release/$pkgver.tar.bz2")
b2sums=('f24d7eb63d2a5af3b68608bbe0b5a727812e87f2ca261ed537ffe1800df9f0f26873d6eda52966680ca326ac859885e8df4a5908d9efb5d0ff0a6dc6937f7d68')

prepare() {
  sed -i 's:_BSD_SOURCE:_DEFAULT_SOURCE:' $pkgname-release/$pkgver/Makefile
}

build() {
  export CFLAGS="$CFLAGS -shared -fPIC -w"
  export LDFLAGS="$LDFLAGS -shared"
  make -C $pkgname-release/$pkgver COMPONENT_TYPE=lib-shared INCLUDEDIR=include LIBDIR=lib PREFIX=/usr
}

package() {
  make -C $pkgname-release/$pkgver COMPONENT_TYPE=lib-shared DESTDIR="$pkgdir" INCLUDEDIR=include LIBDIR=lib PREFIX=/usr install
  install -Dm644 $pkgname-release/$pkgver/COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}
