diff mbox series

[bug#52247] gnu: shotcut: Find ffmpeg and mlt at runtime.

Message ID 20211202161817.554276-1-monego@posteo.net
State Accepted
Headers show
Series [bug#52247] gnu: shotcut: Find ffmpeg and mlt at runtime. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Vinicius Monego Dec. 2, 2021, 4:18 p.m. UTC
* gnu/packages/video.scm (shotcut)[arguments]<:#phases>: Symlink ffmpeg and
mlt binaries to the Shotcut bin folder and remove unused PATH and MLT_PREFIX
environment variables in the 'wrap-executable phase.
---
fixes 50433

 gnu/packages/video.scm | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)


base-commit: fab80c36720bbdb85730708d0dc5fceabcc22a6e

Comments

Leo Famulari Dec. 2, 2021, 7:16 p.m. UTC | #1
On Thu, Dec 02, 2021 at 04:18:17PM +0000, Vinicius Monego wrote:
> * gnu/packages/video.scm (shotcut)[arguments]<:#phases>: Symlink ffmpeg and
> mlt binaries to the Shotcut bin folder and remove unused PATH and MLT_PREFIX
> environment variables in the 'wrap-executable phase.

I read your message about this in #50433:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50433#17

The first link, which points to code that copies "files from other
projects to its bin directory", is in a function named deploy_mac, so I
don't think it's relevant for us.

Overall, I think it's unusual that we would copy or symlink one program
into another like this. I read build-shotcut.sh and it seems they
actually intend to compile ffmpeg themselves...

https://github.com/mltframework/shotcut/blob/af9f47882d64eb15105559e0729bc7b1e337a9bf/scripts/build-shotcut.sh#L1352

... and then use a wrapper script to point to it:

https://github.com/mltframework/shotcut/blob/af9f47882d64eb15105559e0729bc7b1e337a9bf/scripts/build-shotcut.sh#L1369

That's weird for something as common as ffmpeg, although I actually have
some private packages based on custom ffmpeg, so I am sympathetic.

I think we should ask upstream for advice. They do support distro
packagers, apparently:

https://github.com/mltframework/shotcut/issues/769#issuecomment-528686712

Can you do that? I can do it if you'd rather not. And I'm sorry if you
already knew all this and I'm just wasting your time.
Vinicius Monego Dec. 18, 2021, 5:02 p.m. UTC | #2
Em qui, 2021-12-02 às 14:16 -0500, Leo Famulari escreveu:
> On Thu, Dec 02, 2021 at 04:18:17PM +0000, Vinicius Monego wrote:
> > * gnu/packages/video.scm (shotcut)[arguments]<:#phases>: Symlink
> > ffmpeg and
> > mlt binaries to the Shotcut bin folder and remove unused PATH and
> > MLT_PREFIX
> > environment variables in the 'wrap-executable phase.
> 
> I read your message about this in #50433:
> 
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50433#17
> 
> The first link, which points to code that copies "files from other
> projects to its bin directory", is in a function named deploy_mac, so
> I
> don't think it's relevant for us.
> 
> Overall, I think it's unusual that we would copy or symlink one
> program
> into another like this. I read build-shotcut.sh and it seems they
> actually intend to compile ffmpeg themselves...
> 
> https://github.com/mltframework/shotcut/blob/af9f47882d64eb15105559e0729bc7b1e337a9bf/scripts/build-shotcut.sh#L1352
> 
> ... and then use a wrapper script to point to it:
> 
> https://github.com/mltframework/shotcut/blob/af9f47882d64eb15105559e0729bc7b1e337a9bf/scripts/build-shotcut.sh#L1369
> 
> That's weird for something as common as ffmpeg, although I actually
> have
> some private packages based on custom ffmpeg, so I am sympathetic.
> 
> I think we should ask upstream for advice. They do support distro
> packagers, apparently:
> 
> https://github.com/mltframework/shotcut/issues/769#issuecomment-528686712
> 
> Can you do that? I can do it if you'd rather not. And I'm sorry if
> you
> already knew all this and I'm just wasting your time.

Hi,

How about this solution?

https://github.com/NixOS/nixpkgs/blob/aecab6adbd682960b1b341cf20e4c53ddf722104/pkgs/applications/video/shotcut/default.nix#L59

It expands the executable names to the full store paths in the files
where they are called. Could be done with substitutions in a phase.
diff mbox series

Patch

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index eeabb11bcf..dcc2f59357 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -4918,16 +4918,23 @@  transitions, and effects and then export your film to many common formats.")
                     (frei0r (assoc-ref inputs "frei0r-plugins"))
                     (ffmpeg (assoc-ref inputs "ffmpeg"))
                     (jack (assoc-ref inputs "jack"))
+                    (mlt (assoc-ref inputs "mlt"))
                     (sdl2 (assoc-ref inputs "sdl2")))
+               ;; Shotcut looks for ffmpeg and melt executables in the shotcut
+               ;; directory.  Symlink them to be found at runtime.
+               (for-each (lambda (file)
+                           (symlink (string-append ffmpeg "/bin/" file)
+                                    (string-append out "/bin/" file)))
+                         '("ffmpeg" "ffplay" "ffprobe"))
+               (for-each (lambda (file)
+                           (symlink (string-append mlt "/bin/" file)
+                                    (string-append out "/bin/" file)))
+                         '("melt" "melt-7"))
                (wrap-program (string-append out "/bin/shotcut")
-                 `("PATH" ":" prefix
-                   ,(list (string-append ffmpeg "/bin")))
                  `("LD_LIBRARY_PATH" ":" prefix
                    ,(list (string-append jack "/lib" ":" sdl2 "/lib")))
                  `("FREI0R_PATH" ":" =
-                   (,(string-append frei0r "/lib/frei0r-1/")))
-                 `("MLT_PREFIX" ":" =
-                   (,(assoc-ref inputs "mlt"))))))))))
+                   (,(string-append frei0r "/lib/frei0r-1/"))))))))))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("python" ,python-wrapper)