andreas pushed a commit to branch games-updates
in repository guix.

commit 2223e602d13524e20acb6f2707a5948e225c19d9
Author: Steve George <st...@futurile.net>
AuthorDate: Thu Feb 20 16:37:41 2025 +0000

    gnu: Add sc-controller.
    
    * gnu/packages/games.scm (sc-controller): New variable.
    
    Change-Id: Id978f268045bf045e4274a143e78b5ece36bd581
    Signed-off-by: Steve George <st...@futurile.net>
---
 gnu/packages/games.scm | 116 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 116 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index cc3a163186..21c8edc698 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -76,6 +76,7 @@
 ;;; Copyright © 2022 Hendursaga <hendurs...@aol.com>
 ;;; Copyright © 2022 Parnikkapore <poomk...@yahoo.com>
 ;;; Copyright © 2022 Cairn <ca...@pm.me>
+;;; Copyright © 2022 Morgan Smith <morgan.j.sm...@outlook.com>
 ;;; Copyright © 2023 Zheng Junjie <873216...@qq.com>
 ;;; Copyright © 2023 Florian Pelz <pelzflor...@pelzflorian.de>
 ;;; Copyright © 2023 Ivana Drazovic <iv....@hotmail.com>
@@ -183,6 +184,7 @@
   #:use-module (gnu packages libedit)
   #:use-module (gnu packages libidn)
   #:use-module (gnu packages libunwind)
+  #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages llvm)
@@ -12914,6 +12916,120 @@ on the pitch of the voice and the rhythm of singing.")
 Jongg tiles from the playing field by taking one matching pair at a time.")
     (license license:gpl2+)))
 
+(define-public sc-controller
+  (package
+    (name "sc-controller")
+    (version "0.4.8.9")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/Ryochan7/sc-controller";)
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1410yj6947yq43wwrj3cwllalalggzmd74sad70jd1niwj85yvna"
+                ))))
+    (build-system python-build-system)
+    (arguments
+     (list #:phases #~(modify-phases %standard-phases
+                        (delete 'sanity-check)
+                        (add-after 'unpack 'remove-bundled-libraries
+                          (lambda _
+                            (with-directory-excursion "scc/lib"
+                              (for-each delete-file
+                                        '("enum.py" "jsonencoder.py"
+                                          "libusb1.py" "usb1.py")))
+                            ;; libusb1 fixes
+                            (substitute* '("scc/uinput.py"
+                                           "scc/drivers/usb.py"
+                                           "scc/drivers/steamdeck.py"
+                                           "scc/drivers/sc_by_cable.py")
+                              (("scc\\.lib\\.libusb1")
+                               "libusb1")
+                              (("scc\\.lib\\.usb1")
+                               "usb1")
+                              (("from scc\\.lib import usb1")
+                               "import usb1"))
+                            ;; enum fixes
+                            (substitute* "scc/cemuhook_server.py"
+                              (("scc\\.lib\\.enum")
+                               "enum"))
+                            ;; simplejson fixes
+                            (substitute* "scc/profile.py"
+                              (("from scc\\.lib\\.jsonencoder")
+                               "from simplejson"))))
+                        (add-after 'unpack 'fix-paths
+                          (lambda _
+                            (substitute* "scc/lib/xwrappers.py"
+                              (("libXfixes.so")
+                               (string-append (assoc-ref %build-inputs
+                                                         "libxfixes")
+                                              "/lib/libXfixes.so"))
+                              (("libXext.so")
+                               (string-append (assoc-ref %build-inputs
+                                                         "libxext")
+                                              "/lib/libXext.so")))
+                            (substitute* "scc/lib/eudevmonitor.py"
+                              (("libudev.so")
+                               (string-append (assoc-ref %build-inputs "eudev")
+                                              "/lib/libudev.so")))
+                            (substitute* "scc/uinput.py"
+                              (("/usr/include")
+                               (string-append (assoc-ref %build-inputs
+                                                         "linux-libre-headers")
+                                              "/include")))
+                            (substitute* '("scc/gui/app.py"
+                                           "scc/osd/inputdisplay.py"
+                                           "scc/paths.py")
+                              (("/usr/share/scc")
+                               (string-append #$output "/share/scc")))))
+                        (add-after 'wrap 'gi-wrap
+                          (lambda _
+                            (for-each (lambda (prog)
+                                        (wrap-program (string-append #$output
+                                                                     "/bin/"
+                                                                     prog)
+                                          `("GI_TYPELIB_PATH" =
+                                            (,(getenv
+                                               "GI_TYPELIB_PATH")))))
+                                      '("sc-controller" "scc"
+                                        "scc-daemon"
+                                        "scc-osd-dialog"
+                                        "scc-osd-keyboard"
+                                        "scc-osd-launcher"
+                                        "scc-osd-menu"
+                                        "scc-osd-message"
+                                        "scc-osd-radial-menu"
+                                        "scc-osd-show-bindings")))))))
+    (inputs (list bash-minimal
+                  gtk+
+                  gtk-layer-shell
+                  eudev
+                  libxext
+                  libxfixes
+                  linux-libre-headers
+                  python-pycairo
+                  python-evdev
+                  python-libusb1
+                  python-pylibacl
+                  python-pygobject
+                  python-simplejson
+                  python-vdf
+                  zlib))
+    (home-page "https://github.com/Ryochan7/sc-controller";)
+    (synopsis "Driver and configuration tool for game controllers")
+    (description
+     "Driver and configuration tool for game controllers such as
+the Steam Controller, Steam Deck, and Dual Shock 4.  Install the included udev
+rules to solve permissions issues.")
+    (license (list
+              ;; lib/enum.py, lib/usb1.py, and lib/libusb1.py are deleted but
+              ;; do have other licenses.
+              license:cc0 ; images/*, default_profiles/*, profile_examples/*, 
default_menus/*
+              license:zlib ; scripts/gamecontrollerdb.txt
+              license:gpl2)))) ; everything else
+
 (define-public steam-devices-udev-rules
   ;; Last release from 2019-04-10
   (let ((commit "13443480a64fe8f10676606bd57da6de89f8ccb1")

Reply via email to