-
Notifications
You must be signed in to change notification settings - Fork 13
/
updxvk
executable file
·416 lines (332 loc) · 12.9 KB
/
updxvk
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
#!/bin/bash
# TkGlitch's DXVK Updater - ti3nou@gmail.com
# BUILD HEAD OF THE CHOSEN BRANCH WITH : ./updxvk build - (Edit DXVK_BRANCH to point to the branch you want)
# UPDATE WITH : ./updxvk /path/to/wine/prefix - (WINEARCH will be autodetected) - Adding "vulkansdk" after your path will also install vulkansdk to this prefix
# BATCH UPDATE WITH : ./updxvk batch - (Edit PREFIXES_ROOT variable to point to your prefixes dir)
# LUTRIS UPDATE WITH : ./updxvk lutris - (Put 'TkG' as DXVK version in lutris afterwards to use your fresh build)
# PROTON UPDATE WITH : ./updxvk proton-dist - Requires _proton_dist_path to be set in updxvk.cfg
# PROTON-TKG READY WITH : ./updxvk proton-tkg
# FOR BOTH UPDATE AND BATCH UPDATE : optional - build number of the build you want to install
# ex for UPDATE: ./updxvk /home/user/WinePrefixes/DEBUG f4a92a685f8b2f135dc6fe493ea9ce726aa79a52-2018-05-05-16:14:00
# ex for BATCH UPDATE: ./updxvk batch f4a92a685f8b2f135dc6fe493ea9ce726aa79a52-2018-05-05-16:14:00
# Putting patch files in DXVKBUILD/patches will auto-apply them if the extension is .dxvkpatch, auto-revert them if the extension is .dxvkrevert, or ignore them if any other extension (or none) is used
cat << 'EOM'
.---.` `.---.
`/syhhhyso- -osyhhhys/`
.syNMdhNNhss/``.---.``/sshNNhdMNys.
+sdMh.`+MNsssssssssssssssNM+`.hMds+
:syNNdhNNhssssssssssssssshNNhdNNys:
/ssyhhhysssssssssssssssssyhhhyss/
.ossssssssssssssssssssssssssssso.
:sssssssssssssssssssssssssssssssss:
/sssssssssssssssssssssssssssssssssss/
:sssssssssssssoosssssssoosssssssssssss:
osssssssssssssoosssssssoossssssssssssso
osssssssssssyyyyhhhhhhhyyyyssssssssssso
/yyyyyyhhdmmmmNNNNNNNNNNNmmmmdhhyyyyyy/
smmmNNNNNNNNNNNNNNNNNNNNNNNNNNNNNmmms
/dNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNd/
`:sdNNNNNNNNNNNNNNNNNNNNNNNNNds:`
`-+shdNNNNNNNNNNNNNNNdhs+-`
`.-:///////:-.`
EOM
source updxvk.cfg
# Load external configuration file if present. Available variable values will overwrite updxvk.cfg ones.
if [ -e "$_EXT_CONFIG_PATH" ]; then
source "$_EXT_CONFIG_PATH" && echo -e "External configuration file $_EXT_CONFIG_PATH will be used to override updxvk.cfg values.\n"
fi
ROOT="$PWD"
# Use custom compiler paths if defined
if [ -n "${CUSTOM_MINGW_PATH}" ]; then
PATH=${CUSTOM_MINGW_PATH}/bin:${CUSTOM_MINGW_PATH}/lib:${CUSTOM_MINGW_PATH}/include:${PATH}
fi
if [ -n "${CUSTOM_GCC_PATH}" ]; then
PATH=${CUSTOM_GCC_PATH}/bin:${CUSTOM_GCC_PATH}/lib:${CUSTOM_GCC_PATH}/include:${PATH}
fi
_exit_cleanup() {
rm -rf "$ROOT/DXVKBUILD/dxvk-$DXVK_BRANCH"
echo -e "\nexit cleanup done"
}
build() {
mkdir -p DXVKBUILD
mkdir -p DXVKBUILD/patches
if [ "$DIRTYIN" != "2" ]; then
if [ -e "dxvk-$DXVK_BRANCH.dxvkdirty" ] || [ "$DIRTYIN" == "1" ]; then
( cd dxvk-"$DXVK_BRANCH" && git reset --hard HEAD && git clean -xdf )
echo "#################"
echo ""
echo "YOUR TREE WAS CONSIDERED DIRTY AND HAS BEEN CLEARED"
echo ""
echo "#################"
rm "$DXVK_BRANCH".dxvkdirty
fi
else
echo "#################"
echo ""
echo "YOU DIRTY BOI.."
echo ""
echo "#################"
fi
mkdir dxvk-"$DXVK_BRANCH"
cd dxvk-"$DXVK_BRANCH"
if [ ! -e package-release.sh ]; then
git init .
git remote add -t \* -f origin "$DXVK_REPO"
git checkout "$DXVK_BRANCH"
fi
if [ "$DXVK_AUTOUPDATE" == "1" ]; then
git pull
fi
if [ -n "$DXVK_COMMIT" ] && [ "$CUSTOM_COMMIT" == "1" ]; then
git checkout "$DXVK_COMMIT"
fi
git submodule update --init --recursive
GIT_HEAD=$(git rev-parse HEAD)-`date '+%Y-%m-%d-%H:%M:%S'`
# Community patches
if [ -n "$_community_patches" ]; then
_community_patches=($_community_patches)
for _p in ${_community_patches[@]}; do
ln -s $ROOT/../community-patches/dxvk/$_p $ROOT/DXVKBUILD/patches/
done
fi
if [ "$PATCHIN" == "1" ]; then
for F in ../DXVKBUILD/patches/*dxvkrevert; do
if [ -e "${F}" ]; then
echo "#################"
echo ""
echo "REVERTING PATCH ${F}"
echo ""
echo "#################"
patch -Np1 -R < ${F} && echo "This means that branch $DXVK_BRANCH was altered by patching and will be cleared next time you build" >> ../"$DXVK_BRANCH".dxvkdirty || exit 1
else
echo "#################"
echo ""
echo "NO REVERT PATCH DETECTED - MOVING ON"
echo ""
echo "#################"
fi
done
for F in ../DXVKBUILD/patches/*dxvkpatch; do
if [ -e "${F}" ]; then
echo "#################"
echo ""
echo "APPLYING PATCH ${F}"
echo ""
echo "#################"
patch -Np1 < ${F} && echo "This means that branch $DXVK_BRANCH was altered by patching and will be cleared next time you build" >> ../"$DXVK_BRANCH".dxvkdirty || exit 1
else
echo "#################"
echo ""
echo "NO PATCH DETECTED - MOVING ON"
echo ""
echo "#################"
fi
done
fi
# Community patches cleanup
if [ -n $_community_patches ]; then
for _p in ${_community_patches[@]}; do
rm -f $ROOT/DXVKBUILD/patches/${_p}
done
fi
if pacman -Qq ccache &> /dev/null || dpkg -l ccache &> /dev/null; then
echo 'ccache was found and will be used'
sed -i "s|c = 'i686-w64-mingw32-gcc'|c = ['ccache', 'i686-w64-mingw32-gcc']|g" build-win32.txt
sed -i "s|c = 'x86_64-w64-mingw32-gcc'|c = ['ccache', 'x86_64-w64-mingw32-gcc']|g" build-win64.txt
sed -i "s|cpp = 'i686-w64-mingw32-g++'|cpp = ['ccache', 'i686-w64-mingw32-g++']|g" build-win32.txt
sed -i "s|cpp = 'x86_64-w64-mingw32-g++'|cpp = ['ccache', 'x86_64-w64-mingw32-g++']|g" build-win64.txt
else
echo ""
echo 'ccache was not found and will not be used'
fi
echo "#################"
echo ""
echo "BUILDING"
echo ""
echo "#################"
./package-release.sh "$DXVK_BRANCH" ../DXVKBUILD --no-package
if [ -d ../DXVKBUILD/dxvk-"$DXVK_BRANCH"/x32 ] && [ -d ../DXVKBUILD/dxvk-"$DXVK_BRANCH"/x64 ]; then
mkdir -p ../DXVKBUILD/"$DXVK_BRANCH"/"$GIT_HEAD"
mv -v -T ../DXVKBUILD/dxvk-"$DXVK_BRANCH"/x32 ../DXVKBUILD/"$DXVK_BRANCH"/"$GIT_HEAD"/x32
cp ../DXVKBUILD/setup_dxvk32.sh ../DXVKBUILD/"$DXVK_BRANCH"/"$GIT_HEAD"/x32/setup_symlink_dxvk.sh
mv -v -T ../DXVKBUILD/dxvk-"$DXVK_BRANCH"/x64 ../DXVKBUILD/"$DXVK_BRANCH"/"$GIT_HEAD"/x64
cp ../DXVKBUILD/setup_dxvk64.sh ../DXVKBUILD/"$DXVK_BRANCH"/"$GIT_HEAD"/x64/setup_symlink_dxvk.sh
if [ -e ../DXVKBUILD/dxvk-"$DXVK_BRANCH"/setup_dxvk.sh ]; then
cp ../DXVKBUILD/dxvk-"$DXVK_BRANCH"/setup_dxvk.sh ../DXVKBUILD/"$DXVK_BRANCH"/"$GIT_HEAD"/setup_dxvk.sh
fi
rm -R -f ../DXVKBUILD/dxvk-"$DXVK_BRANCH"
echo "Your files were built in $ROOT/DXVKBUILD/$DXVK_BRANCH/$GIT_HEAD"
rm -f ../DXVKBUILD/"$DXVK_BRANCH"/last-HEAD
echo "CURRENT_HEAD=$GIT_HEAD" >> ../DXVKBUILD/"$DXVK_BRANCH"/last-HEAD
rm -f ../DXVKBUILD/"$DXVK_BRANCH"/latest
ln -s "$GIT_HEAD" "$ROOT"/DXVKBUILD/"$DXVK_BRANCH"/latest
else
rm -rf ../DXVKBUILD/*-"$DXVK_BRANCH"
fi
}
update() {
if [ -d "$ROOT/DXVKBUILD" ]; then
source "$ROOT/DXVKBUILD/$DXVK_BRANCH/last-HEAD"
# kill wineserver before installation to make sure correct wine version is used
wineserver -k
WINECMD=${WINE-wine}
if [ $WINECMD = "wine" ]; then
if [ $WINEARCH = "win64" ]; then
WINECMD="wine64"
else
WINECMD="wine"
fi
fi
if [ -z "$2" ]; then
cd "$ROOT/DXVKBUILD/$DXVK_BRANCH/$CURRENT_HEAD"
elif [ -d "$ROOT/DXVKBUILD/$2" ]; then
cd "$ROOT/DXVKBUILD/$2"
else
echo "#################################"
echo ""
echo " DXVKBUILD/$2 directory not found !!"
echo ""
echo "#################################"
fi
if [ -d "x32" ] && [ -d "x64" ]; then
WINEARCH="$WINEARCH" WINEPREFIX="$WINEPREFIX" bash "$_DXVKALIAS"/setup_symlink_dxvk.sh
if [ $WINEARCH = "win64" ]; then
WINEARCH="$WINEARCH" WINEPREFIX="$WINEPREFIX" bash x32/setup_symlink_dxvk.sh
fi
echo "#########################################"
echo ""
echo " DXVK updated in $WINEPREFIX - $WINEARCH"
echo ""
echo "#########################################"
fi
wineserver -k
else
echo "################################################################"
echo ""
echo "You need to build before you can update ! Run updxvk build first"
echo ""
echo "################################################################"
fi
}
# External / Dynamic
if [ -n "$1" ] && [ "$1" != "batch" ] && [ "$1" != "build" ] && [ "$1" != "lutris" ] && [ "$1" != "proton-tkg" ] && [ "$1" != "proton-dist" ]; then
if [ -d "$1" ]; then
WINEPREFIX="$1"
if [ "$2" == "32" ]; then
echo "x86 prefix"
WINEARCH="win32"
_DXVKALIAS="x32"
elif [ "$2" == "64" ]; then
echo "x64 prefix"
WINEARCH="win64"
_DXVKALIAS="x64"
elif [ -d "$1/drive_c/Program Files (x86)" ]; then
echo "assuming x64 prefix"
WINEARCH="win64"
_DXVKALIAS="x64"
else
echo "assuming x86 prefix"
WINEARCH="win32"
_DXVKALIAS="x32"
fi
if [ "$2" == "vulkansdk" ]; then
WINEARCH="$WINEARCH" WINEPREFIX="$WINEPREFIX" "$WINECMD" regedit /S "$ROOT/DXVKBUILD/vulkansdk/vulkan.reg"
if [ ! -f "$ROOT/DXVKBUILD/vulkansdk/VulkanSDK-1.3.224.1-Installer.exe" ]; then
wget https://sdk.lunarg.com/sdk/download/1.3.224.1/windows/VulkanSDK-1.3.224.1-Installer.exe?Human=true -O "$ROOT/DXVKBUILD/vulkansdk/VulkanSDK-1.3.224.1-Installer.exe"
fi
WINEARCH="$WINEARCH" WINEPREFIX="$WINEPREFIX" "$WINECMD" "$ROOT/DXVKBUILD/vulkansdk/VulkanSDK-1.3.224.1-Installer.exe /S"
cp "$ROOT/DXVKBUILD/vulkansdk/winevulkan.json" "$WINEPREFIX/drive_c/windows/winevulkan.json"
echo "Vulkan SDK installation completed."
fi
fi
update
fi
# Batch
if [ "$1" == "batch" ] && [ ! -z "$PREFIXES_ROOT" ]; then
for D in $PREFIXES_ROOT/*; do
if [ -d "${D}" ]; then
echo "${D}"
if [ -d "${D}/drive_c" ]; then
WINEPREFIX="${D}"
if [ -d "${D}/drive_c/Program Files (x86)" ]; then
WINEARCH="win64"
_DXVKALIAS="x64"
else
WINEARCH="win32"
_DXVKALIAS="x32"
fi
update
fi
fi
done
fi
# Lutris
if [ "$1" == "lutris" ]; then
wineserver -k
if [ ! -f ./DXVKBUILD/"$DXVK_BRANCH/"last-HEAD ]; then
echo "You need to build before you can update ! Run updxvk build first"
else
source "$ROOT/DXVKBUILD/$DXVK_BRANCH/last-HEAD"
find "$HOME"/.local/share/lutris/runtime/dxvk/TkG/x64/ -type f -not -name 'd3d12.dll' -delete
find "$HOME"/.local/share/lutris/runtime/dxvk/TkG/x32/ -type f -not -name 'd3d12.dll' -delete
mkdir -p "$HOME"/.local/share/lutris/runtime/dxvk/TkG/x64
mkdir -p "$HOME"/.local/share/lutris/runtime/dxvk/TkG/x32
cp -rv ./DXVKBUILD/"$DXVK_BRANCH"/"$CURRENT_HEAD"/x64/* "$HOME"/.local/share/lutris/runtime/dxvk/TkG/x64
cp -rv ./DXVKBUILD/"$DXVK_BRANCH"/"$CURRENT_HEAD"/x32/* "$HOME"/.local/share/lutris/runtime/dxvk/TkG/x32
echo ""
echo "###########################################################"
echo ""
echo "Put 'TkG' as DXVK version in lutris to use your fresh build"
echo ""
echo "###########################################################"
fi
fi
# Proton-tkg
if [ "$1" == "proton-tkg" ]; then
wineserver -k
if [ ! -f ./DXVKBUILD/"$DXVK_BRANCH"/last-HEAD ]; then
echo "You need to build before you can update ! Run updxvk build first"
else
source "$ROOT/DXVKBUILD/$DXVK_BRANCH/last-HEAD"
if [ "$_proton_tkg_path" = "proton-tkg" ]; then
_proton_tkg_path=".."
else
_proton_tkg_path="../wine-tkg-git/proton-tkg/external-resources"
fi
rm -rf "$_proton_tkg_path"/dxvk
mkdir -p "$_proton_tkg_path"/dxvk/x64
mkdir -p "$_proton_tkg_path"/dxvk/x32
cp -rv ./DXVKBUILD/"$DXVK_BRANCH"/"$CURRENT_HEAD"/x64/* "$_proton_tkg_path"/dxvk/x64
cp -rv ./DXVKBUILD/"$DXVK_BRANCH"/"$CURRENT_HEAD"/x32/* "$_proton_tkg_path"/dxvk/x32
echo ""
echo "###############################################################"
echo ""
echo "This DXVK build will be integrated to your next Proton-tkg build"
echo ""
echo "###############################################################"
fi
fi
# Proton (other)
if [ "$1" == "proton-dist" ] && [ -n "$_proton_dist_path" ]; then
wineserver -k
if [ ! -f ./DXVKBUILD/"$DXVK_BRANCH"/last-HEAD ]; then
echo "You need to build before you can update ! Run updxvk build first"
else
source "$ROOT/DXVKBUILD/$DXVK_BRANCH/last-HEAD"
chmod +w "$_proton_dist_path"/lib64/wine/dxvk/*
chmod +w "$_proton_dist_path"/lib/wine/dxvk/*
\cp -rv ./DXVKBUILD/"$DXVK_BRANCH"/"$CURRENT_HEAD"/x64/* "$_proton_dist_path"/lib64/wine/dxvk
\cp -rv ./DXVKBUILD/"$DXVK_BRANCH"/"$CURRENT_HEAD"/x32/* "$_proton_dist_path"/lib/wine/dxvk
echo ""
echo "###############################################################"
echo ""
echo "This DXVK build will be used by the proton build in $_proton_dist_path"
echo ""
echo "###############################################################"
fi
fi
# Build from latest master branch
if [ "$1" == "build" ]; then
time build
fi
trap _exit_cleanup EXIT SIGTERM