summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bb5ad0a86e2ee8ea0738a42b40fb3c3975b69ed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# Old Maintainer: Dylan Ferris <dylan@psilly.com>
# Old Maintainer: Michael Lojkovic <mikelojkovic@gmail.com>
# Maintainer: Shatur95 <genaloner@gmail.com>
# Co-Maintainer: Neko-san <nekoNexus at protonmail dot ch>
# Contributor: shawarden

# The source is about 200 MiB, with an extra ~11 GiB of dependencies downloaded in Setup.sh, and may take several hours to compile.
# If you want additional options, there are switches below.
pkgname=unreal-engine
pkgver=5.5.0
pkgrel=0
## Check unreal-engine/Engine/Config/Linux/Linux_SDK.json (MainVersion value) for what the below should be set to
UE_SDK_VERSION="native-linux-v23_clang-18.1.0-rockylinux8"
pkgdesc='A 3D game engine by Epic Games which can be used non-commercially for free.'
arch=('x86_64' 'x86_64_v2' 'x86_64_v3' 'x86_64_v4' 'aarch64')
url=https://www.unrealengine.com/
makedepends=('git' 'openssh' 'sed' 'grep' 'glibc' 'wget')
depends=('icu63' 'sdl2' 'python' 'dotnet-runtime' 'dotnet-sdk' 'vulkan-icd-loader' 'lld' 'xdg-user-dirs' 'dos2unix' 'openssl' 'steam' 'coreutils' 'findutils')
optdepends=('polly: for potentially increased performance'
            'qt5-base: qmake build system for projects'
            'cmake: build system for projects'
            'qtcreator: IDE for projects'
            'codelite: IDE for projects'
            'kdevelop: IDE for projects'
            'clion: IDE for projects'
            'pacman-contrib: for the paccache cleaning hook'
            'fake-ms-fonts: Font support for "demo/free/sample/example/tutorial" projects'
            'ttf-ms-fonts: Font support for "demo/free/sample/example/tutorial" projects')
license=('custom:UnrealEngine' 'GPL3')
source=("${UE_SDK_VERSION}.tar.gz::https://cdn.unrealengine.com/Toolchain_Linux/${UE_SDK_VERSION}.tar.gz"
        'unreal-engine-5.sh'
        'com.unrealengine.UE4Editor.desktop'
        'use_system_clang.patch'
        'unreal-engine-5-pacman-cache.hook'
        'ue5editor.svg')
sha256sums=('048ad147d66e45b9dcfcbc986770f8df1ccbf94de11480877e72d2b3b1b48087'
            '55a8ad79c2e502bc5919249b9d1804ad405795b36630ab2f23aeb99dd218e5f4'
            'c04c03b2c5c933b7eb1af283d607934ad95fd57f44d62b83719061b555a85dca'
            'b0a57db9a44d0001dc76ca8504d93e273af30093c6a993a5969d82b0ace54b98'
            '9386160a91594abeeaf4fe02fea562e7a4ead4c6f9a258c2a37b2e5f10e7deca'
            'b00c398b63f15084c46f3963f62a45284ecd8dae9ba6f38a2c4af370bbfdab8d')
# Not sure if compiling Unreal with LTO is legal? Lot's of different proprietary software goes into Unreal
options=('!strip' 'staticlibs') # Package is smaller with "strip" but it takes a long time and generates many warnings

## Use this if you prefer opendoas; the benefit here is that doas won't time out on you if you wait too long to authenticate after compilation
if [ -f /usr/bin/doas ] && [ -f /etc/doas.conf ]; then
  PACMAN_AUTH=(doas)
fi

# Change this to true or 1 for a potentially smaller package size
## Note: We can't guarantee that enabling this won't affect cross-distro compatibility given that Epic provides their own toolchain specifically
## based on the claim that it helps with compatibility...
## Though, you could just distribute your game as an AppImage if you decide to publish on a game store... :p
_use_system_clang=false

# Default engine installation directory. Can be useful if you do not have a lot of space on the default storage drive
# DON'T put a "/" at the start of the path
## Set this as an environment variable in /etc/makepkg.conf if you want predefined behavior
if [ "${_ue5_install_dir}" == "" ]; then
  export _ue5_install_dir="opt/${pkgname}"
fi

# 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
## Set this as an environment variable in /etc/makepkg.conf if you want predefined behavior
if [ "${_WithDDC}" != true ] && [ "${_WithDDC}" != false ]; then
  export _WithDDC=false
fi

# Change this if you want an alternative non-default logo for UE5's desktop icon; the default logo is enabled by default
## Set this as an environment variable in /etc/makepkg.conf if you want predefined behavior
if [ "${USE_DEFAULT_UE_LOGO_AT_INSTALL}" != 1 ] && [ "${USE_DEFAULT_UE_LOGO_AT_INSTALL}" != 0 ]; then
  export USE_DEFAULT_UE_LOGO_AT_INSTALL=1
fi

## An attempt to fix the NuGet SSL issue during the build -- didn't seem to work; users had to do this manually, so we'll rollback to an alternative
#ln -s /etc/ssl /usr/lib/ssl
#ln -s /etc/ssl /usr/lib64/ssl
## ---
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0

## This is for detecting your CPU architecture automatically; set to false if you want to enforce your own makepkg.conf file
## Disabled by default as a compromise for those bothered by having it force-enabled

## 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])
## 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:
## 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

# Valid values are false / disabled / default, auto, and native

# arch_auto=""

if [ ! "$(command -v tr)" ]; then
  :
else
  # shellcheck disable=SC2006
  arch_auto="$(echo "${arch_auto}" | tr '[:upper:]' '[:lower:]')"
fi

case "${arch_auto}" in
  "auto"|"true"|"enable"|"enabled"|"1"|"native"|"false"|"disable"|"disabled"|"2")
    :
  ;;

  *)
    arch_auto=false
  ;;
esac

opt_level=""
  
if [[ ${CFLAGS} =~ -O([0-9]+) ]]; then
  opt_level="-O${BASH_REMATCH[1]}"
else
  opt_level="-O3"
fi

if [ -f "$(find /usr/lib -name 'LLVMPolly.so')" ] || [ -f "$(find /usr/lib64 -name 'LLVMPolly.so')" ]; then
  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"
fi

if [ "${arch_auto}" = "auto" ] || [ "${arch_auto}" = "true" ] || [ "${arch_auto}" = "enable" ] || [ "${arch_auto}" = "enabled" ] || [ "${arch_auto}" = "1" ]
then
  ## Architecture checks and compile flag adjustments - shellcheck throws a fit about the build function but it looks fine to me; checks for the highest available x64 support level and falls back to "native" if either not available
  if [ "$(uname -m)" == "x86_64" ]; then
    if [ "$(/lib/ld-linux-x86-64.so.2 --help | grep -w 'x86-64-v4' | cut -d ',' -f 1 | sed 's/^  //' | sed 's/ (/ - /')" == 'x86-64-v4 - supported' ]; then
      export CFLAGS="${CFLAGS} -march=x86-64-v4 ${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"
      export CXXFLAGS="${CFLAGS} -Wp,-D_GLIBCXX_ASSERTIONS"
      export LDFLAGS="-pie -Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now"
    elif [ "$(/lib/ld-linux-x86-64.so.2 --help | grep -w 'x86-64-v3' | cut -d ',' -f 1 | sed 's/^  //' | sed 's/ (/ - /')" == 'x86-64-v3 - supported' ]; then
      export CFLAGS="${CFLAGS} -march=x86-64-v3 ${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"
      export CXXFLAGS="${CFLAGS} -Wp,-D_GLIBCXX_ASSERTIONS"
      export LDFLAGS="-pie -Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now"
    elif [ "$(/lib/ld-linux-x86-64.so.2 --help | grep -w 'x86-64-v2' | cut -d ',' -f 1 | sed 's/^  //' | sed 's/ (/ - /')" == 'x86-64-v2 - supported' ]; then
      export CFLAGS="${CFLAGS} -march=x86-64-v2 ${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"
      export CXXFLAGS="${CFLAGS} -Wp,-D_GLIBCXX_ASSERTIONS"
      export LDFLAGS="-pie -Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now"
    elif [ "$(/lib/ld-linux-x86-64.so.2 --help | grep 'x86_64' | grep 'supported' | cut -d ',' -f 1 | sed 's/^  //' | sed 's/ (/ - /' | grep -w '^x86_64 - supported')" == 'x86_64 - supported' ]; then
      export CFLAGS="${CFLAGS} -march=x86-64 ${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"
      export CXXFLAGS="${CFLAGS} -Wp,-D_GLIBCXX_ASSERTIONS"
      export LDFLAGS="-pie -Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now"
    fi
  elif [ "$(uname -m)" == "aarch64" ]; then
    export CFLAGS="${CFLAGS} -march=aarch64 ${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"
    export CXXFLAGS="${CFLAGS} -Wp,-D_GLIBCXX_ASSERTIONS"
    export LDFLAGS="-pie -Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now"
  else
    echo "Architecture '$(uname -m)' is not supported! Exiting."
    return
  fi
elif [[ "${arch_auto}" == native ]]; then
    export CFLAGS="${CFLAGS} -march=native -mtune=native ${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"
    export CXXFLAGS="${CFLAGS} -Wp,-D_GLIBCXX_ASSERTIONS"
    export LDFLAGS="-pie -Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now"
fi

case "${arch_auto}" in
  "auto"|"true"|"enable"|"enabled"|"native"|"1")
    :
  ;;

  *)
    if [ -f "$(find /usr/lib -name 'LLVMPolly.so')" ] || [ -f "$(find /usr/lib64 -name 'LLVMPolly.so')" ]; then
      ## 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
      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"
    fi
  ;;
esac

prepare() {
  # Check access to the repository
  if ! git ls-remote git@github.com:EpicGames/UnrealEngine &>/dev/null
  then
    error 'You must register at unrealengine.com and link your github account to access this private repo. See the wiki for more info: https://wiki.archlinux.org/index.php/Unreal_Engine_4'
    exit 1
  fi

  # Download Unreal Engine source or update if the folder exists
  if [[ ! -d "${pkgname}" ]]
  then
    #git clone --depth=1 --branch=ue5-main git@github.com:EpicGames/UnrealEngine "{$pkgname}"
    git clone --depth=1 --branch=${pkgver}-release git@github.com:EpicGames/UnrealEngine "${pkgname}"
    cd "${pkgname}" || return
  else
    cd "${pkgname}" || return
    CURRENT_CLONED_VERSION="$(git describe --tags)"
    if [ "${CURRENT_CLONED_VERSION}" != "${pkgver}-release" ]; then
      cd ..
      rm -rf "${pkgname}"
      git clone --depth=1 --branch=${pkgver}-release git@github.com:EpicGames/UnrealEngine "${pkgname}"
      cd "${pkgname}" || return
    else
      rm -f .git/index.lock
      git fetch --depth=1 origin tag ${pkgver}-release
      git reset --hard ${pkgver}-release
    fi
  fi
  
  ## Apply custom patches if enabled
  if [ "${_use_system_clang}" == true ]; then
    patch -p1 -i "${srcdir}/use_system_clang.patch"
  fi

  # Qt Creator source code access
  if [[ ! -d Engine/Plugins/Developer/QtCreatorSourceCodeAccess ]]
  then
    # https://github.com/fire-archive/QtCreatorSourceCodeAccess - See for usage
    git -C Engine/Plugins/Developer clone --depth=1 https://github.com/fire-archive/QtCreatorSourceCodeAccess
  fi

  # For some reason, despite this file explicitly asking not to be removed, it was removed from the UE5 source; it has to be re-added or the build will fail
  if [[ ! -f ${pkgname}/Engine/Source/ThirdParty/Linux/HaveLinuxDependencies ]]
  then
    mkdir -p "${srcdir}/${pkgname}/Engine/Source/ThirdParty/Linux/"
    touch "${srcdir}/${pkgname}/Engine/Source/ThirdParty/Linux/HaveLinuxDependencies"
    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." "${srcdir}/${pkgname}/Engine/Source/ThirdParty/Linux/HaveLinuxDependencies"
  fi
  
  ./Setup.sh
  cd "${srcdir}/${pkgname}/Engine/Build/BatchFiles/Linux/" || return

  ## This should just be working, but somehow isn't: https://aur.archlinux.org/packages/unreal-engine#comment-986166
  #./Engine/Build/BatchFiles/Linux/SetupToolchain.sh
  ## So, we're doing this instead:
  mkdir -p "${srcdir}/${pkgname}/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/"
  tar -xvf "${srcdir}/${UE_SDK_VERSION}.tar.gz" -C "${srcdir}/${pkgname}/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/"

  "${srcdir}"/"${pkgname}"/Engine/Build/BatchFiles/Linux/BuildThirdParty.sh
  "${srcdir}"/"${pkgname}"/Engine/Build/BatchFiles/Linux/SetupDotnet.sh
  "${srcdir}"/"${pkgname}"/Engine/Build/BatchFiles/Linux/FixDependencyFiles.sh
}

build() {
  cd "${pkgname}" || return
  
  if [ "${_WithDDC}" == true ]; then
    build='Engine/Build/BatchFiles/RunUAT.sh BuildGraph -target="Make Installed Build Linux" -script=Engine/Build/InstalledEngineBuild.xml -set:WithDDC=true -set:HostPlatformOnly=false -set:WithLinux=true -set:WithWin64=true -set:WithMac=false -set:WithAndroid=false -set:WithIOS=false -set:WithTVOS=false'
  else
    build='Engine/Build/BatchFiles/RunUAT.sh BuildGraph -target="Make Installed Build Linux" -script=Engine/Build/InstalledEngineBuild.xml -set:WithDDC=false -set:HostPlatformOnly=false -set:WithLinux=true -set:WithWin64=true -set:WithMac=false -set:WithAndroid=false -set:WithIOS=false -set:WithTVOS=false'
  fi
  
  if eval "${build}"; then
    :
  else
    echo "Error: Build failed; try searching the output for suspicious messages." >&2
    return;
  fi
}

package() {

  # Desktop entry
  if [ ! -f com.unrealengine.UE5Editor.desktop ] && [ -f com.unrealengine.UE4Editor.desktop ]; then
    cp com.unrealengine.UE4Editor.desktop com.unrealengine.UE5Editor.desktop
  fi
  
  sed -i "7c\Exec=/usr/bin/unreal-engine-5.sh %U" com.unrealengine.UE5Editor.desktop
  sed -i "14c\Path=/usr/bin/" com.unrealengine.UE5Editor.desktop
  sed -i 's/Unreal Engine 4 Editor/Unreal Engine 5 Editor/g' com.unrealengine.UE5Editor.desktop
  sed -i 's/Icon=ue4editor/Icon=ue5editor/g' com.unrealengine.UE5Editor.desktop
  install -Dm644 com.unrealengine.UE5Editor.desktop "${pkgdir}/usr/share/applications/com.unrealengine.UE5Editor.desktop"
  chmod +x "${pkgdir}/usr/share/applications/com.unrealengine.UE5Editor.desktop"

  ## Install a pacman hook to keep old builds from compounding cache by tens of GBs - 2 builds alone can reach at least 30 GBs in pacman's cache; having one only takes up about 15 GBs
  install -Dm775 unreal-engine-5-pacman-cache.hook "${pkgdir}/etc/pacman.d/hooks/unreal-engine-5-pacman-cache.hook"
  
  
  install -dm755 "${pkgdir}/usr/bin"
  install -dm755 "${pkgdir}/usr/share/pixmaps/"
  install -dm755 "${pkgdir}/usr/share/applications/"
  # Icon for Desktop entry
  if [ "${USE_DEFAULT_UE_LOGO_AT_INSTALL}" == 1 ]; then
    install -Dm644 ue5editor.svg "${pkgdir}/usr/share/pixmaps/ue5editor.svg"
  else
    mv ue5editor.svg ue5editor.svg.bak
    wget --output-document "ue5editor.svg" "https://raw.githubusercontent.com/EliverLara/candy-icons/master/apps/scalable/ue4editor.svg"
    install -Dm644 ue5editor.svg "${pkgdir}/usr/share/pixmaps/ue5editor.svg"
    wget --output-document "LICENSE" "https://raw.githubusercontent.com/EliverLara/candy-icons/master/LICENSE"
    mkdir -p "${pkgdir}/usr/share/UnrealEngine/EliverLara-candy-icons/"
    install -Dm644 LICENSE "${pkgdir}/usr/share/UnrealEngine/EliverLara-candy-icons/"
    rm ue5editor.svg
    rm LICENSE
    mv ue5editor.svg.bak ue5editor.svg
  fi

  # License
  install -Dm644 "${srcdir}/${pkgname}/LICENSE.md"  "${pkgdir}/usr/share/licenses/UnrealEngine/LICENSE.md"
  
  # Engine
  ## Set to all permissions to prevent the engine from breaking itself; more elegant solutions might exist - suggest them if they can be automated here
  ## Also, correct me if I package this improperly; I added Win64 support for the build in hopes of supporting cross-compilation
  install -dm777 "${pkgdir}/${_ue5_install_dir}/Engine"
  
  # Copy LocalBuilds to pkg...
  cp -flr "${srcdir}"/"${pkgname}"/LocalBuilds/Engine/Linux/* "${pkgdir}"/"${_ue5_install_dir}"/
  if [ -f "${srcdir}"/"${pkgname}"/LocalBuilds/Engine/Linux/Engine/Binaries/Linux/UnrealEditor ]; then
    # Can never be too careful with recursive rm...
    rm -r "${srcdir}"/"${pkgname}"/LocalBuilds
  fi

  # Copy the rest of it to pkg... Should we be overwriting LocalBuilds?
  cp -flr "${srcdir}"/"${pkgname}"/* "${pkgdir}"/"${_ue5_install_dir}"/
  if [ -f "${srcdir}"/"${pkgname}"/Engine/Binaries/Linux/UnrealEditor ]; then
    rm -r "${srcdir}"/"${pkgname:?}"/*
  fi
  
  # if [ -f "${srcdir}/${pkgname}/cpp.hint" ] && [ ! -d "${srcdir}/${pkgname}/cpp.hint" ]; then
  #   mv "${srcdir}/${pkgname}/cpp.hint" "${pkgdir}/${_ue5_install_dir}"
  # elif [ -d "${srcdir}/${pkgname}/cpp.hint" ]; then
  #   mkdir -p "${pkgdir}/${_ue5_install_dir}/cpp.hint"
  #   mv "${srcdir}"/"${pkgname}"/cpp.hint/* "${pkgdir}/${_ue5_install_dir}/cpp.hint"
  # fi
  # 
  # if [ -f "${srcdir}/${pkgname}/GenerateProjectFiles.sh" ]; then
  #   install -Dm777 "${srcdir}/${pkgname}/GenerateProjectFiles.sh" "${pkgdir}/${_ue5_install_dir}"
  # fi
  
  chmod -R 777 "${pkgdir}/${_ue5_install_dir}"
  
  if [ -x "$(find "${pkgdir}/${_ue5_install_dir}" -type f -iname 'xbuild')" ]; then
    find "${pkgdir}/${_ue5_install_dir}" -type f -iname 'xbuild' -exec chmod +x "{}" \;
  fi
  
  if [ -x "$(find "${pkgdir}/${_ue5_install_dir}" -type f -iname 'mcs')" ]; then
    find "${pkgdir}/${_ue5_install_dir}" -type f -iname 'mcs' -exec chmod +x "{}" \;
  fi
  
  ## Do this, in case the path doesn't exist for some reason
  mkdir -p "${pkgdir}/${_ue5_install_dir}/Engine/Binaries/Android/"
  
  # Launch script to initialize missing user folders for Unreal Engine
  install -Dm755 ../unreal-engine-5.sh "${pkgdir}/usr/bin/"
  chmod +x "${pkgdir}/usr/bin/unreal-engine-5.sh"
  ln -s "${pkgdir}/usr/bin/unreal-engine-5.sh" "${pkgdir}/usr/bin/ue5"
  ln -s "${pkgdir}/usr/bin/unreal-engine-5.sh" "${pkgdir}/usr/bin/UE5"
  ln -s "${pkgdir}/usr/bin/unreal-engine-5.sh" "${pkgdir}/usr/bin/unreal-engine-5"
  chmod 755 "${pkgdir}/usr/bin/ue5" "${pkgdir}/usr/bin/UE5" "${pkgdir}/usr/bin/unreal-engine-5"
  
  # Configuring the launch script to detect when it has been run for the first time
  # 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
  DesktopFileChecksum=$(sha256sum "${pkgdir}/usr/share/applications/com.unrealengine.UE5Editor.desktop" | cut -f 1 -d ' ')
  sed -i "s|ChecksumPlaceholder|${DesktopFileChecksum}|" "${pkgdir}/usr/bin/unreal-engine-5.sh"
  sed -i "s|InstalledLocationPlaceholder|/${_ue5_install_dir}/Engine/Binaries|" "${pkgdir}/usr/bin/unreal-engine-5.sh"
}