unreal-engine-src-5.8

LOW
maintainer FinleyLaempe 0 votes scanned 2026-10-06 00:13:36.889724
View on AUR
Why flagged

The package builds Unreal Engine from source using official Epic Games repositories and downloads a toolchain from Epic's CDN; the only risks are unverified sources due to skipped checksums and low popularity, but no malicious or untrusted code execution is present.

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.

Low AI review llm_review

An AI model (qwen/qwen3-235b-a22b-2507) reviewed this and agrees it is LOW (confidence 95%): The package builds Unreal Engine from source using official Epic Games repositories and downloads a toolchain from Epic's CDN; the only risks are unverified sources due to skipped checksums and low popularity, but no malicious or untrusted code execution is present.

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

Scan history

Scanned at (UTC)SeverityRules
2026-10-06 00:13:36 Low 2
2026-10-05 23:40:58 Low 1

Report a package

Reports go to the AURWatch maintainer (one person) and are read by hand. No login required.

0 / 4000
Your suggestion