unreal-engine-src-5.7

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

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