repo/extra/mesa/build
2021-07-10 23:36:30 +03:00

55 lines
1.5 KiB
Bash
Executable File

#!/bin/sh -e
# Install python-mako which is solely needed for mesa
# and thus contained in this build.
{
cd mako
python3 setup.py build
python3 setup.py install \
--prefix=/usr \
--root="$PWD/dist"
# Use a glob to avoid having to figure out the Python
# version for the path below.
cd dist/usr/lib/python*/site-packages
# Set the PYTHONPATH so python knows where to find mako.
# The one liner simply appends the existing path and
# handles the case where an unset PYTHONPATH breaks
# python as it will only contain our new addition.
PYTHONPATH=$PWD:$(python -c "import sys; print(':'.join(sys.path))")
cd -; cd ..
}
export PYTHONPATH
export DESTDIR="$1"
export CFLAGS="$CFLAGS -DGLX_X86_READONLY_TEXT"
# Fix issues with musl and firefox.
# https://bugs.freedesktop.org/show_bug.cgi?id=35268
# https://github.com/mesa3d/mesa/commit/9f37c9903b87f86a533bfaffa72f0ecb285b02b2
sed "/pre_args += '-DUSE_ELF_TLS'/d" meson.build > _
mv -f _ meson.build
# To prevent the need for users to fork the mesa package to add
# libglvnd support, the below code checks for its availability
# and enables it if present. ie: install glvnd, rebuild mesa.
! kiss l libglvnd >/dev/null 2>&1 || glvnd_enabled=true
meson \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--localstatedir=/var \
--buildtype=release \
-Dplatforms=wayland \
-Dglx=disabled \
-Dzstd=false \
-Dglvnd="${glvnd_enabled:-false}" \
. output
ninja -C output
ninja -C output install