# Maintainer: jc_gargma # Maintainer (Arch): Jonathan Steel # Contributor (Arch): Bartłomiej Piotrowski # Contributor (Arch): Duck Hunt # # I maintain this because: # Arch version lacks additional optimization and hardening flags pkgbase=mgba pkgname=('libmgba' 'mgba-sdl' 'mgba-qt') pkgver=0.8.2 pkgrel=1 arch=('x86_64') url='http://mgba.io' license=('custom:MPL2') makedepends=('cmake' 'qt5-multimedia' 'sdl2' 'zlib' 'libpng' 'libzip' 'libedit' 'ffmpeg' 'imagemagick' 'desktop-file-utils' 'qt5-tools') source=($pkgbase-$pkgver.tar.gz::https://github.com/mgba-emu/mgba/archive/$pkgver.tar.gz) b2sums=('5a22d186b2732ba66698ac3fe47cd6ce841ca36ba856e5344948cf14a73aa9368658d94f0e6fb4fd78ae0a454c6d534182ecce221b3b24d62dde511c0aaa02a2') prepare() { [[ ! -d build ]] && mkdir build || rm -rf build } build() { cd build # -fPIE and -pie break compilation export CFLAGS="$CFLAGS -O3 -flto=4 -fPIC" export CXXFLAGS="$CXXFLAGS -O3 -flto=4 -fPIC" cmake "$srcdir"/mgba-$pkgver -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib make } package_libmgba() { pkgdesc='Shared library of mGBA' depends=('zlib' 'libpng' 'libzip' 'libedit' 'ffmpeg' 'imagemagick') cmake -DCOMPONENT=libmgba mgba-$pkgver -DCMAKE_INSTALL_PREFIX="$pkgdir/usr" \ -P build/cmake_install.cmake install -Dm644 mgba-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE } package_mgba-sdl() { pkgdesc='A Nintendo Gameboy Advance Emulator focusing on both speed and accuracy' depends=('libmgba' 'sdl2') cmake -DCOMPONENT=mgba-sdl mgba-$pkgver -DCMAKE_INSTALL_PREFIX="$pkgdir/usr" \ -P build/cmake_install.cmake install -d "$pkgdir"/usr/share/licenses/$pkgname ln -s /usr/share/licenses/libmgba/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE } package_mgba-qt() { pkgdesc='A Nintendo Gameboy Advance Emulator focusing on both speed and accuracy. Qt5 UI.' depends=('libmgba' 'qt5-multimedia' 'sdl2') cmake -DCOMPONENT=mgba-qt mgba-$pkgver -DCMAKE_INSTALL_PREFIX="$pkgdir/usr" \ -P build/cmake_install.cmake desktop-file-install mgba-$pkgver/res/mgba-qt.desktop --dir "$pkgdir"/usr/share/applications/ install -Dm644 mgba-$pkgver/res/mgba-256.png "$pkgdir"/usr/share/pixmaps/mgba.png install -d "$pkgdir"/usr/share/licenses/$pkgname ln -s /usr/share/licenses/libmgba/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE }