-
Notifications
You must be signed in to change notification settings - Fork 13
/
upvkd3d-proton
executable file
·259 lines (206 loc) · 8.92 KB
/
upvkd3d-proton
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
#!/bin/bash
# TkGlitch's vkd3d-proton Updater - ti3nou@gmail.com
# BUILD HEAD OF THE CHOSEN BRANCH WITH : ./upvkd3d-proton build - (Edit VKD3D_BRANCH to point to the branch you want)
# LUTRIS UPDATE WITH : ./upvkd3d-proton lutris - (Put 'TkG' as VKD3D-PROTON version in lutris afterwards to use your fresh build)
# PROTON UPDATE WITH : ./upvkd3d-proton proton-dist - Requires _proton_dist_path to be set in upvkd3d-proton.cfg
# Putting patch files in VKD3D_PROTONBUILD/patches will auto-apply them if the extension is .vkd3dpatch, auto-revert them if the extension is .vkd3drevert, 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 upvkd3d-proton.cfg
# Load external configuration file if present. Available variable values will overwrite upvkd3d-proton.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 upvkd3d-proton.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/VKD3D_PROTONBUILD/vkd3d-proton-$VKD3D_PROTON_BRANCH"
echo -e "\nexit cleanup done"
}
build() {
mkdir -p VKD3D_PROTONBUILD
mkdir -p VKD3D_PROTONBUILD/patches
if [ "$DIRTYIN" != "2" ]; then
if [ -e "vkd3d-proton-$VKD3D_PROTON_BRANCH.vkd3ddirty" ] || [ "$DIRTYIN" == "1" ]; then
( cd vkd3d-proton-"$VKD3D_PROTON_BRANCH" && git reset --hard HEAD && git clean -xdf )
echo "#################"
echo ""
echo "YOUR TREE WAS CONSIDERED DIRTY AND HAS BEEN CLEARED"
echo ""
echo "#################"
rm "$VKD3D_PROTON_BRANCH".vkd3ddirty
fi
else
echo "#################"
echo ""
echo "YOU DIRTY BOI.."
echo ""
echo "#################"
fi
mkdir vkd3d-proton-"$VKD3D_PROTON_BRANCH"
cd vkd3d-proton-"$VKD3D_PROTON_BRANCH"
if [ ! -e package-release.sh ]; then
git init .
git remote add -t \* -f origin "$VKD3D_PROTON_REPO"
git checkout "$VKD3D_PROTON_BRANCH"
fi
if [ "$VKD3D_PROTON_AUTOUPDATE" == "1" ]; then
git pull
fi
if [ -n "$VKD3D_PROTON_COMMIT" ] && [ "$CUSTOM_COMMIT" == "1" ]; then
git checkout "$VKD3D_PROTON_COMMIT"
fi
git submodule update --init --recursive
( cd subprojects/dxil-spirv && git pull origin master )
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/vkd3d-proton/$_p $ROOT/VKD3D_PROTONBUILD/patches/
done
fi
if [ "$PATCHIN" == "1" ]; then
for F in ../VKD3D_PROTONBUILD/patches/*vkd3drevert; do
if [ -e "${F}" ]; then
echo "#################"
echo ""
echo "REVERTING PATCH ${F}"
echo ""
echo "#################"
patch -Np1 -R < ${F} && echo "This means that branch $VKD3D_PROTON_BRANCH was altered by patching and will be cleared next time you build" >> ../"$VKD3D_PROTON_BRANCH".vkd3ddirty || exit 1
else
echo "#################"
echo ""
echo "NO REVERT PATCH DETECTED - MOVING ON"
echo ""
echo "#################"
fi
done
for F in ../VKD3D_PROTONBUILD/patches/*vkd3dpatch; do
if [ -e "${F}" ]; then
echo "#################"
echo ""
echo "APPLYING PATCH ${F}"
echo ""
echo "#################"
patch -Np1 < ${F} && echo "This means that branch $VKD3D_PROTON_BRANCH was altered by patching and will be cleared next time you build" >> ../"$VKD3D_PROTON_BRANCH".vkd3ddirty || 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/VKD3D_PROTONBUILD/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 "$VKD3D_PROTON_BRANCH" ../VKD3D_PROTONBUILD --no-package
if [ -d ../VKD3D_PROTONBUILD/vkd3d-proton-"$VKD3D_PROTON_BRANCH"/x86 ] && [ -d ../VKD3D_PROTONBUILD/vkd3d-proton-"$VKD3D_PROTON_BRANCH"/x64 ]; then
mkdir -p ../VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/"$GIT_HEAD"
mv -v -T ../VKD3D_PROTONBUILD/vkd3d-proton-"$VKD3D_PROTON_BRANCH"/x86 ../VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/"$GIT_HEAD"/x86
mv -v -T ../VKD3D_PROTONBUILD/vkd3d-proton-"$VKD3D_PROTON_BRANCH"/x64 ../VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/"$GIT_HEAD"/x64
if [ -e ../vkd3d-proton-"$VKD3D_PROTON_BRANCH"/setup_vkd3d_proton.sh ]; then
cp ../vkd3d-proton-"$VKD3D_PROTON_BRANCH"/setup_vkd3d_proton.sh ../VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/"$GIT_HEAD"/
fi
rm -R -f ../VKD3D_PROTONBUILD/vkd3d-proton-"$VKD3D_PROTON_BRANCH"
echo "Your files were built in $ROOT/VKD3D_PROTONBUILD/$VKD3D_PROTON_BRANCH/$GIT_HEAD"
rm -f ../VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/last-HEAD
echo "CURRENT_HEAD=$GIT_HEAD" >> ../VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/last-HEAD
rm -f ../VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/latest
ln -s "$GIT_HEAD" "$ROOT"/VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/latest
else
rm -rf ../VKD3D_PROTONBUILD/*-"$VKD3D_PROTON_BRANCH"
fi
}
# Lutris
if [ "$1" == "lutris" ]; then
wineserver -k
if [ ! -f ./VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH/"last-HEAD ]; then
echo "You need to build before you can update ! Run upvkd3d-proton build first"
else
source "$ROOT/VKD3D_PROTONBUILD/$VKD3D_PROTON_BRANCH/last-HEAD"
rm -rv "$HOME"/.local/share/lutris/runtime/vkd3d/TkG/x64/d3d12.dll
rm -rv "$HOME"/.local/share/lutris/runtime/vkd3d/TkG/x32/d3d12.dll
rm -rv "$HOME"/.local/share/lutris/runtime/dxvk/TkG/x64/d3d12.dll
rm -rv "$HOME"/.local/share/lutris/runtime/dxvk/TkG/x32/d3d12.dll
mkdir -p "$HOME"/.local/share/lutris/runtime/vkd3d/TkG/x64
mkdir -p "$HOME"/.local/share/lutris/runtime/vkd3d/TkG/x32
cp -rv ./VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/"$CURRENT_HEAD"/x64/* "$HOME"/.local/share/lutris/runtime/vkd3d/TkG/x64
cp -rv ./VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/"$CURRENT_HEAD"/x86/* "$HOME"/.local/share/lutris/runtime/vkd3d/TkG/x32
echo ""
echo "###########################################################"
echo ""
echo "Put 'TkG' as DXVK version in lutris to use your fresh build"
echo ""
echo "###########################################################"
fi
fi
# Proton (other)
if [ "$1" == "proton-dist" ] && [ -n "$_proton_dist_path" ]; then
wineserver -k
if [ ! -f ./VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/last-HEAD ]; then
echo "You need to build before you can update ! Run upvkd3d-proton build first"
else
source "$ROOT/VKD3D_PROTONBUILD/$VKD3D_PROTON_BRANCH/last-HEAD"
chmod +w "$_proton_dist_path"/lib64/wine/vkd3d-proton/*
chmod +w "$_proton_dist_path"/lib/wine/vkd3d-proton/*
\cp -rv ./VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/"$CURRENT_HEAD"/x64/* "$_proton_dist_path"/lib64/wine/vkd3d-proton
\cp -rv ./VKD3D_PROTONBUILD/"$VKD3D_PROTON_BRANCH"/"$CURRENT_HEAD"/x86/* "$_proton_dist_path"/lib/wine/vkd3d-proton
echo ""
echo "###############################################################"
echo ""
echo "This VKD3D_PROTON 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