-
-
Notifications
You must be signed in to change notification settings - Fork 167
/
proton-tkg.sh
executable file
·1394 lines (1232 loc) · 65.7 KB
/
proton-tkg.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
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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# Created by: Tk-Glitch <ti3nou at gmail dot com>
# This script creates Steamplay compatible wine builds based on wine-tkg-git and additional proton patches and libraries.
# It is not standalone and can be considered an addon to wine-tkg-git PKGBUILD and patchsets.
# You can use the uninstall feature by calling the script with "clean" as argument : ./proton-tkg.sh clean
# You can run the vrclient building alone with : ./proton-tkg.sh build_vrclient
# You can run the lsteamclient building alone with : ./proton-tkg.sh build_lsteamclient
# You can run the steamhelper building alone with : ./proton-tkg.sh build_steamhelper
# You can run the mediaconverter building alone with : ./proton-tkg.sh build_mediaconv
set -e
_nowhere="$PWD"
_nomakepkg="true"
_no_steampath="false"
function resources_cleanup {
# The symlinks switch doesn't need the recursive flag, but we'll use it temporarily
# as a smoother transition for existing users with dirty trees
rm -rf "${_nowhere}"/{Proton,vkd3d-proton,dxvk-tools,dxvk,liberation-fonts,mono,gecko,steam-runtime,openvr}
rm -rf /tmp/steam-runtime
}
trap resources_cleanup EXIT
resources_cleanup
_resources_path="${_nowhere}/external-resources"
mkdir -p "${_resources_path}"/{Proton,vkd3d-proton,dxvk-tools,dxvk,liberation-fonts,mono,gecko,openvr}
ln -s "${_resources_path}"/Proton "${_nowhere}"/Proton
ln -s "${_resources_path}"/vkd3d-proton "${_nowhere}"/vkd3d-proton
ln -s "${_resources_path}"/dxvk-tools "${_nowhere}"/dxvk-tools
ln -s "${_resources_path}"/dxvk "${_nowhere}"/dxvk
ln -s "${_resources_path}"/liberation-fonts "${_nowhere}"/liberation-fonts
ln -s "${_resources_path}"/mono "${_nowhere}"/mono
ln -s "${_resources_path}"/gecko "${_nowhere}"/gecko
ln -s "${_resources_path}"/steam-runtime "${_nowhere}"/steam-runtime
ln -s "${_resources_path}"/openvr "${_nowhere}"/openvr
# Enforce using makepkg when using --makepkg
if [ "$1" = "--makepkg" ]; then
_nomakepkg="false"
fi
if [ "$_ispkgbuild" = "true" ]; then
_wine_tkg_git_path="${_nowhere}/../../wine-tkg-git"
_logdir="$_nowhere/.."
else
_wine_tkg_git_path="${_nowhere}/../wine-tkg-git" # Change to wine-tkg-git path if needed
_logdir="$_nowhere"
# Set Steam root path
if [ -d "$HOME/.steam/root" ]; then # typical on Arch
_steampath="$HOME/.steam/root"
_runtime="$HOME/.steam/root/ubuntu12_32/steam-runtime"
elif [ -e "$HOME/.steam/steam.sh" ]; then # typical on Ubuntu
_steampath="$HOME/.steam"
_runtime="$HOME/.steam/ubuntu12_32/steam-runtime"
else
read -rp "Your Steam install wasn't found! Do you want to continue anyway? N/y: " _no_steampath;
if [ "$_no_steampath" != "y" ]; then
exit
fi
fi
if [ "$_no_steampath" != "y" ]; then
# Set Steam config file path
if [ -e "$HOME/.local/share/Steam/config/config.vdf" ]; then
_config_file="$HOME/.local/share/Steam/config/config.vdf"
elif [ -e "$_steampath/steam/config/config.vdf" ]; then
_config_file="$_steampath/steam/config/config.vdf"
elif [ -e "$_steampath/config/config.vdf" ]; then
_config_file="$_steampath/config/config.vdf"
else
echo -e "Your Steam config file path wasn't found! Exiting.."
exit
fi
fi
fi
cat <<'EOF'
______ __ __ __
| __ \.----.-----.| |_.-----.-----.______| |_| |--.-----.
| __/| _| _ || _| _ | |______| _| <| _ |
|___| |__| |_____||____|_____|__|__| |____|__|__|___ |
|_____|
Also known as "Some kind of build wrapper for wine-tkg-git"
EOF
function new_lib_path_check {
# We want to track builds using the new lib paths - introduced with 0aa335b1060428f5f799c93e3c6dea2bc2dd864a-79a148e1fa8b5ada2dc8fec03cf866a3d78c0d54
# i386
if [ -d "$_nowhere/proton_dist_tmp/$_lib32name/wine/i386-unix" ] && [ ! -d "$_nowhere/proton_dist_tmp/$_lib32name/wine/i386-windows" ]; then # This case shouldn't exist
_new_lib_paths="true"
_new_lib_paths_69="false"
_i386_unix_path="$_nowhere/proton_dist_tmp/$_lib32name/wine/i386-unix/"
_i386_windows_path="$_nowhere/proton_dist_tmp/$_lib32name/wine/"
_i386_windows_tail="/$_lib32name/wine"
# wow64
elif [ ! -d "$_nowhere/proton_dist_tmp/$_lib32name/wine/i386-unix" ] && [ -d "$_nowhere/proton_dist_tmp/$_lib64name/wine/i386-windows" ]; then
_new_lib_paths="true"
_new_lib_paths_69="true"
_wow64_paths="true"
_i386_unix_path=
_i386_windows_path="$_nowhere/proton_dist_tmp/$_lib64name/wine/i386-windows/"
_i386_windows_tail="/$_lib64name/wine/i386-windows"
elif [ ! -d "$_nowhere/proton_dist_tmp/$_lib32name/wine/i386-unix" ] && [ -d "$_nowhere/proton_dist_tmp/$_lib32name/wine/i386-windows" ] && [ ! -e "$_nowhere"/proton_dist_tmp/$_lib32name/libwine.* ]; then
_new_lib_paths="true"
_new_lib_paths_69="false"
_i386_unix_path="$_nowhere/proton_dist_tmp/$_lib32name/"
_i386_windows_path="$_nowhere/proton_dist_tmp/$_lib32name/wine/i386-windows/"
_i386_windows_tail="/$_lib32name/wine/i386-windows"
elif [ -d "$_nowhere/proton_dist_tmp/$_lib32name/wine/i386-unix" ] && [ -d "$_nowhere/proton_dist_tmp/$_lib32name/wine/i386-windows" ] && [ ! -e "$_nowhere"/proton_dist_tmp/$_lib32name/libwine.* ]; then
_new_lib_paths="true"
_new_lib_paths_69="true"
_i386_unix_path="$_nowhere/proton_dist_tmp/$_lib32name/wine/i386-unix/"
_i386_windows_path="$_nowhere/proton_dist_tmp/$_lib32name/wine/i386-windows/"
_i386_windows_tail="/$_lib32name/wine/i386-windows"
else
_new_lib_paths="false"
_new_lib_paths_69="false"
_i386_unix_path="$_nowhere/proton_dist_tmp/$_lib32name/"
_i386_windows_path="$_nowhere/proton_dist_tmp/$_lib32name/wine/"
_i386_windows_tail="/$_lib32name/wine"
fi
# x86_64
if [ -d "$_nowhere/proton_dist_tmp/$_lib64name/wine/x86_64-unix" ] && [ ! -d "$_nowhere/proton_dist_tmp/$_lib64name/wine/x86_64-windows" ]; then # This case shouldn't exist
_new_lib_paths="true"
_new_lib_paths_69="false"
_x86_64_unix_path="$_nowhere/proton_dist_tmp/$_lib64name/wine/x86_64-unix/"
_x86_64_windows_path="$_nowhere/proton_dist_tmp/$_lib64name/wine/"
_x86_64_windows_tail="/$_lib64name/wine"
elif [ ! -d "$_nowhere/proton_dist_tmp/$_lib64name/wine/x86_64-unix" ] && [ -d "$_nowhere/proton_dist_tmp/$_lib64name/wine/x86_64-windows" ] && [ ! -e "$_nowhere"/proton_dist_tmp/$_lib64name/libwine.* ]; then
_new_lib_paths="true"
_new_lib_paths_69="false"
_x86_64_unix_path="$_nowhere/proton_dist_tmp/$_lib64name/"
_x86_64_windows_path="$_nowhere/proton_dist_tmp/$_lib64name/wine/x86_64-windows/"
_x86_64_windows_tail="$_lib64name/wine/x86_64-windows"
elif [ -d "$_nowhere/proton_dist_tmp/$_lib64name/wine/x86_64-unix" ] && [ -d "$_nowhere/proton_dist_tmp/$_lib64name/wine/x86_64-windows" ] && [ ! -e "$_nowhere"/proton_dist_tmp/$_lib64name/libwine.* ]; then
_new_lib_paths="true"
_new_lib_paths_69="true"
_x86_64_unix_path="$_nowhere/proton_dist_tmp/$_lib64name/wine/x86_64-unix/"
_x86_64_windows_path="$_nowhere/proton_dist_tmp/$_lib64name/wine/x86_64-windows/"
_x86_64_windows_tail="$_lib64name/wine/x86_64-windows"
else
_new_lib_paths="false"
_new_lib_paths_69="false"
_x86_64_unix_path="$_nowhere/proton_dist_tmp/$_lib64name/"
_x86_64_windows_path="$_nowhere/proton_dist_tmp/$_lib64name/wine/"
_x86_64_windows_tail="/$_lib64name/wine"
fi
echo "_i386_unix_path=$_i386_unix_path" >>"$_logdir"/proton-tkg.log 2>&1
echo "_i386_windows_path=$_i386_windows_path" >>"$_logdir"/proton-tkg.log 2>&1
echo "_x86_64_unix_path=$_x86_64_unix_path" >>"$_logdir"/proton-tkg.log 2>&1
echo "_x86_64_windows_path=$_x86_64_windows_path" >>"$_logdir"/proton-tkg.log 2>&1
}
function build_vrclient {
cd "$_nowhere"
source "$_nowhere/proton_tkg_token"
git clone https://github.com/ValveSoftware/openvr.git || true # It'll complain the path already exists on subsequent builds
cd openvr
git reset --hard HEAD
git clean -xdf
git pull origin master
#git checkout 52065df3d6f3af96300dac98cdf7397f26abfcd7
#cd ..
export WINEMAKERFLAGS="--nosource-fix --nolower-include --nodlls --nomsvcrt --dll -I$_nowhere/proton_dist_tmp/include/wine/windows/ -I$_nowhere/proton_dist_tmp/include/ -I$_nowhere/proton_dist_tmp/include/wine/"
export CFLAGS="-O2 -g -Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types"
export CXXFLAGS="-Wno-attributes -std=c++0x -O2 -g"
PATH="$_nowhere"/proton_dist_tmp/bin:$PATH
if [[ "$_proton_branch" != *3.* ]] && [[ "$_proton_branch" != *4.* ]]; then
if [[ "$_proton_branch" = *5.0 ]] && [ "$_standard_dlopen" = "true" ]; then
patch -Np1 < "$_nowhere/proton_template/vrclient-remove-library.h-dep.patch" || exit 1
patch -Np1 < "$_nowhere/proton_template/vrclient-use_standard_dlopen_instead_of_the_libwine_wrappers.patch" || exit 1
WINEMAKERFLAGS+=" -ldl"
elif [[ "$_proton_branch" = *5.13 ]]; then
patch -Np1 < "$_nowhere/proton_template/vrclient-remove-library.h-dep.patch" || exit 1
WINEMAKERFLAGS+=" -ldl"
else
WINEMAKERFLAGS+=" -ldl"
fi
fi
new_lib_path_check
rm -rf build/vrclient.win64
rm -rf build/vrclient.win32
mkdir -p build/vrclient.win64
mkdir -p build/vrclient.win32
if [ ! -e "$_nowhere/proton_dist_tmp/include/wine/unixlib.h" ]; then
cp "$_wine_tkg_git_path/src/$_winesrcdir/include/wine/unixlib.h" "$_nowhere/proton_dist_tmp/include/wine/"
fi
cp -a "${_nowhere}"/Proton/vrclient_x64/* build/vrclient.win64
cp -a "${_nowhere}"/Proton/vrclient_x64/* build/vrclient.win32
mv build/vrclient.win32/vrclient_x64 build/vrclient.win32/vrclient
if [ -e build/vrclient.win32/vrclient/vrclient_x64.spec ]; then
mv build/vrclient.win32/vrclient/vrclient_x64.spec build/vrclient.win32/vrclient/vrclient.spec
_vrclient_longpath64="/vrclient_x64"
_vrclient_longpath32="/vrclient"
fi
cd build/vrclient.win64
winemaker $WINEMAKERFLAGS -L"$_nowhere/proton_dist_tmp/$_lib64name/" -L"$_nowhere/proton_dist_tmp/$_lib64name/wine/" -I"$_nowhere/openvr/build/vrclient.win64/vrclient_x64/" -I"$_nowhere/openvr/build/vrclient.win64/" vrclient_x64
make -e CC="winegcc -m64" CXX="wineg++ -m64 $_cxx_addon" -C "$_nowhere/openvr/build/vrclient.win64/vrclient_x64" -j$(nproc) && strip --strip-debug vrclient_x64/vrclient_x64.dll.so || exit 1
winebuild --dll --fake-module -E "$_nowhere/openvr/build/vrclient.win64$_vrclient_longpath64/vrclient_x64.spec" -o vrclient_x64.dll.fake || exit 1
cd ../..
cd build/vrclient.win32
if [ "$_NOLIB32" != "true" ]; then
winemaker $WINEMAKERFLAGS --wine32 -L"$_nowhere/proton_dist_tmp/$_lib32name/" -L"$_nowhere/proton_dist_tmp/$_lib32name/wine/" -I"$_nowhere/openvr/build/vrclient.win32/vrclient/" -I"$_nowhere/openvr/build/vrclient.win32/" vrclient
make -e CC="winegcc -m32" CXX="wineg++ -m32 $_cxx_addon" -C "$_nowhere/openvr/build/vrclient.win32/vrclient" -j$(nproc) && strip --strip-debug vrclient/vrclient.dll.so || exit 1
fi
winebuild --dll --fake-module -E "$_nowhere/openvr/build/vrclient.win32$_vrclient_longpath32/vrclient.spec" -o vrclient.dll.fake || exit 1
cd "$_nowhere"
mkdir -p proton_dist_tmp/lib/wine/dxvk
mkdir -p proton_dist_tmp/lib64/wine/dxvk
cp -v "${_nowhere}"/openvr/bin/win32/openvr_api.dll proton_dist_tmp/lib/wine/dxvk/openvr_api_dxvk.dll
cp -v "${_nowhere}"/openvr/bin/win64/openvr_api.dll proton_dist_tmp/lib64/wine/dxvk/openvr_api_dxvk.dll
if [ "$_wow64_paths" = "true" ]; then
cp -v "${_nowhere}"/openvr/build/vrclient.win64/vrclient_x64/vrclient_x64.dll.so proton_dist_tmp/$_lib64name/wine/x86_64-unix/
cp -v "${_nowhere}"/openvr/build/vrclient.win64/vrclient_x64.dll.fake proton_dist_tmp/$_lib64name/wine/x86_64-windows/vrclient_x64.dll
cp -v "${_nowhere}"/openvr/build/vrclient.win32/vrclient.dll.fake proton_dist_tmp/$_lib64name/wine/i386-windows/vrclient.dll
elif [ "$_new_lib_paths" = "true" ]; then
if [ "$_new_lib_paths_69" = "true" ] && [ -d proton_dist_tmp/$_lib32name/wine/i386-windows ] && [ -d proton_dist_tmp/$_lib64name/wine/x86_64-windows ]; then
cp -v "${_nowhere}"/openvr/build/vrclient.win64/vrclient_x64/vrclient_x64.dll.so proton_dist_tmp/$_lib64name/wine/x86_64-unix/ && cp -v "${_nowhere}"/openvr/build/vrclient.win64/vrclient_x64.dll.fake proton_dist_tmp/$_lib64name/wine/x86_64-windows/vrclient_x64.dll
if [ "$_NOLIB32" != "true" ]; then
cp -v "${_nowhere}"/openvr/build/vrclient.win32/vrclient/vrclient.dll.so proton_dist_tmp/$_lib32name/wine/i386-unix/
fi
cp -v "${_nowhere}"/openvr/build/vrclient.win32/vrclient.dll.fake proton_dist_tmp/$_lib32name/wine/i386-windows/vrclient.dll
fi
else
cp -v "${_nowhere}"/openvr/build/vrclient.win64/vrclient_x64/vrclient_x64.dll.so proton_dist_tmp/$_lib64name/wine/ && cp -v "${_nowhere}"/openvr/build/vrclient.win64/vrclient_x64.dll.fake proton_dist_tmp/$_lib64name/wine/fakedlls/vrclient_x64.dll
cp -v "${_nowhere}"/openvr/build/vrclient.win32/vrclient/vrclient.dll.so proton_dist_tmp/$_lib32name/wine/ && cp -v "${_nowhere}"/openvr/build/vrclient.win32/vrclient.dll.fake proton_dist_tmp/$_lib32name/wine/fakedlls/vrclient.dll
fi
}
function build_lsteamclient {
cd "$_nowhere"/Proton
source "$_nowhere/proton_tkg_token"
export WINEMAKERFLAGS="--nosource-fix --nolower-include --nodlls --nomsvcrt -I$_nowhere/proton_dist_tmp/include/wine -I$_wine_tkg_git_path/src/$_winesrcdir/include -I$_wine_tkg_git_path/src/$_winesrcdir/include/wine"
export CFLAGS="-Wno-attributes -O2 -g"
export CXXFLAGS="-fpermissive -Wno-attributes -O2 -g"
export PATH="$_nowhere"/proton_dist_tmp/bin:$PATH
if [[ "$_proton_branch" != *3.* ]] && [[ "$_proton_branch" != *4.* ]]; then
_cxx_addon="-std=gnu++11"
if [[ "$_proton_branch" = *5.0 ]] && [ "$_standard_dlopen" = "true" ]; then
patch -Np1 < "$_nowhere/proton_template/steamclient-remove-library.h-dep.patch" || exit 1
patch -Np1 < "$_nowhere/proton_template/steamclient-use_standard_dlopen_instead_of_the_libwine_wrappers.patch" || exit 1
WINEMAKERFLAGS+=" -ldl"
elif [[ "$_proton_branch" = *5.13 ]]; then
patch -Np1 < "$_nowhere/proton_template/steamclient-remove-library.h-dep.patch" || exit 1
WINEMAKERFLAGS+=" -ldl"
else
WINEMAKERFLAGS+=" -ldl"
fi
fi
new_lib_path_check
rm -rf build/lsteamclient.win64
rm -rf build/lsteamclient.win32
mkdir -p build/lsteamclient.win64
mkdir -p build/lsteamclient.win32
cp -a lsteamclient/* build/lsteamclient.win64
cp -a lsteamclient/* build/lsteamclient.win32
cd build/lsteamclient.win64
winemaker $WINEMAKERFLAGS --dll -DSTEAM_API_EXPORTS -Dprivate=public -Dprotected=public .
sed -re 's@_LDFLAGS=@_LDFLAGS= -static-libgcc -static-libstdc++ -ldl @' -i "$_nowhere/Proton/build/lsteamclient.win64/Makefile"
make -e CC="winegcc -m64" CXX="wineg++ -m64 $_cxx_addon" -C "$_nowhere/Proton/build/lsteamclient.win64" -j$(nproc) && strip --strip-debug lsteamclient.dll.so || exit 1
if [ "$_new_lib_paths_69" = "true" ]; then
touch "$_nowhere/Proton/build/lsteamclient.win64/steamclient.spec"
winebuild --dll --fake-module -m64 -E "$_nowhere/Proton/build/lsteamclient.win64/steamclient.spec" --dll-name=lsteamclient -o lsteamclient.dll.fake || exit 1
fi
cd ../..
cd build/lsteamclient.win32
if [ "$_NOLIB32" != "true" ]; then
winemaker $WINEMAKERFLAGS --dll -DSTEAM_API_EXPORTS -Dprivate=public -Dprotected=public --wine32 .
sed -re 's@_LDFLAGS=@_LDFLAGS= -static-libgcc -static-libstdc++ -ldl @' -i "$_nowhere/Proton/build/lsteamclient.win32/Makefile"
make -e CC="winegcc -m32" CXX="wineg++ -m32 $_cxx_addon" -C "$_nowhere/Proton/build/lsteamclient.win32" -j$(nproc) && strip --strip-debug lsteamclient.dll.so || exit 1
fi
if [ "$_new_lib_paths_69" = "true" ]; then
touch "$_nowhere/Proton/build/lsteamclient.win32/steamclient.spec"
winebuild --dll --fake-module -m32 -E "$_nowhere/Proton/build/lsteamclient.win32/steamclient.spec" --dll-name=lsteamclient -o lsteamclient.dll.fake || exit 1
fi
cd "$_nowhere"
# Inject lsteamclient libs in our wine-tkg-git build
if [ "$_wow64_paths" = "true" ]; then
cp -v Proton/build/lsteamclient.win64/lsteamclient.dll.so proton_dist_tmp/$_lib64name/wine/x86_64-unix/
cp -v Proton/build/lsteamclient.win64/lsteamclient.dll.fake proton_dist_tmp/$_lib64name/wine/x86_64-windows/lsteamclient.dll
cp -v Proton/build/lsteamclient.win32/lsteamclient.dll.fake proton_dist_tmp/$_lib64name/wine/i386-windows/lsteamclient.dll
elif [ "$_new_lib_paths" = "true" ]; then
if [ "$_new_lib_paths_69" = "true" ]; then
cp -v Proton/build/lsteamclient.win64/lsteamclient.dll.so proton_dist_tmp/$_lib64name/wine/x86_64-unix/
if [ "$_NOLIB32" != "true" ]; then
cp -v Proton/build/lsteamclient.win32/lsteamclient.dll.so proton_dist_tmp/$_lib32name/wine/i386-unix/
fi
else
cp -v Proton/build/lsteamclient.win64/lsteamclient.dll.so proton_dist_tmp/$_lib64name/wine/
cp -v Proton/build/lsteamclient.win32/lsteamclient.dll.so proton_dist_tmp/$_lib32name/wine/
fi
if [ "$_new_lib_paths_69" = "true" ] && [ -d proton_dist_tmp/$_lib32name/wine/i386-windows ] && [ -d proton_dist_tmp/$_lib64name/wine/x86_64-windows ]; then
cp -v Proton/build/lsteamclient.win64/lsteamclient.dll.fake proton_dist_tmp/$_lib64name/wine/x86_64-windows/lsteamclient.dll
cp -v Proton/build/lsteamclient.win32/lsteamclient.dll.fake proton_dist_tmp/$_lib32name/wine/i386-windows/lsteamclient.dll
fi
else
cp -v Proton/build/lsteamclient.win64/lsteamclient.dll.so proton_dist_tmp/$_lib64name/wine/
cp -v Proton/build/lsteamclient.win32/lsteamclient.dll.so proton_dist_tmp/$_lib32name/wine/
cp -v Proton/build/lsteamclient.win64/lsteamclient.dll.fake proton_dist_tmp/$_lib64name/wine/fakedlls/lsteamclient.dll
cp -v Proton/build/lsteamclient.win32/lsteamclient.dll.fake proton_dist_tmp/$_lib32name/wine/fakedlls/lsteamclient.dll
fi
}
function build_vkd3d {
cd "$_nowhere"
source "$_nowhere/proton_tkg_token"
git clone https://github.com/HansKristian-Work/vkd3d-proton.git || true # It'll complain the path already exists on subsequent builds
cd vkd3d-proton
git reset --hard HEAD
git clean -xdf
git pull origin master
git submodule update --init --recursive
if [ "$_bump_dxil_spirv" = "true" ]; then
( cd subprojects/dxil-spirv && git pull origin master )
fi
_user_patches_no_confirm="true"
_userpatch_target="vkd3d-proton"
_userpatch_ext="myvkd3d"
proton_patcher
rm -rf build/lib64-vkd3d
rm -rf build/lib32-vkd3d
mkdir -p build/lib64-vkd3d
mkdir -p build/lib32-vkd3d
unset CFLAGS
unset CPPFLAGS
unset CXXFLAGS
unset LDFLAGS
meson --cross-file build-win64.txt --buildtype release --strip -Denable_tests=false --prefix "$_nowhere"/vkd3d-proton/build/lib64-vkd3d "$_nowhere"/vkd3d-proton/build/lib64-vkd3d
cd "$_nowhere"/vkd3d-proton/build/lib64-vkd3d && ninja install
cd "$_nowhere"/vkd3d-proton
meson --cross-file build-win32.txt --buildtype release --strip -Denable_tests=false --prefix "$_nowhere"/vkd3d-proton/build/lib32-vkd3d "$_nowhere"/vkd3d-proton/build/lib32-vkd3d
cd "$_nowhere"/vkd3d-proton/build/lib32-vkd3d && ninja install
cd "$_nowhere"
}
function build_dxvk {
cd "$_nowhere"
git clone https://github.com/Frogging-Family/dxvk-tools.git || true # It'll complain the path already exists on subsequent builds
cd dxvk-tools
git reset --hard HEAD
git clean -xdf
git pull origin master
if [ -e "$_nowhere"/proton-tkg-userpatches/*.mydxvk* ]; then
cp "$_nowhere"/proton-tkg-userpatches/*.mydxvk* DXVKBUILD/patches/
fi
./updxvk build
_proton_tkg_path="proton-tkg" ./updxvk proton-tkg
cd "$_nowhere"
}
function build_dxvk_nvapi {
cd "$_nowhere"/Proton
git clone https://github.com/jp7677/dxvk-nvapi.git || true # It'll complain the path already exists on subsequent builds
cd dxvk-nvapi
git reset --hard HEAD
git clean -xdf
git pull origin master
git submodule update --init --recursive
rm -rf "$_nowhere"/Proton/build/lib64-dxvk-nvapi
rm -rf "$_nowhere"/Proton/build/lib32-dxvk-nvapi
mkdir -p "$_nowhere"/Proton/build/lib64-dxvk-nvapi
mkdir -p "$_nowhere"/Proton/build/lib32-dxvk-nvapi
unset CFLAGS
unset CPPFLAGS
unset CXXFLAGS
unset LDFLAGS
cd "$_nowhere"/Proton/dxvk-nvapi && ./package-release.sh master "$_nowhere"/Proton/build
cd "$_nowhere"
}
function build_mediaconverter {
mkdir -p "$_nowhere/gst/lib64/gstreamer-1.0"
mkdir -p "$_nowhere/gst/lib/gstreamer-1.0"
if [ "$_build_gstreamer" = "true" ]; then
if [ -n "$_runtime" ]; then
"$_nowhere"/steam-runtime/run.sh "$_nowhere"/proton_template/gstreamer.sh
else
"$_nowhere"/proton_template/gstreamer.sh
fi
fi
if [ "$_build_mediaconv" = "true" ]; then
# git 2.40 workaround
git config --local index.skipHash false && git add .
if [ -d "$_nowhere"/Proton/media-converter ]; then
cd "$_nowhere"/Proton/media-converter
# 32-bit
if [ "$_NOLIB32" != "true" ]; then
mkdir -p "$_nowhere"/Proton/build/mediaconv32
rm -rf "$_nowhere"/Proton/build/mediaconv32/*
( if [ -d '/usr/lib32/pkgconfig' ]; then # Typical Arch path
export PKG_CONFIG_PATH="$_proton_tkg_path/gst/lib/pkgconfig:/usr/lib32/pkgconfig"
elif [ -d '/usr/lib/i386-linux-gnu/pkgconfig' ]; then # Ubuntu 18.04/19.04 path
export PKG_CONFIG_PATH="$_proton_tkg_path/gst/lib/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig"
else
export PKG_CONFIG_PATH="$_proton_tkg_path/gst/lib/pkgconfig:/usr/lib/pkgconfig" # Pretty common path, possibly helpful for OpenSuse & Fedora
fi
PKG_CONFIG_ALLOW_CROSS=1 cargo build --target i686-unknown-linux-gnu --target-dir "$_nowhere"/Proton/build/mediaconv32 --release )
cp -a "$_nowhere"/Proton/build/mediaconv32/i686-unknown-linux-gnu/release/libprotonmediaconverter.so "$_nowhere"/gst/lib/gstreamer-1.0/
fi
# 64-bit
mkdir -p "$_nowhere"/Proton/build/mediaconv64
rm -rf "$_nowhere"/Proton/build/mediaconv64/*
( if [ ! -d '/usr/lib32' ]; then # Fedora
PKG_CONFIG_PATH="$_proton_tkg_path/gst/lib64/pkgconfig:/usr/lib64/pkgconfig"
elif [ -d '/usr/lib32' ] && [ -d '/usr/lib' ] && [ -e '/usr/lib64' ]; then # Arch
PKG_CONFIG_PATH="$_proton_tkg_path/gst/lib64/pkgconfig:/usr/lib/pkgconfig"
fi
cargo build --target x86_64-unknown-linux-gnu --target-dir "$_nowhere"/Proton/build/mediaconv64 --release )
cp -a "$_nowhere"/Proton/build/mediaconv64/x86_64-unknown-linux-gnu/release/libprotonmediaconverter.so "$_nowhere"/gst/lib64/gstreamer-1.0/
fi
fi
strip --strip-unneeded "$_nowhere"/gst/lib/gstreamer-1.0/*.so || true
strip --strip-unneeded "$_nowhere"/gst/lib64/gstreamer-1.0/*.so || true
cd "$_nowhere"
}
function build_steamhelper {
export CFLAGS="-Wno-attributes -O2 -g"
export CXXFLAGS="-Wno-attributes -O2 -g -fpermissive"
# disable openvr support for now since we don't support it
if [[ "$_proton_branch" = *6.3 ]]; then
_cxx_addon="-std=c++17"
if [ "$_no_loader_array" = "true" ]; then
if [ "$_steamvr_support" != "true" ]; then
( cd Proton && patch -Np1 -R < "$_nowhere/proton_template/steamhelper_revert_openvr-support-legacy.patch" ) || exit 1
fi
else
if [ -d "$_nowhere"/Proton/steam_helper/64 ]; then
( cd Proton && patch -Np1 < "$_nowhere/proton_template/steamhelper_remove__wine_make_process_system2.patch" ) || exit 1
#( cd Proton && patch -Np1 < "$_nowhere/proton_template/SHGetFolderPathW_nuke.patch" ) || exit 1
else
( cd Proton && patch -Np1 < "$_nowhere/proton_template/steamhelper_remove__wine_make_process_system.patch" || exit 1 )
fi
if [ "$_steamvr_support" != "true" ]; then
( cd Proton && patch -Np1 -R < "$_nowhere/proton_template/steamhelper_revert_openvr-support.patch" ) || exit 1
fi
fi
fi
if [[ "$_proton_branch" = *6.* ]] || [[ "$_proton_branch" = *7.* ]] && [ "$_processinfoclass" = "true" ]; then
( cd Proton && patch -Np1 < "$_nowhere/proton_template/steamhelper_PROCESSINFOCLASS.patch" ) || exit 1
fi
if [[ $_proton_branch != *3.* ]]; then
source "$_nowhere/proton_tkg_token" || true
rm -rf Proton/build/steam.win32
mkdir -p Proton/build/steam.win32
cp -a Proton/steam_helper/* Proton/build/steam.win32
rm -rf Proton/build/steam.win64
mkdir -p Proton/build/steam.win64
cp -a Proton/steam_helper/* Proton/build/steam.win64
cd Proton/build/steam.win32
new_lib_path_check
if [[ "$_proton_branch" = *4.11 ]]; then
export WINEMAKERFLAGS="--nosource-fix --nolower-include --nodlls -I$_nowhere/proton_dist_tmp/include/wine -I$_wine_tkg_git_path/src/$_winesrcdir/include -I$_wine_tkg_git_path/src/$_winesrcdir/include/wine -I$_nowhere/proton_dist_tmp/include/wine/msvcrt"
winemaker $WINEMAKERFLAGS --wine32 --guiexe -lsteam_api -lole32 -I"$_nowhere/Proton/lsteamclient/steamworks_sdk_142/" -I"$_nowhere/openvr/headers/" -L"$_nowhere/Proton/steam_helper" .
else
export WINEMAKERFLAGS="--nosource-fix --nolower-include --nodlls --nomsvcrt -I$_nowhere/proton_dist_tmp/include/wine -I$_wine_tkg_git_path/src/$_winesrcdir/include -I$_wine_tkg_git_path/src/$_winesrcdir/include/wine"
winemaker $WINEMAKERFLAGS --wine32 --guiexe -lsteam_api -lole32 -I"$_nowhere/Proton/lsteamclient/steamworks_sdk_142/" -I"$_nowhere/openvr/headers/" -L"$_nowhere/Proton/steam_helper" .
fi
if [ "$_NOLIB32" != "true" ]; then
# 32-bit
if [ -e "$_nowhere"/Proton/steam_helper/32/libsteam_api.so ]; then
make -e CC="winegcc -m32" CXX="wineg++ -m32 $_cxx_addon" -C "$_nowhere/Proton/build/steam.win32" LIBRARIES="-L$_nowhere/Proton/steam_helper/32/ -lsteam_api -lole32 -lshlwapi -lmsi -ldl -static-libgcc -static-libstdc++" -j$(nproc) && strip --strip-debug steam.exe.so || exit 1
else
make -e CC="winegcc -m32" CXX="wineg++ -m32 $_cxx_addon" -C "$_nowhere/Proton/build/steam.win32" LIBRARIES="-lsteam_api -lole32 -ldl -static-libgcc -static-libstdc++" -j$(nproc) && strip --strip-debug steam.exe.so || exit 1
fi
fi
if [ "$_new_lib_paths_69" = "true" ]; then
touch "$_nowhere/Proton/build/steam.win32/steam.spec"
winebuild --exe --fake-module -m32 -E "$_nowhere/Proton/build/steam.win32/steam.spec" --dll-name=steam -o steam.exe.fake || exit 1
fi
# 64-bit
if [ -e "$_nowhere"/Proton/steam_helper/64/libsteam_api.so ]; then
cd "$_nowhere"/Proton/build/steam.win64
winemaker $WINEMAKERFLAGS --guiexe -lsteam_api -lole32 -I"$_nowhere/Proton/lsteamclient/steamworks_sdk_142/" -I"$_nowhere/openvr/headers/" -L"$_nowhere/Proton/steam_helper" .
make -e CC="winegcc -m64" CXX="wineg++ -m64 $_cxx_addon" -C "$_nowhere/Proton/build/steam.win64" LIBRARIES="-L$_nowhere/Proton/steam_helper/64/ -lsteam_api -lshlwapi -lmsi -lole32 -ldl -static-libgcc -static-libstdc++" -j$(nproc) && strip --strip-debug steam.exe.so
touch "$_nowhere/Proton/build/steam.win64/steam.spec"
winebuild --exe --fake-module -m64 -E "$_nowhere/Proton/build/steam.win64/steam.spec" --dll-name=steam -o steam.exe.fake || exit 1
fi
cd "$_nowhere"
if [ "$_wow64_paths" = "true" ]; then
cp -v Proton/build/steam.win32/steam.exe.fake proton_dist_tmp/$_lib64name/wine/i386-windows/steam.exe
cp -v Proton/build/steam.win64/steam.exe.fake proton_dist_tmp/$_lib64name/wine/x86_64-windows/steam.exe
cp -v Proton/build/steam.win64/steam.exe.so proton_dist_tmp/$_lib64name/wine/x86_64-unix/
cp -v Proton/build/steam.win64/64/libsteam_api.so proton_dist_tmp/$_lib64name/
elif [ "$_new_lib_paths" = "true" ]; then
# .exe 32 - always there
cp -v Proton/build/steam.win32/steam.exe.fake proton_dist_tmp/$_lib32name/wine/i386-windows/steam.exe
# .exe 64
if [ -e Proton/build/steam.win64/steam.exe.fake ]; then
cp -v Proton/build/steam.win64/steam.exe.fake proton_dist_tmp/$_lib64name/wine/x86_64-windows/steam.exe
fi
if [ "$_new_lib_paths_69" = "true" ]; then
if [ "$_NOLIB32" != "true" ]; then
# .so 32
if [ -e Proton/build/steam.win32/steam.exe.so ]; then
cp -v Proton/build/steam.win32/steam.exe.so proton_dist_tmp/$_lib32name/wine/i386-unix/
fi
fi
# .so 64
if [ -e Proton/build/steam.win64/steam.exe.so ]; then
cp -v Proton/build/steam.win64/steam.exe.so proton_dist_tmp/$_lib64name/wine/x86_64-unix/
fi
else
# .so 32 - always there
cp -v Proton/build/steam.win32/steam.exe.so proton_dist_tmp/$_lib32name/wine/
fi
# .so 32
if [ -e Proton/build/steam.win32/libsteam_api.so ]; then
cp -v Proton/build/steam.win32/libsteam_api.so proton_dist_tmp/$_lib32name/
fi
# .so 64
if [ -e Proton/build/steam.win64/32/libsteam_api.so ]; then
cp -v Proton/build/steam.win64/32/libsteam_api.so proton_dist_tmp/$_lib32name/
cp -v Proton/build/steam.win64/64/libsteam_api.so proton_dist_tmp/$_lib64name/
fi
else
cp -v Proton/build/steam.win32/steam.exe.fake proton_dist_tmp/$_lib32name/wine/fakedlls/steam.exe
cp -v Proton/build/steam.win32/steam.exe.so proton_dist_tmp/$_lib32name/wine/
cp -v Proton/build/steam.win32/libsteam_api.so proton_dist_tmp/$_lib32name/
fi
fi
}
proton_patcher() {
local _patches=("$_nowhere"/proton-tkg-userpatches/*."${_userpatch_ext}revert")
if [ ${#_patches[@]} -ge 2 ] || [ -e "${_patches}" ]; then
if [ "$_user_patches_no_confirm" != "true" ]; then
echo "Found ${#_patches[@]} 'to revert' userpatches for ${_userpatch_target}:"
printf '%s\n' "${_patches[@]}"
read -rp "Do you want to install it/them? - Be careful with that ;)"$'\n> N/y : ' _CONDITION;
fi
if [[ "$_CONDITION" =~ [yY] ]] || [ "$_user_patches_no_confirm" = "true" ]; then
for _f in ${_patches[@]}; do
if [ -e "${_f}" ]; then
echo "######################################################"
echo ""
echo "Reverting your own ${_userpatch_target} patch ${_f}"
echo ""
echo "######################################################"
patch -Np1 -R < "${_f}"
fi
done
fi
fi
_patches=("$_nowhere"/proton-tkg-userpatches/*."${_userpatch_ext}patch")
if [ "${#_patches[@]}" -ge 2 ] || [ -e "${_patches}" ]; then
if [ "$_user_patches_no_confirm" != "true" ]; then
echo "Found ${#_patches[@]} userpatches for ${_userpatch_target}:"
printf '%s\n' "${_patches[@]}"
read -rp "Do you want to install it/them? - Be careful with that ;)"$'\n> N/y : ' _CONDITION;
fi
if [[ "$_CONDITION" =~ [yY] ]] || [ "$_user_patches_no_confirm" = "true" ]; then
for _f in ${_patches[@]}; do
if [ -e "${_f}" ]; then
echo "######################################################"
echo ""
echo "Applying your own ${_userpatch_target} patch ${_f}"
echo ""
echo "######################################################"
patch -Np1 < "${_f}"
fi
done
fi
fi
}
function steam_is_running {
if pgrep -x steam >/dev/null; then
echo "###################################################"
echo ""
echo " Steam is running. Please full close it to proceed."
echo ""
echo "###################################################"
echo ""
read -rp "Press enter when ready..."
steam_is_running
fi
}
function wine_is_running {
pidof -q wineserver || return 0
echo -e "\n Wineserver is running. Waiting for it to finish..."
sleep 3
wine_is_running
}
function proton_tkg_uninstaller {
# Never cross the Proton streams!
i=0
for _proton_tkg in "$_steampath/compatibilitytools.d"/proton_tkg_*; do
if [ -d "$_proton_tkg" ]; then
_GOTCHA="$_proton_tkg" && ((i+=1))
fi
done
if [ -d "$_GOTCHA" ] && [ $i -ge 2 ]; then
cd "$_steampath/compatibilitytools.d"
_available_builds=( `ls -d proton_tkg_* | sort -V` )
_strip_builds="${_available_builds[@]//proton_tkg_/}"
steam_is_running
cp "$_config_file" "$_config_file".bak && echo "Your config.vdf file was backed up from $_config_file (.bak)" && echo ""
echo "What Proton-tkg build do you want to uninstall?"
i=1
if [ -n "$_just_built" ]; then
_newest_build="${_just_built//proton_tkg_/}"
for build in ${_strip_builds[@]//$_newest_build/}; do
echo " $i - $build" && ((i+=1))
done
else
for build in ${_strip_builds[@]}; do
echo " $i - $build" && ((i+=1))
done
fi
read -rp "choice [1-$(($i-1))]: " _to_uninstall;
i=1
if [ -n "$_just_built" ]; then
for build in ${_strip_builds[@]//$_newest_build/}; do
if [ "$_to_uninstall" = "$i" ]; then
rm -rf "proton_tkg_$build" && _available_builds=( `ls -d proton_tkg_* | sort -V` )
sed -i "s/\"Proton-tkg $build\"/\"Proton-tkg ${_newest_build}\"/;s/\"TKG-proton-$build\"/\"TKG-proton-${_newest_build}\"/" "$_config_file"
echo "###########################################################################################################################"
echo ""
echo "Proton-tkg $build was uninstalled and games previously depending on it will now use Proton-tkg ${_newest_build} instead."
echo ""
echo "###########################################################################################################################"
fi
((i+=1))
done
else
for build in ${_strip_builds[@]}; do
if [ "$_to_uninstall" = "$i" ]; then
rm -rf "proton_tkg_$build" && _available_builds=( `ls -d proton_tkg_* | sort -V` ) && _newest_build="${_available_builds[-1]//proton_tkg_/}"
sed -i "s/\"Proton-tkg $build\"/\"Proton-tkg ${_newest_build[@]}\"/;s/\"TKG-proton-$build\"/\"TKG-proton-${_newest_build[@]}\"/" "$_config_file"
echo "###########################################################################################################################"
echo ""
echo "Proton-tkg $build was uninstalled and games previously depending on it will now use Proton-tkg ${_newest_build[@]} instead."
echo ""
echo "###########################################################################################################################"
fi
((i+=1))
done
fi
echo ""
read -rp "Wanna uninstall more? N/y: " _uninstall_more;
echo ""
if [[ "$_uninstall_more" =~ [yY] ]]; then
proton_tkg_uninstaller
fi
elif [ -d "$_GOTCHA" ] && [ $i -eq 1 ]; then
echo "This tool requires at least two Proton-tkg builds installed in $_steampath/compatibilitytools.d/ and only one was found."
else
echo "No Proton-tkg installation found in $_steampath/compatibilitytools.d/"
fi
}
function setup_dxvk_version_url {
_dxvk_version_base_url="https://api.github.com/repos/doitsujin/dxvk/releases"
if [ "${_dxvk_version}" = "" ] || [ "${_dxvk_version}" = "latest" ]; then
_dxvk_version_url="${_dxvk_version_base_url}/latest"
# in case of default "" set it to "latest" too
_dxvk_version="latest"
else
_dxvk_version_url="${_dxvk_version_base_url}/tags/${_dxvk_version}"
fi
}
function download_dxvk_version {
while true ; do
setup_dxvk_version_url
# If anything goes wrong we get exit code 22 from "curl -f"
set +e
_dxvk_version_response=$(curl -s -f "$_dxvk_version_url")
_dxvk_version_response_status=$?
set -e
if [ $_dxvk_version_response_status -eq 0 ]; then
echo "#######################################################"
echo ""
echo " Downloading ${_dxvk_version} DXVK release from github for you..."
echo ""
echo "#######################################################"
echo ""
echo "$_dxvk_version_response" \
| jq .assets[].browser_download_url \
| grep -v "dxvk-native" \
| head -1 \
| tr -d \" \
| wget -qi -
break
else
echo ""
echo "#######################################################"
echo ""
echo " Could not download specified DXVK version (${_dxvk_version})"
echo ""
echo "#######################################################"
echo ""
echo "Please select DXVK release version (ex: v1.6.1)"
read -rp "> [latest]: " _dxvk_version
echo ""
fi
done
}
function latest_mono {
if [ "$_use_latest_mono" = "true" ]; then
curl -s https://api.github.com/repos/madewokherd/wine-mono/releases/latest | grep "browser_download_url.*x86.tar.xz" | cut -d : -f 2,3 | tr -d \"
else
_current_mono=$( grep "#define MONO_VERSION" "$_wine_tkg_git_path/src/$_winesrcdir/dlls/appwiz.cpl/addons.c" | cut -d'"' -f 2 )
echo "https://github.com/madewokherd/wine-mono/releases/download/wine-mono-$_current_mono/wine-mono-$_current_mono-x86.tar.xz"
fi
}
function latest_mono_msi {
if [ "$_use_latest_mono" = "true" ]; then
curl -s https://api.github.com/repos/madewokherd/wine-mono/releases/latest | grep "browser_download_url.*x86.msi" | cut -d : -f 2,3 | tr -d \"
else
_current_mono=$( grep "#define MONO_VERSION" "$_wine_tkg_git_path/src/$_winesrcdir/dlls/appwiz.cpl/addons.c" | cut -d'"' -f 2 )
echo "https://github.com/madewokherd/wine-mono/releases/download/wine-mono-$_current_mono/wine-mono-$_current_mono-x86.msi"
fi
}
if [ "$1" = "clean" ]; then
proton_tkg_uninstaller
elif [ "$1" = "build_vrclient" ]; then
build_vrclient
elif [ "$1" = "build_lsteamclient" ]; then
build_lsteamclient
elif [ "$1" = "build_vkd3d" ]; then
build_vkd3d
elif [ "$1" = "build_dxvk" ]; then
build_dxvk
elif [ "$1" = "build_mediaconv" ]; then
_build_mediaconv="true" build_mediaconverter
elif [ "$1" = "build_steamhelper" ]; then
build_steamhelper
else
# If $1 contains a path, and it exists, use it as default for config
if [ -n "$1" ]; then
_EXT_CONFIG_PATH="$(readlink -m $1)"
if [ ! -f "$_EXT_CONFIG_PATH" ]; then
echo "User-supplied external config file '${_EXT_CONFIG_PATH}' not found! Please fix your passed path!"
exit 0
fi
sed -i -e "s|_EXT_CONFIG_PATH.*|_EXT_CONFIG_PATH=${_EXT_CONFIG_PATH}|" "$_nowhere"/proton-tkg-profiles/advanced-customization.cfg
fi
rm -rf "$_nowhere"/proton_dist_tmp
cd "$_nowhere"
# We'll need a token to register to wine-tkg-git - keep one for us to steal wine-tkg-git options later
echo -e "_proton_tkg_path='${_nowhere}'\n_no_steampath='${_no_steampath}'" > proton_tkg_token && cp proton_tkg_token "${_wine_tkg_git_path}/"
echo -e "Proton-tkg - $(date +"%m-%d-%Y %H:%M:%S")" > "$_logdir"/proton-tkg.log
if [ -n "$_runtime" ]; then
rm -rf "${_nowhere}"/external-resources/steam-runtime
if [ -d /tmp ]; then
cp -R "$_runtime" /tmp/
ln -s /tmp/steam-runtime "${_nowhere}"/external-resources/
else
mkdir -p "${_resources_path}"/steam-runtime
cp -R "$_runtime" external-resources/
fi
rm -f steam-runtime/pinned_libs_32/*curl.so* # Use system curl libs for git
rm -f steam-runtime/pinned_libs_64/*curl.so* # Use system curl libs for git
fi
# Now let's build
cd "$_wine_tkg_git_path"
if [ -e "/usr/bin/makepkg" ] && [ "$_nomakepkg" = "false" ]; then
makepkg -s || true
else
rm -f "$_wine_tkg_git_path"/non-makepkg-builds/HL3_confirmed
if [ -n "$_runtime" ]; then
echo -e "Using Steam runtime\n"
"$_nowhere"/steam-runtime/run.sh ./non-makepkg-build.sh
else
./non-makepkg-build.sh
# makepkg proton pkgver loop hack
if [ "$_isfirstloop" = "true" ]; then
exit 0
fi
fi
fi
# Wine-tkg-git has injected versioning and settings in the token for us, so get the values back
source "$_nowhere/proton_tkg_token"
if [ "$_NOLIB32" = "true" ]; then
_lib32name="lib"
_lib64name="lib"
else
_lib32name="lib"
_lib64name="lib64"
fi
# Prompt to re-use existing gst
if [ -d "${_resources_path}"/gst ] && [ -z $_reuse_built_gst ]; then
echo " Existing proton gstreamer dir found. Do you want to use it instead of rebuilding?"
read -rp $'\n> Y/n : ' _reuse_gst;
if ( [ "$_reuse_gst" != "n" ] && [ "$_reuse_gst" != "N" ] ); then
_reuse_built_gst="true"
fi
fi
# We might not want experimental branches since they are a moving target and not useful to us, so fallback to regular by default unless _proton_branch_exp="true" is passed
if [[ "$_proton_branch" = experimental* ]] && [ "$_proton_branch_exp" != "true" ]; then
echo -e "#### Replacing experimental branch by regular ####"
sed -i "s/experimental_/proton_/g" "$_nowhere/proton_tkg_token" && source "$_nowhere/proton_tkg_token"
fi
# Use custom compiler paths if defined
if [ -n "${CUSTOM_MINGW_PATH}" ] && [ -z "${CUSTOM_GCC_PATH}" ]; then
PATH="${PATH}:${CUSTOM_MINGW_PATH}/bin:${CUSTOM_MINGW_PATH}/lib:${CUSTOM_MINGW_PATH}/include"
elif [ -n "${CUSTOM_GCC_PATH}" ] && [ -z "${CUSTOM_MINGW_PATH}" ]; then
PATH="${CUSTOM_GCC_PATH}/bin:${CUSTOM_GCC_PATH}/lib:${CUSTOM_GCC_PATH}/include:${PATH}"
elif [ -n "${CUSTOM_MINGW_PATH}" ] && [ -n "${CUSTOM_GCC_PATH}" ]; then
PATH="${CUSTOM_GCC_PATH}/bin:${CUSTOM_GCC_PATH}/lib:${CUSTOM_GCC_PATH}/include:${CUSTOM_MINGW_PATH}/bin:${CUSTOM_MINGW_PATH}/lib:${CUSTOM_MINGW_PATH}/include:${PATH}"
fi
# If mingw-w64 gcc can't be found, disable building vkd3d-proton
if ! command -v x86_64-w64-mingw32-gcc &> /dev/null; then
echo -e "######\nmingw-w64 gcc not found - vkd3d-proton and dxvk won't be built\n######"
_build_vkd3d="false"
if [ "$_use_dxvk" = "git" ]; then
_use_dxvk="latest"
fi
else
if [ "$_use_vkd3dlib" != "true" ]; then
_build_vkd3d="true"
fi
echo -e "######\nmingw-w64 gcc found\n######"
fi
# Copy the resulting package in here to begin our work
if [ -e "$_proton_pkgdest"/../HL3_confirmed ]; then
cd "$_nowhere"
# Create required dirs and clean
if [ -z "$_protontkg_true_version" ]; then
export _protontkg_true_version="$_protontkg_version"
fi
rm -rf "proton_tkg_$_protontkg_version" && mkdir "proton_tkg_$_protontkg_version"
mkdir -p proton_template/share/fonts
mv "$_proton_pkgdest" proton_dist_tmp
# Liberation Fonts
rm -f proton_template/share/fonts/*
git clone https://github.com/liberationfonts/liberation-fonts.git || true # It'll complain the path already exists on subsequent builds
cd liberation-fonts
git reset --hard 9510ebd
git clean -xdf
#git pull
patch -Np1 < "$_nowhere/proton_template/LiberationMono-Regular.patch"
make -j$(nproc)
cp -rv liberation-fonts-ttf*/Liberation{Sans-Regular,Sans-Bold,Serif-Regular,Mono-Regular}.ttf "$_nowhere/proton_template/share/fonts"/
cd "$_nowhere"
if [ "$_NUKR" != "debug" ]; then
if [ -d Proton ] && [ ! -f Proton/proton ]; then
( cd Proton && find . -name . -o -prune -exec rm -rf -- {} + ) # We need to clean everything including dotfiles
fi
# Clone Proton tree as we need to build some tools from it
git clone https://github.com/ValveSoftware/Proton || true # It'll complain the path already exists on subsequent builds
cd Proton
git reset --hard origin/HEAD
git clean -xdf
if ( ! git pull --ff-only ) || ( [ -n "$_bleeding_tag" ] ); then
echo -e "######\nProton tree was force-pushed upstream.. Recloning clean to avoid issues..\n######"
find . -name . -o -prune -exec rm -rf -- {} + # We need to clean everything including dotfiles
cd ..
git clone https://github.com/ValveSoftware/Proton || true # It'll complain the path already exists on subsequent builds
cd Proton
else
git pull origin
fi
if [ -n "$_bleeding_tag" ]; then
_bleeding_commit=$(git rev-list -n 1 "${_bleeding_tag}")
_proton_branch="$_bleeding_commit"
fi
git checkout "$_proton_branch"
_user_patches_no_confirm="true"
_userpatch_target="proton"
_userpatch_ext="myproton"
proton_patcher
else
cd Proton
fi
# Tooling compilation needs an update for latest BE - Use slightly older tooling for now
if [ -n "$_bleeding_tag" ] || [[ "$_proton_branch" = experimental_8* ]] || [[ "$_proton_branch" = *9* ]]; then
git checkout f5e9c76903e4e18e0416e719a6d42d0cb00998aa
fi
# Embed fake data to spoof desired fonts
fontforge -script "$_nowhere/Proton/fonts/scripts/generatefont.pe" "$_nowhere/proton_template/share/fonts/LiberationSans-Regular" "Arial" "Arial" "Arial" "$_nowhere/proton_template/share/fonts"/arial.ttf
fontforge -script "$_nowhere/Proton/fonts/scripts/generatefont.pe" "$_nowhere/proton_template/share/fonts/LiberationSans-Bold" "Arial-Bold" "Arial" "Arial Bold" "$_nowhere/proton_template/share/fonts"/arialbd.ttf
fontforge -script "$_nowhere/Proton/fonts/scripts/generatefont.pe" "$_nowhere/proton_template/share/fonts/LiberationSerif-Regular" "TimesNewRoman" "Times New Roman" "Times New Roman" "$_nowhere/proton_template/share/fonts"/times.ttf
fontforge -script "$_nowhere/Proton/fonts/scripts/generatefont.pe" "$_nowhere/proton_template/share/fonts/LiberationMono-Regular" "CourierNew" "Courier New" "Courier New" "$_nowhere/proton_template/share/fonts"/cour.ttf
# Build GST/mediaconverter
if [ "$_build_mediaconv" = "true" ] || [ "$_build_gstreamer" = "true" ]; then
if [ "$_reuse_built_gst" = "true" ] && [ -d "${_resources_path}"/gst ]; then
cp -r "${_resources_path}"/gst "$_nowhere"/gst
else
build_mediaconverter
rm -rf "${_resources_path}"/gst && cp -r "$_nowhere"/gst "${_resources_path}"/gst
fi
fi
# Grab share template and inject version
_versionpre=`date '+%s'`
echo "$_versionpre" "TKG-proton-$_protontkg_true_version" > "$_nowhere/proton_dist_tmp/version" && cp -r "$_nowhere/proton_template/share"/* "$_nowhere/proton_dist_tmp/share"/
# Create the dxvk dirs
mkdir -p "$_nowhere/proton_dist_tmp/lib64/wine/dxvk"
mkdir -p "$_nowhere/proton_dist_tmp/lib/wine/dxvk"
# Build vrclient libs
# I'm not sure we actually need this considering VR support is broken, but it might be needed by other tools
if [ "$_steamvr_support" = "true" ]; then
build_vrclient