Merge branch 'add-gamescope' into 'master'

nongnu: Add gamescope.

See merge request nonguix/nonguix!452
This commit is contained in:
aurtzy 2025-02-11 22:29:30 +00:00
commit 0e1d09dc87
2 changed files with 244 additions and 0 deletions

View File

@ -8,6 +8,9 @@
;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org>
;;; Copyright © 2023 Elijah Malaby
;;; Copyright © 2023 Timo Wilken <guix@twilken.net>
;;; Copyright © 2022 Samuel Culpepper <sculpepper@newstore.com>
;;; Copyright © 2024 aurtzy <aurtzy@gmail.com>
;;; Copyright © 2022 Demis Balbach <db@minikn.xyz>
(define-module (nongnu packages game-client)
#:use-module ((guix licenses) #:prefix license:)
@ -17,12 +20,16 @@
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix build-system gnu)
#:use-module (guix build-system meson)
#:use-module (guix build-system python)
#:use-module (gnu packages admin)
#:use-module (gnu packages audio)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages certs)
#:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages commencement)
#:use-module (gnu packages curl)
#:use-module (gnu packages elf)
#:use-module (gnu packages file)
@ -42,19 +49,193 @@
#:use-module (gnu packages llvm)
#:use-module (gnu packages logging)
#:use-module (gnu packages lsof)
#:use-module (gnu packages maths)
#:use-module (nongnu packages nvidia)
#:use-module (gnu packages pciutils)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python)
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages sdl)
#:use-module (gnu packages stb)
#:use-module (gnu packages toolkits)
#:use-module (gnu packages video)
#:use-module (gnu packages vulkan)
#:use-module (gnu packages wm)
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages xorg)
#:use-module (nonguix build-system chromium-binary)
#:use-module (nonguix multiarch-container)
#:use-module (nonguix utils))
(define vulkan-headers/newer
(package
(inherit vulkan-headers)
(name "vulkan-headers")
(version "vulkan-sdk-1.3.280.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/KhronosGroup/Vulkan-Headers")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32
"13mmv5621z73hlfnsrccbcb4z0d7kwj92a081701vbpss45a4whj"))))))
(define stb-image-resize
((@@ (gnu packages stb) make-stb-header-package)
"stb-image-resize" "0.96"
"stb-image-resize is a library that supports scaling and translation of
images."))
(define libdecor
(package
(name "libdecor")
(version "0.2.2")
(source
(origin (method git-fetch)
(uri (git-reference
(url "https://gitlab.freedesktop.org/libdecor/libdecor")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32
"05rxchwzhnkm91kcr30mavizkp25wgjlhb6lcraa456pw7vgb04q"))))
(build-system meson-build-system)
(native-inputs (list cmake
pkg-config))
(inputs (list cairo
dbus
egl-wayland
gtk+
libglvnd
libxkbcommon
pango
wayland
wayland-protocols))
(home-page "https://gitlab.freedesktop.org/libdecor/libdecor")
(synopsis "Client-side decorations library for Wayland clients")
(description "libdecor is a library that can help Wayland clients draw
window decorations for them. It aims to provide multiple backends that
implements the decoration drawing.")
(license license:expat)))
(define-public gamescope
;; Use older than 3.14.3 due to a bug:
;; https://github.com/ValveSoftware/gamescope/issues/1218
(let ((version "3.14.2")
(revision "0")
(commit "d0d23c4c3010c81add1bd90cbe478ce4a386e28d"))
(package
(name "gamescope")
(version (git-version version revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/ValveSoftware/gamescope")
(commit commit)
(recursive? #t)))
(sha256
(base32 "1sw2br3g16mird7jc7idbcxf5xxjmiyr6hjw3966s0nsv6bn8vb2"))
(file-name (git-file-name name version))))
(build-system meson-build-system)
(arguments
(list
#:modules '((guix build meson-build-system)
(guix build utils)
(nonguix build mesa-utils))
#:imported-modules `(,@%meson-build-system-modules
(guix build utils)
(nonguix build mesa-utils))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'patch-subprojects
(lambda _
;; glm
(invoke
#+(file-append unzip "/bin/unzip")
#+(origin
(method url-fetch)
(uri
"https://wrapdb.mesonbuild.com/v2/glm_0.9.9.8-2/get_patch")
(sha256
(base32
"0gfqg3j1kfhycg7bygdxxfhp1qarzxqlrk4j9sz893d2sgya2c6r")))
"-d"
"subprojects/packagefiles/")
(copy-recursively "subprojects/packagefiles/glm-0.9.9.8"
"subprojects/packagefiles/glm")
;; stb
(patch-wrap-file
"stb"
#+(directory-union "stb" (list stb-image
stb-image-write
stb-image-resize)))
(substitute* "subprojects/stb/meson.build"
(("include_directories\\('\\.'\\)")
(string-append "include_directories('./include')")))
;; libdisplay-info
(substitute* "src/meson.build"
;; Allow newer versions
(("(version: \\['>= 0\\.0\\.0'), '< 0\\.2\\.0'(\\])"
_ left-part right-part)
(string-append left-part right-part)))
;; hwdata:pnp
(substitute* "meson.build"
(("warning\\('Building without hwdata pnp id support\\.'\\)")
(string-append
"add_project_arguments("
"'-DHWDATA_PNP_IDS=\"" #$hwdata:pnp "/share/hwdata\"',"
"language: 'cpp'"
")"))))))))
(native-inputs
(list cmake
pkg-config
python-3))
(inputs
(list clang
eudev
gcc-toolchain-12
glm
glslang
libdecor
libdisplay-info
libdrm
libinput
libseat
libx11
libxcomposite
libxcursor
libxdamage
libxext
libxkbcommon
libxmu
libxres
libxt
libxtst
libxxf86vm
;; openvr ;does not build when included
pipewire
pixman
sdl2
vulkan-headers/newer
vulkan-loader
wayland
wayland-protocols
xcb-util-wm
xorg-server-xwayland))
(home-page "https://github.com/ValveSoftware/gamescope")
(synopsis "Session compositing window manager")
(description "Gamescope is a Wayland compositor for running games,
formerly known as steamcompmgr. It is designed for use in embedded sessions
and as a nested compositor on top of a regular desktop environment through
sandboxed Xwayland sessions.")
(license license:gpl3+))))
(define heroic-client
(package
(name "heroic-client")

View File

@ -0,0 +1,63 @@
;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Copyright © 2024 aurtzy <aurtzy@gmail.com>
(define-module (nonguix build mesa-utils)
#:use-module (guix build utils)
#:use-module (ice-9 match)
#:export (patch-wrap-file))
(define* (patch-wrap-file subproject-name
source-dir
#:key
(subprojects-dir "subprojects")
(overlay-dir (string-append
subprojects-dir
"/packagefiles/"
subproject-name))
(provides '()))
"Generate a local directory with SOURCE-DIR recursively copied to it, and
then patches the wrap file for SUBPROJECT-NAME to use it. This is
particularly useful for wrap files that would otherwise attempt to fetch the
content from the Internet.
SUBPROJECT-NAME is the name of the subproject that the wrap file will apply
to. It should match the base name of the wrap file (without the \".wrap\"
extension) to patch.
SOURCE-DIR is a string directory path. This is the path that SUBPROJECT-NAME
will be patched to use.
SUBPROJECTS-DIR is a string path to the directory where wrap files are
located for a project.
OVERLAY-DIR specifies the directory where files to overlay on the subproject
directory are located. By default, this is expected to be in
\"SUBPROJECTS-DIR/packagefiles/SUBPROJECT-NAME\".
The [provide] section of the wrap file can also be configured via an alist
specification provided to PROVIDES."
(let* ((wrap-file (string-append
subprojects-dir "/" subproject-name ".wrap"))
(subproject-dest (string-append
subprojects-dir "/" subproject-name)))
(copy-recursively source-dir subproject-dest)
(when (file-exists? overlay-dir)
(copy-recursively overlay-dir subproject-dest))
(call-with-output-file wrap-file
(lambda (port)
(format port
"[wrap-file]
directory = ~a
"
subproject-name)
(unless (null? provides)
(format port
"[provide]
~a"
(string-join
(map (match-lambda
((key . value)
(string-append key " = " value)))
provides)
"\n"
'suffix)))))))