summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d44090c18020680b937136c384b87e2c4ce20128 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Maintainer: Vaporeon <vaporeon@vaporeon.io>

pkgbase=mgba-git
pkgname=('libmgba-git' 'mgba-sdl-git' 'mgba-qt-git')
pkgver=0.10.0.r7087.9355def31
pkgrel=1
arch=('x86_64')
url='http://mgba.io/'
license=('custom:MPL2')
makedepends=('cmake' 'qt5-multimedia' 'sdl2' 'zlib' 'libpng' 'libzip' 'libedit'
             'ffmpeg' 'desktop-file-utils' 'qt5-tools' 'git' 'ninja')
source=("git+https://github.com/mgba-emu/mgba.git")
sha1sums=('SKIP')

pkgver() {
    cd "$srcdir"/mgba
    for v in LIB_VERSION_MAJOR \
    		 LIB_VERSION_MINOR \
    		 LIB_VERSION_PATCH; do
    	ver=$(grep -m 1 $v version.cmake | grep -o '[0-9]' | tr -d '\n')
    	printf -v "$v" "%s" "$ver"
    done

    printf "%s.%s.%s.r%s.%s" \
        $LIB_VERSION_MAJOR \
        $LIB_VERSION_MINOR \
        $LIB_VERSION_PATCH \
        "$(git rev-list --count HEAD)" \
        "$(git rev-parse --short HEAD)"
}

prepare() {
    mkdir -p build
}

build() {
    cd build
    cmake "$srcdir"/mgba -G Ninja \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DCMAKE_INSTALL_PREFIX=/usr
    ninja
}

package_libmgba-git() {
    pkgdesc='Shared library of mGBA'
    depends=('zlib' 'libpng' 'libzip' 'libedit' 'ffmpeg' 'sqlite' )
    conflicts=('libmgba')
    provides=('libmgba')

    cmake -DCOMPONENT=libmgba mgba -DCMAKE_INSTALL_PREFIX="$pkgdir/usr" \
        -P build/cmake_install.cmake

    cmake -DCOMPONENT=mgba-dev mgba -DCMAKE_INSTALL_PREFIX="$pkgdir/usr" \
    	-P build/cmake_install.cmake

    install -Dm644 mgba/LICENSE "$pkgdir"/usr/share/licenses/${pkgname%-git}/LICENSE
}

package_mgba-sdl-git() {
    pkgdesc='A Nintendo Gameboy Advance Emulator focusing on both speed and accuracy'
    depends=('libmgba' 'sdl2')
    conflicts=('mgba-sdl')
    provides=('mgba-sdl')

    cmake -DCOMPONENT=mgba-sdl mgba -DCMAKE_INSTALL_PREFIX="$pkgdir/usr" \
        -P build/cmake_install.cmake

    install -d "$pkgdir"/usr/share/licenses/${pkgname%-git}
    ln -s /usr/share/licenses/libmgba/LICENSE "$pkgdir"/usr/share/licenses/${pkgname%-git}/LICENSE
}

package_mgba-qt-git() {
    pkgdesc='A Nintendo Gameboy Advance Emulator focusing on both speed and accuracy. Qt5 UI.'
    depends=('libmgba' 'qt5-multimedia' 'sdl2')
    conflicts=('mgba-qt')
    provides=('mgba-qt')

    cmake -DCOMPONENT=mgba-qt mgba -DCMAKE_INSTALL_PREFIX="$pkgdir/usr" \
        -P build/cmake_install.cmake

    desktop-file-install mgba/res/mgba-qt.desktop --dir "$pkgdir"/usr/share/applications/
    install -Dm644 mgba/res/mgba-256.png "$pkgdir"/usr/share/pixmaps/mgba.png

    install -d "$pkgdir"/usr/share/licenses/${pkgname%-git}
    ln -s /usr/share/licenses/libmgba/LICENSE "$pkgdir"/usr/share/licenses/${pkgname%-git}/LICENSE
}