summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cf0d0cc9df6ee35b5a0bdde59a3090b8f95791f9 (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: Alexandre Bouvier <contact@amb.tf>
_pkgname=shadps4
pkgname=$_pkgname-git
pkgver=0.15.0.r72.gcead66d
pkgrel=1
pkgdesc="Sony PlayStation 4 emulator (CLI)"
arch=('aarch64' 'x86_64')
url="https://shadps4.net/"
license=('GPL-2.0-or-later')
depends=(
	'glibc'
	'glslang>=15'
	'miniz>=3.1'
	'pugixml>=1.14'
	'sdl3>=3.3.5'
	'sdl3_image'
	'sdl3_mixer'
)
makedepends=(
	'boost>=1.84'
	'cli11>=2.6.1'
	'cmake>=3.16.3'
	'ffmpeg>=2:5.1.2'
	'fmt>=10.2'
	'git'
	'half>=1.12'
	'libgcc'
	'libpng>=1.6'
	'libstdc++'
	'magic_enum>=0.9.7'
	'nlohmann-json>=3.12'
	'openal'
	'rapidjson'
	'renderdoc'
	'robin-map>=1.3'
	'spirv-headers'
	'stb'
	'systemd-libs'
	'toml11>=4.2'
	'util-linux-libs'
	'vulkan-headers>=1:1.4.329'
	'vulkan-memory-allocator>=3.1'
	'xbyak>=7.07'
	'xxhash>=0.8.2'
	'zlib'
	'zycore-c' # 'zydis>=5'
)
optdepends=(
	'renderdoc: for graphics debugging'
	'shadps4-qtlauncher: for official Qt GUI'
	'vulkan-validation-layers: for vulkan debugging'
)
provides=("$_pkgname=$pkgver")
conflicts=("$_pkgname")
source=(
	"$_pkgname::git+https://github.com/shadps4-emu/shadPS4.git"
	"$_pkgname-discord-rpc::git+https://github.com/shadps4-emu/ext-discord-rpc.git"
	"$_pkgname-hwinfo::git+https://github.com/shadps4-emu/ext-hwinfo.git"
	"$_pkgname-imgui::git+https://github.com/shadps4-emu/ext-imgui.git"
	"$_pkgname-libatrac9::git+https://github.com/shadps4-emu/ext-LibAtrac9.git"
	"$_pkgname-libusb::git+https://github.com/shadexternals/libusb.git"
	"$_pkgname-sirit::git+https://github.com/shadps4-emu/sirit.git"
	"$_pkgname-tracy::git+https://github.com/shadps4-emu/tracy.git"
	"aac::git+https://android.googlesource.com/platform/external/aac.git"
	"zydis::git+https://github.com/zyantific/zydis.git"
)
b2sums=('SKIP'{,,,,,,,,,})

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

prepare() {
	cd $_pkgname
	git config submodule.externals/aacdec/fdk-aac.url ../aac
	git config submodule.externals/dear_imgui.url ../$_pkgname-imgui
	git config submodule.externals/discord-rpc.url ../$_pkgname-discord-rpc
	git config submodule.externals/hwinfo.url ../$_pkgname-hwinfo
	git config submodule.externals/LibAtrac9.url ../$_pkgname-libatrac9
	git config submodule.externals/libusb.url ../$_pkgname-libusb
	git config submodule.externals/sirit.url ../$_pkgname-sirit
	git config submodule.externals/tracy.url ../$_pkgname-tracy
	git config submodule.externals/zydis.url ../zydis
	git -c protocol.file.allow=always submodule update
	# remove hardcoded flag
	sed -i '/-march=/d' CMakeLists.txt
	# use system glslang
	sed -i '/find_package/s/glslang 15/glslang/' CMakeLists.txt
	# use system sdl3_mixer
	sed -i 's/MIX_\(G\|S\)etMasterGain/MIX_\1etMixerGain/g' src/core/libraries/np/trophy_ui.cpp
}

build() {
	local options=(
		-B build
		-D CMAKE_BUILD_TYPE=Release
		-D CMAKE_C_FLAGS_RELEASE="-DNDEBUG"
		-D CMAKE_CXX_FLAGS_RELEASE="-DNDEBUG"
		-D CMAKE_INSTALL_PREFIX=/usr
		-D CMAKE_SKIP_INSTALL_RPATH=ON
		-D ENABLE_UPDATER=OFF
		-D SIRIT_USE_SYSTEM_SPIRV_HEADERS=ON
		-W no-dev
	)
	cmake "${options[@]}" $_pkgname
	cmake --build build
}

package() {
	depends+=(
		'libavcodec.so'
		'libavformat.so'
		'libavutil.so'
		'libfmt.so'
		'libgcc_s.so'
		'libopenal.so'
		'libpng16.so'
		'libstdc++.so'
		'libswresample.so'
		'libswscale.so'
		'libudev.so'
		'libuuid.so'
		'libxxhash.so'
		'libz.so'
		# 'libZydis.so'
	)

	# shellcheck disable=SC2154
	DESTDIR="$pkgdir" cmake --install build
}