summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e91bb02db0076b1fd28ac0cce9ad146b05db4174 (plain)
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
# Author: Janusz Lewandowski <lew21@xtreeme.org>
# Maintainer: David McFarland <corngood@gmail.com>
# Autogenerated from AMD's Packages file

pkgbase=amdgpu-pro-installer
pkgname=(amdgpu-pro amdgpu-pro-dkms amdgpu-pro-gst-omx amdgpu-pro-libdrm amdgpu-pro-libgl amdgpu-pro-mesa-omx amdgpu-pro-opencl amdgpu-pro-vdpau amdgpu-pro-vulkan lib32-amdgpu-pro lib32-amdgpu-pro-gst-omx lib32-amdgpu-pro-libdrm lib32-amdgpu-pro-libgl lib32-amdgpu-pro-mesa-omx lib32-amdgpu-pro-opencl lib32-amdgpu-pro-vdpau lib32-amdgpu-pro-vulkan xf86-video-amdgpu-pro)
pkgver=17.40.492261
pkgrel=2
arch=('x86_64')
url='http://www.amd.com'
license=('custom:AMD')
makedepends=('wget')

DLAGENTS='https::/usr/bin/wget --referer https://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Install.aspx -N %u'

major=17.40
minor=492261

source=(https://www2.ati.com/drivers/linux/ubuntu/amdgpu-pro-${major}-${minor}.tar.xz
	0001-disable-firmware-copy.patch
	0003-add-archlinux-as-build-option.patch)
sha256sums=(b0645157577c9ff175dc02487c4c682ded2624c8c2cfd6aa603960962e1d07b0
	85359c89d7f1317cf5176bc9c489314aba2db20d962b120a43fc532575466345
	2bf8eac2afac3bce0d17f840c15009838b578a72412ff66df6e8caa6c00fade7)



# extracts a debian package
# $1: deb file to extract
extract_deb() {
	local tmpdir="$(basename "${1%.deb}")"
	rm -Rf "$tmpdir"
	mkdir "$tmpdir"
	cd "$tmpdir"
	ar x "$1"
	tar -C "${pkgdir}" -xf data.tar.xz
}
# move ubuntu specific /usr/lib/x86_64-linux-gnu to /usr/lib
# $1: library dir
# $2: destination (optional)
move_libdir() {
	local libdir="usr/lib"
	if [ -n "$2" ]; then
		libdir="$2"
	fi
	if [ -d "$1" ]; then
		if [ -d "${pkgdir}/${libdir}" ]; then
			cp -ar -t "${pkgdir}/${libdir}/" "$1"/*
			rm -rf "$1"
		else
			mkdir -p "${pkgdir}/${libdir}"
			mv -t "${pkgdir}/${libdir}/" "$1"/*
			rmdir "$1"
		fi
	fi
}


package_amdgpu-pro () {
	pkgdesc="The AMDGPU Pro driver package"
	install=amdgpu-pro-core.install
	arch=('x86_64')
	depends=("binfmt-support" "libedit>=2.11-20080614" "libffi>=3.0.9" "libx11" "libxext" "libxfixes" "ncurses" "ncurses5-compat-libs>=6" "zlib>=1.2.0")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./amdgpu-pro_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./amdgpu-pro-core_${major}-${minor}_all.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./amdgpu-pro-lib32_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./ids-amdgpu-pro_1.0.0-${minor}_all.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgbm1-amdgpu-pro_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgbm1-amdgpu-pro-base_${major}-${minor}_all.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgbm1-amdgpu-pro-dev_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgl1-amdgpu-pro-dri_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libllvm5.0-amdgpu-pro_5.0-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro_5.0-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro-5.0_5.0-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro-5.0-dev_5.0-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro-5.0-doc_5.0-${minor}_all.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro-5.0-runtime_5.0-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro-dev_5.0-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro-runtime_5.0-${minor}_amd64.deb

	move_libdir "${pkgdir}/lib"

	# extra_commands:
	mv "${pkgdir}"/usr/lib/x86_64-linux-gnu/dri ${pkgdir}/usr/lib/
	# This is needed because libglx.so has a hardcoded DRI_DRIVER_PATH
	ln -s /usr/lib/dri ${pkgdir}/usr/lib/x86_64-linux-gnu/dri
	mkdir -p "${pkgdir}/etc/ld.so.conf.d/"
	echo "/opt/amdgpu-pro/lib/x86_64-linux-gnu/" > "${pkgdir}"/etc/ld.so.conf.d/amdgpu-pro.conf
}


package_amdgpu-pro-dkms () {
	pkgdesc="amdgpu-pro driver in DKMS format."
	arch=('any')
	depends=("amdgpu-pro=${major}.${minor}-${pkgrel}" "dkms>=1.95")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./amdgpu-pro-dkms_${major}-${minor}_all.deb

	move_libdir "${pkgdir}/lib"

	# extra_commands:
	msg 'Applying patches...'
	(cd ${pkgdir}/usr/src/amdgpu-${major}-${minor};
		sed -i 's/\/extra/\/extramodules/' dkms.conf
			msg2 '0001-disable-firmware-copy.patch'
		patch -p1 -i "${srcdir}/0001-disable-firmware-copy.patch";
		msg2 '0003-add-archlinux-as-build-option.patch'
		patch -p1 -i "${srcdir}/0003-add-archlinux-as-build-option.patch"
	)
}


package_amdgpu-pro-gst-omx () {
	pkgdesc="GStreamer OpenMAX plugins for AMDGPU Pro"
	arch=('x86_64')
	depends=("glib2>=2.37.3" "gst-plugins-base>=1.6.0" "gstreamer>=1.0.0" "libomxil-bellagio")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./gst-omx-amdgpu-pro_1.0.0.1-${minor}_amd64.deb

	move_libdir "${pkgdir}/lib"

}


package_amdgpu-pro-libdrm () {
	pkgdesc="The AMDGPU Pro userspace interface to kernel DRM services"
	arch=('x86_64')
	provides=('libdrm')
	conflicts=('libdrm')
	depends=("amdgpu-pro=${major}.${minor}-${pkgrel}" "bcunit")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libdrm-amdgpu-pro-amdgpu1_2.4.82-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libdrm-amdgpu-pro-dev_2.4.82-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libdrm-amdgpu-pro-radeon1_2.4.82-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libdrm-amdgpu-pro-utils_2.4.82-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libdrm2-amdgpu-pro_2.4.82-${minor}_amd64.deb

	move_libdir "${pkgdir}/lib"

}


package_amdgpu-pro-libgl () {
	pkgdesc="The AMDGPU Pro libgl library symlinks"
	arch=('x86_64')
	provides=('libgl')
	conflicts=('libgl')
	depends=("amdgpu-pro-libdrm=${major}.${minor}-${pkgrel}" "amdgpu-pro=${major}.${minor}-${pkgrel}" "libx11" "libx11>=1.4.99.1" "libxcb" "libxcb>=1.8" "libxcb>=1.9.2" "libxdamage>=1.1" "libxext" "libxfixes" "libxshmfence" "libxxf86vm")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libegl1-amdgpu-pro_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgl1-amdgpu-pro-appprofiles_${major}-${minor}_all.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgl1-amdgpu-pro-ext_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgl1-amdgpu-pro-glx_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgles2-amdgpu-pro_${major}-${minor}_amd64.deb

	move_libdir "${pkgdir}/lib"

}


package_amdgpu-pro-mesa-omx () {
	pkgdesc="Mesa OpenMAX video drivers for AMDGPU Pro"
	arch=('x86_64')
	depends=("amdgpu-pro-libdrm=${major}.${minor}-${pkgrel}" "amdgpu-pro=${major}.${minor}-${pkgrel}" "libomxil-bellagio" "libx11" "libxcb" "libxcb>=1.8" "ncurses5-compat-libs>=6" "zlib>=1.2.0")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./mesa-amdgpu-pro-omx-drivers_17.0.1-${minor}_amd64.deb

	move_libdir "${pkgdir}/lib"

}


package_amdgpu-pro-opencl () {
	pkgdesc="The AMDGPU Pro OpenCL implementation"
	arch=('x86_64')
	provides=('opencl-driver')
	depends=("amdgpu-pro=${major}.${minor}-${pkgrel}" "pciutils>=3.3.1-1")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./clinfo-amdgpu-pro_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./hsa-ext-amdgpu-pro-finalize_1.1.6-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./hsa-ext-amdgpu-pro-image_1.1.6-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./hsa-runtime-tools-amdgpu-pro_1.1.6-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./hsa-runtime-tools-amdgpu-pro-dev_1.1.6-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libopencl1-amdgpu-pro_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./opencl-amdgpu-pro-icd_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./rocm-amdgpu-pro_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./rocm-amdgpu-pro-icd_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./rocm-amdgpu-pro-opencl_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./rocm-amdgpu-pro-opencl-dev_${major}-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./rocr-amdgpu-pro_1.1.6-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./rocr-amdgpu-pro-dev_1.1.6-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./roct-amdgpu-pro_1.0.6-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./roct-amdgpu-pro-dev_1.0.6-${minor}_amd64.deb

	move_libdir "${pkgdir}/lib"

}


package_amdgpu-pro-vdpau () {
	pkgdesc="The AMDGPU Pro VDPAU driver"
	arch=('x86_64')
	depends=("amdgpu-pro-libdrm=${major}.${minor}-${pkgrel}" "amdgpu-pro=${major}.${minor}-${pkgrel}" "libvdpau>=1.1" "libxcb" "libxcb>=1.8" "ncurses5-compat-libs>=6" "zlib>=1.2.0")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libvdpau-amdgpu-pro_17.0.1-${minor}_amd64.deb

	move_libdir "${pkgdir}/lib"

	# extra_commands:
	mkdir -p "${pkgdir}"/usr/lib/
	ln -s /opt/amdgpu-pro/lib/x86_64-linux-gnu/vdpau/libvdpau_amdgpu.so.1.0.0 "${pkgdir}"/usr/lib/libvdpau_amdgpu.so.1.0.0
	ln -s /opt/amdgpu-pro/lib/x86_64-linux-gnu/vdpau/libvdpau_amdgpu.so.1.0.0 "${pkgdir}"/usr/lib/libvdpau_amdgpu.so.1
	ln -s /opt/amdgpu-pro/lib/x86_64-linux-gnu/vdpau/libvdpau_amdgpu.so.1.0.0 "${pkgdir}"/usr/lib/libvdpau_amdgpu.so
}


package_amdgpu-pro-vulkan () {
	pkgdesc="The AMDGPU Pro Vulkan driver"
	arch=('x86_64')
	provides=('vulkan-driver')
	depends=("amdgpu-pro=${major}.${minor}-${pkgrel}")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./vulkan-amdgpu-pro_${major}-${minor}_amd64.deb

	move_libdir "${pkgdir}/lib"

	# extra_commands:
	mkdir -p "${pkgdir}"/usr/share/vulkan/icd.d/
	mv "${pkgdir}"/etc/vulkan/icd.d/amd_icd64.json "${pkgdir}"/usr/share/vulkan/icd.d/
	sed -i "s@abi_versions\(.*\)0.9.0\(.*\)@api_version\11.0.61\2@" "${pkgdir}"/usr/share/vulkan/icd.d/amd_icd64.json
	rm -rf "${pkgdir}"/etc/vulkan/
}


package_lib32-amdgpu-pro () {
	pkgdesc="Meta package to install amdgpu Pro components. (32bit libraries)"
	arch=('x86_64')
	depends=("binfmt-support" "lib32-libedit>=2.11-20080614" "lib32-libffi>=3.0.9" "lib32-libx11" "lib32-libxext" "lib32-libxfixes" "lib32-ncurses" "lib32-ncurses5-compat-libs>=6" "lib32-zlib>=1.2.0")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./amdgpu-pro_${major}-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgbm1-amdgpu-pro_${major}-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgbm1-amdgpu-pro-dev_${major}-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgl1-amdgpu-pro-dri_${major}-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libllvm5.0-amdgpu-pro_5.0-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro_5.0-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro-5.0_5.0-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro-5.0-dev_5.0-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro-5.0-runtime_5.0-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro-dev_5.0-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./llvm-amdgpu-pro-runtime_5.0-${minor}_i386.deb

	move_libdir "${pkgdir}/lib" "usr/lib32"

	# extra_commands:
	mkdir -p "${pkgdir}"/usr/lib32/
	mv "${pkgdir}"/usr/lib/i386-linux-gnu/dri "${pkgdir}"/usr/lib32/
	rm -rf "${pkgdir}"/etc
	mkdir -p "${pkgdir}/etc/ld.so.conf.d/"
	echo "/opt/amdgpu-pro/lib/i386-linux-gnu/" > "${pkgdir}"/etc/ld.so.conf.d/lib32-amdgpu-pro.conf

	# lib32 cleanup
	rm -rf "${pkgdir}"/usr/{bin,lib,include,share} "${pkgdir}/var" "${pkgdir}"/opt/amdgpu-pro/{bin,include,share}
	rm -rf "${pkgdir}"/opt/amdgpu-pro/lib/xorg/modules/extensions/

}


package_lib32-amdgpu-pro-gst-omx () {
	pkgdesc="GStreamer OpenMAX plugins for AMDGPU Pro (32bit libraries)"
	arch=('x86_64')
	depends=("lib32-glib2>=2.37.3" "lib32-gst-plugins-base>=1.6.0" "lib32-gstreamer>=1.0.0" "lib32-libomxil-bellagio")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./gst-omx-amdgpu-pro_1.0.0.1-${minor}_i386.deb

	move_libdir "${pkgdir}/lib" "usr/lib32"


	# lib32 cleanup
	rm -rf "${pkgdir}"/usr/{bin,lib,include,share} "${pkgdir}/var" "${pkgdir}"/opt/amdgpu-pro/{bin,include,share}
	rm -rf "${pkgdir}"/opt/amdgpu-pro/lib/xorg/modules/extensions/

}


package_lib32-amdgpu-pro-libdrm () {
	pkgdesc="The AMDGPU Pro userspace interface to kernel DRM services (32bit libraries)"
	arch=('x86_64')
	provides=('lib32-libdrm')
	conflicts=('lib32-libdrm')
	depends=("amdgpu-pro-libdrm=${major}.${minor}-${pkgrel}" "amdgpu-pro=${major}.${minor}-${pkgrel}")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libdrm-amdgpu-pro-amdgpu1_2.4.82-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libdrm-amdgpu-pro-dev_2.4.82-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libdrm-amdgpu-pro-radeon1_2.4.82-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libdrm2-amdgpu-pro_2.4.82-${minor}_i386.deb

	move_libdir "${pkgdir}/lib" "usr/lib32"


	# lib32 cleanup
	rm -rf "${pkgdir}"/usr/{bin,lib,include,share} "${pkgdir}/var" "${pkgdir}"/opt/amdgpu-pro/{bin,include,share}
	rm -rf "${pkgdir}"/opt/amdgpu-pro/lib/xorg/modules/extensions/

}


package_lib32-amdgpu-pro-libgl () {
	pkgdesc="The AMDGPU Pro libgl library symlinks (32bit libraries)"
	arch=('x86_64')
	provides=('lib32-libgl')
	conflicts=('lib32-libgl')
	depends=("amdgpu-pro-libdrm=${major}.${minor}-${pkgrel}" "amdgpu-pro-libgl=${major}.${minor}-${pkgrel}" "amdgpu-pro=${major}.${minor}-${pkgrel}" "lib32-libx11" "lib32-libx11>=1.4.99.1" "lib32-libxcb" "lib32-libxcb>=1.8" "lib32-libxcb>=1.9.2" "lib32-libxdamage>=1.1" "lib32-libxext" "lib32-libxfixes" "lib32-libxshmfence" "lib32-libxxf86vm")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libegl1-amdgpu-pro_${major}-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgl1-amdgpu-pro-ext_${major}-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgl1-amdgpu-pro-glx_${major}-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libgles2-amdgpu-pro_${major}-${minor}_i386.deb

	move_libdir "${pkgdir}/lib" "usr/lib32"

	# extra_commands:
	rm -rf "${pkgdir}"/etc

	# lib32 cleanup
	rm -rf "${pkgdir}"/usr/{bin,lib,include,share} "${pkgdir}/var" "${pkgdir}"/opt/amdgpu-pro/{bin,include,share}
	rm -rf "${pkgdir}"/opt/amdgpu-pro/lib/xorg/modules/extensions/

}


package_lib32-amdgpu-pro-mesa-omx () {
	pkgdesc="Mesa OpenMAX video drivers for AMDGPU Pro (32bit libraries)"
	arch=('x86_64')
	depends=("amdgpu-pro-libdrm=${major}.${minor}-${pkgrel}" "amdgpu-pro=${major}.${minor}-${pkgrel}" "lib32-libomxil-bellagio" "lib32-libx11" "lib32-libxcb" "lib32-libxcb>=1.8" "lib32-ncurses5-compat-libs>=6" "lib32-zlib>=1.2.0")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./mesa-amdgpu-pro-omx-drivers_17.0.1-${minor}_i386.deb

	move_libdir "${pkgdir}/lib" "usr/lib32"

	# extra_commands:
	rm -f "${pkgdir}"/etc/xdg/gstomx.conf

	# lib32 cleanup
	rm -rf "${pkgdir}"/usr/{bin,lib,include,share} "${pkgdir}/var" "${pkgdir}"/opt/amdgpu-pro/{bin,include,share}
	rm -rf "${pkgdir}"/opt/amdgpu-pro/lib/xorg/modules/extensions/

}


package_lib32-amdgpu-pro-opencl () {
	pkgdesc="The AMDGPU Pro OpenCL implementation"
	arch=('x86_64')
	provides=('lib32-opencl-driver')
	depends=("amdgpu-pro=${major}.${minor}-${pkgrel}")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libopencl1-amdgpu-pro_${major}-${minor}_i386.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./opencl-amdgpu-pro-icd_${major}-${minor}_i386.deb

	move_libdir "${pkgdir}/lib" "usr/lib32"


	# lib32 cleanup
	rm -rf "${pkgdir}"/usr/{bin,lib,include,share} "${pkgdir}/var" "${pkgdir}"/opt/amdgpu-pro/{bin,include,share}
	rm -rf "${pkgdir}"/opt/amdgpu-pro/lib/xorg/modules/extensions/

}


package_lib32-amdgpu-pro-vdpau () {
	pkgdesc="The AMDGPU Pro VDPAU driver (32bit libraries)"
	arch=('x86_64')
	depends=("amdgpu-pro-libdrm=${major}.${minor}-${pkgrel}" "amdgpu-pro=${major}.${minor}-${pkgrel}" "lib32-libvdpau>=1.1" "lib32-libxcb" "lib32-libxcb>=1.8" "lib32-ncurses5-compat-libs>=6" "lib32-zlib>=1.2.0")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./libvdpau-amdgpu-pro_17.0.1-${minor}_i386.deb

	move_libdir "${pkgdir}/lib" "usr/lib32"

	# extra_commands:
	mkdir -p "${pkgdir}"/usr/lib32/
	ln -s /opt/amdgpu-pro/lib/i386-linux-gnu/vdpau/libvdpau_amdgpu.so.1.0.0 "${pkgdir}"/usr/lib32/libvdpau_amdgpu.so.1.0.0
	ln -s /opt/amdgpu-pro/lib/i386-linux-gnu/vdpau/libvdpau_amdgpu.so.1.0.0 "${pkgdir}"/usr/lib32/libvdpau_amdgpu.so.1
	ln -s /opt/amdgpu-pro/lib/i386-linux-gnu/vdpau/libvdpau_amdgpu.so.1.0.0 "${pkgdir}"/usr/lib32/libvdpau_amdgpu.so

	# lib32 cleanup
	rm -rf "${pkgdir}"/usr/{bin,lib,include,share} "${pkgdir}/var" "${pkgdir}"/opt/amdgpu-pro/{bin,include,share}
	rm -rf "${pkgdir}"/opt/amdgpu-pro/lib/xorg/modules/extensions/

}


package_lib32-amdgpu-pro-vulkan () {
	pkgdesc="The AMDGPU Pro Vulkan driver (32bit libraries)"
	arch=('x86_64')
	provides=('lib32-vulkan-driver')
	depends=("amdgpu-pro=${major}.${minor}-${pkgrel}")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./vulkan-amdgpu-pro_${major}-${minor}_i386.deb

	move_libdir "${pkgdir}/lib" "usr/lib32"

	# extra_commands:
	mkdir -p "${pkgdir}"/usr/share/vulkan/icd.d/
	mv "${pkgdir}"/etc/vulkan/icd.d/amd_icd32.json "${pkgdir}"/usr/share/vulkan/icd.d/
	sed -i "s@abi_versions\(.*\)0.9.0\(.*\)@api_version\11.0.61\2@" "${pkgdir}"/usr/share/vulkan/icd.d/amd_icd32.json
	rm -rf "${pkgdir}"/etc/vulkan/

	# lib32 cleanup
	rm -rf "${pkgdir}"/usr/{bin,lib,include,share} "${pkgdir}/var" "${pkgdir}"/opt/amdgpu-pro/{bin,include,share}
	rm -rf "${pkgdir}"/opt/amdgpu-pro/lib/xorg/modules/extensions/

}


package_xf86-video-amdgpu-pro () {
	pkgdesc="The AMDGPU Pro X.org video driver"
	arch=('x86_64')
	provides=('xf86-video-amdgpu')
	conflicts=('xf86-video-amdgpu' 'xorg-server<1.19.0' 'X-ABI-VIDEODRV_VERSION<23' 'X-ABI-VIDEODRV_VERSION>=24')
	groups=('xorg-drivers')
	depends=("amdgpu-pro-libdrm=${major}.${minor}-${pkgrel}" "amdgpu-pro=${major}.${minor}-${pkgrel}" "libsystemd>=183")

	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./xserver-xorg-video-amdgpu-pro_1.3.99-${minor}_amd64.deb
	extract_deb "${srcdir}"/amdgpu-pro-${major}-${minor}/./xserver-xorg-video-modesetting-amdgpu-pro_1.19.0-${minor}_amd64.deb

	move_libdir "${pkgdir}/lib"

}