-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwt-install-dev
executable file
·1759 lines (1562 loc) · 54.7 KB
/
wt-install-dev
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/sh
# Copyright (C) 2020-2023 Francois Gouget
#
# Installs the packages needed for Wine development.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
name0=`basename "$0"`
error()
{
echo "$name0:error:" "$@" >&2
}
warning()
{
echo "$name0:warning:" "$@" >&2
}
dry_run()
{
local rc
echo "$@"
# This assumes that the command does not need quoting
[ -n "$opt_cmd_log" ] && echo "$@" >>"$opt_cmd_log"
[ "$opt_dry_run" = "1" ] && return 0
"$@"
rc=$?
[ $rc -ne 0 ] && echo "$1 -> rc=$rc"
return $rc
}
#####
#
# Generic helpers
#
#####
pkginstall=""
pkgbroken=""
pkgmissing=""
pkgworkaround=""
wt_get_bad_pkgs()
{
local pkgre="$1"
echo "$pkgbroken $pkgmissing" | tr ' ' '\n' | sort -u | grep -E "^$pkgre" | tr '\n' ' '
}
wt_remove_bad_pkg()
{
local pkg="$1"
pkgbroken=`echo "$pkgbroken " | sed -e "s/ $pkg / /g"`
pkgmissing=`echo "$pkgmissing " | sed -e "s/ $pkg / /g"`
}
wt_explain_bad_pkgs()
{
local pkg
local rc=1
for pkg in $*
do
if echo " $pkgmissing $pkgbroken " | grep -q " $pkg "
then
wt_remove_bad_pkg "$pkg"
rc=0
fi
done
return $rc
}
wt_pretty_list()
{
echo "$@" | tr ' ' '\n' | sort -u | tr '\n' ' ' | sed -e 's/^ //' -e 's/ $//'
}
wt_libdirs=""
wt_create_so_warn=1
# wt_create_so <sodev> <solib>
#
# Creates the <sodev>.so symlink pointing to the <solib>.so.<ver> library.
# If <solib> is omitted it is assumed to be identical to <sodev>.
# wt_create_so() also handles cases where the library is in /lib* rather than
# /usr/lib*.
#
# Returns 0 if the symlink was already present, 1 if it was successfully
# created, 2 if it could not be created.
wt_create_so()
{
local libdir rc sover usrlibdir
local sodev="$1"
local solib="$2"
[ -n "$solib" ] || solib="$sodev"
if [ -z "$wt_libdirs" ]
then
error "the per-distribution code must set \$wt_libdirs"
exit 1
fi
rc=0
for libdir in $wt_libdirs
do
usrlibdir="/usr$libdir"
if [ ! -f "$usrlibdir/$sodev.so" ]
then
sover=`cd "$usrlibdir" 2>/dev/null && ls "$solib.so".[0-9]* 2>/dev/null | head -n1`
if [ ! -f "$usrlibdir/$sover" ]
then
# We want the full path in this case
sover=`ls "$libdir/$solib.so".[0-9]* 2>/dev/null | head -n1`
[ -f "$sover" ] || sover=""
fi
if [ -z "$sover" ]
then
error "could not find the ...$libdir/$sodev.so symlink target"
rc=2
# Use -f because $sodev.so may be a broken symlink
elif ! dry_run ln -s -f "$sover" "$usrlibdir/$sodev.so"
then
error "could not create the ...$libdir/$sodev.so symlink"
rc=2
elif [ $rc -eq 0 ]
then
rc=1
fi
fi
done
if [ $rc -eq 2 -a -n "$wt_create_so_warn" ]
then
wt_create_so_warn=
warning "The symlink creation will fail if the non-dev package is not installed."
[ "$opt_dry_run" = "1" ] && warning "This is particularly likely with --dry-run."
fi
return $rc
}
# wt_create_sos <pkgdevre> <sodev1> ...
#
# Create the development library symlinks in the <sodev1> ... list using
# wt_create_so(). If they all succeeded, remove the packages matching the
# <pkgdevre> regular expression from the broken and missing packages lists.
wt_create_sos()
{
local bad_pkgs lib success
local pkgre="$1"
shift
fixed=""
for lib in "$@"
do
wt_create_so "$lib"
# Only mark a package as fixed if no error occurred and at least one
# symlink was provided (if no symlink was provided the package is
# presumably bad for other reasons).
rc=$?
[ $rc -eq 2 ] && fixed=0
[ $rc -eq 1 -a -z "$fixed" ] && fixed=1
done
if [ "$fixed" = "1" ]
then
bad_pkgs=`wt_get_bad_pkgs "$pkgre"`
for pkg in $bad_pkgs
do
wt_remove_bad_pkg "$pkg"
done
pkgworkaround="$pkgworkaround $bad_pkgs"
fi
}
#####
#
# Debian
#
#####
#
# Debian: Package helpers
#
# apt_check <action> <pkg> <egrep-args>
#
# Checks that the information about <pkg> matches the specified <egrep-args>.
# With the 'show' <action> this can be used to verify that the package actually
# exists, has the expected version, etc.
apt_check()
{
local action="$1"
local pkg="$2"
shift 2
[ "$action" = "show" ] && action="show --no-all-versions"
LANG= apt-cache $action "$pkg" 2>/dev/null | grep -E -q "$@"
}
# apt_addsection <landmark> <section> <packages>
#
# Checks if the <landmark> package is available and returns immediately if it
# is. Otherwise asks whether <section> should be added to the apt sources.
# If --yes was given or the user agrees the section is added but
# 'apt-get update' is not called.
#
# Returns 0 if a section was added, non-zero otherwise.
apt_addsection()
{
local a pkg
local landmark="$1"
local section="$2"
local packages="$3"
# Can the section even be added?
command -v apt-add-repository >/dev/null 2>&1 || return 1
# Does it need to be added?
pkg=`echo "$landmark" | sed -e "s/:.*//g"`
apt_check show "$landmark" "Package: $pkg" && return 1
echo
echo "********************"
echo
echo "The $section section is needed for $packages."
echo
echo -n "Do you want to add it? [Y/n] "
if [ -n "$opt_yes" ]
then
echo "yes"
a="y"
else
read a
fi
[ -z "$a" -o "$a" = "y" -o "$a" = "Y" ] || return 1
dry_run apt-add-repository "$section"
}
# apt_pkg [--test] <pkg1> ...
#
# If <pkg1> exists, schedule it for installation and return success.
# Otherwise try again with the next package in the list.
#
# If none of the packages exist and --test was not specified, add them all
# to the missing packages list and return failure.
apt_pkg()
{
local pkg pkgarch
local test=
if [ "$1" = "--test" ]
then
test=1
shift
fi
echo -n "Checking $*..."
for pkgarch in $*
do
pkg=`echo "$pkgarch" | sed -e "s/:.*//g"`
if apt_check show "$pkgarch" "Package: $pkg"
then
echo " yes"
pkginstall="$pkginstall $pkgarch"
return 0
fi
done
echo " missing"
[ -z "$test" ] && pkgmissing="$pkgmissing "`echo "$@" | sed -e 's/ /|/g'`
return 1
}
# apt_is_installed <pkg1> ...
#
# Returns success if the specified packages are all installed.
apt_is_installed()
{
dpkg -l "$@" >/dev/null 2>&1
}
# apt_multi [--test|--if-0 <rc>|--if-not-0 <rc>] <pkg1> ...
#
# Schedules installation of both the 32- and 64-bit versions of the package
# if possible. Otherwise installs the 64-bit version and marks the 32-bit one
# as broken.
#
# Specifically, if --if-0 (resp. --if-not-0) is specified and <rc> is not 0
# (resp. is 0), assume the package does not support multiarch.
#
# If <pkg1> exists:
# - If it supports multiarch schedule the installation of both 32- and 64-bit
# versions and return 0 (success).
# - If it is architecture neutral schedule installation and return success.
# - Otherwise schedule installation of the 64-bit package, mark the 32-bit
# version as broken and return 1 (failure).
#
# If <pkg1> does not exist, try again with the next package in the list.
# If none of the packages exists and --test was not specified, add them all
# to the missing packages list and return 2 (failure).
apt_multi()
{
local pkg
local test=
local not_multi=
if [ "$1" = "--test" ]
then
test=1
shift
elif [ "$1" = "--if-0" ]
then
[ "$2" = "0" ] || not_multi=1
shift 2
elif [ "$1" = "--if-not-0" ]
then
[ "$2" != "0" ] || not_multi=1
shift 2
fi
for pkg in $*
do
echo -n "Checking multiarch $pkg..."
if [ -z "$not_multi" ] &&
# Check that both architectures are present
apt_check show "$pkg:amd64" "Multi-Arch: same" &&
apt_check show "$pkg:i386" "Multi-Arch: same"
then
echo " i386 amd64"
pkginstall="$pkginstall $pkg:i386 $pkg:amd64"
return 0
elif apt_check show "$pkg" "Architecture: all"
then
echo " all"
pkginstall="$pkginstall $pkg"
return 0
elif apt_check show "$pkg" "Package: $pkg"
then
echo " broken"
pkginstall="$pkginstall $pkg"
[ -z "$test" ] && pkgbroken="$pkgbroken $pkg:i386"
return 1
fi
echo " missing"
done
[ -z "$test" ] && pkgmissing="$pkgmissing "`echo "$@" | sed -e 's/ /|/g'`
return 2
}
# apt_blacklist <canary> <versionre> <pkgdev> <pkglibs>
#
# This is meant to deal with cases where multiarch support in <pkgdev> is
# broken by the <canary> package in a hard to detect way.
#
# Checks the version of the <canary> package and if it matches the <versionre>
# regular expression, installs the native <pkgdev> package and the 32-bit
# <pkglibs> package and returns failure.
# Otherwise invokes apt_multi() on <pkgdev> || <pkglibs> and returns success.
apt_blacklist()
{
local canary="$1"
local versionre="$2"
local pkgdev="$3"
local pkglibs="$4"
if apt_check show "$canary" "Version: $versionre"
then
warning "Bad version for $canary, not using multiarch for $pkgdev"
apt_pkg "$pkgdev"
apt_pkg "$pkglibs:i386"
pkgbroken="$pkgbroken $pkgdev:i386"
return 1
fi
apt_multi "$pkgdev" || apt_multi "$pkglibs"
return 0
}
apt_install()
{
if [ -z "$opt_dry_run" ]
then
echo -n "Waiting for the dpkg lock"
while fuser /var/lib/dpkg/lock /var/lib/dpkg/lock-frontend \
/var/run/unattended-upgrades.lock >/dev/null 2>&1
do
echo -n "."
sleep 1
done
echo " done"
fi
dry_run apt-get install $opt_yes `wt_pretty_list "$pkginstall"` || exit 1
echo
}
# apt_dev_workaround <pkg>
#
# For some packages we need more than just the links created by wt_create_sos.
# For those apt_dev_workaround manually extracts the package files and copies
# the architecture-specific headers, pkg-config files, and libraries.
apt_dev_workaround()
{
local pkg="$1"
local dir file
mkdir pkgextract
cd pkgextract
apt-get download "$pkg:i386"
dpkg -x "$pkg"*.deb .
find usr/lib/i386-linux-gnu/ \( -type f -o -type l \) | \
while read file
do
dir=$(dirname "/$file")
[ -d "$dir" ] || dry_run mkdir -p "$dir" || exit 1
dry_run mv "$file" "/$file" || exit 1
done
rc=$?
cd ..
rm -rf pkgextract
if [ $rc -eq 0 ]
then
wt_remove_bad_pkg "$pkg:i386"
fi
return $rc
}
#
# Debian: Base Wine dependencies
#
apt_init()
{
if [ `dpkg --print-architecture` != "amd64" ]
then
error "expected a 64-bit Debian distribution"
exit 1
fi
if [ "$opt_packages" = "1" ]
then
dry_run dpkg --add-architecture i386
dry_run apt-get update
fi
wt_libdirs="/lib/i386-linux-gnu /lib/x86_64-linux-gnu"
}
apt_wine()
{
local ver
# Tools
apt_pkg bison
apt_pkg flex
apt_pkg gcc
apt_pkg gcc-mingw-w64
apt_pkg gcc-multilib
apt_pkg gettext
apt_pkg git
# Pop! OS 22.04 managed to break multiarch support in libc6-dev!!!
LANG= apt-get install --dry-run linux-libc-dev:i386 linux-libc-dev:amd64 >"$TMPDIR/$name0.$$" 2>&1
if [ $? -ne 0 ]
then
ver=`sed -e 's/^.*but \(5\..*\) is to be installed$/\1/' -e t -e d "$TMPDIR/$name0.$$" | head -n 1`
warning "Force installing version $ver of linux-libc-dev"
pkginstall="$pkginstall --allow-downgrades linux-libc-dev:i386=$ver linux-libc-dev:amd64=$ver"
fi
rm "$TMPDIR/$name0.$$"
apt_multi libasound2-dev
apt_multi libcapi20-dev
apt_multi libdbus-1-dev
apt_multi libfaudio-dev # Not used since Wine d8be85863fed (2021-10-21)
# The FontConfig development package can only be installed if the FreeType
# one supports multiarch
apt_multi libfreetype6
apt_multi libfreetype-dev libfreetype6-dev
apt_multi --if-0 $? libfontconfig-dev libfontconfig1-dev || apt_multi libfontconfig1
apt_multi libegl-dev
apt_multi libgl-dev libgl1-mesa-dev
apt_multi libglu1-mesa-dev # Not used since Wine ec55b1c271ae (2020-11-12)
# The GPhoto2 development package can only be installed if the Exif
# one supports multiarch
apt_multi --test libexif-dev
apt_multi --if-0 $? libgphoto2-dev || apt_multi libgphoto2-6
apt_multi libgsm1-dev # Not used since Wine 0e7fd41af953 (2021-10-20)
# The GnuTLS development package can only be installed if the idn2 one
# one supports multiarch
apt_multi --test libidn2-dev libidn2-0-dev
apt_multi --if-0 $? libgnutls28-dev || apt_multi libgnutls30
apt_multi libjpeg62-turbo-dev libjpeg-turbo8-dev # Not used since Wine a6ac035a7454 (2021-10-19)
apt_multi libjxr-dev # Not used since Wine eb0180e7b4df (2021-10-21)
if grep -i ubuntu /etc/os-release >/dev/null
then
# krb5-multidev multiarch support is broken on Ubuntu,
# including for version 1.20.1-2.
apt_blacklist krb5-multidev "(1.19.2-.ubuntu|1.20-.ubuntu|1.20.1-[123])" libkrb5-dev libkrb5-3
else
# krb5-multidev multiarch support works on Debian,
# including for version 1.20.1-2.
apt_multi libkrb5-dev
fi
apt_multi liblcms2-dev # Not used since Wine 5c4c272a2606 (2021-10-19)
apt_multi libldap-dev libldap2-dev
apt_multi libmpg123-dev # Not used since Wine 5329da61ac51 (2021-10-21)
apt_multi libncurses-dev libncurses5-dev # Not used since Wine 26c715f85b49 (2020-09-22)
# The GStreamer development package can only be installed if the liborc
# one supports multiarch
apt_multi --test liborc-0.4-dev
apt_multi --if-0 $? libgstreamer-plugins-base1.0-dev
if [ $? -ne 0 ]
then
apt_multi libgstreamer-plugins-base1.0-0
apt_multi libgstreamer1.0-dev
fi
apt_multi libopenal-dev
apt_multi libosmesa6-dev
apt_multi libpcap0.8-dev || apt_multi libpcap0.8
# On Debian Testing this version has a conflicting man page (bug 1064636)
apt_blacklist libpcsclite-dev 2.0.1-1.b1 libpcsclite-dev libpcsclite1
apt_multi libpng-dev libpng12-dev # Not used since Wine c3d8a29a0499 (2021-10-18)
# The PulseAudio development package can only be installed if the Glib2
# one supports multiarch
apt_multi --test libglib2.0-dev
apt_multi --if-0 $? libpulse-dev || apt_multi libpulse0
# On Debian 9 libsane-dev claims to support multiarch but is broken
apt_blacklist libsane-dev 1.0.25-4.1 libsane-dev libsane
apt_pkg libsasl2-dev # One arch is sufficient for Wine
# On Ubuntu 18.04 libsdl2-dev depends on libmirclient-dev which breaks
# without warning in a multiarch configuration!
apt_blacklist libmirclient-dev 0.31.1-0ubuntu1 libsdl2-dev libsdl2-2.0-0
# The CUPS development package can only be installed if the libtiff and
# libcupsimage ones support multiarch
rc=0
apt_multi libtiff-dev libtiff5-dev || rc=1 # Not used since Wine d36615ee5232 (2021-10-19)
apt_multi --test libcupsimage2-dev libcupsimage-dev || rc=1
apt_multi --if-0 $rc libcups2-dev || apt_multi libcups2
apt_multi libudev-dev
apt_pkg libunwind-dev # Wine only needs the 64-bit library
apt_multi libusb-1.0-0-dev
apt_multi libv4l-dev
# vkd3d is not used since Wine 24432a24d5e9 (2022-03-03)
# Before 1.2 vkd3d is missing libvkd3d-shader1 which is required for Wine.
if apt_pkg libvkd3d-shader1
then
# Multiarch support is broken in early versions (see bug 983776)
apt_blacklist libvkd3d-dev '1.2-[1-5]$' libvkd3d-dev libvkd3d1
fi
apt_multi libvulkan-dev
apt_multi libwayland-dev
apt_multi libx11-dev
apt_multi libxcb1-dev
apt_multi libxcomposite-dev
apt_multi libxcursor-dev
apt_multi libxi-dev
apt_multi libxinerama-dev
apt_multi libxkbcommon-dev
apt_multi libxkbregistry-dev
# The XML and XSLT development packages can only be installed if the ICU
# one supports multiarch
apt_multi --test libicu-dev; rc=$?
apt_multi --if-0 $rc libxml2-dev || apt_multi libxml2 # Not used since Wine bca1b7f2faeb (2021-10-20)
apt_multi --if-0 $rc libxslt1-dev || apt_multi libxslt1.1 # Not used since Wine bca1b7f2faeb (2021-10-20)
apt_multi libxrandr-dev
apt_multi libxrender-dev
apt_multi libxxf86vm-dev
apt_pkg make
apt_multi ocl-icd-opencl-dev
apt_multi oss4-dev
apt_pkg prelink # Not used since Wine 4a0f3fbcb587 (2023-02-27)
# For libnetapi (see bug 961867)
apt_check depends samba-libs:i386 -E 'Depends: python3?-talloc:i386'
apt_multi --if-not-0 $? samba-dev
apt_multi unixodbc-dev || apt_multi libodbc1
}
apt_wine_extra()
{
apt_pkg autoconf
apt_multi libgettextpo-dev # To let wrc rebuild PO files
apt_pkg libxml-libxml-perl # For make_opengl
apt_pkg python3 # For make_vulkan
apt_pkg unzip # For make_unicode
apt_pkg wget # For make_unicode, make_opengl
}
apt_wine_tests()
{
local pkg
apt_addsection ttf-mscorefonts-installer contrib "the Microsoft TrueType fonts packages" &&
dry_run apt-get update
# GStreamer plugins for the quartz (winegstreamer) tests
apt_multi gstreamer1.0-libav
apt_multi --test libmjpegutils-2.1-0
apt_multi --if-0 $? gstreamer1.0-plugins-bad
apt_multi gstreamer1.0-plugins-base
apt_multi gstreamer1.0-plugins-good
apt_multi --test libsidplay1v5
apt_multi --if-0 $? gstreamer1.0-plugins-ugly
apt_multi libnss-mdns
# For each 64-bit libnss module, its 32-bit equivalent is needed too for
# the 32-bit tests:
for pkg in $(dpkg -l libnss-*:amd64 | sed -e 's/^.* \([a-zA-Z0-9-]*\):amd64.*$/\1/' -e t -e d)
do
apt_multi $pkg
done
# The MIDI tests have to go through ALSA which needs the PulseAudio plugin
apt_multi libasound2-plugins
apt_pkg ttf-mscorefonts-installer
apt_pkg winbind # For ntlm_auth
}
apt_wine_locales()
{
# Install fonts for the locale tests
# Use Debian's task-* packages, which includes the task-<locale>* ones
# that install the fonts relevant to that locale.
# Also install the fonts for mlterm, the multi-lingual terminal emulator.
local tasks="$(apt-cache search '^task-' | cut -f1 -d' ')"
local font_pkg=""
local extra_pkg=""
for font_pkg in $(LANG= apt-cache depends $tasks mlterm | sed -e 's/^ *Recommends: fonts-/fonts-/' -e t -e d | sort -u)
do
apt_pkg "$font_pkg"
case "$font_pkg" in
fonts-noto*)
# Avoid the fonts-noto-*-extra packages as they cause excessive
# Wine slowdowns (see bug 51367).
for extra_pkg in $(LANG= apt-cache depends "$font_pkg" | sed -e 's/^ *Recommends: \(fonts-noto.*-extra\)$/\1/' -e t -e d | sort -u)
do
if dpkg -l "$extra_pkg" | grep -E -q '^[^hrp]n'
then
apt-mark hold "$extra_pkg"
fi
done
;;
esac
done
# Needed for gdi32:font in the Chinese locale
apt_pkg fonts-arphic-uming
}
apt_wt_daily()
{
apt_pkg ntfs-3g
apt_pkg time
}
apt_tb_wine()
{
apt_pkg genisoimage
apt_pkg upx-ucl
}
apt_workarounds()
{
local xsltconfig
if [ "$opt_wine" = "1" ]
then
# Work around the missing or broken multiarch support where possible
# Needed for all Debian versions so far
if apt_is_installed libvkd3d1:i386
then
wt_create_sos libvkd3d-dev libvkd3d libvkd3d-shader libvkd3d-utils
fi
# Needed for Debian 10
wt_create_sos libsdl2-dev libSDL2-2.0 # Broken up to 2.0.9
wt_create_so libSDL2 libSDL2-2.0
# Needed for Ubuntu 18.04
wt_create_sos libcups2-dev libcups
wt_create_sos libfontconfig1-dev libfontconfig
wt_create_sos libfreetype6-dev libfreetype
wt_create_sos libgnutls28-dev libgnutls
wt_create_sos libpcap0.8-dev libpcap
wt_create_sos libpcsclite-dev libpcsclite
wt_create_sos libtiff-dev libtiff
if ! apt_is_installed libgstreamer-plugins-base1.0-dev:i386
then
apt_dev_workaround libgstreamer-plugins-base1.0-dev
fi
wt_create_sos libgstreamer-plugins-base1.0-dev libgstaudio-1.0 libgstbase-1.0 libgstreamer-1.0 libgstvideo-1.0
# Ubuntu 18.04 is missing libxslt/xsltconfig.h
xsltconfig="libxslt/xsltconfig.h"
if [ -f "/usr/include/x86_64-linux-gnu/$xsltconfig" -a \
! -f "/usr/include/i386-linux-gnu/$xsltconfig" -a \
! -f "/usr/include/$xsltconfig" -a \
-d "/usr/include/libxslt" ]
then
dry_run ln -s "../x86_64-linux-gnu/$xsltconfig" "/usr/include/$xsltconfig"
elif [ -f "/usr/include/x86_64-linux-gnu/$xsltconfig" -a \
-f "/usr/include/i386-linux-gnu/$xsltconfig" -a \
-h "/usr/include/$xsltconfig" ]
then
echo "Removing the obsolete /usr/include/$xsltconfig symlink (was for libxslt1-dev)"
dry_run rm "/usr/include/$xsltconfig"
fi
# Needed for Debian 9
wt_create_sos libgphoto2-dev libgphoto2 libgphoto2_port
wt_create_sos libjpeg62-turbo-dev libjpeg
wt_create_sos libkrb5-dev libcom_err libgssapi_krb5 libk5crypto libkrb5
wt_create_sos libpulse-dev libpulse
wt_create_sos libsane-dev libsane
wt_create_sos libxml2-dev libxml2
wt_create_sos libxslt1-dev libxslt
wt_create_sos unixodbc-dev libodbc
fi
}
apt_epilogue()
{
if wt_explain_bad_pkgs "libfaudio-dev"
then
echo "* Wine does not use the distribution's FAudio development packages since"
echo " 2021-10 so feel free to ignore this issue. For older versions, FAudio is only"
echo " available on distributions derived from Debian 11+."
echo
fi
if wt_explain_bad_pkgs "libfaudio-dev:i386"
then
echo "* Wine does not use the distribution's FAudio development packages since"
echo " 2021-10 so feel free to ignore this issue. For older versions, the"
echo " 32-bit libfaudio-dev package is missing."
echo
fi
if wt_explain_bad_pkgs "libgstreamer-plugins-base1.0-dev"
then
echo "* GStreamer has different header files for 32- and 64-bit. Unfortunately"
echo " libgstreamer-plugins-base1.0-dev:i386 cannot be installed because some of its"
echo " dependencies do not support multiarch. But this issue has been fixed in"
echo " Debian 10 which may provide a viable workaround."
echo
fi
if apt_check show "libpcap0.8" "Version: 1\\.[2-9]"
then
echo "* libpcap is likely too old and missing pcap_init(), making it unusable."
echo
fi
if wt_explain_bad_pkgs "libxkbregistry-dev"
then
echo "* libxkbregistry is not available on Debian 10 and older so Wayland is not supported."
echo
fi
if wt_explain_bad_pkgs "prelink"
then
echo "* Wine does not use prelink since 2023-02 so feel free to ignore this issue."
echo
fi
if wt_explain_bad_pkgs "ttf-mscorefonts-installer"
then
echo "* ttf-mscorefonts-installer is in the contrib section of the repository. You"
echo " may need to update /etc/apt/sources.list (man sources.list)."
echo
fi
if wt_explain_bad_pkgs "oss4-dev"
then
echo "* OSS4 is no longer available in Debian but is obsolete anyway."
echo " If really required, it is available in the Debian multimedia repository:"
echo " deb-multimedia.org."
echo
fi
if wt_explain_bad_pkgs "samba-dev:i386"
then
echo "* samba-dev ostensibly supports multiarch but the 32-bit version depends"
echo " on python:i386 through python-talloc and samba-libs. Similarly the 64-bit"
echo " version depends on python:amd64 thus breaking multiarch support."
echo " https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=961867"
echo
fi
if wt_explain_bad_pkgs "libvkd3d-shader1"
then
echo "* Wine does not use the distribution's vkd3d development packages since 2022-03"
echo " so feel free to ignore this issue. For older versions, Wine needs a"
echo " vkd3d >= 1.2 package (see experimental?)."
echo
elif wt_explain_bad_pkgs "libvkd3d-dev:i386"
then
echo "* Wine does not use the distribution's vkd3d development packages since 2022-03"
echo " so feel free to ignore this issue. Should you want to install libvkd3d-dev"
echo " anyway, note that 1.2-* claims to support multiarch but some versions ship a"
echo " conflicting file (vkd3d-compiler)."
echo " https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983776"
echo
fi
if wt_explain_bad_pkgs "libvkd3d1:i386"
then
echo "* Wine does not use the distribution's vkd3d development packages since 2022-03"
echo " so feel free to ignore this issue. For older versions the 32-bit libvkd3d1"
echo " package is missing."
echo
fi
}
#####
#
# Zypper package manager (openSUSE, etc.)
#
#####
#
# zypper: Package helpers
#
zypper_retry_lock()
{
local msg="$1"
shift
[ -n "$msg" ] && echo -n "$msg " >&3
locked="Waiting for lock."
while zypper "$@" 2>/dev/null; [ $? -eq 7 ]
do
echo -n "$locked" >&3
locked="."
sleep 1
done
[ -n "$msg" -o "$locked" = "." ] && echo " done" >&3
}
zypper_packages=""
zypper_get_packages()
{
if [ -z "$zypper_packages" ]
then
zypper_packages=`zypper_retry_lock "Grabbing the available package list..." --non-interactive packages 3>&2 | sed -e '0,/\+----/ d' | cut -d'|' -f3 | sort -u`
if [ -z "$zypper_packages" ]
then
error "'zypper packages' did not return the list of available packages"
exit 1
fi
fi
}
zypper_newrepos=""
# zypper_addrepo <landmark> <project> <packages>
#
# Checks if the <landmark> package is available and returns immediately if it
# is. Otherwise builds the OBS repository URL from the <project> string and
# asks whether it should be added. If --yes was given or the user agrees the
# repository is added but 'zypper refresh' is not called.
#
# Returns 0 if the repository is available, non-zero otherwise.
zypper_addrepo()
{
local a distname url
local landmark="$1"
local project="$2"
local packages="$3"
repo_alias=$(echo $project | sed -e 's/:/_/g')
if zypper repos 2>/dev/null | grep -q "$repo_alias"
then
zypper_newrepos="$zypper_newrepos $repo_alias"
return 0
fi
[ -n "$opt_norepo" ] && return 1
zypper_get_packages
if [ -n "$landmark" ]
then
case "$zypper_packages" in
*" $landmark "*) return 1 ;;
esac
fi
distname=`zypper targetos | sed -e 's/^Distribution Label: //' -e 's/-x86_64$//' -e 's/[ -]/_/g'`
# zypper targetos is broken on openSUSE Leap 15.3+
[ -n "$distname" ] || distname=`zypper --terse targetos --label | grep labelLong | sed -e 's/labelLong[ \t]*//' -e 's/ /_/g'`
url="https://download.opensuse.org/repositories/$project/$distname/$project.repo"
echo
echo "********************"
echo
echo "The OBS repository below is needed for $packages."
echo "$url"
echo
echo -n "Do you want to add it? [Y/n] "
if [ -n "$opt_yes" ]
then
echo "yes"
a="y"
else
read a
fi
[ -z "$a" -o "$a" = "y" -o "$a" = "Y" ] || return 1
options="--refresh"
if [ -n "$opt_yes" ]
then
# Disable GPG checks to avoid the new GPG key question during refresh.
# Also disable auto-refresh to limit future usage.
options="--no-gpgcheck"
fi
preopt=""
[ -n "$opt_yes" ] && preopt="--non-interactive"
dry_run zypper $preopt addrepo $options "$url"
[ $? -ne 0 ] && return 1
zypper_newrepos="$zypper_newrepos $repo_alias"
return 0
}
# zypper_check <action> <pkg> <egrep-args>
#
# Checks that the information about <pkg> matches the specified <egrep-args>.
# With the 'info' <action> this can be used to verify that the package actually
# exists, has the expected version, etc.
zypper_check()
{
local action="$1"
local pkg="$2"
shift 2
LANG= zypper --non-interactive $action "$pkg" 2>/dev/null | grep -E -q "$@"
}
# zypper_pkg <pkg1> ...
#
# If <pkg1> exists, schedule it for installation and return success.
# Otherwise try again with the next package in the list.
#
# If none of the packages exists, add them all to the missing packages list
# and return failure.
zypper_pkg()
{
local pkg
zypper_get_packages
for pkg in $*
do
echo -n "Checking $pkg..."
case "$zypper_packages" in
*" $pkg "*)
echo " yes"
pkginstall="$pkginstall $pkg"
return 0
;;
esac
# zypper_get_packages() does not know about virtual packages so fall
# back to a slower 'zypper install' dry-run.
if zypper --non-interactive install --dry-run "$pkg" >/dev/null 2>&1
then
echo " yes"
# Add the virtual package to $zypper_packages in case it is
# queried again. Note: ensure it is enclosed in spaces.
zypper_packages="$zypper_packages$pkg "
pkginstall="$pkginstall $pkg"
return 0
fi
echo " no"
done
pkgmissing="$pkgmissing "`echo "$@" | sed -e 's/ /|/g'`