APKBUILD 6.73 KB
Newer Older
Natanael Copa's avatar
Natanael Copa committed
1 2
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mesa
Leo's avatar
Leo committed
3
pkgver=19.1.4
marmota's avatar
marmota committed
4
pkgrel=0
5
pkgdesc="Mesa DRI OpenGL library"
6
url="https://www.mesa3d.org"
7
arch="all"
Taner Tas's avatar
Taner Tas committed
8
license="MIT SGI-B-2.0 BSL-1.0"
9 10
subpackages="
	$pkgname-dev
Natanael Copa's avatar
Natanael Copa committed
11 12
	$pkgname-dri-ati:_dri
	$pkgname-dri-nouveau:_dri
13
	$pkgname-dri-freedreno:_dri
Natanael Copa's avatar
Natanael Copa committed
14 15
	$pkgname-dri-swrast:_dri
	$pkgname-dri-virtio:_dri
16
	$pkgname-glapi $pkgname-egl $pkgname-gl $pkgname-gles
Natanael Copa's avatar
Natanael Copa committed
17
	$pkgname-xatracker $pkgname-osmesa $pkgname-gbm
Taner Tas's avatar
Taner Tas committed
18
	$pkgname-vulkan-ati:_vulkan
19
	"
Natanael Copa's avatar
Natanael Copa committed
20
_llvmver=8
21 22 23 24 25 26 27 28 29 30 31 32 33 34
depends_dev="
	libdrm-dev
	libxext-dev
	libxdamage-dev
	libxcb-dev
	libxshmfence-dev
	"
makedepends="
	$depends_dev
	bison
	eudev-dev
	expat-dev
	flex
	gettext
35
	elfutils-dev
36 37 38 39 40
	libtool
	libxfixes-dev
	libva-dev
	libvdpau-dev
	libx11-dev
Taner Tas's avatar
Taner Tas committed
41
	libxrandr-dev
42 43
	libxt-dev
	libxvmc-dev
Taner Tas's avatar
Taner Tas committed
44
	libxxf86vm-dev
45 46
	llvm$_llvmver-dev
	makedepend
prspkt's avatar
prspkt committed
47
	meson
48 49 50 51 52 53 54 55 56 57 58
	py-mako
	py3-libxml2
	python3
	talloc-dev
	wayland-dev
	wayland-protocols
	xorgproto
	zlib-dev
	"
source="
	https://mesa.freedesktop.org/archive/mesa-$pkgver.tar.xz
59
	adjust-cache-deflate-buffer.patch
Natanael Copa's avatar
Natanael Copa committed
60
	musl-fix-includes.patch
prspkt's avatar
prspkt committed
61
	add-glx-use-tls.patch
62
	"
63 64
replaces="mesa-dricore"

65
_dri_driverdir=/usr/lib/xorg/modules/dri
prspkt's avatar
prspkt committed
66
_dri_drivers="r100,r200,nouveau"
67
_gallium_drivers="r300,r600,radeonsi,nouveau,freedreno,swrast,virgl"
prspkt's avatar
prspkt committed
68
_vulkan_drivers="amd"
Natanael Copa's avatar
Natanael Copa committed
69
_arch_opts=
70

71 72 73
case "$CARCH" in
x86*)
	_dri_drivers="${_dri_drivers},i915,i965"
74
	_gallium_drivers="${_gallium_drivers},svga"
prspkt's avatar
prspkt committed
75
	_vulkan_drivers="${_vulkan_drivers},intel"
76 77 78 79
	subpackages="$subpackages \
			$pkgname-dri-intel:_dri \
			$pkgname-dri-vmwgfx:_dri \
			$pkgname-vulkan-intel:_vulkan"
prspkt's avatar
prspkt committed
80
	_arch_opts="-Ddri3=true"
Taner Tas's avatar
Taner Tas committed
81
	case "$CARCH" in
82
	x86)
prspkt's avatar
prspkt committed
83
		_arch_opts="$_arch_opts -Dglx-read-only-text=true -Dasm=false";;
Taner Tas's avatar
Taner Tas committed
84
	esac
85
	;;
86
armhf|armv7|aarch64)
87
	_gallium_drivers="${_gallium_drivers},vc4,kmsro,lima,panfrost,etnaviv,tegra"
88 89 90 91
	subpackages="$subpackages
		$pkgname-dri-vc4:_dri
		$pkgname-dri-kmsro:_dri
		$pkgname-dri-lima:_dri
92
		$pkgname-dri-panfrost:_dri
93 94
		$pkgname-dri-etnaviv:_dri
		$pkgname-dri-tegra:_dri
95
		"
96
	;;
97 98
esac

99
build() {
Natanael Copa's avatar
Natanael Copa committed
100
	cd "$builddir"
Timo Teräs's avatar
Timo Teräs committed
101

Natanael Copa's avatar
Natanael Copa committed
102
	export CFLAGS="$CFLAGS -D_XOPEN_SOURCE=700"
prspkt's avatar
prspkt committed
103
	meson \
104
		--prefix=/usr \
Natanael Copa's avatar
Natanael Copa committed
105
		--sysconfdir=/etc \
prspkt's avatar
prspkt committed
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
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--buildtype=release \
		-Ddri-drivers-path=$_dri_driverdir \
		-Dgallium-drivers=$_gallium_drivers \
		-Ddri-drivers=$_dri_drivers \
		-Dvulkan-drivers=$_vulkan_drivers \
		-Dplatforms=x11,drm,wayland \
		-Dllvm=true \
		-Dshared-llvm=true \
		-Dshared-glapi=true \
		-Dgbm=true \
		-Dglx=dri \
		-Dosmesa=gallium \
		-Dgles1=true \
		-Dgles2=true \
		-Degl=true \
		-Dgallium-xa=true \
		-Dgallium-vdpau=true \
		-Dgallium-va=true \
		-Dgallium-xvmc=false \
		-Dglx-use-tls=false \
		-Dgallium-nine=false \
		-Db_ndebug=true \
		$_arch_opts \
		. output
	ninja -C output
133 134 135
}

package() {
Natanael Copa's avatar
Natanael Copa committed
136
	cd "$builddir"
prspkt's avatar
prspkt committed
137
	DESTDIR="$pkgdir" ninja -C output install
Natanael Copa's avatar
Natanael Copa committed
138 139
}

140
egl() {
Natanael Copa's avatar
Natanael Copa committed
141
	pkgdesc="Mesa libEGL runtime libraries"
142
	depends="mesa"
Jakub Jirutka's avatar
Jakub Jirutka committed
143

144
	install -d "$subpkgdir"/usr/lib
Jakub Jirutka's avatar
Jakub Jirutka committed
145
	mv "$pkgdir"/usr/lib/libEGL.so* "$subpkgdir"/usr/lib/
Natanael Copa's avatar
Natanael Copa committed
146 147 148 149
}

gl() {
	pkgdesc="Mesa libGL runtime libraries"
150
	depends="mesa"
Jakub Jirutka's avatar
Jakub Jirutka committed
151

Natanael Copa's avatar
Natanael Copa committed
152
	install -d "$subpkgdir"/usr/lib
Jakub Jirutka's avatar
Jakub Jirutka committed
153
	mv "$pkgdir"/usr/lib/libGL.so* "$subpkgdir"/usr/lib/
Natanael Copa's avatar
Natanael Copa committed
154 155
}

Natanael Copa's avatar
Natanael Copa committed
156 157
glapi() {
	pkgdesc="Mesa shared glapi"
Jakub Jirutka's avatar
Jakub Jirutka committed
158 159
	replaces="$pkgname-gles"

Natanael Copa's avatar
Natanael Copa committed
160
	install -d "$subpkgdir"/usr/lib
Jakub Jirutka's avatar
Jakub Jirutka committed
161
	mv "$pkgdir"/usr/lib/libglapi.so.* "$subpkgdir"/usr/lib/
Natanael Copa's avatar
Natanael Copa committed
162 163
}

Natanael Copa's avatar
Natanael Copa committed
164 165
gles() {
	pkgdesc="Mesa libGLESv2 runtime libraries"
166
	depends="mesa"
Jakub Jirutka's avatar
Jakub Jirutka committed
167

Natanael Copa's avatar
Natanael Copa committed
168
	install -d "$subpkgdir"/usr/lib
Jakub Jirutka's avatar
Jakub Jirutka committed
169
	mv "$pkgdir"/usr/lib/libGLES*.so* "$subpkgdir"/usr/lib/
Natanael Copa's avatar
Natanael Copa committed
170 171 172 173
}

xatracker() {
	pkgdesc="Mesa XA state tracker for vmware"
174
	depends="mesa"
Jakub Jirutka's avatar
Jakub Jirutka committed
175

Natanael Copa's avatar
Natanael Copa committed
176
	install -d "$subpkgdir"/usr/lib
Jakub Jirutka's avatar
Jakub Jirutka committed
177
	mv "$pkgdir"/usr/lib/libxatracker*.so.* "$subpkgdir"/usr/lib/
Natanael Copa's avatar
Natanael Copa committed
178 179 180 181
}

osmesa() {
	pkgdesc="Mesa offscreen rendering libraries"
182
	depends="mesa"
Jakub Jirutka's avatar
Jakub Jirutka committed
183

Natanael Copa's avatar
Natanael Copa committed
184
	install -d "$subpkgdir"/usr/lib
Jakub Jirutka's avatar
Jakub Jirutka committed
185
	mv "$pkgdir"/usr/lib/libOSMesa.so.* "$subpkgdir"/usr/lib/
Natanael Copa's avatar
Natanael Copa committed
186 187 188 189
}

gbm() {
	pkgdesc="Mesa gbm library"
190
	depends="mesa"
Jakub Jirutka's avatar
Jakub Jirutka committed
191

Natanael Copa's avatar
Natanael Copa committed
192
	install -d "$subpkgdir"/usr/lib
Jakub Jirutka's avatar
Jakub Jirutka committed
193
	mv "$pkgdir"/usr/lib/libgbm.so.* "$subpkgdir"/usr/lib/
194 195
}

196 197
_mv_dri() {
	install -d "$subpkgdir"/$_dri_driverdir
198

199 200
	while [ $# -gt 0 ]; do
		mv "$pkgdir"/$_dri_driverdir/${1}.so \
Jakub Jirutka's avatar
Jakub Jirutka committed
201
			"$subpkgdir"/$_dri_driverdir/
202 203 204 205
		shift
	done
}

206 207 208 209 210
_mv_vdpau() {
	local i
	install -d "$subpkgdir"/usr/lib/vdpau
	for i in "$@"; do
		mv "$pkgdir"/usr/lib/vdpau/libvdpau_$i.* \
Jakub Jirutka's avatar
Jakub Jirutka committed
211
			"$subpkgdir"/usr/lib/vdpau/
212 213 214
	done
}

Natanael Copa's avatar
Natanael Copa committed
215
_mv_gpipe() {
Natanael Copa's avatar
Natanael Copa committed
216 217 218 219 220 221 222
	return 0
	# http://cgit.freedesktop.org/mesa/mesa/commit/?id=44ec468e8033553c26a112cebba41c343db00eb1
	# https://code.google.com/p/chromium/issues/detail?id=412089
#	local i
#	install -d "$subpkgdir"/usr/lib/gallium-pipe
#	for i in "$@"; do
#		mv "$pkgdir"/usr/lib/gallium-pipe/pipe_$i.* \
Jakub Jirutka's avatar
Jakub Jirutka committed
223
#			"$subpkgdir"/usr/lib/gallium-pipe/
Natanael Copa's avatar
Natanael Copa committed
224
#	done
Natanael Copa's avatar
Natanael Copa committed
225 226
}

Taner Tas's avatar
Taner Tas committed
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
_mv_vulkan() {
	local i
	install -d "$subpkgdir"/usr/lib
	install -d "$subpkgdir"/usr/share/vulkan/icd.d
	for i in "$@"; do
		mv "$pkgdir"/usr/lib/libvulkan_${i}.so "$subpkgdir"/usr/lib/
		mv "$pkgdir"/usr/share/vulkan/icd.d/${i}* "$subpkgdir"/usr/share/vulkan/icd.d/
	done
}

_mv_va() {
	local i
	install -d "$subpkgdir"/usr/lib/dri
	for i in "$@"; do
		mv "$pkgdir"/usr/lib/dri/${i}_drv_video.so \
			"$subpkgdir"/usr/lib/dri/
	done
}

Natanael Copa's avatar
Natanael Copa committed
246 247 248
_dri() {
	local n=${subpkgname##*-dri-}
	pkgdesc="Mesa DRI driver for $n"
249
	depends="mesa"
Jakub Jirutka's avatar
Jakub Jirutka committed
250

Natanael Copa's avatar
Natanael Copa committed
251 252 253 254
	case $n in
	ati)
		_mv_dri radeon_dri r200_dri r300_dri r600_dri radeonsi_dri \
			&& _mv_vdpau r300 r600 radeonsi \
Taner Tas's avatar
Taner Tas committed
255 256
			&& _mv_gpipe r300 r600 \
			&& _mv_va r600 radeonsi
Natanael Copa's avatar
Natanael Copa committed
257 258 259 260 261 262 263
		;;
	intel)
		_mv_dri i915_dri i965_dri
		;;
	nouveau)
		_mv_dri nouveau_dri nouveau_vieux_dri \
			&& _mv_vdpau nouveau \
Taner Tas's avatar
Taner Tas committed
264 265
			&& _mv_gpipe nouveau \
			&& _mv_va nouveau
Natanael Copa's avatar
Natanael Copa committed
266
		;;
267
	freedreno)
268
		_mv_dri msm_dri kgsl_dri
269
		;;
Natanael Copa's avatar
Natanael Copa committed
270 271 272
	swrast)
		_mv_dri swrast_dri kms_swrast_dri && _mv_gpipe swrast
		;;
273
	vc4)
Natanael Copa's avatar
Natanael Copa committed
274
		_mv_dri vc4_dri
275
		;;
Natanael Copa's avatar
Natanael Copa committed
276 277 278 279 280 281
	vmwgfx)
		_mv_dri vmwgfx_dri && _mv_gpipe vmwgfx
		;;
	virtio)
		_mv_dri virtio_gpu_dri
		;;
282 283 284 285 286
	kmsro)
		_mv_dri exynos_dri hx8357d_dri ili9225_dri ili9341_dri meson_dri mi0283qt_dri pl111_dri repaper_dri rockchip_dri st7586_dri st7735r_dri sun4i-drm_dri
		;;
	lima)
		_mv_dri lima_dri
287 288 289 290
		;;
	panfrost)
		_mv_dri panfrost_dri
		;;
291 292 293 294 295 296
	etnaviv)
		_mv_dri armada-drm_dri imx-drm_dri etnaviv_dri
		;;
	tegra)
		_mv_dri tegra_dri
		;;
Natanael Copa's avatar
Natanael Copa committed
297 298
	esac
}
299

Taner Tas's avatar
Taner Tas committed
300 301 302
_vulkan() {
	local n=${subpkgname##*-vulkan-}
	pkgdesc="Mesa Vulkan API driver for $n"
303
	depends="mesa"
Taner Tas's avatar
Taner Tas committed
304 305 306 307 308 309 310 311

	case $n in
	ati)
		_mv_vulkan radeon ;;
	intel)
		_mv_vulkan intel ;;
	esac
}
Leo's avatar
Leo committed
312
sha512sums="234032d917c9b378c3f6ceb921677b64e549344c3957331810b50fd73e0dccd2f4f62e2bd39e619590f389bc58fdab10fab4b88f7c117557cbeb1dda049b9fc5  mesa-19.1.4.tar.xz
313
cdf22d2da3328e116c379264886bd01fd3ad5cc45fe03dc6fd97bdc4794502598ee195c0b9d975fa264d6ac31c6fa108c0535c91800ecf4fcabfd308e53074cc  adjust-cache-deflate-buffer.patch
prspkt's avatar
prspkt committed
314 315
cf849044d6cc7d2af4ff015208fb09d70bf9660538699797da21bda2ecb7c1892d312af83d05116afd826708d9caafb1d05a13f09139c558aea6fee931e3eee7  musl-fix-includes.patch
1d89e305659bb0ca95b0b593dbc1a17ed28f4a18fabe468c20527302fc90c1ce11ca40a79c8786f1eca68ef643027af706b8689068e31c7f27ceb2303d51633e  add-glx-use-tls.patch"