blob: 8630c5d289b212bb9b0c0f785a528f8852b26442 (
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
|
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{8..11} )
inherit meson-multilib python-any-r1 linux-info
MY_P="${P/-amber}"
MY_P="${MY_P/_/-}"
DESCRIPTION="OpenGL-like graphic library for Linux"
HOMEPAGE="https://docs.mesa3d.org/amber.html"
if [[ ${PV} == 9999 ]]; then
EGIT_REPO_URI="https://gitlab.freedesktop.org/mesa/mesa.git"
inherit git-r3
else
SRC_URI="https://archive.mesa3d.org/${MY_P}.tar.xz"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~sparc-solaris ~x64-solaris ~x86-solaris"
fi
LICENSE="MIT"
SLOT="amber"
RESTRICT="!test? ( test )"
RADEON_CARDS="r100 r200 radeon"
VIDEO_CARDS="${RADEON_CARDS} i915 i965 intel nouveau"
for card in ${VIDEO_CARDS}; do
IUSE_VIDEO_CARDS+=" video_cards_${card}"
done
IUSE="${IUSE_VIDEO_CARDS}
cpu_flags_x86_sse2 debug gles1 +gles2 selinux test valgrind wayland +X
+zstd"
LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.107"
RDEPEND="
!<=media-libs/mesa-21.3.8
!media-libs/mesa:amber
media-libs/mesa[${MULTILIB_USEDEP}]
>=dev-libs/expat-2.1.0-r3:=[${MULTILIB_USEDEP}]
>=media-libs/libglvnd-1.3.2[X?,${MULTILIB_USEDEP}]
>=sys-libs/zlib-1.2.8[${MULTILIB_USEDEP}]
selinux? ( sys-libs/libselinux[${MULTILIB_USEDEP}] )
wayland? (
>=dev-libs/wayland-1.18.0:=[${MULTILIB_USEDEP}]
>=dev-libs/wayland-protocols-1.8
)
${LIBDRM_DEPSTRING}[video_cards_nouveau?,${MULTILIB_USEDEP}]
video_cards_intel? (
!video_cards_i965? ( ${LIBDRM_DEPSTRING}[video_cards_intel] )
)
video_cards_i915? ( ${LIBDRM_DEPSTRING}[video_cards_intel] )
X? (
>=x11-libs/libX11-1.6.2:=[${MULTILIB_USEDEP}]
>=x11-libs/libxshmfence-1.1:=[${MULTILIB_USEDEP}]
>=x11-libs/libXext-1.3.2:=[${MULTILIB_USEDEP}]
>=x11-libs/libXxf86vm-1.1.3:=[${MULTILIB_USEDEP}]
>=x11-libs/libxcb-1.13:=[${MULTILIB_USEDEP}]
x11-libs/libXfixes:=[${MULTILIB_USEDEP}]
)
zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] )
"
for card in ${RADEON_CARDS}; do
RDEPEND="${RDEPEND}
video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] )
"
done
DEPEND="${RDEPEND}
valgrind? ( dev-util/valgrind )
X? (
x11-libs/libXrandr[${MULTILIB_USEDEP}]
x11-base/xorg-proto
)
"
BDEPEND="
${PYTHON_DEPS}
sys-devel/bison
sys-devel/flex
virtual/pkgconfig
$(python_gen_any_dep ">=dev-python/mako-0.8.0[\${PYTHON_USEDEP}]")
wayland? ( dev-util/wayland-scanner )
"
S="${WORKDIR}/${MY_P}"
EGIT_CHECKOUT_DIR=${S}
QA_WX_LOAD="
x86? (
usr/lib/libGLX_amber.so.0.0.0
)"
python_check_deps() {
has_version -b ">=dev-python/mako-0.8.0[${PYTHON_USEDEP}]"
}
pkg_setup() {
if use video_cards_i965; then
if kernel_is -ge 5 11 3; then
CONFIG_CHECK="~KCMP"
elif kernel_is -ge 5 11; then
CONFIG_CHECK="~CHECKPOINT_RESTORE"
elif kernel_is -ge 5 10 20; then
CONFIG_CHECK="~KCMP"
else
CONFIG_CHECK="~CHECKPOINT_RESTORE"
fi
linux-info_pkg_setup
fi
python-any-r1_pkg_setup
}
multilib_src_configure() {
local emesonargs=()
# Intel code
dri_driver_enable video_cards_i915 i915
dri_driver_enable video_cards_i965 i965
if ! use video_cards_i915 && \
! use video_cards_i965; then
dri_driver_enable video_cards_intel i915 i965
fi
# Nouveau code
dri_driver_enable video_cards_nouveau nouveau
# ATI code
dri_driver_enable video_cards_r100 r100
dri_driver_enable video_cards_r200 r200
if ! use video_cards_r100 && \
! use video_cards_r200; then
dri_driver_enable video_cards_radeon r100 r200
fi
local platforms
use X && platforms+="x11"
use wayland && platforms+=",wayland"
emesonargs+=(-Dplatforms=${platforms#,})
driver_list() {
local drivers="$(sort -u <<< "${1// /$'\n'}")"
echo "${drivers//$'\n'/,}"
}
emesonargs+=(
-Damber=true
$(meson_use test build-tests)
-Dglx=$(usex X dri disabled)
-Dshared-glapi=enabled
-Ddri3=enabled
-Degl=enabled
-Dgbm=enabled
$(meson_feature gles1)
$(meson_feature gles2)
-Dglvnd=true
-Dosmesa=false
-Dllvm=disabled
$(meson_use selinux)
$(meson_feature zstd)
$(meson_use cpu_flags_x86_sse2 sse2)
-Dvalgrind=$(usex valgrind auto disabled)
-Ddri-drivers=$(driver_list "${DRI_DRIVERS[*]}")
-Dgallium-drivers=''
-Dvulkan-drivers=''
--buildtype $(usex debug debug plain)
-Db_ndebug=$(usex debug false true)
)
meson_src_configure
}
multilib_src_test() {
meson_src_test -t 100
}
multilib_src_install_all() {
# These are provided by media-libs/mesa:0
local files=(
"${ED}"/usr/lib*/libgbm.so*
"${ED}"/usr/lib*/libglapi.so*
"${ED}"/usr/include
"${ED}"/usr/lib*/pkgconfig
"${ED}"/usr/share/drirc.d/00-mesa-defaults.conf
)
rm -r "${files[@]}" || die
# Move i915_dri.so -> i915c_dri.so to not conflict with media-libs/mesa:0.
for dridir in "${ED}"/usr/lib*/dri; do
if [[ -e ${dridir}/i915_dri.so ]]; then
mv ${dridir}/i915{,c}_dri.so || die
fi
done
}
# $1 - VIDEO_CARDS flag (check skipped for "--")
# other args - names of DRI drivers to enable
dri_driver_enable() {
if [[ $1 == -- ]] || use $1; then
shift
DRI_DRIVERS+=("$@")
fi
}
|