-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPKGBUILD
282 lines (232 loc) · 8.79 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
# Created by: Tk-Glitch <ti3nou at gmail dot com>
plain ' .---.` `.---.'
plain ' `/syhhhyso- -osyhhhys/`'
plain ' .syNMdhNNhss/``.---.``/sshNNhdMNys.'
plain ' +sdMh.`+MNsssssssssssssssNM+`.hMds+'
plain ' :syNNdhNNhssssssssssssssshNNhdNNys:'
plain ' /ssyhhhysssssssssssssssssyhhhyss/'
plain ' .ossssssssssssssssssssssssssssso.'
plain ' :sssssssssssssssssssssssssssssssss:'
plain ' /sssssssssssssssssssssssssssssssssss/'
plain ' :sssssssssssssoosssssssoosssssssssssss:'
plain ' osssssssssssssoosssssssoossssssssssssso'
plain ' osssssssssssyyyyhhhhhhhyyyyssssssssssso'
plain ' /yyyyyyhhdmmmmNNNNNNNNNNNmmmmdhhyyyyyy/'
plain ' smmmNNNNNNNNNNNNNNNNNNNNNNNNNNNNNmmms'
plain ' /dNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNd/'
plain ' `:sdNNNNNNNNNNNNNNNNNNNNNNNNNds:`'
plain ' `-+shdNNNNNNNNNNNNNNNdhs+-`'
plain ' `.-:///////:-.`'
_where="$PWD" # track basedir as different Arch based distros are moving srcdir around
source "$_where"/customization.cfg
# Load external configuration file if present. Available variable values will overwrite customization.cfg ones.
if [ -e "$_EXT_CONFIG_PATH" ]; then
source "$_EXT_CONFIG_PATH" && msg2 "External configuration file $_EXT_CONFIG_PATH will be used to override customization.cfg values.\n"
fi
if [ -n "$_vkd3d_source" ] && [ "$_vkd3d_source" != 'git://source.winehq.org/git/vkd3d' ]; then
_vkd3dsrcdir=$( sed 's|/|-|g' <<< $(sed 's|.*://.[^/]*/||g' <<< $_vkd3d_source))
else
_vkd3dsrcdir='vkd3d'
_vkd3d_source='git://source.winehq.org/git/vkd3d'
fi
if [ "$_vkd3d_source" = "https://github.com/HansKristian-Work/vkd3d-proton" ]; then
_pkgnameprefix="vkd3d-proton-tkg-git"
else
_pkgnameprefix="vkd3d-tkg-git"
fi
pkgname=("$_pkgnameprefix" "lib32-$_pkgnameprefix")
pkgver=1.2.r48.g5fb9bcd
pkgrel=1
# custom vkd3d commit to pass to git
if [ -n "$_vkd3d_commit" ]; then
_vkd3d_commit="#commit=${_vkd3d_commit}"
fi
pkgdesc='Wine d3d12 to vulkan translation lib, git version'
url='https://source.winehq.org/git/vkd3d.git'
arch=('x86_64')
license=('LGPL')
makedepends=('git' 'autoconf' 'ncurses' 'bison' 'perl' 'fontforge' 'flex'
'gcc>=4.5.0-2' 'spirv-headers'
'vulkan-headers' 'vulkan-icd-loader'
'lib32-vulkan-icd-loader' 'wine'
'glslang'
)
if [ "$_vkd3d_source" = "https://github.com/HansKristian-Work/vkd3d-proton" ] && [ "$_fork_disable_meson" = "false" ]; then
makedepends+=('meson' 'ninja' 'xcb-util-keysyms' 'lib32-xcb-util-keysyms')
fi
optdepends=('schedtool')
source=("$_vkd3dsrcdir"::"git+${_vkd3d_source}${_vkd3d_commit}"
)
makedepends=(${makedepends[@]} ${depends[@]})
function exit_cleanup {
# Remove temporarily copied patches
rm -rf "$_where"/src/*
# Community patches removal
for _p in ${_community_patches[@]}; do
rm -f "$_where"/$_p
done
remove_deps
msg2 "Cleanup done"
}
user_patcher() {
# To patch the user because all your base are belong to us
local _patches=("$_where"/*."${_userpatch_ext}revert")
if [ ${#_patches[@]} -ge 2 ] || [ -e "${_patches}" ]; then
if [ "$_user_patches_no_confirm" != "true" ]; then
msg2 "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" == "y" ] || [ "$_user_patches_no_confirm" == "true" ]; then
for _f in "${_patches[@]}"; do
if [ -e "${_f}" ]; then
msg2 "######################################################"
msg2 ""
msg2 "Reverting your own ${_userpatch_target} patch ${_f}"
msg2 ""
msg2 "######################################################"
patch -Np1 -R < "${_f}"
echo "Reverted your own patch ${_f}" >> "$_where"/last_build_config.log
fi
done
fi
fi
_patches=("$_where"/*."${_userpatch_ext}patch")
if [ ${#_patches[@]} -ge 2 ] || [ -e "${_patches}" ]; then
if [ "$_user_patches_no_confirm" != "true" ]; then
msg2 "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" == "y" ] || [ "$_user_patches_no_confirm" == "true" ]; then
for _f in "${_patches[@]}"; do
if [ -e "${_f}" ]; then
msg2 "######################################################"
msg2 ""
msg2 "Applying your own ${_userpatch_target} patch ${_f}"
msg2 ""
msg2 "######################################################"
patch -Np1 < "${_f}"
echo "Applied your own patch ${_f}" >> "$_where"/last_build_config.log
fi
done
fi
fi
}
pkgver() {
# retrieve current version
cd "${srcdir}/${_vkd3dsrcdir}"
# version string
echo $(git describe --long 2>/dev/null || printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)") | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/vkd3d.//g'
}
prepare() {
# Cleanups
rm -fv $_where/last_build_config.log
cd "${srcdir}/${_vkd3dsrcdir}"
# Community patches
if [ -n "$_community_patches" ]; then
if [ ! -d "$_where/../community-patches" ]; then
cd "$_where/.." && git clone https://github.com/Frogging-Family/community-patches.git && cd "${srcdir}/${_vkd3dsrcdir}"
fi
_community_patches=($_community_patches)
for _p in ${_community_patches[@]}; do
ln -s "$_where"/../community-patches/vkd3d-git/$_p "$_where"/
done
fi
# vkd3d user patches
_userpatch_target="vkd3d"
_userpatch_ext="myvkd3d"
user_patcher
# Community patches removal
for _p in ${_community_patches[@]}; do
rm -f "$_where"/$_p
done
# create new build dirs
mkdir -p "${srcdir}"/"${_pkgnameprefix}"
mkdir -p "${srcdir}"/lib32-"${_pkgnameprefix}"
cd "$_where"
}
build() {
# 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
if [ "$_vkd3d_source" != "https://github.com/HansKristian-Work/vkd3d-proton" ] || [ "$_fork_disable_meson" = "true" ]; then
cd "${srcdir}/${_vkd3dsrcdir}"
./autogen.sh
export CC='gcc -m32 -mstackrealign'
export CXX='g++ -m32 -mstackrealign'
export PKG_CONFIG_PATH='/usr/lib32/pkgconfig'
cd "${srcdir}"/lib32-"${_pkgnameprefix}"
../${_vkd3dsrcdir}/configure \
--prefix=/usr \
--libdir=/usr/lib32
# make using all available threads
schedtool -B -n 1 -e ionice -n 1 make -j$(nproc) -C "${srcdir}"/lib32-"${_pkgnameprefix}" || make -j$(nproc) -C "${srcdir}"/lib32-"${_pkgnameprefix}"
export CC='gcc -m64'
export CXX='g++ -m64'
export PKG_CONFIG_PATH='/usr/lib/pkgconfig'
cd "${srcdir}"/"${_pkgnameprefix}"
../${_vkd3dsrcdir}/configure \
--prefix=/usr \
--libdir=/usr/lib
# make using all available threads
schedtool -B -n 1 -e ionice -n 1 make -j$(nproc) -C "${srcdir}"/"${_pkgnameprefix}" || make -j$(nproc) -C "${srcdir}"/"${_pkgnameprefix}"
else
cd "${srcdir}/${_vkd3dsrcdir}"
git submodule update --init --recursive
cd "${srcdir}"
# 64
export CC="gcc -m64"
export CXX="g++ -m64"
arch-meson "${srcdir}/${_vkd3dsrcdir}" "${srcdir}"/"${_pkgnameprefix}" \
--libdir lib \
--buildtype release
ninja $NINJAFLAGS -C "${_pkgnameprefix}"
# 32
export CC='gcc -m32 -mstackrealign'
export CXX='g++ -m32 -mstackrealign'
export PKG_CONFIG_PATH='/usr/lib32/pkgconfig'
arch-meson "${srcdir}/${_vkd3dsrcdir}" "${srcdir}"/lib32-"${_pkgnameprefix}" \
--libdir lib32 \
--buildtype release
ninja $NINJAFLAGS -C lib32-"${_pkgnameprefix}"
fi
}
_package_vkd3d() {
provides=("vkd3d=$pkgver")
conflicts=("vkd3d")
msg2 'Packaging vkd3d 64...'
if [ "$_vkd3d_source" != "https://github.com/HansKristian-Work/vkd3d-proton" ] || [ "$_fork_disable_meson" = "true" ]; then
cd "${srcdir}"/"${pkgname}"
make -C "${srcdir}"/"${pkgname}" DESTDIR="${pkgdir}" install
else
DESTDIR="$pkgdir" ninja $NINJAFLAGS -C "${_pkgnameprefix}" install
fi
}
_package_lib32-vkd3d() {
provides=("lib32-vkd3d=$pkgver")
conflicts=("lib32-vkd3d")
msg2 'Packaging vkd3d 32...'
if [ "$_vkd3d_source" != "https://github.com/HansKristian-Work/vkd3d-proton" ] || [ "$_fork_disable_meson" = "true" ]; then
cd "${srcdir}"/"${pkgname}"
make -C "${srcdir}"/"${pkgname}" DESTDIR="${pkgdir}" install
else
DESTDIR="$pkgdir" ninja $NINJAFLAGS -C lib32-"${_pkgnameprefix}" install
fi
rm -rf ${pkgdir}/usr/include
rm -f ${pkgdir}/usr/bin/vkd3d-compiler
}
source /dev/stdin <<EOF
package_$_pkgnameprefix() {
_package_vkd3d
}
package_lib32-$_pkgnameprefix() {
_package_lib32-vkd3d
}
EOF
md5sums=('SKIP')
trap exit_cleanup EXIT