1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

gnu: Add guile-wayland-scm-socket.

* gnu/packages/guile-xyz.scm (guile-wayland-scm-socket): New variable.

Change-Id: Ib808886c83d4a9a9847389971217f14a9f1e87da
Signed-off-by: Danny Milosavljevic <dannym@friendly-machines.com>
This commit is contained in:
Grigory Shepelev
2025-11-30 07:45:59 +03:00
committed by Danny Milosavljevic
parent 7bbc2e64a0
commit 8a7a5b63ab

View File

@@ -3457,6 +3457,84 @@ install:
well. Run @command{guix edit g-golf-adw-1-examples} for inspiration how to
wrap G-Golf applications when writing a Guix package.")))
(define-public guile-wayland-scm-socket
(package
(name "guile-wayland-scm-socket")
(version "v0.0.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://codeberg.org/shegeley/wayland-scm")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32
"17xfc2826nh96ivsszv4avpcs4gbli8k3r0i1idyxkdhxa745rm7"))))
(build-system gnu-build-system)
(arguments
(list
#:modules `(((guix build guile-build-system)
#:select (target-guile-effective-version))
,@%default-gnu-modules)
#:imported-modules `((guix build guile-build-system)
,@%default-gnu-imported-modules)
#:make-flags
#~(list
"GUILE_AUTO_COMPILE=0"
(string-append "CC=" #$(cc-for-target))
(string-append "CFLAGS=" "-I" #$(this-package-input "guile")
"/include/guile/3.0")
(string-append "PREFIX=" #$output))
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'chdir
(lambda _
(chdir "ext/socket")))
(add-before 'build 'respect-guile
(lambda* (#:key outputs #:allow-other-keys)
(delete-file "Makefile")
(rename-file "guile.Makefile" "Makefile")))
;; 'build is actually 'build-so
(add-after 'build 'install-so
(lambda* (#:key outputs #:allow-other-keys)
(let* ((v (target-guile-effective-version))
(libdir (string-append #$output "/lib/guile/" v)))
(install-file "wayland-scm-socket.so" libdir))))
(add-after 'build 'build-guile
(lambda* (#:key inputs #:allow-other-keys)
(setenv "GUILE_AUTO_COMPILE" "0")
(let* ((v (target-guile-effective-version))
(libdir (string-append #$output "/lib/guile/" v)))
(substitute* '("guile-socket.scm")
(("wayland-scm-socket")
(string-append libdir "/wayland-scm-socket.so"))))
(invoke "guild" "compile" "-o" "guile-socket.go"
"guile-socket.scm")))
(add-after 'build-guile 'install-guile
(lambda* (#:key outputs #:allow-other-keys)
(let* ((v (target-guile-effective-version))
(share-dir (string-append #$output "/share/guile/site/" v
"/wayland-scm")))
(rename-file "guile-socket.scm" "socket.scm")
(install-file "socket.scm" share-dir))))
(delete 'check)
(delete 'install))))
(native-search-paths
(list (search-path-specification
(variable "GUILE_EXTENSIONS_PATH")
(files (list "lib/guile/3.0")))))
(inputs (list gcc guile-3.0))
(synopsis "C bindings for UNIX sockets in multi-scheme (Guile, Gauche,
Chicken) Wayland library")
(description "Guile C bindings for UNIX sockets. Exposes simple
procedures: @code{process_fd}, @code{wl_recvmsg}, @code{wl_sendmsg},
@code{init_socket}.
Probably can be replaced with guile's built-ins: @code{fdes->ports},
@code{recv!}, @code{send}")
(home-page "https://codeberg.org/shegeley/wayland-scm")
(license license:wtfpl2)))
(define-public g-wrap
(package
(name "g-wrap")