diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm index d169362c6d..5a92b5212e 100644 --- a/gnu/packages/guile-xyz.scm +++ b/gnu/packages/guile-xyz.scm @@ -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")