This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
install_UnrealEngine4.sh
executable file
·252 lines (194 loc) · 8.79 KB
/
install_UnrealEngine4.sh
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
#!/bin/bash
SCRIPT_SRC_DIR="$(dirname "$(realpath -s "$0")")"
source "$SCRIPT_SRC_DIR/install"
#------------------------------------------------------------------------------------------------------
exportdefvar TARGET_DIR "${HOME}"
exportdefvar GIT_USER ""
exportdefvar GIT_PASS ""
exportdefvar GIT_REPO "github.com/EpicGames/UnrealEngine.git"
exportdefvar GIT_BRANCH "release"
exportdefvar GIT_REVISION ""
exportdefvar SKIP_DEPS n
exportdefvar APT_AUTO_ACCEPT n
exportdefvar ANDROID_SUPPORT y
exportdefvar ENABLE_OPENGL n
exportdefvar DELETE_IF_EXISTS y
exportdefvar GIT_RESET y
exportdefvar SDK_RESET y
exportdefvar ADD_UE4GITPLUGIN n
exportdefvar CLEAN_BUILD n
exportdefvar FINAL_RM_GIT y
exportdefvar FINAL_RM_IMT y
exportdefvar FINAL_RM_MAC y
exportdefvar FINAL_RM_WIN y
exportdefvar AUTORUN_EDITOR y
exportdefvar AUTORUN_ARGS ""
exportdefvar ROOT_PASS ""
#------------------------------------------------------------------------------------------------------
if [[ $SKIP_DEPS != "y" ]] ; then
# update_system
install_lpkg \
wget \
clang \
cmake \
build-essential \
mono-complete \
mono-devel \
dos2unix \
xdg-user-dirs \
git \
libcogl20 \
libglew-dev \
libcheese8 \
libcheese-gtk25 \
libclutter-1.0-0 \
libclutter-gtk-1.0-0 \
libclutter-gst-3.0-0 \
xserver-xorg-input-all
# FIX for: Engine/Binaries/Linux/UE4Editor: error while loading shared libraries: libfbxsdk.so: cannot open shared object file: No such file or directory
bash "${SCRIPT_SRC_DIR}/install_fbxsdk.sh"
fi
if ! pushd "${TARGET_DIR}" ; then
show_message "Target dir is not exists!"
goto_exit 2
fi
show_message "Installation path: ${TARGET_DIR}/UnrealEngine-${GIT_BRANCH}"
if [ -d "UnrealEngine-${GIT_BRANCH}" ] ; then
if [[ ${DELETE_IF_EXISTS} == "y" ]] ; then
show_message "Remove existing sources and do a clean install: UnrealEngine-${GIT_BRANCH}"
rm -rf "UnrealEngine-${GIT_BRANCH}"
else
show_message " Update existing sources: UnrealEngine-${GIT_BRANCH}"
show_message " Source URL: https://${GIT_USER}:@${GIT_REPO}"
pushd "UnrealEngine-${GIT_BRANCH}"
if [[ ${GIT_RESET} == "y" ]] ; then
git init
git remote remove origin
git remote add origin "https://${GIT_USER}:${GIT_PASS}@${GIT_REPO}"
git fetch origin
git submodule foreach --recursive "git clean -dfx"
git clean -dfx
git submodule foreach --recursive "git reset --hard HEAD"
git reset --hard origin/${GIT_BRANCH}
git pull origin ${GIT_BRANCH}
fi
if [[ ${SDK_RESET} == "y" ]] ; then
rm -rf "Engine/Extras/ThirdPartyNotUE/SDKs"
rm -rf ".git/ue4-gitdeps"
rm -rf ".git/ue4-sdks"
fi
popd
fi
fi
if ! [ -d "UnrealEngine-${GIT_BRANCH}" ] ; then
git clone --depth 1 --single-branch -b "${GIT_BRANCH}" "https://${GIT_USER}:${GIT_PASS}@${GIT_REPO}" "UnrealEngine-${GIT_BRANCH}"
fi
pushd "UnrealEngine-${GIT_BRANCH}"
# parse file and print version
# /Engine/Build/Build.version
if [[ $MAKEONLY != "y" ]] ; then
rm ".git/index.lock"
sed -i "s#if which curl 1>/dev/null; then#if [ '' ] ; then#g" "Engine/Build/BatchFiles/Linux/SetupToolchain.sh"
if ! ( eval "echo y | ./Setup.sh" ) ; then
show_message "Setup was Failed!"
goto_exit 6
fi
sleep 3s ; sync
if ! ( ./GenerateProjectFiles.sh ) ; then
show_message "GenerateProjectFiles was Failed!"
goto_exit 7
fi
sleep 3s ; sync
else show_message "Make only!" ; fi
if [[ ${ENABLE_OPENGL} == "y" ]] ; then
# enable OpenGL target
sed -i 's/.*;.*+TargetedRHIs=GLSL_430/+TargetedRHIs=GLSL_430/g' "Engine/Config/BaseEngine.ini"
# disable warning
sed -i 's/FMessageDialog.*LinuxDynamicRHI.*OpenGLDeprecated.*OpenGL.*deprecated.*;//g' "Engine/Source/Runtime/RHI/Private/Linux/LinuxDynamicRHI.cpp"
fi
if [[ ${ADD_UE4GITPLUGIN} == "y" ]] ; then
pushd "Engine/Plugins/Developer"
rm -rf "GitSourceControl"
git clone "https://github.com/SRombauts/UE4GitPlugin.git" "GitSourceControl"
# DISABLE HOT-RELOADING FEATURE
sed -i 's/UPackageTools::ReloadPackages/\/\/&/' "GitSourceControl/Source/GitSourceControl/Private/GitSourceControlMenu.cpp"
popd
fi
if [[ ${IS_KDE} ]] ; then qdbus org.kde.KWin /Compositor suspend ; fi
TC_VER=`realpath Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v*clang*`/ToolchainVersion.txt
if ! [ -f "${TC_VER}" ] ; then echo `ls "Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64"` > "${TC_VER}" ; fi
if [[ $CLEAN_BUILD == "y" ]] ; then make ARGS=-clean ; fi
if ! ( make ) ; then
show_message "Making process was Failed!"
goto_exit 8
fi
if ! ( make ShaderCompileWorker ) ; then
show_message "Making process was Failed!"
goto_exit 9
fi
chmod +x "Engine/Binaries/Linux/UE4Editor"
if [[ ${ANDROID_SUPPORT} == "y" ]] ; then
pushd "$SCRIPT_SRC_DIR"
./install_tools_dev_android.sh
popd
if ! [ -d "${HOME}/android-studio" ] ; then
ANDROID_STUDIO_DIR=`realpath /opt/android-studio*/android-studio`
if [ -d "${ANDROID_STUDIO_DIR}" ] ; then
ln -s "${ANDROID_STUDIO_DIR}" "${HOME}/android-studio"
fi
fi
pushd "Engine/Extras/Android"
./SetupAndroid.sh
popd
fi
if [[ ${FINAL_RM_GIT} == "y" ]] ; then rm -rf ".git" ; fi
if [[ ${FINAL_RM_IMT} == "y" ]] ; then rm -rf "Engine/Intermidiate" ; fi
function rm_by_mask() {
find "$1" -type d -iname "$2" -exec sh -c 'x=$(realpath "{}"); rm -rf "$x";' \;
}
if [[ ${FINAL_RM_MAC} == "y" ]] ; then
rm_by_mask "Engine/Binaries" "mac"
rm_by_mask "Engine/Binaries" "ios"
rm_by_mask "Engine/Source/ThirdParty" "mac"
rm_by_mask "Engine/Source/ThirdParty" "ios"
fi
if [[ $FINAL_RM_WIN == "y" ]] ; then
rm_by_mask "Engine/Binaries" "windows"
rm_by_mask "Engine/Binaries" "win32"
rm_by_mask "Engine/Binaries" "win64"
rm_by_mask "Engine/Source/ThirdParty" "windows"
rm_by_mask "Engine/Source/ThirdParty" "win32"
rm_by_mask "Engine/Source/ThirdParty" "win64"
rm_by_mask "Engine/Plugins" "windows"
rm_by_mask "Engine/Plugins" "win32"
rm_by_mask "Engine/Plugins" "win64"
fi
echo "#!/usr/bin/env xdg-open
[Desktop Entry]
Name=UE4Editor
Comment=Unreal Engine 4 Editor
Exec=${TARGET_DIR}/UnrealEngine-${GIT_BRANCH}/Engine/Binaries/Linux/UE4Editor
Icon=${TARGET_DIR}/UnrealEngine-${GIT_BRANCH}/Engine/Content/Slate/Testing/UE4Icon.png
Terminal=false
Type=Application
Categories=Development;Games" | tee "${DESKTOP_DIR}/UE4Editor.desktop"
chmod +x "${DESKTOP_DIR}/UE4Editor.desktop"
if [[ ${ENABLE_OPENGL} == "y" ]] ; then
echo "#!/usr/bin/env xdg-open
[Desktop Entry]
Name=UE4Editor (OpenGL)
Comment=Unreal Engine 4 Editor (OpenGL)
Exec=${TARGET_DIR}/UnrealEngine-${GIT_BRANCH}/Engine/Binaries/Linux/UE4Editor -opengl4
Icon=${TARGET_DIR}/UnrealEngine-${GIT_BRANCH}/Engine/Content/Slate/Testing/UE4Icon.png
Terminal=false
Type=Application
Categories=Development;Games" | tee "${DESKTOP_DIR}/UE4EditorOGL.desktop"
chmod +x "${DESKTOP_DIR}/UE4EditorOGL.desktop"
if ! [[ "${AUTORUN_ARGS}" =~ "-opengl4" ]] && ! [[ "${AUTORUN_ARGS}" =~ "-vulkan" ]] ; then
export AUTORUN_ARGS="-opengl4 ${AUTORUN_ARGS}"
fi
fi
if [[ ${IS_KDE} ]] ; then qdbus org.kde.KWin /Compositor resume ; fi
if [[ ${AUTORUN_EDITOR} == "y" ]] ; then eval "Engine/Binaries/Linux/UE4Editor ${AUTORUN_ARGS}" ; fi
popd
popd