aboutsummaryrefslogtreecommitdiff
blob: 43d6529345d46ad62be785a0184ebf51917918b2 (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8

MULTILIB_COMPAT=( abi_x86_{32,64} )

inherit rpm unpacker multilib-build

DESCRIPTION="AMD Open Source Driver for Vulkan: official binary version"
HOMEPAGE="https://github.com/GPUOpen-Drivers/AMDVLK"
MY_PV="${PV/'.'/'.Q'}"
FETCH_URI="https://github.com/GPUOpen-Drivers/AMDVLK/releases/download"
SRC_URI="${FETCH_URI}/v-${MY_PV}/amdvlk-${MY_PV}.x86_64.rpm -> ${P}-amd64.rpm
${FETCH_URI}/v-${MY_PV}/amdvlk_${MY_PV}_i386.deb -> ${P}-i386.deb"
RESTRICT="test"
REQUIRED_USE="abi_x86_64"

LICENSE="MIT"
SLOT="legacy-polaris"
KEYWORDS="-* ~amd64" # The hardware is not supported x86 anymore

RDEPEND="
	sys-libs/zlib[${MULTILIB_USEDEP}]
	app-arch/zstd[${MULTILIB_USEDEP}]
	x11-libs/libdrm[${MULTILIB_USEDEP}]
	x11-libs/libXrandr[${MULTILIB_USEDEP}]
	x11-libs/libxcb[${MULTILIB_USEDEP}]
	x11-libs/libxshmfence[${MULTILIB_USEDEP}]
	>=media-libs/vulkan-loader-1.3.224[${MULTILIB_USEDEP}]
	!media-libs/amdvlk
	!media-libs/amdvlk-bin:0
	"
DEPEND="
	${RDEPEND}
"
BDEPEND="sys-apps/sed"
QA_PREBUILT="
	usr/lib/*
	usr/lib64/*
"
# TODO: Found a correct way to disable QA_SONAME for /usr/lib/amdvlk32.so
# I don't know why the current value is not working
QA_SONAME="usr/lib/*"

S=${WORKDIR}

pkg_pretend(){
	einfo "This is last version which supports AMD's legacy graphics cards such as:"
	einfo "Radeon™ RX Vega Series"
	einfo "Radeon™ RX 400/500 Series"
	einfo "Radeon™ Pro WX 9100, x200 Series"
	einfo "Radeon™ Pro W5700/W5500 Series"
	einfo "Use it at your own risk"
	einfo "Check Gentoo Wiki for further information"
	einfo "https://wiki.gentoo.org/wiki/AMDVLK"
	if use abi_x86_32; then
	ewarn "32-bit amdvlk binary is untested"
	ewarn "Work in progress, use it at your risk"
	fi
}

src_unpack(){
	elog "Unpacking abi_x86_64..."
	mkdir -p "${S}"/amd64
	cd "${S}"/amd64 || die
	rpm_unpack ${P}-amd64.rpm
	if use abi_x86_32; then
		elog "Unpacking abi_x86_32..."
		mkdir -p "${S}"/i386 || die
		cd "${S}"/i386 || die
		unpacker ${P}-i386.deb
	fi
}

src_prepare() {
	default
	if use abi_x86_32; then
		elog "Changing layout of abi_x86_32 from debian/ubuntu to Gentoo/RHEL-alike"
		mv "${S}/i386/usr/lib/i386-linux-gnu/amdvlk32.so" "${S}/i386/usr/lib/" || die
		rm -d "${S}/i386/usr/lib/i386-linux-gnu/" || die
		rm -r "${S}/i386/usr/share/" || die
	fi
	mv "${S}/amd64/usr/share/doc/amdvlk/LICENSE.txt" "${S}" || die
	rm -r "${S}/amd64/usr/share/" || die
}

src_configure(){
	if use abi_x86_32; then
		elog "Changing configuration of abi_x86_32 from debian/ubuntu to Gentoo/RHEL-alike"
		sed -i 's/\/usr\/lib\/i386-linux-gnu\/amdvlk32.so/\/usr\/lib\/amdvlk32.so/g' \
		"${S}/i386/etc/vulkan/icd.d/amd_icd32.json" || die
		sed -i 's/\/usr\/lib\/i386-linux-gnu\/amdvlk32.so/\/usr\/lib\/amdvlk32.so/g' \
		"${S}/i386/etc/vulkan/implicit_layer.d/amd_icd32.json" || die
	fi
}
src_compile(){
	elog "Nothing to compile..."
}

src_install(){
	if use abi_x86_32; then
		cp -a "${S}/i386"/* "${D}" || die
	fi
	cp -a "${S}/amd64"/* "${D}" || die
	dodoc LICENSE.txt
}

pkg_postinst(){
	ewarn "If you are using Xorg:"
	ewarn "Make sure the following line is NOT included in the any Xorg configuration section:"
	ewarn "| Driver	  \"modesetting\""
	ewarn "and make sure you use DRI3 mode for Xorg"
	ewarn "If you are using Wayland, it should be fine"
	elog "More information about the configuration can be found here:"
	elog "https://github.com/GPUOpen-Drivers/AMDVLK"
	elog "See also https://wiki.gentoo.org/wiki/AMDVLK (but it might be outdated)"
	elog "You can use AMD_VULKAN_ICD variable to switch to the required driver."
	elog "AMD_VULKAN_ICD=RADV application   - for using radv."
	elog "AMD_VULKAN_ICD=AMDVLK application - for using amdvlk."
}