# Contributor: August Klein # Maintainer: August Klein pkgname=mednafen pkgver=0.9.38.3 pkgrel=1 pkgdesc="A command-line multi-system emulator" url="http://mednafen.sourceforge.net" arch="all" license="GPL2" depends="" depends_dev="alsa-lib-dev libcdio-dev libsndfile-dev sdl-dev zlib-dev" makedepends="$depends_dev mesa-dev glu-dev paxmark" install="" subpackages="$pkgname-lang" source="https://prdownloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2 01-fix_help.patch 02-sdl_by_default.patch 03-fix_textrels.patch 04-fix_x86_inline_asm.patch " _builddir="$srcdir"/$pkgname prepare() { local i cd "$_builddir" update_config_sub || return 1 for i in $source; do case $i in *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; esac done } build() { cd "$_builddir" ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr || return 1 make || return 1 } package() { cd "$_builddir" make DESTDIR="$pkgdir" install || return 1 rm -rf "$pkgdir"/usr/lib/charset.alias mv -f "$pkgdir"/usr/bin/mednafen "$pkgdir"/usr/bin/mednafen-bin || return 1 libgl=$(scanelf -qF '#F%S' /usr/lib/libGL.so) cat > "$pkgdir"/usr/bin/mednafen << __EOF__ #!/bin/sh # as a workaround for libGL's initial-exec TLS we preload libgl # https://bugs.freedesktop.org/show_bug.cgi?id=35268 LD_PRELOAD=$libgl exec /usr/bin/mednafen-bin "\$@" __EOF__ chmod 755 "$pkgdir"/usr/bin/mednafen paxmark -m "$pkgdir"/usr/bin/mednafen-bin } md5sums="34556f552cf128c0ea18c025d675a28c mednafen-0.9.38.3.tar.bz2 259d9396e292b0446f3837799c3ff091 01-fix_help.patch fe551992f13f1cfe44fde9a96f5fd0b2 02-sdl_by_default.patch 355403c74108baaa6b65fc5521c87be0 03-fix_textrels.patch 7c5210fdc196e79b9f73637ec306b5ad 04-fix_x86_inline_asm.patch" sha256sums="e64c6ac9de18b3735ed24f797c9e9304cb51ad3467011aae8e6d188b3a49e7d4 mednafen-0.9.38.3.tar.bz2 511509758cd80cb2472bc95a8c790ae69565869a081a6d70acffb5d57c6c4b4a 01-fix_help.patch 3fd7154caaf00c6f58b912a24d396503d817fbb2cfdea1550f7dd9dea69d4664 02-sdl_by_default.patch 36d96b1e5829a67e7458a338d3c296e56f1cae5f3ba11453949be7e7ef52ed02 03-fix_textrels.patch d8524b5afa22ba09f03578c1bc49ea7763bf22492ea6d8670b83bdd96af09cae 04-fix_x86_inline_asm.patch" sha512sums="d43d41f9a852cdb20fc56218b0674f36f41318d997b2bdaf9f0141ebd3acdf03f48fbf6f83cd86cf3a09fb7bafbc32384748fb1b4baf4dcc139760bace81a469 mednafen-0.9.38.3.tar.bz2 80e549698687fbe61021ccf964979bb83243ba86d5651fb648ca134822b6b0147c79d0491d076cdfbd579236b5e9db314fcda6d0df46b17a4e856e3677314c56 01-fix_help.patch 856d16f4c044c3787abdd3d65c6b72b6e42c88d7195f097cb6767fde6e0027d756cacc1fd54279a90a6a1bd164cecb8baaf1ff66787ca38d64bdd3eb6583738b 02-sdl_by_default.patch 361522814a514c7bb21c3d3c3451b80817a6de80c224f839071590ae6469a994e144100b67f7e33d4259e4dd3af6b115fe8e12470aaff143920b8193e54db343 03-fix_textrels.patch 424a6727117f4e0ad022b2fe2726a85c43a8a529770e74dada7e7810a6542741c0a2f7ad767e0d0471c5201c26242ab5380b7c82d25f74aa533c4508ded71811 04-fix_x86_inline_asm.patch"