unreal-engine-src-5.4
LOW
maintainer FinleyLaempe
0 votes
scanned 2026-10-06 14:02:37.567106
Why flagged
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
Triggered rules
Low
Few votes, recently uploaded
zero_votes_recent
Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.
PKGBUILD
1
# Maintainer: Finley Laempe <finley.laempe@web.de>
2
# Contributor: Alexis Belmonte <alexbelm48@gmail.com>
3
# Contributor: Neko-san <nekoNexus at protonmail dot ch>
4
# Contributor: Dylan Ferris <dylan@psilly.com>
5
# Contributor: Michael Lojkovic <mikelojkovic@gmail.com>
6
# Contributor: Shatur95 <genaloner@gmail.com>
7
# Contributor: slx
8
#
9
# Based on the `unreal-engine` AUR package (https://aur.archlinux.org/packages/unreal-engine),
10
# maintained by Alexis Belmonte. The build logic in this PKGBUILD, the launcher, desktop
11
# entry, pacman hook and icon are copied from it, and its patches are taken automatically
12
# from its newest release of each Unreal Engine version.
13
# Patches in this package: upstream commit f5fa798 (5.4.4, Neko-san)
14
#
15
# Per-minor parallel-install variant, published from:
16
# https://github.com/FinleyLaempe/aur-unreal-engine-src
17
18
# The source is about 200 MiB, with an extra ~11 GiB of dependencies downloaded in Setup.sh, and may take several hours to compile.
19
# If you want additional options, there are switches below.
20
pkgname=unreal-engine-src-5.4
21
pkgver=5.4.4
22
pkgrel=1
23
_uetag="${pkgver}-release"
24
_ueminor="5.4"
25
_ueminor_us="5_4"
26
# Empty override = parse from cloned UE5 repo's Engine/Config/Linux/Linux_SDK.json at build time
27
_ue_sdk_override=""
28
pkgdesc='A 3D game engine by Epic Games which can be used non-commercially for free.'
29
arch=('x86_64' 'x86_64_v2' 'x86_64_v3' 'x86_64_v4' 'aarch64')
30
url=https://www.unrealengine.com/
31
makedepends=('git' 'openssh' 'sed' 'grep' 'glibc' 'wget' 'rsync' 'curl')
32
depends=('sdl3' 'python' 'dotnet-runtime' 'dotnet-sdk' 'vulkan-icd-loader' 'lld' 'xdg-user-dirs' 'dos2unix' 'openssl' 'steam' 'coreutils' 'findutils')
33
optdepends=('polly: for potentially increased performance'
34
'qt5-base: qmake build system for projects'
35
'cmake: build system for projects'
36
'qtcreator: IDE for projects'
37
'codelite: IDE for projects'
38
'kdevelop: IDE for projects'
39
'clion: IDE for projects'
40
'rider: IDE for projects'
41
'code: IDE for projects'
42
'pacman-contrib: for the paccache cleaning hook'
43
'fake-ms-fonts: Font support for "demo/free/sample/example/tutorial" projects'
44
'ttf-ms-fonts: Font support for "demo/free/sample/example/tutorial" projects')
45
license=('custom:UnrealEngine' 'GPL3')
46
# Toolchain tarball is NOT in source=(); downloaded by prepare() after clone
47
# once SDK_VERSION is known (either from or parsed
48
# from the cloned UE5 repo's Engine/Config/Linux/Linux_SDK.json).
49
source=('unreal-engine-5.4.sh'
50
'com.unrealengine.UE5_4Editor.desktop'
51
'unreal-engine-src-5.4-pacman-cache.hook'
52
'ue5_4editor.svg')
53
sha256sums=('SKIP'
54
'SKIP'
55
'SKIP'
56
'SKIP')
57
# Not sure if compiling Unreal with LTO is legal? Lot's of different proprietary software goes into Unreal
58
# 'staticlibs' kept: the installed engine ships .a files needed to link C++ projects.
59
# 'strip' left ON (no '!strip'): UE5 debug symbols add tens of GiB; stripping is the
60
# single biggest size win.
61
# '!debug': do NOT emit a separate -debug subpackage. Its files live under
62
# /usr/lib/debug/.build-id/<hash> keyed by content hash, so two minors that share
63
# any identical object collide on install (e.g. 5.4-debug vs 5.7-debug) — which
64
# would break parallel installation of multiple unreal-engine-src-5.X packages.
65
# We strip and discard the symbols instead of packaging them.
66
options=('staticlibs' '!debug')
67
68
# Default engine installation directory. Can be useful if you do not have a lot of space on the default storage drive
69
# DON'T put a "/" at the start of the path
70
## Set this as an environment variable in /etc/makepkg.conf if you want predefined behavior
71
if [[ "${UE_INSTALL_DIR}" == "" ]]; then
72
export UE_INSTALL_DIR="opt/unreal-engine-src-5.4"
73
fi
74
75
# Change this to true if you have a modern system and don't mind the extra packaging time (and size) to avoid compiling shaders on UE startup later; set to false by default for those with less robust systems
76
## Set this as an environment variable in /etc/makepkg.conf if you want predefined behavior
77
if [[ "${UE_WITH_DDC}" != "true" && "${UE_WITH_DDC}" != "false" ]]; then
78
# Skip the prebuilt Derived Data Cache by default: it adds hours to the
79
# build (compiles shader permutations for every sample asset) and the
80
# Editor compiles shaders on first launch anyway. Override with
81
# UE_WITH_DDC=true in /etc/makepkg.conf or on the makepkg command line if
82
# you want the shipped-shader experience at the cost of build time.
83
export UE_WITH_DDC=false
84
fi
85
86
# Enable Win64 toolchain/components in BuildGraph for cross-compilation targets.
87
# Default false: shipping the Win64 cross toolchain + binaries adds ~10-20 GiB to
88
# the package and is useless unless you actually cross-compile for Windows.
89
## Set this as an environment variable in /etc/makepkg.conf if you want predefined behavior
90
if [[ "${UE_WITH_WIN64}" != "true" && "${UE_WITH_WIN64}" != "false" ]]; then
91
export UE_WITH_WIN64=false
92
fi
93
94
# Keep full debug info in produced binaries
95
## Set this as an environment variable in /etc/makepkg.conf if you want predefined behavior
96
if [[ "${UE_WITH_FULL_DEBUG_INFO}" != "true" && "${UE_WITH_FULL_DEBUG_INFO}" != "false" ]]; then
97
export UE_WITH_FULL_DEBUG_INFO=false
98
fi
99
100
# BuildGraph platform toggles
101
## Set these as environment variables in /etc/makepkg.conf if you want predefined behavior
102
if [[ "${UE_WITH_LINUX}" != "true" && "${UE_WITH_LINUX}" != "false" ]]; then
103
export UE_WITH_LINUX=true
104
fi
105
106
# Linux AArch64 (arm64) target. InstalledEngineBuild.xml defaults this ON
107
# (DefaultWithLinuxArm64=true), which cross-compiles a full second arm64 target
108
# on an x86_64 host: it roughly doubles build time and package size, and host
109
# strip/fakeroot can't process the arm64 .a/.debug files (harmless warnings).
110
# Default false; set UE_WITH_LINUX_ARM64=true if you actually ship to arm64 Linux.
111
if [[ "${UE_WITH_LINUX_ARM64}" != "true" && "${UE_WITH_LINUX_ARM64}" != "false" ]]; then
112
export UE_WITH_LINUX_ARM64=false
113
fi
114
115
if [[ "${UE_WITH_MAC}" != "true" && "${UE_WITH_MAC}" != "false" ]]; then
116
export UE_WITH_MAC=false
117
fi
118
119
if [[ "${UE_WITH_ANDROID}" != "true" && "${UE_WITH_ANDROID}" != "false" ]]; then
120
export UE_WITH_ANDROID=false
121
fi
122
123
if [[ "${UE_WITH_IOS}" != "true" && "${UE_WITH_IOS}" != "false" ]]; then
124
export UE_WITH_IOS=false
125
fi
126
127
if [[ "${UE_WITH_TVOS}" != "true" && "${UE_WITH_TVOS}" != "false" ]]; then
128
export UE_WITH_TVOS=false
129
fi
130
131
# BuildGraph game configurations string (semicolon-separated)
132
## Set this as an environment variable in /etc/makepkg.conf if you want predefined behavior
133
if [[ -z "${UE_GAME_CONFIGURATIONS}" ]]; then
134
export UE_GAME_CONFIGURATIONS="Development;Shipping"
135
fi
136
137
# Optional BuildGraph architecture override: x64 or arm64
138
## Leave unset to auto-detect from host architecture
139
if [[ -n "${UE_BUILD_ARCH_OVERRIDE}" && "${UE_BUILD_ARCH_OVERRIDE}" != "x64" && "${UE_BUILD_ARCH_OVERRIDE}" != "arm64" ]]; then
140
msg "Invalid UE_BUILD_ARCH_OVERRIDE='${UE_BUILD_ARCH_OVERRIDE}'. Expected 'x64' or 'arm64'. Ignoring override."
141
unset UE_BUILD_ARCH_OVERRIDE
142
fi
143
144
# Change this if you want an alternative non-default logo for UE5's desktop icon; the default logo is enabled by default
145
## Set this as an environment variable in /etc/makepkg.conf if you want predefined behavior
146
if [[ "${UE_USE_DEFAULT_LOGO_AT_INSTALL}" != "1" && "${UE_USE_DEFAULT_LOGO_AT_INSTALL}" != "0" ]]; then
147
export UE_USE_DEFAULT_LOGO_AT_INSTALL=1
148
fi
149
150
151
## This is for detecting your CPU architecture automatically; set to false if you want to enforce your own makepkg.conf file
152
## Disabled by default as a compromise for those bothered by having it force-enabled
153
154
## Note: the resulting package will still be named containing "x86_64" unless the build was done with an "official" Arch distro for that architecture (like Arch ARM - [don't exactly advise using Arch ARM though])
155
## or if you manage to trick your Arch installation to accept other architecture extensions by fiddling with the $CARCH variable and /etc/pacman.conf - this method has flaws, namely due to a bug:
156
## it doesn't work with "makechrootpkg" - though, this PKGBUILD doesn't work in with this method anyway because of Github SSH Agent nonsense -- if this changes in the future, let us know
157
158
# Valid values are false / disabled / default, auto, and native
159
160
# UE_ARCH_AUTO=""
161
162
if [[ -n "$(command -v tr)" ]]; then
163
# shellcheck disable=SC2006
164
UE_ARCH_AUTO="$(echo "${UE_ARCH_AUTO}" | tr '[:upper:]' '[:lower:]')"
165
fi
166
167
case "${UE_ARCH_AUTO}" in
168
"auto"|"true"|"enable"|"enabled"|"1"|"native"|"false"|"disable"|"disabled"|"2")
169
:
170
;;
171
172
*)
173
UE_ARCH_AUTO=false
174
;;
175
esac
176
177
if [[ ${CFLAGS} =~ -O([0-9]+) ]]; then
178
_ue_opt_level="-O${BASH_REMATCH[1]}"
179
else
180
_ue_opt_level="-O3"
181
fi
182
183
_ue_polly_path="$(find /usr/lib /usr/lib64 -name 'LLVMPolly.so' -print -quit 2>/dev/null)"
184
185
if [[ -n "${_ue_polly_path}" ]]; then
186
export CFLAGS="${CFLAGS} -fplugin=LLVMPolly.so -mllvm=-polly -mllvm=-polly-ast-use-context -mllvm=-polly-vectorizer=stripmine -mllvm=-polly-invariant-load-hoisting -mllvm=-polly-run-inliner -mllvm=-polly-run-dce"
187
fi
188
189
_ue_arch="$(uname -m)"
190
191
_ue_common_cflags="${_ue_opt_level} -pipe -fno-plt -fstack-clash-protection -fstack-protector-strong -fcf-protection -Wl,-z,relro,-z,now -Wformat -Werror=format-security -fPIC -fPIE -Wp,-D_FORTIFY_SOURCE=2"
192
_ue_common_ldflags="-pie -Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now"
193
194
_ue_is_arch_auto_enabled() {
195
case "$1" in
196
auto|true|enable|enabled|1) return 0 ;;
197
*) return 1 ;;
198
esac
199
}
200
201
_ue_set_arch_flags() {
202
local _ue_march="$1"
203
local _ue_tune="$2"
204
205
export CFLAGS="${CFLAGS} -march=${_ue_march} ${_ue_tune} ${_ue_common_cflags}"
206
export CXXFLAGS="${CFLAGS} -Wp,-D_GLIBCXX_ASSERTIONS"
207
export LDFLAGS="${_ue_common_ldflags}"
208
}
209
210
_ue_detect_x86_64_march() {
211
local _ue_ldso="/lib/ld-linux-x86-64.so.2"
212
local _ue_ld_help
213
214
_ue_ld_help="$("${_ue_ldso}" --help 2>/dev/null || true)"
215
216
if grep -qw "x86-64-v4 (supported" <<< "${_ue_ld_help}"; then
217
echo "x86-64-v4"
218
elif grep -qw "x86-64-v3 (supported" <<< "${_ue_ld_help}"; then
219
echo "x86-64-v3"
220
elif grep -qw "x86-64-v2 (supported" <<< "${_ue_ld_help}"; then
221
echo "x86-64-v2"
222
elif grep -Ewq "x86_64.*supported" <<< "${_ue_ld_help}"; then
223
echo "x86-64"
224
else
225
echo ""
226
fi
227
}
228
229
_ue_map_build_arch() {
230
local _ue_source_arch="$1"
231
232
case "${_ue_source_arch}" in
233
x86_64) echo "x64" ;;
234
aarch64) echo "arm64" ;;
235
*) echo "" ;;
236
esac
237
}
238
239
if [[ -n "${UE_BUILD_ARCH_OVERRIDE}" ]]; then
240
_ue_build_arch="${UE_BUILD_ARCH_OVERRIDE}"
241
else
242
_ue_build_arch="$(_ue_map_build_arch "${_ue_arch}")"
243
fi
244
245
if _ue_is_arch_auto_enabled "${UE_ARCH_AUTO}"; then
246
247
if [[ "${_ue_arch}" == "x86_64" ]]; then
248
_ue_detected_march="$(_ue_detect_x86_64_march)"
249
250
if [[ -n "${_ue_detected_march}" ]]; then
251
_ue_set_arch_flags "${_ue_detected_march}" ""
252
else
253
msg "Could not detect a supported x86_64 micro-architecture level. Exiting."
254
return 1
255
fi
256
elif [[ "${_ue_arch}" == "aarch64" ]]; then
257
_ue_set_arch_flags "aarch64" ""
258
else
259
msg "Architecture '${_ue_arch}' is not supported! Exiting."
260
return 1
261
fi
262
elif [[ "${UE_ARCH_AUTO}" == "native" ]]; then
263
_ue_set_arch_flags "native" "-mtune=native"
264
fi
265
266
case "${UE_ARCH_AUTO}" in
267
"auto"|"true"|"enable"|"enabled"|"native"|"1")
268
:
269
;;
270
271
*)
272
if [[ -n "${_ue_polly_path}" ]]; then
273
## Make sure that if polly is installed and the auto-flags above are not used, to add the polly flags to CXXFLAGS for consistency with having them set as CFLAGS
274
CXXFLAGS="${CXXFLAGS} -fplugin=LLVMPolly.so -mllvm=-polly -mllvm=-polly-ast-use-context -mllvm=-polly-vectorizer=stripmine -mllvm=-polly-invariant-load-hoisting -mllvm=-polly-run-inliner -mllvm=-polly-run-dce"
275
fi
276
;;
277
esac
278
279
# Causes a SEGV during derived data cache build if not set
280
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
281
282
# Ported from upstream (5.8.2): the Roslyn compiler server coordinates through named
283
# mutexes backed by lock files under ${TMPDIR}/.dotnet/shm; concurrent MSBuild nodes
284
# racing on them intermittently fail with "MSB3883: ReleaseMutex failed". Compiling
285
# in-process sidesteps the server (MSBuild reads this as a global property, so it
286
# also covers BuildGraph/UAT), and disabling node reuse stops stale nodes outliving
287
# makepkg.
288
export UseSharedCompilation=false
289
export MSBUILDDISABLENODEREUSE=1
290
291
prepare() {
292
# --- Probe GitHub access (SSH first, HTTPS fallback) ---
293
local _ue_remote_ssh="git@github.com:EpicGames/UnrealEngine.git"
294
local _ue_remote_https="https://github.com/EpicGames/UnrealEngine.git"
295
local _ue_remote=""
296
297
msg "Probing GitHub access to EpicGames/UnrealEngine..."
298
if git ls-remote "${_ue_remote_ssh}" &>/dev/null; then
299
_ue_remote="${_ue_remote_ssh}"
300
msg " -> SSH OK, using ${_ue_remote}"
301
elif git ls-remote "${_ue_remote_https}" &>/dev/null; then
302
_ue_remote="${_ue_remote_https}"
303
msg " -> SSH failed, HTTPS OK, using ${_ue_remote}"
304
else
305
error "Cannot access EpicGames/UnrealEngine via SSH or HTTPS."
306
error "You must:"
307
error " 1. Have a GitHub account linked to your Epic Games account:"
308
error " https://www.unrealengine.com/en-US/ue-on-github"
309
error " 2. Accept the @EpicGames org invitation in your GitHub inbox."
310
error " 3. Configure either:"
311
error " - SSH: 'ssh -T git@github.com' must succeed with your key"
312
error " - HTTPS: 'gh auth login' or git credential helper with PAT (repo scope)"
313
error "Probed: ${_ue_remote_ssh} and ${_ue_remote_https}"
314
exit 1
315
fi
316
317
# --- Build config summary (preserved from upstream lines 255–311) ---
318
local _ue_commit="not-cloned"
319
local _ue_install_path="/${UE_INSTALL_DIR#/}"
320
local _ue_arch_label="${_ue_build_arch:-unknown}"
321
local _ue_arch_detail=""
322
local _ue_ddc_text="no"
323
local _ue_debug_text="no"
324
local _ue_default_logo_text="yes"
325
local _ue_target_platforms=()
326
local _ue_platforms_csv="none"
327
328
if [[ -d "${pkgname}/.git" ]]; then
329
_ue_commit="$(git -C "${pkgname}" rev-parse --short HEAD 2>/dev/null || echo unknown)"
330
fi
331
if [[ "${_ue_arch_label}" == "x64" ]]; then
332
if [[ -n "${_ue_detected_march}" ]]; then
333
_ue_arch_detail=" (${_ue_detected_march})"
334
elif [[ ${CFLAGS} =~ -march=([^[:space:]]+) ]]; then
335
_ue_arch_detail=" (${BASH_REMATCH[1]})"
336
else
337
_ue_arch_detail=" (x86_64)"
338
fi
339
elif [[ "${_ue_arch_label}" == "arm64" ]]; then
340
if [[ ${CFLAGS} =~ -march=([^[:space:]]+) ]]; then
341
_ue_arch_detail=" (${BASH_REMATCH[1]})"
342
else
343
_ue_arch_detail=" (aarch64)"
344
fi
345
fi
346
[[ "${UE_WITH_DDC}" == "true" ]] && _ue_ddc_text="yes"
347
[[ "${UE_WITH_FULL_DEBUG_INFO}" == "true" ]] && _ue_debug_text="yes"
348
[[ "${UE_USE_DEFAULT_LOGO_AT_INSTALL}" == "0" ]] && _ue_default_logo_text="no"
349
[[ "${UE_WITH_WIN64}" == "true" ]] && _ue_target_platforms+=("Windows")
350
[[ "${UE_WITH_LINUX}" == "true" ]] && _ue_target_platforms+=("Linux")
351
[[ "${UE_WITH_MAC}" == "true" ]] && _ue_target_platforms+=("macOS")
352
[[ "${UE_WITH_TVOS}" == "true" ]] && _ue_target_platforms+=("tvOS")
353
[[ "${UE_WITH_ANDROID}" == "true" ]] && _ue_target_platforms+=("Android")
354
[[ "${UE_WITH_IOS}" == "true" ]] && _ue_target_platforms+=("iOS")
355
if (( ${#_ue_target_platforms[@]} > 0 )); then
356
local IFS=", "
357
_ue_platforms_csv="${_ue_target_platforms[*]}"
358
fi
359
msg ''
360
msg "Unreal Engine ${pkgver} (commit ${_ue_commit}) build options summary:"
361
msg ''
362
msg "- End package installation path: ${_ue_install_path}"
363
msg "- Target architecture build: ${_ue_arch_label}${_ue_arch_detail}"
364
msg "- Integrate prebuilt shader cache: ${_ue_ddc_text}"
365
msg "- Target platforms supported for export: ${_ue_platforms_csv}"
366
msg "- Game configurations: ${UE_GAME_CONFIGURATIONS}"
367
msg "- Include full debug info: ${_ue_debug_text}"
368
msg "- Use default logo at install: ${_ue_default_logo_text}"
369
msg ''
370
371
# --- Clone or update UE5 source ---
372
if [[ ! -d "${pkgname}" ]]; then
373
git clone --depth=1 --branch="${_uetag}" "${_ue_remote}" "${pkgname}"
374
else
375
cd "${pkgname}"
376
if [[ "$(git describe --tags 2>/dev/null)" != "${_uetag}" ]]; then
377
cd .. && rm -rf "${pkgname}"
378
git clone --depth=1 --branch="${_uetag}" "${_ue_remote}" "${pkgname}"
379
else
380
rm -f .git/index.lock
381
git fetch --depth=1 origin tag "${_uetag}"
382
git reset --hard "${_uetag}"
383
cd ..
384
fi
385
fi
386
387
# --- Apply patches (upstream's for this minor + local extras; continues on failure per upstream behaviour) ---
388
for patch_file in ../*.patch; do
389
[[ -f "${patch_file}" ]] || continue
390
msg "Applying ${patch_file}"
391
if ! patch -p1 -d "${pkgname}" -i "${patch_file}"; then
392
msg "Some or all of the patch at ${patch_file} failed to apply. Will still try to build."
393
fi
394
done
395
396
cd "${pkgname}" || return
397
398
# --- Qt Creator source code access (preserved from upstream) ---
399
if [[ ! -d Engine/Plugins/Developer/QtCreatorSourceCodeAccess ]]; then
400
git -C Engine/Plugins/Developer clone --depth=1 https://github.com/fire-archive/QtCreatorSourceCodeAccess
401
fi
402
403
# --- HaveLinuxDependencies marker (preserved from upstream) ---
404
if [[ ! -f Engine/Source/ThirdParty/Linux/HaveLinuxDependencies ]]; then
405
mkdir -p Engine/Source/ThirdParty/Linux/
406
touch Engine/Source/ThirdParty/Linux/HaveLinuxDependencies
407
sed -i "1c\This file must have no extension so that GitDeps considers it a binary dependency - it will only be pulled by the Setup script if Linux is enabled. Please do not remove this file." Engine/Source/ThirdParty/Linux/HaveLinuxDependencies
408
fi
409
410
# --- Suppress UnrealVersionSelector self-registration in Setup.sh ---
411
# Setup.sh runs `UnrealVersionSelector-Linux-Shipping -register`, which writes
412
# an engine-ID -> path map to ~/.config/Epic/UnrealEngine/Install.ini and drops
413
# com.epicgames.* desktop entries (an "editor" and a "generate project files"
414
# applet). At BUILD time those record the transient build-tree path, not the
415
# final /${UE_INSTALL_DIR}, so they would point nowhere post-install. We strip
416
# the build-time call and instead register at first launch from the launcher,
417
# where UVS runs from the real /${UE_INSTALL_DIR} binary and records the
418
# correct path (so .uproject double-click/right-click associations work).
419
if [[ -f Setup.sh ]]; then
420
sed -i '/UnrealVersionSelector-Linux-Shipping -register/d' Setup.sh
421
fi
422
423
# --- Resolve SDK_VERSION ---
424
# MUST happen BEFORE Setup.sh: SetupToolchain.sh (invoked by Setup.sh)
425
# downloads the toolchain itself, and Epic's CDN download path is slow/
426
# flaky enough that it routinely fails partway through. By extracting our
427
# own tarball into the expected destination first, SetupToolchain.sh's
428
# "already installed" check passes and the embedded downloader is skipped
429
# entirely.
430
local _sdk_ver="${_ue_sdk_override}"
431
if [[ -z "${_sdk_ver}" ]]; then
432
# Newer UE (5.1+) declares the toolchain in Engine/Config/Linux/Linux_SDK.json
433
# ("MainVersion"). Older UE (e.g. 5.0) has no such JSON and instead hardcodes
434
# it in UnrealBuildTool's LinuxPlatformSDK.cs GetMainVersion() as
435
# return "v20_clang-13.0.1-centos7";
436
# Try the JSON first, then fall back to parsing the .cs return string.
437
local _sdk_json="${srcdir}/${pkgname}/Engine/Config/Linux/Linux_SDK.json"
438
local _sdk_cs="${srcdir}/${pkgname}/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxPlatformSDK.cs"
439
if [[ -f "${_sdk_json}" ]]; then
440
_sdk_ver=$(grep -oE '"MainVersion"[[:space:]]*:[[:space:]]*"[^"]+"' "${_sdk_json}" | \
441
sed -E 's/.*"MainVersion"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
442
elif [[ -f "${_sdk_cs}" ]]; then
443
# First `return "v<NN>_clang-...";` inside GetMainVersion(). Excludes the
444
# `// Example: v11_...` comment because grep matches the `return "` prefix.
445
_sdk_ver=$(grep -oE 'return[[:space:]]+"v[0-9]+_clang-[^"]+"' "${_sdk_cs}" | \
446
head -1 | sed -E 's/.*"(v[0-9]+_clang-[^"]+)".*/\1/')
447
else
448
error "Cannot find ${_sdk_json} or ${_sdk_cs}; cannot resolve SDK_VERSION."
449
exit 1
450
fi
451
fi
452
if [[ -z "${_sdk_ver}" ]]; then
453
error "Failed to parse SDK_VERSION from Linux_SDK.json or LinuxPlatformSDK.cs."
454
exit 1
455
fi
456
# Linux_SDK.json's MainVersion is the bare toolchain identifier
457
# (e.g. "v26_clang-20.1.8-rockylinux8"). Epic's CDN serves it as
458
# "native-linux-<MainVersion>.tar.gz" so add the prefix if it's not
459
# already present (handles user overrides that already include it).
460
local _sdk_basename="${_sdk_ver}"
461
if [[ "${_sdk_basename}" != native-linux-* ]]; then
462
_sdk_basename="native-linux-${_sdk_basename}"
463
fi
464
msg "Resolved SDK_VERSION=${_sdk_ver} (tarball: ${_sdk_basename}.tar.gz)"
465
466
# --- Download + extract toolchain (before Setup.sh) ---
467
local _sdk_url="https://cdn.unrealengine.com/Toolchain_Linux/${_sdk_basename}.tar.gz"
468
local _sdk_tar="${srcdir}/${_sdk_basename}.tar.gz"
469
# Host toolchain dir is named by host arch (Linux_x64 / Linux_arm64). Use the
470
# arch we already detected from uname so an arm64 host extracts to the right
471
# place instead of a hardcoded x64 path.
472
local _sdk_dest="${srcdir}/${pkgname}/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_${_ue_build_arch:-x64}/"
473
if [[ ! -f "${_sdk_tar}" ]]; then
474
msg "Downloading SDK toolchain from ${_sdk_url}"
475
curl -fL --retry 3 -o "${_sdk_tar}" "${_sdk_url}" || {
476
error "Failed to download SDK toolchain from ${_sdk_url}"
477
exit 1
478
}
479
fi
480
mkdir -p "${_sdk_dest}"
481
# Only extract if not already done (idempotent across resume attempts).
482
if [[ ! -d "${_sdk_dest}${_sdk_basename}" ]]; then
483
msg "Extracting SDK toolchain to ${_sdk_dest}"
484
tar -xf "${_sdk_tar}" -C "${_sdk_dest}"
485
else
486
msg "SDK toolchain already extracted at ${_sdk_dest}${_sdk_basename}"
487
fi
488
489
# --- Setup.sh (now sees existing toolchain, skips its own download) ---
490
./Setup.sh
491
cd "${srcdir}" || return
492
493
# --- Build third-party + dotnet setup (preserved from upstream) ---
494
"${srcdir}/${pkgname}/Engine/Build/BatchFiles/Linux/BuildThirdParty.sh"
495
"${srcdir}/${pkgname}/Engine/Build/BatchFiles/Linux/SetupDotnet.sh"
496
"${srcdir}/${pkgname}/Engine/Build/BatchFiles/Linux/FixDependencyFiles.sh"
497
}
498
499
build() {
500
cd "${pkgname}" || return
501
502
# Rebuild UBT from patched source so the pre-built dll is replaced before BuildGraph runs.
503
# RunUBT.sh skips the rebuild when InstalledBuild.txt exists, so we must do it explicitly here.
504
if ! dotnet build "Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj" \
505
-c Development \
506
-o "Engine/Binaries/DotNET/UnrealBuildTool" \
507
--no-self-contained \
508
-p:GenerateDocumentationFile=false; then
509
error 'Failed to rebuild UnrealBuildTool.'
510
return 1
511
fi
512
513
local _ue_buildgraph_arch_arg=()
514
515
if [[ -n "${_ue_build_arch}" ]]; then
516
_ue_buildgraph_arch_arg=(-set:BuildArchitecture="${_ue_build_arch}")
517
fi
518
519
# DDC commandlet routinely SIGSEGVs at editor shutdown (LockFreeFixedSizeAllocator
520
# assertion, UE5 Vulkan-RHI cleanup bug). When the user hasn't explicitly opted
521
# in, skip the BuildGraph node by name in addition to -set:WithDDC=false so a
522
# stale env value can't reintroduce the crash. The editor compiles shaders on
523
# first launch instead.
524
local _ue_buildgraph_extra=()
525
if [[ "${UE_WITH_DDC}" != "true" ]]; then
526
_ue_buildgraph_extra+=(-IgnoreNode="Build Derived Data Cache")
527
fi
528
529
# Platform selection matches the proven upstream unreal-engine PKGBUILD: pass
530
# each -set:With* explicitly (no HostPlatformOnly). The per-platform defaults
531
# come from the UE_WITH_* env block above; WithLinuxArm64 is the one we add on
532
# top of upstream to skip the arm64 cross-compile by default.
533
if ! "Engine/Build/BatchFiles/RunUAT.sh" BuildGraph \
534
-target="Make Installed Build Linux" \
535
-script=Engine/Build/InstalledEngineBuild.xml \
536
-nosign \
537
"${_ue_buildgraph_arch_arg[@]}" \
538
"${_ue_buildgraph_extra[@]}" \
539
-set:WithDDC="${UE_WITH_DDC}" \
540
-set:WithLinux="${UE_WITH_LINUX}" \
541
-set:WithLinuxArm64="${UE_WITH_LINUX_ARM64}" \
542
-set:WithWin64="${UE_WITH_WIN64}" \
543
-set:WithMac="${UE_WITH_MAC}" \
544
-set:WithAndroid="${UE_WITH_ANDROID}" \
545
-set:WithIOS="${UE_WITH_IOS}" \
546
-set:WithTVOS="${UE_WITH_TVOS}" \
547
-set:GameConfigurations="${UE_GAME_CONFIGURATIONS}" \
548
-set:WithFullDebugInfo="${UE_WITH_FULL_DEBUG_INFO}"; then
549
error "Build failed; try searching the output for suspicious messages."
550
return 1
551
fi
552
}
553
554
package() {
555
# Desktop entry (rendered with correct Exec + Path per minor; no sed needed)
556
install -Dm644 "com.unrealengine.UE${_ueminor_us}Editor.desktop" \
557
"${pkgdir}/usr/share/applications/com.unrealengine.UE${_ueminor_us}Editor.desktop"
558
chmod +x "${pkgdir}/usr/share/applications/com.unrealengine.UE${_ueminor_us}Editor.desktop"
559
560
## Pacman hook: trim cache to one prior build per minor
561
install -Dm775 "${pkgname}-pacman-cache.hook" \
562
"${pkgdir}/etc/pacman.d/hooks/${pkgname}-pacman-cache.hook"
563
564
install -dm755 "${pkgdir}/usr/bin"
565
install -dm755 "${pkgdir}/usr/share/pixmaps/"
566
install -dm755 "${pkgdir}/usr/share/applications/"
567
568
# Icon for Desktop entry (renamed per minor to avoid pixmap collisions)
569
if [[ "${UE_USE_DEFAULT_LOGO_AT_INSTALL}" == "1" ]]; then
570
install -Dm644 "ue${_ueminor_us}editor.svg" "${pkgdir}/usr/share/pixmaps/ue${_ueminor_us}editor.svg"
571
else
572
mv "ue${_ueminor_us}editor.svg" "ue${_ueminor_us}editor.svg.bak"
573
wget --output-document "ue${_ueminor_us}editor.svg" "https://raw.githubusercontent.com/EliverLara/candy-icons/master/apps/scalable/ue4editor.svg"
574
install -Dm644 "ue${_ueminor_us}editor.svg" "${pkgdir}/usr/share/pixmaps/ue${_ueminor_us}editor.svg"
575
wget --output-document "LICENSE" "https://raw.githubusercontent.com/EliverLara/candy-icons/master/LICENSE"
576
# Per-pkgname dir avoids collision when multiple unreal-engine-src-5.X
577
# packages are installed in parallel.
578
mkdir -p "${pkgdir}/usr/share/${pkgname}/EliverLara-candy-icons/"
579
install -Dm644 LICENSE "${pkgdir}/usr/share/${pkgname}/EliverLara-candy-icons/"
580
rm "ue${_ueminor_us}editor.svg"
581
rm LICENSE
582
mv "ue${_ueminor_us}editor.svg.bak" "ue${_ueminor_us}editor.svg"
583
fi
584
585
# License — per-pkgname dir (Arch convention + avoids collision when
586
# multiple unreal-engine-src-5.X packages are installed in parallel).
587
install -Dm644 "${srcdir}/${pkgname}/LICENSE.md" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.md"
588
589
# Engine
590
## 755, not 777: an Installed Build is redistributable and does NOT write back
591
## into its own install tree at runtime (DDC, config and Saved data go to the
592
## user's home / project dirs). World-writable /opt would let any local user
593
## replace engine binaries another user then executes — a local privesc.
594
install -dm755 "${pkgdir}/${UE_INSTALL_DIR}/Engine"
595
596
# Ship ONLY the Installed Build (the redistributable engine produced by
597
# "Make Installed Build Linux"). It already contains the headers and static
598
# libs needed to compile C++ projects, so we deliberately do NOT also rsync
599
# the full source tree on top — that dragged in .git, Setup.sh's ThirdParty
600
# downloads, the SDK toolchain and DDC, inflating the package by ~100 GiB.
601
rsync -a "${srcdir}/${pkgname}/LocalBuilds/Engine/Linux/" "${pkgdir}/${UE_INSTALL_DIR}/"
602
if [[ -f "${srcdir}/${pkgname}/LocalBuilds/Engine/Linux/Engine/Binaries/Linux/UnrealEditor" ]]; then
603
# Can never be too careful with recursive rm...
604
rm -r "${srcdir}/${pkgname}/LocalBuilds"
605
fi
606
607
# Ensure InstalledBuild.txt is present so UBT treats this as an installed engine,
608
# preventing the "unique build environment" error when building projects.
609
printf '%s' "${pkgver}" | install -Dm644 /dev/stdin "${pkgdir}/${UE_INSTALL_DIR}/Engine/Build/InstalledBuild.txt"
610
611
# BuildGraph staging copies the unpatched UBT into the Installed Build, clobbering
612
# the patched UnrealBuildTool we rebuilt in build(). Re-stamp the installed copy.
613
local _ubtsrc="${srcdir}/${pkgname}/Engine/Binaries/DotNET/UnrealBuildTool"
614
local _ubtdst="${pkgdir}/${UE_INSTALL_DIR}/Engine/Binaries/DotNET/UnrealBuildTool"
615
if [[ -d "${_ubtsrc}" && -d "${_ubtdst}" ]]; then
616
rsync -a "${_ubtsrc}/" "${_ubtdst}/"
617
fi
618
619
find "${pkgdir}/${UE_INSTALL_DIR}" -type f \( -iname 'xbuild' -o -iname 'mcs' \) -exec chmod +x '{}' +
620
621
## Do this, in case the path doesn't exist for some reason
622
mkdir -p "${pkgdir}/${UE_INSTALL_DIR}/Engine/Binaries/Android/"
623
624
# Launcher (per-minor name avoids collision with other unreal-engine-src-5.X packages)
625
install -Dm755 "../unreal-engine-5.4.sh" "${pkgdir}/usr/bin/unreal-engine-5.4"
626
chmod +x "${pkgdir}/usr/bin/unreal-engine-5.4"
627
# Per-minor short-form symlinks (e.g. ue5.6, UE5.6); no plain ue5/UE5/unreal-engine-5 to avoid cross-minor collisions.
628
# Target is absolute (/usr/bin/unreal-engine-5.4) so the link resolves correctly once the package is installed.
629
# No chmod here: it would follow the symlink (currently dangling inside ${pkgdir}) and fail. Linux ignores
630
# symlink mode bits anyway — the underlying target's perms apply when the link is traversed.
631
for _link in ue5.4 UE5.4; do
632
ln -s "/usr/bin/unreal-engine-5.4" "${pkgdir}/usr/bin/${_link}"
633
done
634
635
# Configuring the launch script to detect when it has been run for the first time
636
# Note: Requires that there isn't already a UE5 desktop entry in "${HOME}/local/share/applications/" - delete yours if you have one there before installing this
637
DesktopFileChecksum=$(sha256sum "${pkgdir}/usr/share/applications/com.unrealengine.UE${_ueminor_us}Editor.desktop" | cut -f 1 -d ' ')
638
sed -i "s|ChecksumPlaceholder|${DesktopFileChecksum}|" "${pkgdir}/usr/bin/unreal-engine-5.4"
639
sed -i "s|InstalledLocationPlaceholder|/${UE_INSTALL_DIR}/Engine/Binaries|" "${pkgdir}/usr/bin/unreal-engine-5.4"
640
}
641
Scan history
| Scanned at (UTC) | Severity | Rules |
|---|---|---|
| 2026-10-06 14:02:37 | Low | 1 |
| 2026-10-06 00:13:36 | Clean | 2 |
| 2026-10-05 23:40:58 | Low | 1 |