mirror of
https://github.com/dslm4515/BMLFS.git
synced 2025-08-03 16:40:25 +00:00
133 lines
5.3 KiB
Bash
133 lines
5.3 KiB
Bash
#! /bin/bash
|
|
|
|
# Mesa with Xorg
|
|
# Source: https://mesa.freedesktop.org/archive/mesa-24.0.8.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, libglvnd, spirv-headers
|
|
# Optional: libgcrypt, lm-sensors, nettle, valgrind, libunwind, vulkan-headers (vulkan support/driver)
|
|
# Optional: vulkan-loader (vulkan support), libclc(vulkan-support), libxcb(for Xorg), libX11(for Xorg)
|
|
# Optional: libxshmfence(for Xorg), libXxf86vm(for Xorg), libXrandr(for Xorg), DirectX-headers
|
|
|
|
# As of version 22.x.x, Mesa's classic OpenGL drivers (non-Gallium3D) have been removed. These are the
|
|
# old Radeon R100 and R200 drivers, the original Nouveau code, and the Intel i915 and i965 drivers.
|
|
# More info at https://www.phoronix.com/scan.php?page=news_item&px=Mesa-Classic-Retired
|
|
|
|
# Apply patches from Chimera Linux... patches for 23.3.4 also pply to 24.0.8
|
|
patch -Np1 -i ../patches/mesa-23.3.4-chimera/0001-radeonsi-On-Aarch64-force-persistent-buffers-to-GTT.patch
|
|
patch -Np1 -i ../patches/mesa-23.3.4-chimera/disable-ppc64-asm.patch
|
|
#patch -Np1 -i ../patches/mesa-23.3.4-chimera/fix-meson-build.patch
|
|
patch -Np1 -i ../patches/mesa-23.3.4-chimera/musl-endian.patch
|
|
patch -Np1 -i ../patches/mesa-23.3.4-chimera/musl-stacksize.patch
|
|
patch -Np1 -i ../patches/mesa-23.3.4-chimera/musl.patch
|
|
patch -Np1 -i ../patches/mesa-23.3.4-chimera/no-unlink-megadrivers.patch
|
|
patch -Np1 -i ../patches/mesa-23.3.4-chimera/vec-clang.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 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,intel_hasvk" ;;
|
|
arm*) export GLL_DRV="vc4,panfrost,nouveau,tegra,swrast"
|
|
#export DRI_DRIVERS="nouveau"
|
|
export V_DRIVERS="swrast" ;;
|
|
esac
|
|
|
|
# Set configure flags
|
|
export BUILDOPT="-Dbuildtype=release "
|
|
export BUILDOPT+="-Dllvm=enabled "
|
|
export BUILDOPT+="-Dshared-llvm=enabled "
|
|
export BUILDOPT+="-Dosmesa=true "
|
|
export BUILDOPT+="-Dvalgrind=disabled "
|
|
|
|
export GFXOPT="-Dglx=dri "
|
|
export GFXOPT+="-Dglx-read-only-text=true "
|
|
export GFXOPT+="-Dxlib-lease=enabled "
|
|
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="-Degl-native-platform=wayland "
|
|
|
|
export GALLIUMOPT="-Dgallium-va=enabled "
|
|
export GALLIUMOPT+="-Dgallium-xa=enabled "
|
|
export GALLIUMOPT+="-Dgallium-nine=true "
|
|
export GALLIUMOPT+="-Dgallium-vdpau=enabled "
|
|
|
|
# if libclc is installed:
|
|
#export XTRA_OPTS="-Dgallium-opencl=icd "
|
|
# Option breaks build.
|
|
|
|
# if libglvnd is installed
|
|
export XTRA_OPTS="-Dglvnd=true "
|
|
# if spirv-llvm-translator is installed:
|
|
export XTRA_OPTS+="-Dopencl-spirv=true -Dspirv-to-dxil=true "
|
|
# if video codec are desired:
|
|
export XTRA_OPTS+="-Dvideo-codecs=all "
|
|
|
|
# Classic OpenGL drivers, such as the i965/i915, were retired to amber branch
|
|
# Crocus driver will handle i965 chipsets
|
|
#export XTRA_OPTS+="-Dprefer-crocus=true "
|
|
#export XTRA_OPTS+="-Ddri-drivers=\"${DRI_DRIVERS}\" "
|
|
|
|
# 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,d3d12"
|
|
export V_DRIVERS="swrast,intel"
|
|
|
|
# If glslang is installed, vulkan layers an be built
|
|
export V_LAYERS="-Dvulkan-layers=device-select,overlay,intel-nullhw "
|
|
|
|
# If compiling with clang-17, add flag:
|
|
LDFLAGS="-Wl,--undefined-version" \
|
|
meson setup --prefix=/usr -Dvulkan-drivers="${V_DRIVERS}" \
|
|
-Dgallium-drivers="${GLL_DRV}" \
|
|
-Dplatforms=wayland,x11 -Dtools=glsl \
|
|
$BUILDOPT $GFXOPT $DRVROPT $GALLIUMOPT $V_LAYERS $XTRA_OPTS OUT
|
|
|
|
read -p "Compile?" && ninja -C OUT -j2 &&
|
|
|
|
sudo -S DESTDIR=$BUILD ninja -C OUT install &&
|
|
unset CFLAGS GLL_DRV V_DRIVERS BUILDOPT
|
|
unset GFXOPT DRVROPT GALLIUMOPT V_LAYERS XTRA_OPTS &&
|
|
|
|
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:
|
|
EOF
|
|
sudo -S mv -v /tmp/slack-desc install/ &&
|
|
sudo -S makepkg -l y -c n $PKGS/mesa-24.0.8-$PSUFFIX &&
|
|
sudo -S rm -rf ${BUILD}/*
|