Subject: [PATCH v2 4/4] gnu: Add racket-with-video.

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

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

diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 5468fff6c4..14849e14ec 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -36,6 +36,7 @@ (define-module (gnu packages racket)
   #:use-module (srfi srfi-34)
   #:use-module (ice-9 match)
   #:use-module (gnu packages)
+  #:use-module (gnu packages audio)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages chez)
   #:use-module (gnu packages compression)
@@ -1114,6 +1115,164 @@ (define-public racket-libvid
 interoperate more easily with Racket's foreign interface.")
       (license license:asl2.0))))
 
+(define-public racket-with-video
+  (let* ((commit "3c69669063c56ff8d269768589cb9506a33315e5")
+         (revision "1")
+         (video-version (git-version "0.2.3" revision commit)))
+    (package
+      (inherit racket)
+      (name "racket-with-video")
+      (version (string-append %racket-version "+video" video-version))
+      (source #f)
+      (native-inputs '())
+      (inputs
+       (list
+        racket
+        racket-vm-cs
+        portaudio
+        racket-portaudio-librsoundcallbacks
+        racket-libvid
+        (lookup-package-input racket-libvid "ffmpeg") ; get the right version
+        (racket-packages-origin
+         "video" (origin
+                   (method git-fetch)
+                   (uri (git-reference
+                         (url "https://github.com/videolang/video")
+                         (commit commit)))
+                   (sha256
+                    (base32 "17lysqgd4h0kdx73vzmsdqc6ip5rlk56hss3880yapvic14lf5dy"))
+                   (snippet
+                    #~(begin
+                        (use-modules (guix build utils))
+                        (substitute* "info.rkt"
+                          ;; remove dependencies on pre-built libvid
+                          (("[(]\"libvid-.*linux" orig)
+                           (string-append "#|removed for Guix|# #;" orig)))))
+                   (file-name (git-file-name "racket-video" video-version)))
+         '(("video" ".")))
+        (let ((commit "fffe0d44e6183d19b5e2b22bf07be4192994243b"))
+          (racket-packages-origin
+           "bitsyntax" (origin
+                         (method git-fetch)
+                         (uri (git-reference
+                               (url "https://github.com/tonyg/racket-bitsyntax")
+                               (commit commit)))
+                         (sha256
+                          (base32 "0bvadklalbabd06r4a5jl6p41xmibr88iq4lq6ykcyng86r65rk3"))
+                         (file-name (git-file-name "racket-bitsyntax"
+                                                   (git-version "0.0" "1" commit))))
+           '(("bitsyntax" "."))))
+        (let ((commit "f06848871ed7b4b488341fdd73e9f640b4788733"))
+          (racket-packages-origin
+           "graph" (origin
+                     (method git-fetch)
+                     (uri (git-reference
+                           (url "https://github.com/stchang/graph")
+                           (commit commit)))
+                     (sha256
+                      (base32 "0smpd3nrxx91j32pkixq765dkgsyqxalkarc05kh76xmsvrrwgxk"))
+                     (file-name (git-file-name "racket-graph"
+                                               (git-version "0.5.2" "1" commit))))
+           '("graph" "graph-lib" "graph-doc" "graph-test" "gen-queue-lib")))
+        (let ((commit "69993f73dab8382796be37998ec47ded7883faf7"))
+          (racket-packages-origin
+           "lang-file" (origin
+                         (method git-fetch)
+                         (uri (git-reference
+                               (url "https://github.com/AlexKnauth/lang-file")
+                               (commit commit)))
+                         (sha256
+                          (base32 "1ij2ijpc0x5qyvvx5jwvi52gwk2972zrhz3481k91c3naxjaxyqq"))
+                         (file-name (git-file-name "racket-lang-file"
+                                                   (git-version "0.0" "1" commit))))
+           '("lang-file" "lang-file-lib")))
+        (let ((commit "1aaf2b2836680f807fbec5234ed475585b41b4ab"))
+          (racket-packages-origin
+           "opengl" (origin
+                      (method git-fetch)
+                      (uri (git-reference
+                            (url "https://github.com/stephanh42/RacketGL")
+                            (commit commit)))
+                      (sha256
+                       (base32 "1dc55jhwydin6f1c2bpzls3fzip3gg2j5aq2gwrkzvifj6p8wxj6"))
+                      (file-name (git-file-name "racket-opengl"
+                                                (git-version "0.0" "1" commit))))
+           '(("opengl" "."))))
+        (racket-packages-origin
+         "portaudio" (package-source racket-portaudio-librsoundcallbacks)
+         '(("portaudio" ".")))
+        (let ((commit "141332655e6c3003f847282d4187882aa8c95792"))
+          (racket-packages-origin
+           "ppict" (origin
+                     (method git-fetch)
+                     (uri (git-reference
+                           (url "https://github.com/rmculpepper/ppict")
+                           (commit commit)))
+                     (sha256
+                      (base32 "01ncygig6rp3hg6j5cgs11wlyplmcvim1iq93m4by6dwqvzq7ycm"))
+                     (file-name (git-file-name "racket-ppict"
+                                               (git-version "1.2" "1" commit))))
+           '(("ppict" "."))))
+        (let ((commit "f38e629f9713d2bc2691538b2ce5784bb1187252"))
+          (racket-packages-origin
+           "reprovide-lang" (origin
+                              (method git-fetch)
+                              (uri (git-reference
+                                    (url "https://github.com/AlexKnauth/reprovide-lang")
+                                    (commit commit)))
+                              (sha256
+                               (base32 "08i4lgir6n0sbd6iaz1jnk07vr5lr6pvr9a6a7rvxs2xyy5sdxk1"))
+                              (file-name (git-file-name "racket-reprovide-lang"
+                                                        (git-version "0.0" "1" commit))))
+           '("reprovide-lang" "reprovide-lang-lib")))
+        (let ((commit "d20497348015aecb309bdddd29cebea4a0b35664"))
+          (racket-packages-origin
+           "syntax-macro-lang" (origin
+                                 (method git-fetch)
+                                 (uri (git-reference
+                                       (url "https://github.com/AlexKnauth/syntax-macro-lang")
+                                       (commit commit)))
+                                 (sha256
+                                  (base32 "01dkp9z8rfnp788py9m6n16fvws2iwf6qypd85v7dqv8q2dpk89x"))
+                                 (file-name (git-file-name "racket-syntax-macro-lang"
+                                                           (git-version "0.0" "1" commit))))
+           '(("syntax-macro-lang" "."))))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments racket)
+         ((#:phases std-phases)
+          #~(modify-phases #$std-phases
+              (add-before 'install 'log
+                (lambda args
+                  (setenv "PLTSTDERR" "error debug@setup")))))
+         ((#:make-flags _ '())
+          #~`("video"))
+         ((#:configure-flags _ '())
+          #~`("--tethered"
+              "--extra-foreign-lib-search-dirs"
+              ,(format #f "~s"
+                       '(#$@(map (lambda (name)
+                                   (cond
+                                    ((this-package-input name)
+                                     => (cut file-append <> "/lib"))
+                                    (else
+                                     (raise
+                                      (formatted-message
+                                       (G_ "missing input '~a' to the 'racket-with-video' package")
+                                       name)))))
+                                 '("portaudio"
+                                   "racket-portaudio-librsoundcallbacks"
+                                   "racket-libvid"
+                                   "ffmpeg"))))))))
+      (home-page "https://lang.video")
+      (synopsis "Racket with @code{#lang video}")
+      (description
+       "Video is a language for making movies.  It combines the power
+of a traditional video editor with the capabilities of a full
+programming language.  Video integrates with the Racket ecosystem and
+extensions for DrRacket to transform it into a non-linear video
+editor.")
+      (license license:asl2.0))))
+
 (define configure-layer.rkt
   (scheme-file
    "configure-layer.rkt"
-- 
2.41.0