GNU bug report logs - #77990
[PATCH] gnu: Add emacs-ffi.

Previous Next

Package: guix-patches;

Reported by: "Suhail Singh" <suhailsingh247 <at> gmail.com>

Date: Tue, 22 Apr 2025 15:26:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 77990 in the body.
You can then email your comments to 77990 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to andrew <at> trop.in, csantosb <at> inventati.org, divya <at> subvertising.org, hako <at> ultrarare.space, ian <at> retrospec.tv, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#77990; Package guix-patches. (Tue, 22 Apr 2025 15:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Suhail Singh" <suhailsingh247 <at> gmail.com>:
New bug report received and forwarded. Copy sent to andrew <at> trop.in, csantosb <at> inventati.org, divya <at> subvertising.org, hako <at> ultrarare.space, ian <at> retrospec.tv, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org. (Tue, 22 Apr 2025 15:26:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Suhail Singh" <suhailsingh247 <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Add emacs-ffi.
Date: Tue, 22 Apr 2025 10:51:53 -0400
* gnu/packages/emacs-xyz.scm (emacs-ffi): New variable.

Change-Id: I3379ff4728d3e3f45d5327978b5e284fcc0e664e
---
 gnu/packages/emacs-xyz.scm | 53 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 08bd88fd08..efdb658bf7 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -236,6 +236,7 @@ (define-module (gnu packages emacs-xyz)
   #:use-module (gnu packages llvm)
   #:use-module (gnu packages image)
   #:use-module (gnu packages image-viewers)
+  #:use-module (gnu packages libffi)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages lisp)
@@ -23092,6 +23093,58 @@ (define-public emacs-display-wttr
 @uref{https://wttr.in} and then displays it on the mode line.")
     (license license:gpl3+)))
 
+(define-public emacs-ffi
+  (package
+    (name "emacs-ffi")
+    (version "0.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/emacs-ffi/emacs-ffi")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "05crpgscpbzkg4k0ylbfjz2wyw2r8lki8q9w2kmdpljsqrpdrwl0"))))
+    (build-system emacs-build-system)
+    (arguments
+     (list
+      #:tests? (not (%current-target-system))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-module-load
+            (lambda _
+              (make-file-writable "src/ffi.el")
+              (emacs-substitute-sexps "src/ffi.el"
+                ("(require 'ffi-module nil t)"
+                 `(module-load
+                   ,(string-append #$output "/lib/ffi-module.so"))))))
+          (add-before 'check 'build-emacs-module
+            (lambda _
+              ;; Compile the shared object file.
+              (invoke "make"
+                      #$(string-append "CC="
+                                       (cc-for-target)))
+              ;; Copy the build artifacts to root and let the install phase do
+              ;; its thing
+              (copy-recursively "build/lib" ".")
+              ;; Install the shared object file into /lib.
+              (install-file "build/lib/ffi-module.so"
+                            (string-append #$output "/lib"))))
+          (add-before 'install 'installinfo
+            (lambda _
+              (install-file "build/doc/emacs-ffi.info"
+                            (string-append #$output "/share/info")))))))
+    (inputs (list emacs-compat libltdl libffi))
+    (native-inputs (list texinfo))
+    (home-page "https://emacs-ffi.github.io/emacs-ffi/")
+    (synopsis "FFI for Emacs based in libffi")
+    (description
+     "This package provides an FFI for Emacs.  It is based on
+libffi and relies on the dynamic module support in order to be loaded into
+Emacs.  It is relatively full-featured, but for the time being low-level.")
+    (license license:gpl3+)))
+
 (define-public emacs-free-keys
   (package
     (name "emacs-free-keys")

base-commit: c8194a529724721e2b96e0fe259cd92b63ff57aa




Information forwarded to andrew <at> trop.in, csantosb <at> inventati.org, divya <at> subvertising.org, hako <at> ultrarare.space, ian <at> retrospec.tv, cox.katherine.e+guix <at> gmail.com, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#77990; Package guix-patches. (Tue, 22 Apr 2025 15:33:02 GMT) Full text and rfc822 format available.

Message #8 received at 77990 <at> debbugs.gnu.org (full text, mbox):

From: "Suhail Singh" <suhailsingh247 <at> gmail.com>
To: 77990 <at> debbugs.gnu.org
Subject: [PATCH v2] gnu: Add emacs-ffi.
Date: Tue, 22 Apr 2025 10:51:53 -0400
* gnu/packages/emacs-xyz.scm (emacs-ffi): New variable.

Change-Id: I3379ff4728d3e3f45d5327978b5e284fcc0e664e
---
 gnu/packages/emacs-xyz.scm | 53 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 08bd88fd08..e6253089e8 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -236,6 +236,7 @@ (define-module (gnu packages emacs-xyz)
   #:use-module (gnu packages llvm)
   #:use-module (gnu packages image)
   #:use-module (gnu packages image-viewers)
+  #:use-module (gnu packages libffi)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages lisp)
@@ -23092,6 +23093,58 @@ (define-public emacs-display-wttr
 @uref{https://wttr.in} and then displays it on the mode line.")
     (license license:gpl3+)))
 
+(define-public emacs-ffi
+  (package
+    (name "emacs-ffi")
+    (version "0.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/emacs-ffi/emacs-ffi")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "05crpgscpbzkg4k0ylbfjz2wyw2r8lki8q9w2kmdpljsqrpdrwl0"))))
+    (build-system emacs-build-system)
+    (arguments
+     (list
+      #:tests? (not (%current-target-system))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-module-load
+            (lambda _
+              (make-file-writable "src/ffi.el")
+              (emacs-substitute-sexps "src/ffi.el"
+                ("(require 'ffi-module nil t)"
+                 `(module-load
+                   ,(string-append #$output "/lib/ffi-module.so"))))))
+          (add-before 'check 'build-emacs-module
+            (lambda _
+              ;; Compile the shared object file.
+              (invoke "make"
+                      #$(string-append "CC="
+                                       (cc-for-target)))
+              ;; Copy the build artifacts to root and let the install phase do
+              ;; its thing
+              (copy-recursively "build/lib" ".")
+              ;; Install the shared object file into /lib.
+              (install-file "build/lib/ffi-module.so"
+                            (string-append #$output "/lib"))))
+          (add-before 'install 'installinfo
+            (lambda _
+              (install-file "build/doc/emacs-ffi.info"
+                            (string-append #$output "/share/info")))))))
+    (inputs (list emacs-compat libltdl libffi))
+    (native-inputs (list texinfo))
+    (home-page "https://emacs-ffi.github.io/emacs-ffi/")
+    (synopsis "FFI for Emacs based on libffi")
+    (description
+     "This package provides an FFI for Emacs.  It is based on
+libffi and relies on the dynamic module support in order to be loaded into
+Emacs.  It is relatively full-featured, but for the time being low-level.")
+    (license license:gpl3+)))
+
 (define-public emacs-free-keys
   (package
     (name "emacs-free-keys")

base-commit: c8194a529724721e2b96e0fe259cd92b63ff57aa




Information forwarded to guix-patches <at> gnu.org:
bug#77990; Package guix-patches. (Tue, 22 Apr 2025 18:50:01 GMT) Full text and rfc822 format available.

Message #11 received at 77990 <at> debbugs.gnu.org (full text, mbox):

From: Cayetano Santos <csantosb <at> inventati.org>
To: "Suhail Singh" <suhailsingh247 <at> gmail.com>
Cc: Ian Eure <ian <at> retrospec.tv>,
 Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>,
 Liliana Marie Prikler <liliana.prikler <at> gmail.com>,
 Andrew Tropin <andrew <at> trop.in>, Hilton Chain <hako <at> ultrarare.space>,
 77990 <at> debbugs.gnu.org, Divya Ranjan Pattanaik <divya <at> subvertising.org>
Subject: Re: [bug#77990] [PATCH v2] gnu: Add emacs-ffi.
Date: Tue, 22 Apr 2025 20:49:07 +0200
[Message part 1 (text/plain, inline)]
>mar. 22 avril 2025 at 10:51, "Suhail Singh" <suhailsingh247 <at> gmail.com> wrote:

> * gnu/packages/emacs-xyz.scm (emacs-ffi): New variable.
>
> Change-Id: I3379ff4728d3e3f45d5327978b5e284fcc0e664e
> ---
>  gnu/packages/emacs-xyz.scm | 53 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
>
> diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
> index 08bd88fd08..e6253089e8 100644
> --- a/gnu/packages/emacs-xyz.scm
> +++ b/gnu/packages/emacs-xyz.scm
> @@ -236,6 +236,7 @@ (define-module (gnu packages emacs-xyz)
>    #:use-module (gnu packages llvm)
>    #:use-module (gnu packages image)
>    #:use-module (gnu packages image-viewers)
> +  #:use-module (gnu packages libffi)
>    #:use-module (gnu packages linux)
>    #:use-module (gnu packages libevent)
>    #:use-module (gnu packages lisp)
> @@ -23092,6 +23093,58 @@ (define-public emacs-display-wttr
>  @uref{https://wttr.in} and then displays it on the mode line.")
>      (license license:gpl3+)))
>
> +(define-public emacs-ffi
> +  (package
> +    (name "emacs-ffi")
> +    (version "0.2.1")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/emacs-ffi/emacs-ffi")
> +             (commit version)))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "05crpgscpbzkg4k0ylbfjz2wyw2r8lki8q9w2kmdpljsqrpdrwl0"))))
> +    (build-system emacs-build-system)
> +    (arguments
> +     (list
> +      #:tests? (not (%current-target-system))
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'patch-module-load
> +            (lambda _
> +              (make-file-writable "src/ffi.el")
> +              (emacs-substitute-sexps "src/ffi.el"
> +                ("(require 'ffi-module nil t)"
> +                 `(module-load
> +                   ,(string-append #$output "/lib/ffi-module.so"))))))
> +          (add-before 'check 'build-emacs-module
> +            (lambda _
> +              ;; Compile the shared object file.
> +              (invoke "make"
> +                      #$(string-append "CC="
> +                                       (cc-for-target)))
> +              ;; Copy the build artifacts to root and let the install phase do
> +              ;; its thing
> +              (copy-recursively "build/lib" ".")
> +              ;; Install the shared object file into /lib.
> +              (install-file "build/lib/ffi-module.so"
> +                            (string-append #$output "/lib"))))

I have a doubt about where do we  put .so files.

- lib
- lib/package
- lib/emacs (see emacs-jinx)

Other than this, LFTM.

C.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#77990; Package guix-patches. (Wed, 23 Apr 2025 02:33:01 GMT) Full text and rfc822 format available.

Message #14 received at 77990 <at> debbugs.gnu.org (full text, mbox):

From: Suhail Singh <suhailsingh247 <at> gmail.com>
To: Cayetano Santos <csantosb <at> inventati.org>
Cc: Ian Eure <ian <at> retrospec.tv>,
 Katherine Cox-Buday <cox.katherine.e+guix <at> gmail.com>,
 Liliana Marie Prikler <liliana.prikler <at> gmail.com>,
 Andrew Tropin <andrew <at> trop.in>, Hilton Chain <hako <at> ultrarare.space>,
 77990 <at> debbugs.gnu.org, Divya Ranjan Pattanaik <divya <at> subvertising.org>,
 Suhail Singh <suhailsingh247 <at> gmail.com>
Subject: Re: [bug#77990] [PATCH v2] gnu: Add emacs-ffi.
Date: Tue, 22 Apr 2025 22:32:28 -0400
Cayetano Santos <csantosb <at> inventati.org> writes:

>> +              ;; Install the shared object file into /lib.
>> +              (install-file "build/lib/ffi-module.so"
>> +                            (string-append #$output "/lib"))))
>
> I have a doubt about where do we  put .so files.
>
> - lib
> - lib/package
> - lib/emacs (see emacs-jinx)
>
> Other than this, LFTM.

IIUC the standard place for shared libraries is in #$output/lib.  I
don't know of any reason to deviate from that in this case.  To the
extent it matters, at least one other dynamic module (emacs-sqlite3-api)
also uses that convention.

I'm no authority, but it seems that Emacs dynamic modules are simply
less consistent about storing libraries in the standard location, rather
than there being a principled reason against using the standard
convention.

Thanks for the review.

-- 
Suhail




Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Sun, 11 May 2025 09:32:01 GMT) Full text and rfc822 format available.

Notification sent to "Suhail Singh" <suhailsingh247 <at> gmail.com>:
bug acknowledged by developer. (Sun, 11 May 2025 09:32:02 GMT) Full text and rfc822 format available.

Message #19 received at 77990-done <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Suhail Singh <suhailsingh247 <at> gmail.com>
Cc: Cayetano Santos <csantosb <at> inventati.org>, 77990-done <at> debbugs.gnu.org
Subject: Re: [bug#77990] [PATCH v2] gnu: Add emacs-ffi.
Date: Sun, 11 May 2025 10:31:11 +0100
[Message part 1 (text/plain, inline)]
Suhail Singh <suhailsingh247 <at> gmail.com> writes:

> Cayetano Santos <csantosb <at> inventati.org> writes:
>
>>> +              ;; Install the shared object file into /lib.
>>> +              (install-file "build/lib/ffi-module.so"
>>> +                            (string-append #$output "/lib"))))
>>
>> I have a doubt about where do we  put .so files.
>>
>> - lib
>> - lib/package
>> - lib/emacs (see emacs-jinx)
>>
>> Other than this, LFTM.
>
> IIUC the standard place for shared libraries is in #$output/lib.  I
> don't know of any reason to deviate from that in this case.  To the
> extent it matters, at least one other dynamic module (emacs-sqlite3-api)
> also uses that convention.
>
> I'm no authority, but it seems that Emacs dynamic modules are simply
> less consistent about storing libraries in the standard location, rather
> than there being a principled reason against using the standard
> convention.
>
> Thanks for the review.

Thanks both, I've pushed this to master as
65dea0cde084dc364dbd0dbd51e589733951fed6.

Chris
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 08 Jun 2025 11:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 28 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.