view graphics/mesa/mesa.sh @ 1341:9f35c15329d1 default tip @

dev/meson: downgrade to 0.59.4 due to many regression
author David Demelier <markand@malikania.fr>
date Wed, 22 Dec 2021 21:52:57 +0100
parents 66d3e04b22e6
children
line wrap: on
line source

#!/bin/sh
#
# Copyright (c) 2019-2021 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

PKGNAME=mesa
PKGVERSION=21.2.5
PKGREVISION=1
PKGLICENSE="Custom"
PKGSUMMARY="opensource OpenGL implementation"
PKGWWW="https://www.mesa3d.org"
PKGDOWNLOAD="https://mesa.freedesktop.org/archive/$PKGNAME-$PKGVERSION.tar.xz"
PKGDEPENDS="meson:build"
PKGOPTIONS="DRI EGL GALLIUM GLVND LLVM PLATFORMS SELINUX VULKAN WAYLAND X"

: ${CC:=clang}
: ${CFLAGS:=-O2}
: ${CXX:=clang++}
: ${CXXFLAGS:=-O2}
: ${LDFLAGS:=}
: ${DRI:=yes}           # Select: list|yes, no
: ${EGL:=yes}
: ${GALLIUM:=yes}       # Select: list|yes, no
: ${GLVND:=no}
: ${LLVM:=yes}
: ${SELINUX:=no}
: ${VULKAN:=yes}        # Select: list|yes, no
: ${WAYLAND:=yes}
: ${X:=yes}

# Convert user options separated by spaces to comma.
with_platforms=""

case "$DRI" in
"yes")
        with_dri_drivers="auto" ;;
"no")
        with_dri_drivers="" ;;
*)
	with_dri_drivers="$(echo $DRI | sed -e "s/ /,/g")" ;;
esac

if [ "$EGL" = "yes" ]; then
	with_egl="-D egl=true"
else
	with_egl="-D egl=false"
fi

case "$GALLIUM" in
"yes")
        with_gallium_drivers="auto" ;;
"no")
        with_gallium_drivers="" ;;
*)
	with_gallium_drivers="$(echo $GALLIUM | sed -e "s/ /,/g")"
esac

if [ "$GLVND" = "yes" ]; then
	with_glvnd="-D glvnd=true"
else
	with_glvnd="-D glvnd=false"
fi

if [ "$LLVM" = "yes" ]; then
	PKGDEPENDS="llvm $PKGDEPENDS"
	with_llvm="-D llvm=true"
else
	with_llvm="-D llvm=false"
fi

case "$VULKAN" in
"yes")
        with_vulkan_drivers="auto" ;;
"no")
	with_vulkan_drivers="$(echo $VULKAN | sed -e "s/ /,/g")" ;;
*)
        with_vulkan_drivers="" ;;
esac

if [ "$WAYLAND" = "yes" ]; then
	PKGDEPENDS="wayland wayland-protocols $PKGDEPENDS"
	with_platforms="wayland $with_platforms"
fi

if [ "$X" = "yes" ]; then
	PKGDEPENDS="libx11
	            libxdamage
	            libxext
	            libxrandr
	            libxshmfence
	            libxxf86vm
	            $PKGDEPENDS"
	with_platforms="x11 $with_platforms"
	with_dri="-D dri3=true"
	with_glx="-D glx=dri"
else
	with_dri="-D dri3=false"
	with_glx="-D glx=disabled"
fi

build()
{
	rm -rf $PKGNAME-$PKGVERSION
	tar -xvf $PKGNAME-$PKGVERSION.tar.xz
	cd $PKGNAME-$PKGVERSION

	CC="$CC" \
	CFLAGS="$CFLAGS" \
	CXX="$CXX" \
	CXXFLAGS="$CXXFLAGS" \
	LDFLAGS="$LDFLAGS" \
	meson . build \
		--prefix / \
		--buildtype release \
		--default-library shared \
		-D libdir=lib \
                -D platforms="$(echo ${with_platforms% *} | tr " " ",")" \
		-D dri-drivers="$with_dri_drivers" \
		-D gallium-drivers="$with_gallium_drivers" \
		-D vulkan-drivers="$with_vulkan_drivers" \
		$with_dri \
		$with_egl \
		$with_glvnd \
		$with_glx \
		$with_llvm
	ninja -C build
	DESTDIR=$DESTDIR ninja -C build install
	sed -i -e "s|prefix=/|prefix=|" $DESTDIR/lib/pkgconfig/*.pc

	cd ..
	rm -rf $PKGNAME-$PKGVERSION
}