#! /bin/bash # Mesa without Xorg # Source: ftp://ftp.freedesktop.org/pub/mesa/mesa-21.3.3.tar.xz # # $BUILD = Directory to temporarily install # $PKGS = Directory to store built packages # # DEPS # Required: LLVM, libdrm, Mako # Recommended: Libva, libvdpau(for Xorg), wayland-protocols # Optional: libgcrypt, lm-sensors, nettle, valgrind, libunwind, glslang (for vulkan layers) # Apply patches from Alpine Linux patch -Np1 -i ../patches/mesa-alpine-21.2.1/0001-radeonsi-On-Aarch64-force-persistent-buffers-to-GTT.patch patch -Np1 -i ../patches/mesa-alpine-21.2.1/add-use-elf-tls.patch patch -Np1 -i ../patches/mesa-alpine/disable-rgb10-by-default.patch # patch needs update patch -Np1 -i ../patches/mesa-alpine-21.2.1/musl-fix-includes.patch # If optimizing, use these flags # LTO is not recommended export CFLAGS="-march=native -mtune=native " export CFLAGS+="-Ofast -falign-functions=32 -fno-lto " export CFLAGS+="-fno-semantic-interposition -mprefer-vector-width=256 " export CXXFLAGS=$CFLAGS unset LDFLAGS export CFLAGS="$CFLAGS -D_XOPEN_SOURCE=700" && case $(uname -m) in i686|x86_64) export GLL_DRV="i915,nouveau,radeonsi,svga,swrast,r600,iris,crocus" export DRI_DRIVERS="i965,nouveau" export V_DRIVERS="amd,swrast,intel" ;; arm*) export GLL_DRV="vc4,panfrost,nouveau,tegra,swrast" export DRI_DRIVEiRS="nouveau" export V_DRIVERS="" ;; esac # Set configure flags export BUILDOPT="-Dbuildtype=release " export BUILDOPT+="-Dllvm=enabled " export BUILDOPT+="-Dshared-llvm=enabled " export BUILDOPT+="-Dosmesa=true " export BUILDOPT+="-Dtools= " export BUILDOPT+="-Dvalgrind=false " export GFXOPT="-Dglx=disabled " export GFXOPT+="-Dglx-read-only-text=true " export GFXOPT+="-Dxlib-lease=disabled " export GFXOPT+="-Ddri3=enabled " export GFXOPT+="-Dopengl=true " export GFXOPT+="-Degl=enabled " export GFXOPT+="-Dgles2=enabled " export GFXOPT+="-Dgles1=enabled " export GFXOPT+="-Dshared-glapi=enabled " export DRVROPT="-Dplatforms=wayland " export DRVROPT+="-Degl-native-platform=wayland " export GALLIUMOPT="-Dgallium-va=disabled " export GALLIUMOPT+="-Dgallium-xa=false " export GALLIUMOPT+="-Dgallium-xvmc=false " export GALLIUMOPT+="-Dgallium-nine=false " export GALLIUMOPT+="-Dgallium-vdpau=disabled " # For intel graphics only (i.e. intergrated graphics on some laptops) # then only enable these drivers: export DRI_DRIVERS="i965" export GLL_DRV="i915,svga,swrast,iris,crocus" export V_DRIVERS="swrast,intel" # If glslang is installed, vulkan layers an be built export V_LAYERS="-Dvulkan-layers=device-select,overlay,intel-nullhw " export MESA_GIT_SHA1_OVERRIDE=53b2b224dc2de982c37915a0ad218e33365ff75e && python3 bin/git_sha1_gen.py --output include/git_sha1.h && meson --prefix=/usr \ -Dvulkan-drivers="${V_DRIVERS}" \ -Ddri-drivers="${DRI_DRIVERS}" \ -Dgallium-drivers="${GLL_DRV}" \ $BUILDOPT $GFXOPT $DRVROPT $GALLIUMOPT $V_LAYERS OUT read -p "Compile?" && ninja -C OUT -j2 && sudo -S DESTDIR=$BUILD ninja -C OUT install && unset CFLAGS GLL_DRV DRI_DRIVERS MESA_GIT_SHA1_OVERRIDE V_DRIVERS && unset BUILDOPT GFXOPT DRVROPT GALLIUMOPT V_LAYERS cd $BUILD && sudo -S mkdir -v ${BUILD}/install && cat > /tmp/slack-desc << "EOF" # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' # on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| mesa: mesa (a 3-D graphics library) mesa: mesa: Mesa is a 3-D graphics library with an API very similar to that of mesa: another well-known 3-D graphics library. The Mesa libraries are used mesa: by X to provide both software and hardware accelerated graphics. mesa: mesa: Mesa was written by Brian Paul. mesa: mesa: Homepage: https://www.mesa3d.org mesa: mesa: Tailored without Xorg Libraries EOF sudo -S mv -v /tmp/slack-desc install/ && sudo -S makepkg -l y -c n $PKGS/mesa-21.3.3_nox-$(uname -m)-mlfs.txz && sudo -S rm -rf ${BUILD}/*