unreal-engine-src-5.6

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

Scan history

Scanned at (UTC)SeverityRules
2026-10-06 14:02:37 Low 1
2026-10-06 00:13:36 Clean 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