Subject: [PATCH v2 3/4] gnu: Add racket-libvid.

From: Philip McGrath <[email-masked]>
Date: Fri, 20 Oct 2023 22:01:13 -0400

* gnu/packages/racket.scm (racket-libvid): New variable.
---
 gnu/packages/racket.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 43187318d8..5468fff6c4 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -51,6 +51,7 @@ (define-module (gnu packages racket)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages xorg)
   #:use-module ((guix licenses) #:prefix license:))
 
@@ -1076,6 +1077,43 @@ (define-public racket-portaudio-librsoundcallbacks
 callbacks supplied @i{via} Racket's foreign interface.")
       (license license:lgpl2.0+))))
 
+(define-public racket-libvid
+  (let ((commit "dfe1d5cb7271b1657bbde9c8f67ee9c5a513a9c7")
+        (revision "1"))
+    (package
+      (name "racket-libvid")
+      (version (git-version "0.2.1.1" revision commit))
+      (source
+       ;; Avoid even a shallow clone of the rest of the repository,
+       ;; which includes large binaries for many platforms.
+       (origin
+         (method url-fetch)
+         (uri (string-append
+               "https://raw.githubusercontent.com/videolang/native-pkgs/"
+               commit
+               "/libvid-src/libvid.c"))
+         (sha256
+          (base32 "14byvwsadg1d2bd2j0x9nhmxkjhlq04afhq4l43y34r3y4zdcyq5"))))
+      (inputs (list ffmpeg-4)) ; NOTE: major versions break compatibility
+      (build-system copy-build-system)
+      (arguments
+       (list
+        #:install-plan
+        #~`(("libvid.so.0" "lib/"))
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-before 'install 'build
+              (lambda args
+                (invoke #$(cc-for-target)
+                        "-Wall" "-Werror" "-shared" "-fPIC"
+                        "-o" "libvid.so.0"
+                        "libvid.c"))))))
+      (home-page "https://lang.video")
+      (synopsis "Logging support library for @code{#lang video}")
+      (description "The libvid library adapts FFmpeg's logging API to
+interoperate more easily with Racket's foreign interface.")
+      (license license:asl2.0))))
+
 (define configure-layer.rkt
   (scheme-file
    "configure-layer.rkt"
-- 
2.41.0