guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: gnu: lem: Build included shared library.


From: guix-commits
Subject: 02/02: gnu: lem: Build included shared library.
Date: Wed, 2 Oct 2024 16:40:43 -0400 (EDT)

jgart pushed a commit to branch master
in repository guix.

commit 3048b6f20440c17f3d8fb045646095faad615da9
Author: jgart <jgart@dismail.de>
AuthorDate: Wed Oct 2 02:20:24 2024 -0500

    gnu: lem: Build included shared library.
    
    * gnu/packages/text-editors.scm (lem): Build shared library.
    [source]: Delete precompiled binaries.
    [arguments]: Patch libvterm and build shared library.
    [inputs]: Add libvterm.
    
    Change-Id: I296f139f93032ccbb380e112c9c1e4fd681ae1a7
---
 gnu/packages/text-editors.scm | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm
index afc6caffbe..1851440ffd 100644
--- a/gnu/packages/text-editors.scm
+++ b/gnu/packages/text-editors.scm
@@ -165,25 +165,53 @@ extensions over the standard utility.")
          (snippet
           #~(begin
               (use-modules (guix build utils))
-              (delete-file-recursively "roswell")))))
+              (delete-file-recursively "roswell")
+              ;; Delete precompiled shared object files.
+              (delete-file-recursively "extensions/terminal/lib")))))
       (build-system asdf-build-system/sbcl)
       (arguments
        (list
         #:phases
         #~(modify-phases %standard-phases
+            (add-after 'unpack 'patch-shared-object-files
+              (lambda* (#:key inputs outputs #:allow-other-keys)
+                (let* ((libvterm-lib (assoc-ref inputs "libvterm"))
+                       (lib-dir (string-append libvterm-lib "/lib"))
+                       (shared-lib-dir (string-append (assoc-ref outputs "out")
+                                                      "/lib"))
+                       (shared-lib (string-append shared-lib-dir
+                                                  "/terminal.so")))
+
+                  (substitute* "extensions/terminal/ffi.lisp"
+                    (("terminal.so") shared-lib)))))
             (add-after 'create-asdf-configuration 'build-program
               (lambda* (#:key outputs #:allow-other-keys)
                 (build-program
                  (string-append (assoc-ref outputs "out") "/bin/lem")
                  outputs
                  #:dependencies '("lem-ncurses" "lem-sdl2")
-                 #:entry-program '((lem:main) 0)))))))
+                 #:entry-program '((lem:main) 0))))
+            (add-after 'build 'build-terminal-library
+              (lambda* (#:key inputs outputs #:allow-other-keys)
+                (let* ((libvterm-lib (assoc-ref inputs "libvterm"))
+                       (lib-dir (string-append libvterm-lib "/lib"))
+                       (shared-lib-dir (string-append (assoc-ref outputs "out")
+                                                      "/lib"))
+                       (shared-lib (string-append shared-lib-dir
+                                                  "/terminal.so")))
+                  (mkdir-p shared-lib-dir)
+                  (invoke "gcc" "extensions/terminal/terminal.c"
+                          "-L" lib-dir "-lvterm"
+                          "-Wl,-Bdynamic"
+                          "-o" shared-lib
+                          "-fPIC" "-shared")))))))
       (native-inputs
        (list sbcl-cl-ansi-text
              sbcl-rove
              sbcl-trivial-package-local-nicknames))
       (inputs
        (list
+        libvterm
         sbcl-alexandria
         sbcl-trivia
         sbcl-trivial-gray-streams



reply via email to

[Prev in Thread] Current Thread [Next in Thread]