# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=libx86emu
pkgver=%version%
pkgrel=%release%
pkgdesc='x86 emulation library'
arch=(x86_64)
url='https://github.com/wfeldt/libx86emu'
license=(BSD)
makedepends=(git setconf)
source=("git+$url#commit=41aaa2f246d362f6d7dea262052a43141743ead2") # tag: 3.5
b2sums=('SKIP')

prepare() {
  sed -i 's/-shared -Wl/-shared '"$LDFLAGS"'/g' $pkgname/Makefile
  setconf $pkgname/Makefile \
    CFLAGS="$CFLAGS -shared -fPIC -fvisibility=hidden -fomit-frame-pointer -w"
}

build() {
  make -C $pkgname LIBDIR=/usr/lib
}

package() {
  make -C $pkgname LIBDIR=/usr/lib DESTDIR="$pkgdir" install
  install -Dm644 $pkgname/LICENSE \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
