pkgname=duktape
pkgver=2.7.0
pkgdesc='Embeddable Javascript engine'
homepage='https://duktape.org/'
arch=(x86_64)
license=(MIT)
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("${homepage}${sources[0]}")
md5sums=("b3200b02ab80125b694bae887d7c1ca6")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  sed -i 's/-Os/-O2/' Makefile.sharedlibrary
}

src_build() {
  make -f Makefile.sharedlibrary INSTALL_PREFIX=/usr
}

src_install() {
  make -f Makefile.sharedlibrary INSTALL_PREFIX=/usr DESTDIR="$pkgdir" install
  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 LICENSE.txt
}
