GNU bug report logs - #52247
[PATCH] gnu: shotcut: Find ffmpeg and mlt at runtime.

Previous Next

Package: guix-patches;

Reported by: Vinicius Monego <monego <at> posteo.net>

Date: Thu, 2 Dec 2021 16:20:02 UTC

Severity: normal

Tags: patch

Done: Leo Famulari <leo <at> famulari.name>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52247 in the body.
You can then email your comments to 52247 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#52247; Package guix-patches. (Thu, 02 Dec 2021 16:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vinicius Monego <monego <at> posteo.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 02 Dec 2021 16:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vinicius Monego <monego <at> posteo.net>
To: guix-patches <at> gnu.org
Cc: Vinicius Monego <monego <at> posteo.net>
Subject: [PATCH] gnu: shotcut: Find ffmpeg and mlt at runtime.
Date: Thu,  2 Dec 2021 16:18:17 +0000
* 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(-)

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)

base-commit: fab80c36720bbdb85730708d0dc5fceabcc22a6e
-- 
2.30.2





Information forwarded to guix-patches <at> gnu.org:
bug#52247; Package guix-patches. (Thu, 02 Dec 2021 19:17:01 GMT) Full text and rfc822 format available.

Message #8 received at 52247 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Vinicius Monego <monego <at> posteo.net>
Cc: 52247 <at> debbugs.gnu.org
Subject: Re: [bug#52247] [PATCH] gnu: shotcut: Find ffmpeg and mlt at runtime.
Date: Thu, 2 Dec 2021 14:16:38 -0500
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.




Information forwarded to guix-patches <at> gnu.org:
bug#52247; Package guix-patches. (Sat, 18 Dec 2021 17:04:03 GMT) Full text and rfc822 format available.

Message #11 received at 52247 <at> debbugs.gnu.org (full text, mbox):

From: Vinicius Monego <monego <at> posteo.net>
To: Leo Famulari <leo <at> famulari.name>
Cc: 52247 <at> debbugs.gnu.org
Subject: Re: [bug#52247] [PATCH] gnu: shotcut: Find ffmpeg and mlt at runtime.
Date: Sat, 18 Dec 2021 17:02:59 +0000
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.





Information forwarded to guix-patches <at> gnu.org:
bug#52247; Package guix-patches. (Sat, 18 Dec 2021 18:13:01 GMT) Full text and rfc822 format available.

Message #14 received at 52247 <at> debbugs.gnu.org (full text, mbox):

From: Vinicius Monego <monego <at> posteo.net>
To: 52247 <at> debbugs.gnu.org
Cc: Vinicius Monego <monego <at> posteo.net>
Subject: [PATCH v2 1/2] gnu: shotcut: Find ffmpeg and mlt at runtime.
Date: Sat, 18 Dec 2021 18:12:26 +0000
* gnu/packages/video.scm (shotcut)[arguments]<:#phases>: Add phase
'patch-executable-paths to use full store paths for ffmpeg and mlt.
---
This adds the suggestion from above, using just the string for replacement.

 gnu/packages/video.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 4b7251ee23..9b5738358b 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -4818,9 +4818,20 @@ transitions, and effects and then export your film to many common formats.")
         (base32 "0jgv6wl65gf6c4nmfica8k9vbgn3w3594d1phx1mb7zjvyy9y97k"))))
     (build-system qt-build-system)
     (arguments
-     `(#:tests? #f ;there are no tests
+     `(#:tests? #f                      ;there are no tests
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'patch-executable-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Shotcut expects ffmpeg and melt executables in the shotcut
+             ;; directory.  Use full store paths.
+             (let* ((ffmpeg (assoc-ref inputs "ffmpeg"))
+                    (mlt (assoc-ref inputs "mlt")))
+               (substitute* "src/jobs/ffmpegjob.cpp"
+                 (("\"ffmpeg\"") (string-append "\"" ffmpeg "/bin/ffmpeg\"")))
+               (substitute* "src/jobs/meltjob.cpp"
+                 (("\"melt\"") (string-append "\"" mlt "/bin/melt\""))
+                 (("\"melt-7\"") (string-append "\"" mlt "/bin/melt-7\""))))))
          (replace 'configure
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out")))

base-commit: 86d6c6053c7d1c7a82c83f0daf0f5e09b1ecfb63
-- 
2.30.2





Information forwarded to guix-patches <at> gnu.org:
bug#52247; Package guix-patches. (Sat, 18 Dec 2021 18:14:02 GMT) Full text and rfc822 format available.

Message #17 received at 52247 <at> debbugs.gnu.org (full text, mbox):

From: Vinicius Monego <monego <at> posteo.net>
To: 52247 <at> debbugs.gnu.org
Cc: Vinicius Monego <monego <at> posteo.net>
Subject: [PATCH v2 2/2] gnu: shotcut: Adjust environment variables in
 'wrap-program.
Date: Sat, 18 Dec 2021 18:12:27 +0000
* gnu/packages/video.scm (shotcut)[arguments]<#:phases>: In the 'wrap-program
phase, wrap LADSPA_PATH, don't wrap MLT_PREFIX, remove trailing slash from
FREI0R_PATH, remove ffmpeg and add mlt to PATH.
---
 gnu/packages/video.scm | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 9b5738358b..30d6341c59 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -4844,18 +4844,19 @@ transitions, and effects and then export your film to many common formats.")
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (frei0r (assoc-ref inputs "frei0r-plugins"))
-                    (ffmpeg (assoc-ref inputs "ffmpeg"))
                     (jack (assoc-ref inputs "jack"))
+                    (ladspa (assoc-ref inputs "ladspa"))
+                    (mlt (assoc-ref inputs "mlt"))
                     (sdl2 (assoc-ref inputs "sdl2")))
                (wrap-program (string-append out "/bin/shotcut")
-                 `("PATH" ":" prefix
-                   ,(list (string-append ffmpeg "/bin")))
+                 `("FREI0R_PATH" ":" =
+                   (,(string-append frei0r "/lib/frei0r-1")))
+                 `("LADSPA_PATH" ":" =
+                   (,(string-append ladspa "/lib/ladspa")))
                  `("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"))))))))))
+                 `("PATH" ":" prefix
+                   ,(list (string-append mlt "/bin"))))))))))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("python" ,python-wrapper)
-- 
2.30.2





Reply sent to Leo Famulari <leo <at> famulari.name>:
You have taken responsibility. (Sun, 26 Dec 2021 23:39:01 GMT) Full text and rfc822 format available.

Notification sent to Vinicius Monego <monego <at> posteo.net>:
bug acknowledged by developer. (Sun, 26 Dec 2021 23:39:02 GMT) Full text and rfc822 format available.

Message #22 received at 52247-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Vinicius Monego <monego <at> posteo.net>
Cc: 52247-done <at> debbugs.gnu.org
Subject: Re: [bug#52247] [PATCH v2 1/2] gnu: shotcut: Find ffmpeg and mlt at
 runtime.
Date: Sun, 26 Dec 2021 18:38:32 -0500
On Sat, Dec 18, 2021 at 06:12:26PM +0000, Vinicius Monego wrote:
> * gnu/packages/video.scm (shotcut)[arguments]<:#phases>: Add phase
> 'patch-executable-paths to use full store paths for ffmpeg and mlt.

Thanks! Pushed as 4e9895b462a004ac69ee92f544fe39b6c42d8525




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Jan 2022 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 64 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.