Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sharkautarch/ff5dc08e8fba3f5a337bae9386c68703 to your computer and use it in GitHub Desktop.
Save sharkautarch/ff5dc08e8fba3f5a337bae9386c68703 to your computer and use it in GitHub Desktop.
gamescope-git clang UBsan
# gamescope-git PKGBUILD modified to build w/ clang UndefinedBehaviorSanitizer -- sharkautarch
# PKGBUILD based on the official Arch gamescope PKGBUILD
# Maintainer - Sid Pranjale <sidpranjale127@protonmail.com>
# Maintainer: Sefa Eyeoglu <contact@scrumplex.net>
# Maintainer: Bouke Sybren Haarsma <boukehaarsma23 at gmail dot com>
# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Maintainer: Giancarlo Razzolini <grazzolini@archlinux.org>
# Contributor: Samuel "scrufulufugus" Monson <smonson@irbash.net>
# Contributor: PedroHLC <root@pedrohlc.com>
_pkgname=gamescope
pkgname=${_pkgname}-git
pkgver=3.14.0.r6.g9e46c89
pkgrel=1
pkgdesc='SteamOS session compositing window manager'
arch=(x86_64)
url=https://github.com/ValveSoftware/gamescope
license=(BSD)
depends=(
gcc-libs
glibc
glm
hwdata
libavif
libcap.so
libdisplay-info.so
libdrm
libliftoff.so
libinput
libpipewire-0.3.so
libvulkan.so
libx11
libxcb
libxcomposite
libxdamage
libxext
libxfixes
libxkbcommon
libxmu
libxrender
libxres
libxtst
libxxf86vm
seatd
sdl2
vulkan-icd-loader
wayland
xcb-util-wm
xcb-util-errors
xorg-server-xwayland
)
makedepends=(
benchmark
cmake
git
glslang
meson
ninja
vulkan-headers
wayland-protocols
)
options=(!strip)
source=('git+https://github.com/ValveSoftware/gamescope.git')
b2sums=('SKIP')
provides=("$_pkgname")
conflicts=("$_pkgname")
prepare() {
cd $_pkgname
# This really should be a pacman feature...
for src in "${source[@]}"; do
src="${src%%::*}"
src="${src##*/}"
[[ $src = *.patch ]] || continue
echo "Applying patch $src..."
git apply "../$src"
done
meson subprojects download
git submodule init
git -c protocol.file.allow=always submodule update
# Use Arch provided libdisplay-info, do use other subprojects as is
rm -rf subprojects/libdisplay-info
}
pkgver() {
cd $_pkgname
git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
build() {
CXX=clang++ CC=clang arch-meson "${_pkgname}" build --reconfigure --buildtype=debugoptimized \
-Dc_args="-fno-omit-frame-pointer" \
-Dc_link_args="-fno-omit-frame-pointer -fuse-ld=lld" \
-Dcpp_args="-fsanitize-recover=all -fsanitize=undefined -shared-libsan -fsanitize=implicit-signed-integer-truncation -fno-omit-frame-pointer -fsanitize=float-divide-by-zero -fsanitize=local-bounds" \
-Dcpp_link_args="-fsanitize-recover=all -fsanitize=undefined -shared-libsan -fsanitize=implicit-signed-integer-truncation -fno-omit-frame-pointer -fsanitize=float-divide-by-zero -fsanitize=local-bounds -fuse-ld=lld -lm /usr/lib/clang/16/lib/linux/libclang_rt.ubsan_standalone-x86_64.so -Wl,-rpath=/usr/lib/clang/16/lib/linux/" \
-Dforce_fallback_for=stb \
-Dpipewire=enabled
CXX=clang++ CC=clang meson compile -C build
}
package() {
CXX=clang++ CC=clang meson install -C build --skip-subprojects --destdir="${pkgdir}"
cd "$srcdir/$_pkgname"
install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/$pkgname/"
}
# vim: ts=2 sw=2 et:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment