Last active
November 21, 2023 18:20
-
-
Save sharkautarch/8a0cfac4207c23ec1b2d05ab1bf685f0 to your computer and use it in GitHub Desktop.
working gamescope-git PKGBUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: Sefa Eyeoglu <contact@scrumplex.net> | |
_pkgname=gamescope | |
pkgname=${_pkgname}-git | |
pkgver=3.12.5.r25.ga260d74 | |
pkgrel=1 | |
pkgdesc="Micro-compositor formerly known as steamcompmgr" | |
arch=(x86_64) | |
url="https://github.com/ValveSoftware/gamescope" | |
license=("custom:BSD-2-Clause") | |
depends=( | |
# gamescope | |
"libxcomposite" "libxtst" "libxres" "sdl2" "pipewire" "libxmu" "glm" "benchmark" | |
# wlroots | |
"libdrm" "libxkbcommon" "libinput" "pixman" "xorg-xwayland" "xcb-util-renderutil" "xcb-util-wm" "xcb-util-errors" "seatd" | |
) | |
makedepends=("git" "meson" "ninja" "vulkan-headers" "glslang" "wayland-protocols" "cmake" | |
) | |
#gs_handle_newer_wlroot.patch | |
provides=($_pkgname "steamcompmgr") | |
conflicts=($_pkgname "steamcompmgr") | |
source=( "$_pkgname::git+https://github.com/ValveSoftware/gamescope.git" | |
"git+https://gitlab.freedesktop.org/wlroots/wlroots.git" | |
"git+https://gitlab.freedesktop.org/emersion/libliftoff.git" | |
"git+https://gitlab.freedesktop.org/emersion/libdisplay-info.git" | |
"git+https://github.com/ValveSoftware/openvr.git" | |
"git+https://github.com/Joshua-Ashton/vkroots.git" | |
"git+https://github.com/nothings/stb.git" | |
) | |
sha512sums=( | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
) | |
options=(!strip) | |
#pkgver() { | |
# cd "$srcdir/$_pkgname" | |
# | |
# git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | |
#} | |
prepare() { | |
cd "$srcdir/$_pkgname" | |
for src in "${source[@]}"; do | |
src="${src%%::*}" | |
src="${src##*/}" | |
[[ $src = *.patch && -z "$(echo $src)" ]] || continue | |
echo "Applying patch $src..." | |
git apply "../$src" | |
done | |
#git add * | |
#git am -3 --rerere-autoupdate $srcdir/revert-nvidia-breaking-commit.patch | |
git checkout 04eb72b5f519c2ed1b13edf843754583b92bf8d6 | |
git submodule init | |
git config submodule.subprojects/wlroots.url "$srcdir/wlroots" | |
git config submodule.subprojects/libliftoff.url "$srcdir/libliftoff" | |
git config submodule.subprojects/libdisplay-info.url "$srcdir/libdisplay-info" | |
git config submodule.subprojects/openvr.url "$srcdir/openvr" | |
git config submodule.subprojects/vkroots.url "$srcdir/vkroots" | |
git -c protocol.file.allow=always submodule update | |
# make stb.wrap use our local clone | |
sed -i "s|https://github.com/nothings/stb.git|$srcdir/stb|" "subprojects/stb.wrap" | |
meson subprojects download | |
} | |
build() { | |
cd "${_pkgname}" | |
params2=($CXXFLAGS) | |
FLAGS="" | |
for flag in ${params2[@]}; do | |
if [[ -z $(echo " $flag" | grep -E "[-]fomit-frame-pointer|[-]fno-omit-frame-pointer|-O|-fuse-ld") && -n '$FLAGS' ]]; then | |
FLAGS="$FLAGS $flag" | |
echo "if branch: $flag" | |
elif [[ -z $(echo " $flag" | grep -E "[-]fomit-frame-pointer|[-]fno-omit-frame-pointer|-O|-fuse-ld") ]]; then | |
FLAGS="$flag" | |
echo "elif branch: $flag" | |
fi | |
done | |
export CFLAGS="-g2 -fno-semantic-interposition -falign-functions=32 -falign-jumps -falign-loops -falign-labels -Wno-maybe-uninitialized -march=native -Wno-uninitialized -fno-common -fno-semantic-interposition -falign-functions=32 -fweb -ftree-slp-vectorize -fivopts -ftree-vectorize -fno-plt -ftree-slp-vectorize -ftree-vectorize -fmerge-all-constants -ffast-math -mrecip=all -fno-common -fno-semantic-interposition -ftree-vectorize -fmerge-all-constants -fmerge-all-constants -fgcse-sm -fgcse-las -fgcse-after-reload -fdevirtualize-speculatively --param=vect-max-layout-candidates=8192 --param=sra-max-propagations=1024 --param=max-stores-to-track=1048576 --param=max-stores-to-sink=16 --param=max-stores-to-merge=8192 --param=max-store-chains-to-track=65536 --param=max-reload-search-insns=512 --param=max-hoist-depth=0 --param=max-gcse-memory=8000000 --param=loop-invariant-max-bbs-in-loop=100000 --param=max-cse-insns=10000 --param=max-dse-active-local-stores=5000 --param=max-cselib-memory-locations=5000 --param=max-cse-path-length=10000 --param=max-inline-insns-recursive=300 --param=loop-max-datarefs-for-datadeps=200000 --param=iv-max-considered-uses=50000 --param=max-peeled-insns=64 --param=iv-always-prune-cand-set-bound=100 --param=ira-max-conflict-table-size=80000 --param=ira-consider-dup-in-all-alts=1 --param=ipa-max-param-expr-ops=512 --param=ipa-max-loop-predicates=320 --param=ipa-max-agg-items=3200 --param=ipa-max-aa-steps=250000 --param=ipa-jump-function-lookups=32768 --param=dse-max-alias-queries-per-store=20480 --param=dse-max-object-size=2048 --param=max-tail-merge-iterations=10 --param=max-tail-merge-comparisons=1000 --param=loop-versioning-max-inner-insns=100 --param=loop-versioning-max-outer-insns=64" | |
export CXXFLAGS="-fstrict-enums -g2 -fno-semantic-interposition -falign-functions=32 -falign-jumps -falign-loops -Wno-maybe-uninitialized -march=native -Wno-uninitialized -fno-common -fno-semantic-interposition -falign-functions=32 -fweb -ftree-slp-vectorize -fivopts -ftree-vectorize -fno-plt -ftree-slp-vectorize -ftree-vectorize -fmerge-all-constants -ffast-math -mrecip=all -fvisibility-inlines-hidden -fno-common -fno-semantic-interposition -ftree-vectorize -fmerge-all-constants -fmerge-all-constants -fgcse-sm -fgcse-las -fgcse-after-reload -fdevirtualize-speculatively --param=vect-max-layout-candidates=8192 --param=sra-max-propagations=1024 --param=max-stores-to-track=1048576 --param=max-stores-to-sink=16 --param=max-stores-to-merge=8192 --param=max-store-chains-to-track=65536 --param=max-reload-search-insns=512 --param=max-hoist-depth=0 --param=max-gcse-memory=8000000 --param=loop-invariant-max-bbs-in-loop=100000 --param=max-cse-insns=10000 --param=max-dse-active-local-stores=5000 --param=max-cselib-memory-locations=5000 --param=max-cse-path-length=10000 --param=max-inline-insns-recursive=300 --param=loop-max-datarefs-for-datadeps=200000 --param=iv-max-considered-uses=50000 --param=max-peeled-insns=64 --param=iv-always-prune-cand-set-bound=100 --param=ira-max-conflict-table-size=80000 --param=ira-consider-dup-in-all-alts=1 --param=ipa-max-param-expr-ops=512 --param=ipa-max-loop-predicates=320 --param=ipa-max-agg-items=3200 --param=ipa-max-aa-steps=250000 --param=ipa-jump-function-lookups=32768 --param=dse-max-alias-queries-per-store=20480 --param=dse-max-object-size=2048 --param=max-tail-merge-iterations=10 --param=max-tail-merge-comparisons=1000 --param=loop-versioning-max-inner-insns=100 --param=loop-versioning-max-outer-insns=64" | |
unset FLAGS | |
params3=($LDFLAGS) | |
FLAGS2="" | |
for flag in ${params3[@]}; do | |
if [[ -z $(echo " $flag" | grep -E "[-]fuse-ld|[-]fno-omit-frame-pointer|-fomit-frame-pointer|-fuse-ld" ) && -n '$FLAGS2' ]]; then | |
FLAGS2="$FLAGS2 $flag" | |
echo "if branch: $flag" | |
elif [[ -z $(echo " $flag" | grep -E "[-]fuse-ld|[-]fno-omit-frame-pointer|-fomit-frame-pointer|-fuse-ld") ]]; then | |
FLAGS2="$flag" | |
echo "elif branch: $flag" | |
fi | |
done | |
echo "FLAGS: ${FLAGS[@]}" | |
export LDFLAGS="-lrt " | |
sed -i "s/if get_option[(]'enable_openvr_support'[)]/if false/" "$srcdir/$_pkgname/meson.build" | |
arch-meson "$srcdir/$_pkgname" build \ | |
--buildtype release \ | |
--force-fallback-for=wlroots,libliftoff,stb \ | |
-Dpipewire=enabled \ | |
-Dwlroots:backends=drm,libinput,x11 \ | |
-Dwlroots:renderers=gles2,vulkan \ | |
-Db_pch=false \ | |
-Dcpp_args="$CXXFLAGS" \ | |
-Db_lto=true | |
sed -i "s/if get_option[(]'enable_openvr_support'[)]/if false/" "$srcdir/$_pkgname/meson.build" | |
cd "$srcdir/$_pkgname" | |
ninja -C build | |
} | |
package() { | |
cd "${_pkgname}" | |
meson install -C build --skip-subprojects --destdir "$pkgdir" | |
cd "$srcdir/$_pkgname" | |
install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" | |
install -Dm644 "README.md" "${pkgdir}/usr/share/doc/${_pkgname}/README.md" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment