videolang / video

Source Code for Video language.
https://lang.video
Apache License 2.0
125 stars 12 forks source link

#lang video on Guix OS #67

Open Bost opened 1 year ago

Bost commented 1 year ago

Hi Leif,

FYI I just created a patch [1] enabling #lang video on the Guix OS. I guess you might want to extend the list [2] of supported operating systems when the patch gets merged ;-)

Cheers

Bost

[1] https://issues.guix.gnu.org/56534 [2] https://docs.racket-lang.org/video@video/Installing.html

PS: It's been more than 2,5 years since you made your last commit. It'd a pitty not to continue this project.

LiberalArtist commented 1 year ago

Hi,

On Wed, Jul 13, 2022, at 7:55 AM, Bost wrote:

Hi Leif,

FYI I just created a patch [1] enabling #lang video on the Guix OS. I guess you might want to extend the list [2] of supported operating systems when the patch gets merged ;-)

Cheers

Bost

[1] https://issues.guix.gnu.org/56534 [2] @.***/Installing.html

It's great to see more Racketeers interested in Guix!

I'm cross-posting this to both https://issues.guix.gnu.org/56534 and https://github.com/videolang/video/issues/67.

I've been working for some time toward making a Guix build system and importer for Racket packages: I'm optimistic that I may get something working between the Racket 8.6 and 8.7 releases.

For now, I would suggest not adding portaudio and ffmpeg as inputs to the main racket package. Instead, if you want to get something working for now, I would suggest adding a new package racket-with-video that extends the racket package in the same way that racket extends racket-minimal. I'd expect it would go somewhat like this:

EDIT: see next post for properly formatted code

Those helper functions are not exported from (gnu packages racket) because they're hack-ish and should be replaced with proper build system support, but hopefully you can see from the docstrings how they work for now.

I ran into https://github.com/racket/racket/issues/4357 while working on this example: we'd need to backport a fix for that, or it might make it into 8.6. Incidentally, you might be interested in my branch at https://gitlab.com/philip1/guix-patches/-/tree/zuo getting ready for the Racket release: I'll be updating it to the new 8.5.900 release candidate soon.

@LeifAndersen, I used 3c69669063c56ff8d269768589cb9506a33315e5 because I expect Guix would run into that issue during our build process, but we could use the stable branch or cherry-pick it if you think that would be better.

Hopefully by the next time a situation like https://guix.gnu.org/en/blog/2021/reproducible-data-processing-pipelines/ comes up, Guix folks will be able to get #lang video's "sweet high-level functional interface" together with reproducibility of their makefile!

-Philip

LiberalArtist commented 1 year ago

Apparently markdown doesn't work when replying by email, so here's the code:

(define-public racket-with-video
  (let* ((commit "3c69669063c56ff8d269768589cb9506a33315e5")
         (revision "1")
         (video-version (git-version "0.2.3" revision commit)))
    (package
      (inherit racket)
      (version (string-append %racket-version "+video" video-version))
      (source #f)
      (native-inputs '())
      (inputs
       (list
        racket
        (racket-vm-for-system)
        ffmpeg
        portaudio
        (racket-packages-origin
         "video" (origin
                   (method git-fetch)
                   (uri (git-reference
                         (url "https://github.com/videolang/video")
                         (commit commit)))
                   (sha256
                    (base32 "17lysqgd4h0kdx73vzmsdqc6ip5rlk56hss3880yapvic14lf5dy"))
                   (file-name (git-file-name "racket-video" video-version)))
         '("video"))
        #|
        ... likewise for other packages not in main-distribution,
        particularly libvid ...
        |#))
      (arguments
       (substitute-keyword-arguments (package-arguments racket)
         ((#: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"
                                   "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))))
LiberalArtist commented 9 months ago

Hello Philip and all,

"Philip McGrath" @.***> skribis:

I'm cross-posting this to both https://issues.guix.gnu.org/56534 and https://github.com/videolang/video/issues/67.

I've been working for some time toward making a Guix build system and importer for Racket packages: I'm optimistic that I may get something working between the Racket 8.6 and 8.7 releases.

For now, I would suggest not adding portaudio and ffmpeg as inputs to the main racket package. Instead, if you want to get something working for now, I would suggest adding a new package racket-with-video that extends the racket package in the same way that racket extends racket-minimal. I'd expect it would go somewhat like this

It’s been a while. Should one of you add the ‘racket-with-video’ package you proposed? WDYT?

Thanks, Ludo’.

LiberalArtist commented 9 months ago

Hi Ludo’.,

On Mon, Oct 9, 2023, at 9:34 AM, Ludovic Courtès wrote:

Hello Philip and all,

"Philip McGrath" @.***> skribis:

I'm cross-posting this to both https://issues.guix.gnu.org/56534 and https://github.com/videolang/video/issues/67.

I've been working for some time toward making a Guix build system and importer for Racket packages: I'm optimistic that I may get something working between the Racket 8.6 and 8.7 releases.

For now, I would suggest not adding portaudio and ffmpeg as inputs to the main racket package. Instead, if you want to get something working for now, I would suggest adding a new package racket-with-video that extends the racket package in the same way that racket extends racket-minimal. I'd expect it would go somewhat like this

It’s been a while. Should one of you add the ‘racket-with-video’ package you proposed? WDYT?

I'd be happy to give it a try, though I may not have time until next week (definitely not today).

IIRC, all of the potential complications I mentioned up-thread have been solved by now, so it should just be a matter of collecting all the dependencies.

Philip

LiberalArtist commented 8 months ago

Hi Ludo’ and everyone,

Here is a patch series adding 'racket-with-video'.

(I'm BCC'ing https://github.com/videolang/video/issues/67 on this cover letter, but not on the patches themselves: they will be at https://issues.guix.gnu.org/56534.)

The package builds file, but unfortunately, while trying to confirm that it works, I'm getting errors related to ALSA plugins. I'm not familiar with how ALSA finds plugins or how Guix packages should handle them, so I'm hoping someone will have suggestions. I also asked on IRC: see https://logs.guix.gnu.org/guix/2023-10-20.log#230814.

Here's how to provoke the problem:

  1. Launch a shell with the new package, e.g. with ./pre-inst-env guix shell racket-with-video alsa-plugins alsa-plugins:pulseaudio alsa-plugins:jack. I added all of the alsa-plugins to see if they made a difference, but they did not.

  2. Start DrRacket, e.g. with:

    PLTUSERHOME=/tmp/plthome drracket &> green.vid.shell-with-all-plugins.log

    Setting PLTUSERHOME ensures the experiment is not affected by any preferences you may have configured or packages you may have installed in user scope.

  3. As prompted by DrRacket, perform the on-first-run selection of a programming language: select the “Choose Language…” item in the “Language” menu and choose “The Racket Language” in the dialog.

  4. Enter the following example program in the definitions window:

    #lang video
    (color "green")
  5. Press the “Run” button. The program will compile and run successfully, nearly instantaneously. You will see the language noted at the top of the REPL updated to reflect #lang video.

  6. Press the “Preview Video” button. DrRacket will freeze. Eventually, DrRacket will crash. Every time I have tried this, it has brought my terminal (Konsole) down with it.

I've been doing this in a KDE Wayland session on Debian Bookworm. It would be good to know if the problem also happens in other environments, especially Guix System.

I have tried it with both ffmpeg-4 and ffmpeg-3.4 with similar results.

I will send the full log as an attachment to a follow-up message. Much of it consists of errors like this:

ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_rate_lavrate.so (/gnu/store/adlkhsffrpcpv8mnan13d8y9r3dp1724-profile/lib/alsa-lib/libasound_module_rate_lavrate.so: cannot open shared object file: No such file or directory)

The messages are slightly different if you run the build drracket without going through guix shell, e.g.:

ALSA lib conf.c:3725:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so (/gnu/store/l6bi14a5qrbjgb9lqh39wzrbsk50r8np-alsa-lib-1.2.4/lib/alsa-lib/libasound_module_conf_pulse.so: cannot open shared object file: No such file or directory)

There is in fact no lib/alsa-lib directory in the store item for alsa-lib. A file lib/alsa-lib/libasound_module_conf_pulse.so does exist in the alsa-plugins:pulseaudio output, and, interestingly, that one did not appear in the logs from my latest test: so maybe including it in the shell did make a difference? On the other hand, I haven't managed to locate a libasound_module_rate_lavrate.so anywhere in Guix.

Hopefully someone will have some idea of what's going on.

-Philip

Philip McGrath (4): gnu: racket: Fix layered documentation rendering. gnu: Add racket-portaudio-librsoundcallbacks. gnu: Add racket-libvid. gnu: Add racket-with-video.

gnu/packages/racket.scm | 254 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 253 insertions(+), 1 deletion(-)

base-commit: fed6ac2ae182597a492b17a29ed8b26986498755 -- 2.41.0