This repository has been archived by the owner on Jun 25, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPKGBUILD
445 lines (396 loc) · 14.3 KB
/
PKGBUILD
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
# Created by: Tk-Glitch <ti3nou at gmail dot com>
pkgname=wine-tkg
pkgver=0
# workaround for pkgrel overwritten on regen
pkgrel=1
eval pkgrel=327
_esyncsrcdir='esync'
export _where="$PWD" # track basedir as different Arch based distros are moving srcdir around
_configure_args=() # additional args to ./configure will be added during prepare()
_makepkg_options=()
# load functions
source "$_where"/wine-tkg-scripts/prepare.sh
source "$_where"/wine-tkg-scripts/build.sh
exit_cleanup() {
_exit_cleanup
remove_deps || true
}
# init steps
if msg2; then # Arch chroot workaround for even more looping fun
_init
fi
if [ -z "$_localbuild" ]; then
_pkgnaming
fi
# custom plain wine commit to pass to git
if [ -n "$_plain_version" ]; then
if [[ "$_LOCAL_PRESET" = valve* ]]; then
_plain_commit="#branch=$_plain_version"
elif [ "$_use_staging" = "false" ] || ( [ "$_use_staging" = "true" ] && [ "$_staging_upstreamignore" = "true" ] ); then
_plain_commit="#commit=$_plain_version"
fi
fi
# custom staging commit to pass to git
if [ "$_use_staging" = "true" ] && [ -n "$_staging_version" ]; then
_staging_commit="#commit=$_staging_version"
fi
pkgdesc='This "Wine to rule them all" package is the result of some random pkgbuild found online. Looks safe to me, amirite? Some variants of it can be found in lutris runners.'
url='https://github.com/Tk-Glitch/PKGBUILDS/tree/master/wine-tkg-git'
arch=('x86_64')
_makepkg_options+=('!strip')
_makepkg_options+=('!ccache')
# Only pass the staticlibs option to system-wide installs
if [ "$_EXTERNAL_INSTALL" != "true" ]; then
_makepkg_options+=(staticlibs)
fi
if [ "$_NOCCACHE" != "true" ]; then
if msg2; then # Arch chroot workaround for even more looping fun
# Use ccache if available
if pacman -Qq ccache &> /dev/null; then
msg2 'ccache was found and will be used'
else
msg2 'ccache was not found and will not be used'
fi
fi
fi
options=(${_makepkg_options[@]} !lto)
license=('LGPL')
depends=(
'attr' 'fontconfig'
'lcms2' 'libxml2'
'libxcursor' 'libxrandr'
'libxdamage' 'libxi'
'gettext' 'freetype2'
'glu' 'libsm'
'gcc-libs' 'libpcap'
'jxrlib' 'desktop-file-utils'
$_user_deps
)
if [ "$_NOLIB32" = "false" ]; then
depends+=(
'lib32-attr' 'lib32-fontconfig'
'lib32-lcms2' 'lib32-lcms2'
'lib32-libxml2' 'lib32-libxcursor'
'lib32-libxrandr' 'lib32-libxdamage'
'lib32-libxi' 'lib32-gettext'
'lib32-freetype2' 'lib32-glu'
'lib32-libsm' 'lib32-gcc-libs'
'lib32-libpcap'
)
fi
makedepends=(
'git' 'autoconf'
'ncurses' 'bison'
'perl' 'fontforge'
'flex' 'gcc>=4.5.0-2'
'pkgconf' 'giflib'
'libpng' 'gnutls'
'libxinerama' 'libxcomposite'
'libxmu' 'libxxf86vm'
'libldap' 'mpg123'
'openal' 'v4l-utils'
'alsa-lib' 'libxcomposite'
'mesa' 'libgl'
'libxslt' 'libpulse'
'libva' 'gtk3'
'gst-plugins-base-libs' 'gst-plugins-good'
'vulkan-icd-loader' 'sdl2'
'libcups' 'samba'
'opencl-headers' 'meson'
'ninja' 'glslang'
'wget' 'ocl-icd'
'jack' 'libxpresent'
'libgcrypt' $_user_makedeps
)
if [ "$_NOLIB32" = "false" ]; then
makedepends+=(
'lib32-giflib' 'lib32-libpng'
'lib32-gnutls' 'lib32-libxinerama'
'lib32-libxcomposite' 'lib32-libxmu'
'lib32-libxxf86vm' 'lib32-libldap'
'lib32-mpg123' 'lib32-openal'
'lib32-v4l-utils' 'lib32-alsa-lib'
'lib32-mesa' 'lib32-libgl'
'lib32-libxslt' 'lib32-libpulse'
'lib32-libva' 'lib32-gtk3'
'lib32-gst-plugins-base-libs' 'lib32-gst-plugins-good'
'lib32-vulkan-icd-loader' 'lib32-sdl2'
'lib32-libcups' 'lib32-ocl-icd'
'lib32-jack' 'lib32-libgcrypt'
)
fi
# mingw
if [ -z "${CUSTOM_MINGW_PATH}" ]; then
makedepends+=('mingw-w64-gcc')
fi
# proton-tkg deps
if [ -e "$_where"/proton_tkg_token ]; then
makedepends+=('fontforge' 'python-fonttools')
depends+=('tk')
fi
if [ "$_build_mediaconv" = "true" ]; then
depends+=('gst-plugins-ugly')
fi
# wine-mono deps
if [ "$_use_mono" = "true" ]; then
depends+=('wine-mono')
fi
optdepends=(
'giflib' 'libpng'
'libldap' 'gnutls'
'mpg123' 'openal'
'v4l-utils' 'libpulse'
'alsa-plugins' 'alsa-lib'
'libjpeg-turbo' 'libxcomposite'
'libxinerama' 'ncurses'
'libxslt' 'libva'
'gtk3' 'gst-plugins-base-libs'
'vulkan-icd-loader' 'sdl2'
'cups' 'samba'
'dosbox' 'faudio'
'schedtool' 'zapcc'
'clang' 'ccache'
)
if [ "$_NOLIB32" = "false" ]; then
optdepends+=(
'lib32-giflib' 'lib32-libpng'
'lib32-libldap' 'lib32-gnutls'
'lib32-mpg123' 'lib32-openal'
'lib32-v4l-utils' 'lib32-libpulse'
'lib32-alsa-plugins' 'lib32-alsa-lib'
'lib32-libjpeg-turbo' 'lib32-libxcomposite'
'lib32-libxinerama' 'lib32-ncurses'
'lib32-libxslt' 'lib32-libva'
'lib32-gtk3' 'lib32-gst-plugins-base-libs'
'lib32-vulkan-icd-loader' 'lib32-sdl2'
'lib32-faudio'
)
fi
# Wine source
if [ "$_github_mirrorsrc" = "true" ]; then
_winesrcdir="wine-mirror-git"
_stgsrcdir="wine-staging-mirror-git"
_winesrctarget="git+https://github.com/wine-mirror/wine.git"
_stgsrctarget="git+https://github.com/wine-staging/wine-staging.git"
else
_winesrcdir="wine-git"
_stgsrcdir="wine-staging-git"
_winesrctarget="git+https://gitlab.winehq.org/wine/wine.git"
_stgsrctarget="git+https://gitlab.winehq.org/wine/wine-staging.git"
fi
if [ -n "$_custom_wine_source" ]; then
_winesrcdir=$( sed 's|/|-|g' <<< $(sed 's|.*://.[^/]*/||g' <<< ${_custom_wine_source//./}))
if [[ "$_custom_wine_source" = https* ]]; then
_winesrctarget="git+$_custom_wine_source"
else
_winesrctarget="$_custom_wine_source"
fi
fi
if [ ! -e "$_where"/BIG_UGLY_FROGMINER ]; then
# remove src symlink if it exists
if [ -L "$_where"/src ]; then
rm -rf "$_where"/src
fi
find "$_where"/wine-tkg-patches -type f '(' -iname '*patch' -or -iname '*.conf' ')' -not -path "*hotfixes*" -exec cp -n {} "$_where" \; && # copy patches inside the PKGBUILD's dir to preserve makepkg sourcing and md5sum checking
cp "$_where"/wine-tkg-userpatches/*.my* "$_where" 2>/dev/null # copy userpatches inside the PKGBUILD's dir
fi
# Handle unbranched bleeding version
if [[ "$_LOCAL_PRESET" = valve* ]] && [ -n "$_bleeding_tag" ]; then
_plain_commit="${_bleeding_tag}"
fi
source=("$_winesrcdir"::"${_winesrctarget}${_plain_commit}"
"$_stgsrcdir"::"${_stgsrctarget}${_staging_commit}"
# misc
'30-win32-aliases.conf' # 32-bit font antialiasing
'wine-binfmt.conf' # Enables launching windows executables directly
)
md5sums=('SKIP'
'SKIP'
'1ff4e467f59409272088d92173a0f801'
'cff441678d798466a13a0d03b01e23d7'
)
if [ "$_EXTERNAL_INSTALL" = "true" ]; then
provides=(
"$pkgname=$pkgver"
)
conflicts=("$pkgname")
else
provides=(
"wine=$pkgver"
"wine-wow64=$pkgver"
"wine-staging=$pkgver"
"wine-esync=$pkgver"
)
conflicts=('wine' 'wine-wow64' 'wine-staging' 'wine-esync')
if [[ "$pkgname" == *-git ]]; then
replaces=("${pkgname/%-git/-faudio-git}")
fi
fi
if [ -n "$_localbuild" ]; then
_winesrcdir="$_localbuild"
_use_staging="false"
pkgname="$_localbuild"
if [ -n "$_PKGNAME_OVERRIDE" ]; then
if [ "$_PKGNAME_OVERRIDE" = "none" ]; then
pkgname="${pkgname}"
else
pkgname="${_PKGNAME_OVERRIDE}"
fi
if msg2; then # Arch chroot workaround for even more looping fun
msg2 "Overriding default pkgname. New pkgname: ${pkgname}"
fi
fi
fi
makedepends=("${makedepends[@]}" "${depends[@]}")
nonuser_patcher() {
if [ "$_NUKR" != "debug" ] || [[ "$_DEBUGANSW1" =~ [yY] ]]; then
if [ "$_nopatchmsg" != "true" ]; then
_fullpatchmsg=" -- ( $_patchmsg )"
fi
msg2 "Applying ${_patchname}"
echo -e "\n${_patchname}${_fullpatchmsg}" >> "$_where"/prepare.log
patch -Np1 < ../"$_patchname" >> "$_where"/prepare.log || (error "Patch application has failed. The error was logged to $_where/prepare.log for your convenience." && exit 1)
echo -e "${_patchname}${_fullpatchmsg}" >> "$_where"/last_build_config.log
fi
}
pkgver() {
if [ "$_use_staging" = "true" ] && [[ "$_custom_wine_source" != *"ValveSoftware"* ]]; then
cd "${srcdir}/${_stgsrcdir}"
else
cd "${srcdir}/${_winesrcdir}"
fi
# retrieve current wine version - if staging is enabled, staging version will be used instead
_ismakepkg="true" _describe_wine
}
prepare() {
# Handle unbranched bleeding version
if [ "$_LOCAL_PRESET" = "valve-exp-bleeding" ]; then
(
cd "${srcdir}/${_winesrcdir}"
if [ -z "$_bleeding_tag" ]; then
_bleeding_tag=$(git tag -l --sort=-v:refname | grep "bleeding" | head -n 1)
echo "_bleeding_tag='$_bleeding_tag'" >> "$_where"/temp
fi
_bleeding_commit=$(git rev-list -n 1 "${_bleeding_tag}")
_plain_commit="${_bleeding_commit}"
git -c advice.detachedHead=false checkout "${_bleeding_commit}"
)
fi
if msg2; then # Arch chroot workaround for even more looping fun
# Remove gst-editing-services
if pacman -Qq gst-editing-services &> /dev/null; then
warning '! found gst-editing-services package, known to break wine prefix creation !'
read -rp " Uninstall it?"$'\n> N/y : ' _gst_editing_services;
if [[ "$_gst_editing_services" =~ [yY] ]]; then
sudo pacman -R gst-editing-services
fi
fi
fi
# Symlink legacy patches to srcdir
if [ "$_NUKR" != "debug" ] || [[ "$_DEBUGANSW1" =~ [yY] ]]; then
for _sympatch in "$_where"/*.patch; do
if [[ ! "${source[@]##*/}" =~ "${_sympatch##*/}" ]]; then
ln -s "$_sympatch" "$srcdir/"
fi
done
fi
# state tracker start - FEAR THE MIGHTY FROG MINER
touch "${_where}"/BIG_UGLY_FROGMINER
# prepare steps
if [ -z "$_localbuild" ]; then
_source_cleanup > "$_where"/prepare.log
_prepare
else
echo -e "Building local source $_localbuild" > "$_where"/prepare.log
fi
_polish
_makedirs
if [ "$_allow_server_rt_prio" = "true" ] || [ "$_allow_wine_net_raw" = "true" ]; then
if [ "$_EXTERNAL_INSTALL" = "true" ]; then
if [ "$_EXTERNAL_NOVER" = "true" ]; then
_serverpath="$_DEFAULT_EXTERNAL_PATH/$pkgname/bin/wineserver"
_preloaderpath="$_DEFAULT_EXTERNAL_PATH/$pkgname/bin/wine-preloader"
_preloader64path="$_DEFAULT_EXTERNAL_PATH/$pkgname/bin/wine64-preloader"
else
if [ "$_use_staging" = "true" ]; then
cd "$srcdir/$_stgsrcdir"
else
cd "$srcdir/$_winesrcdir"
fi
_realwineversion=$(_describe_wine)
_serverpath="$_DEFAULT_EXTERNAL_PATH/$pkgname-$_realwineversion/bin/wineserver"
_preloaderpath="$_DEFAULT_EXTERNAL_PATH/$pkgname-$_realwineversion/bin/wine-preloader"
_preloader64path="$_DEFAULT_EXTERNAL_PATH/$pkgname-$_realwineversion/bin/wine64-preloader"
fi
else
_serverpath="/usr/bin/wineserver"
_preloaderpath="/usr/bin/wine-preloader"
_preloader64path="/usr/bin/wine64-preloader"
fi
cp "$_where"/wine.install "$_where"/wine-tkg.install
sed -i "s|#echo \"Setting wineserver and/or wine-preloader capabilities\"|echo \"Setting wineserver and/or wine-preloader capabilities\"|g" "$_where"/wine-tkg.install
if [ "$_allow_server_rt_prio" = "true" ] && [ "$_allow_wine_net_raw" != "true" ]; then
sed -i "s|#setcap cap_net_raw+eip /usr/bin/wineserver 2>/dev/null|setcap cap_sys_nice+ep $_serverpath 2>/dev/null|g" "$_where"/wine-tkg.install
fi
if [ "$_allow_wine_net_raw" = "true" ] && [ "$_allow_server_rt_prio" != "true" ]; then
sed -i "s|#setcap cap_net_raw+eip /usr/bin/wineserver 2>/dev/null|setcap cap_net_raw+eip $_serverpath 2>/dev/null|g" "$_where"/wine-tkg.install
fi
if [ "$_allow_wine_net_raw" = "true" ] && [ "$_allow_server_rt_prio" = "true" ]; then
sed -i "s|#setcap cap_net_raw+eip /usr/bin/wineserver 2>/dev/null|setcap cap_sys_nice,cap_net_raw+eip $_serverpath 2>/dev/null|g" "$_where"/wine-tkg.install
fi
if [ "$_allow_wine_net_raw" = "true" ]; then
sed -i "s|#setcap cap_net_raw+eip /usr/bin/wine-preloader 2>/dev/null|setcap cap_net_raw+eip $_preloaderpath 2>/dev/null|g" "$_where"/wine-tkg.install
sed -i "s|#setcap cap_net_raw+eip /usr/bin/wine64-preloader 2>/dev/null|setcap cap_net_raw+eip $_preloader64path 2>/dev/null|g" "$_where"/wine-tkg.install
fi
fi
}
build() {
_prebuild_common
local _prefix=/usr
local _lib32name="lib32"
local _lib64name="lib"
# configure args
if [ -n "$_configure_userargs64" ]; then
_configure_args64+=($_configure_userargs64)
fi
if [ -n "$_configure_userargs32" ]; then
_configure_args32+=($_configure_userargs32)
fi
# External install
if [ "$_EXTERNAL_INSTALL" = "true" ]; then
_lib32name="lib" && _lib64name="lib64"
if [ "$_EXTERNAL_NOVER" = "true" ]; then
_prefix="$_DEFAULT_EXTERNAL_PATH/$pkgname"
else
if [ "$_use_staging" = "true" ]; then
cd "$srcdir/$_stgsrcdir"
else
cd "$srcdir/$_winesrcdir"
fi
_realwineversion=$(_describe_wine)
_prefix="$_DEFAULT_EXTERNAL_PATH/$pkgname-$_realwineversion"
fi
_configure_args64+=(--libdir="$_prefix/$_lib64name")
_configure_args32+=(--libdir="$_prefix/$_lib32name")
elif [ "$_EXTERNAL_INSTALL" = "proton" ]; then
_prefix="$_where"
_configure_args+=(--without-curses)
else
_configure_args64+=(--libdir="$_prefix/$_lib64name")
_configure_args32+=(--libdir="$_prefix/$_lib32name")
fi
if [ "$_SKIPBUILDING" != "true" ] && [ "$_NOCOMPILE" != "true" ]; then
_build
fi
}
package() {
if [ "$_allow_server_rt_prio" = "true" ]; then
install=wine-tkg.install
else
install=wine.install
fi
if [ "$_NOCOMPILE" != "true" ]; then
_package_makepkg
fi
}
trap exit_cleanup EXIT