summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e865cfbf1ab3d3a25b2a5ab4e909963b00ab7124 (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Maintainer: Alexandre Bouvier <contact@amb.tf>
_pkgname=azahar
pkgname=$_pkgname-git
pkgver=2123.rc2.r38.g068fec0
pkgrel=1
pkgdesc="Nintendo 3DS emulator based on Citra"
arch=('x86_64')
url="https://azahar-emu.org/"
license=('GPL-2.0-or-later')
depends=(
	'crypto++'
	'enet'
	'gcc-libs'
	'glibc'
	'glslang'
	'hicolor-icon-theme'
	'qt6-base'
	'qt6-multimedia'
	'sdl2'
)
makedepends=(
	'boost'
	'catch2'
	'cmake'
	'cpp-jwt'
	'cubeb'
	'ffmpeg4.4'
	'fmt'
	'git'
	'libbacktrace'
	'libinih'
	'libusb'
	'nlohmann-json'
	'openal'
	'openssl'
	'qt6-tools'
	'rapidjson'
	'robin-map'
	'spirv-headers'
	'vulkan-headers'
	'vulkan-memory-allocator'
	'zydis'
)
provides=("$_pkgname=$pkgver")
conflicts=("$_pkgname")
source=(
	"$_pkgname::git+https://github.com/azahar-emu/azahar.git"
	"$_pkgname-compatibility-list::git+https://github.com/azahar-emu/compatibility-list.git"
	"$_pkgname-discord-rpc::git+https://github.com/azahar-emu/discord-rpc.git"
	"$_pkgname-dynarmic::git+https://github.com/azahar-emu/dynarmic.git"
	"$_pkgname-mcl::git+https://github.com/azahar-emu/mcl.git"
	"$_pkgname-sirit::git+https://github.com/azahar-emu/sirit.git"
	"$_pkgname-soundtouch::git+https://github.com/azahar-emu/soundtouch.git"
	"dds-ktx::git+https://github.com/septag/dds-ktx.git"
	"faad2::git+https://github.com/knik0/faad2.git"
	"lodepng::git+https://github.com/lvandeve/lodepng.git"
	"nihstro::git+https://github.com/neobrain/nihstro.git"
	"teakra::git+https://github.com/wwylele/teakra.git"
	"xbyak::git+https://github.com/herumi/xbyak.git"
	"zstd::git+https://github.com/facebook/zstd.git"
)
b2sums=('SKIP'{,,,,,,,,,,,,,})

pkgver() {
	cd $_pkgname
	git describe --long --tags --abbrev=7 | sed 's/[^-]*-g/r&/;s/-/./g'
}

prepare() {
	cd $_pkgname
	git config submodule.compatibility-list.url ../$_pkgname-compatibility-list
	git config submodule.dds-ktx.url ../dds-ktx
	git config submodule.discord-rpc.url ../$_pkgname-discord-rpc
	git config submodule.dynarmic.url ../$_pkgname-dynarmic
	git config submodule.faad2.url ../faad2
	git config submodule.lodepng.url ../lodepng
	git config submodule.nihstro.url ../nihstro
	git config submodule.sirit.url ../$_pkgname-sirit
	git config submodule.soundtouch.url ../$_pkgname-soundtouch
	git config submodule.teakra.url ../teakra
	git config submodule.xbyak.url ../xbyak
	git config submodule.zstd.url ../zstd
	git -c protocol.file.allow=always submodule update
	cd externals/dynarmic
	git config submodule.mcl.url ../../../$_pkgname-mcl
	git -c protocol.file.allow=always submodule update
	# ignore unneeded missing submodules
	sed -i '/check_submodules_present()/d' ../../CMakeLists.txt
	# fix zstd include
	sed -i 's|zstd/contrib/seekable_format/||' ../../src/common/zstd_compression.cpp
	# use system spirv-tools
	sed -i '/spirv-tools/d' ../../externals/CMakeLists.txt
	# fix qt include dir
	sed -i '/COMPONENTS/s/ Gui /&GuiPrivate /' ../../src/citra_qt/CMakeLists.txt
	sed -i '/Qt6Gui_PRIVATE_INCLUDE_DIRS/c target_link_libraries(citra_qt PRIVATE Qt6::GuiPrivate)' ../../src/citra_qt/CMakeLists.txt
}

build() {
	local options=(
		-D CITRA_USE_PRECOMPILED_HEADERS=OFF
		-D CITRA_WARNINGS_AS_ERRORS=OFF
		-D CMAKE_BUILD_TYPE=Release
		-D CMAKE_C_FLAGS_RELEASE="-DNDEBUG"
		-D CMAKE_CXX_FLAGS_RELEASE="-DNDEBUG"
		-D CMAKE_INCLUDE_PATH="/usr/include/ffmpeg4.4"
		-D CMAKE_INSTALL_PREFIX=/usr
		-D DISABLE_SYSTEM_CPP_HTTPLIB=ON
		-D DISABLE_SYSTEM_DYNARMIC=ON
		-D DISABLE_SYSTEM_LODEPNG=ON
		-D DISABLE_SYSTEM_SOUNDTOUCH=ON
		-D DISABLE_SYSTEM_XBYAK=ON
		-D DISABLE_SYSTEM_ZSTD=ON
		-D ENABLE_LTO=OFF
		-D ENABLE_QT_TRANSLATION=ON
		-D ENABLE_ROOM_STANDALONE=OFF
		-D ENABLE_TESTS="$CHECKFUNC"
		-D USE_DISCORD_PRESENCE=ON
		-D USE_SYSTEM_LIBS=ON
		-Wno-dev
	)
	local flags
	IFS=' ' read -r -a flags <<< "$CXXFLAGS"
	if ! g++ "${flags[@]}" -dM -E - < /dev/null | grep -q __SSE4_2__; then
		options+=(-D ENABLE_SSE42=OFF)
	fi
	cd $_pkgname
	cmake "${options[@]}" -B build
	cmake --build build
}

check() {
	cd $_pkgname
	ctest --output-on-failure --test-dir build
}

package() {
	depends+=(
		'libbacktrace.so'
		'libboost_iostreams.so'
		'libboost_serialization.so'
		'libcrypto.so'
		'libcubeb.so'
		'libfmt.so'
		'libopenal.so'
		'libssl.so'
		'libusb-1.0.so'
		'libZydis.so'
	)
	cd $_pkgname
	# shellcheck disable=SC2154
	DESTDIR="$pkgdir" cmake --install build
}