summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5d7806982177cc631fa59db68c7ab7393d651909 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Maintainer: Tim Schumacher <timschumi@gmx.de>
# Contributor: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
# Contributor: ceri
# Contributor: Imperator Storm <30777770+ImperatorStorm@users.noreply.github.com>

_pkgbase='citra'
pkgbase="$_pkgbase-git"
pkgname=("$_pkgbase-git" "$_pkgbase-qt-git")
pkgver=r9079.5a7d80172
pkgrel=1
pkgdesc="An experimental open-source Nintendo 3DS emulator/debugger"
arch=('i686' 'x86_64')
url="https://github.com/citra-emu/citra/"
license=('GPL2')
depends=('ffmpeg')
makedepends=('git' 'cmake' 'sdl2' 'qt5-base' 'shared-mime-info' 'desktop-file-utils' 'qt5-multimedia')
source=("$_pkgbase::git+https://github.com/citra-emu/citra"
        "boost::git+https://github.com/citra-emu/ext-boost/"
        "catch::git+https://github.com/catchorg/Catch2"
        "cpp-jwt::git+https://github.com/arun11299/cpp-jwt"
        "cubeb::git+https://github.com/mozilla/cubeb"
        "discord-rpc::git+https://github.com/discord/discord-rpc"
        "dynarmic::git+https://github.com/citra-emu/dynarmic"
        "enet::git+https://github.com/lsalzman/enet"
        "fmt::git+https://github.com/fmtlib/fmt"
        "libressl::git+https://github.com/citra-emu/ext-libressl-portable"
        "nihistro::git+https://github.com/neobrain/nihstro"
        "soundtouch::git+https://github.com/citra-emu/ext-soundtouch"
        "teakra::git+https://github.com/wwylele/teakra"
        "xbyak::git+https://github.com/herumi/xbyak"
        "zstd::git+https://github.com/facebook/zstd"
        "inih::git+https://github.com/benhoyt/inih"
        "libusb::git+https://github.com/libusb/libusb"
        "cryptopp::git+https://github.com/weidai11/cryptopp"
        "lodepng::git+https://github.com/lvandeve/lodepng"
        "sanitizers-cmake::git+https://github.com/arsenm/sanitizers-cmake"
        "googletest::git+https://github.com/google/googletest")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

# Clang generates weird object files when LTO is enabled, breaking static libraries (.a).
# Force-disable LTO if we are using clang.
if [ "$CXX" = "clang++" ]; then
	options=('!lto')
fi

pkgver() {
	cd "$srcdir/$_pkgbase"
	echo "r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
}

prepare() {
	cd "$srcdir/$_pkgbase"

	if [[ -d build ]]; then
		rm -rf build
	fi
	mkdir build

	git submodule init
	for external in boost catch cpp-jwt cubeb discord-rpc dynarmic enet fmt libressl nihistro soundtouch teakra xbyak zstd inih libusb cryptopp lodepng; do
		git config submodule.$external.url "$srcdir/$external"
	done
	git submodule update

	# agh, submodule has submodules
	cd externals/cubeb
	git submodule init
	git config submodule.cmake/sanitizers-cmake.url "$srcdir/sanitizers-cmake"
	git config submodule.googletest.url "$srcdir/googletest"
	git submodule update
}

build() {
	cd "$srcdir/$_pkgbase/build"

	# Fix for an issue some users are facing when compiling with GCC
	CXXFLAGS+=" -DFMT_USE_USER_DEFINED_LITERALS=0"

	# Bump the expression nesting limit for clang
	if [ "$CXX" = "clang++" ]; then
		CXXFLAGS+=" -fbracket-depth=649"
	fi

	cmake .. \
	  -DCMAKE_INSTALL_PREFIX=/usr \
	  -DCMAKE_BUILD_TYPE=Release \
	  -DENABLE_FFMPEG_AUDIO_DECODER=ON \
	  -DUSE_SYSTEM_CURL=ON
	make
}

check() {
	cd "$srcdir/$_pkgbase/build"
	make test
}

package_citra-git() {
	depends=('sdl2' 'libpng')

	install -Dm755 "$srcdir/$_pkgbase/build/bin/Release/citra" "$pkgdir/usr/bin/citra"
}

package_citra-qt-git() {
	depends=('qt5-base' 'qt5-multimedia' 'sdl2' 'shared-mime-info' 'desktop-file-utils')
	optdepends=('libxkbcommon-x11: for X11 support'
	            'qt5-wayland: for Wayland support')

	cd "$srcdir/$_pkgbase/build"
	make DESTDIR="$pkgdir/" install
	rm "$pkgdir/usr/bin/citra"
}