[PATCH v2] gnu: mpv: Fix pkgconfig file.

  • Done
  • quality assurance status badge
Details
3 participants
  • Josselin Poiret
  • Hilton Chain
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Hilton Chain
Severity
normal
H
H
Hilton Chain wrote on 5 Jan 06:06 +0100
[PATCH] gnu: Add libmpv.
(address . guix-patches@gnu.org)(name . Hilton Chain)(address . hako@ultrarare.space)
521d0ba6e3d10b3b8aa98b35862d819c82223412.1704430613.git.hako@ultrarare.space
* gnu/packages/video.scm (libmpv): New variable.
(mpv)[arguments]<#:configure-flags>: Remove libmpv library.
(celluloid,mpv-mpris)[inputs]: Replace mpv with libmpv.
* gnu/packages/kde-plasma.scm (plasmatube)[inputs]: Likewise.
* gnu/packages/python-xyz.scm (python-mpv)[inputs]: Likewise.

Change-Id: I7c0a808f9d54f9bfd98b3d2632316c7d58b67896
---
gnu/packages/kde-plasma.scm | 2 +-
gnu/packages/python-xyz.scm | 2 +-
gnu/packages/video.scm | 24 ++++++++++++++++++++----
3 files changed, 22 insertions(+), 6 deletions(-)

Toggle diff (91 lines)
diff --git a/gnu/packages/kde-plasma.scm b/gnu/packages/kde-plasma.scm
index 331ab28cd1..0527fa136a 100644
--- a/gnu/packages/kde-plasma.scm
+++ b/gnu/packages/kde-plasma.scm
@@ -1611,12 +1611,12 @@ (define-public plasmatube
(list kconfig
kirigami
ki18n
+ libmpv
qtbase-5
qtdeclarative-5
qtmultimedia-5
qtquickcontrols2-5
qtsvg-5
- mpv
youtube-dl))
(home-page "https://apps.kde.org/plasmatube/")
(synopsis "Kirigami YouTube video player")
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 2afce6c667..b23eaaadfc 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -33948,7 +33948,7 @@ (define-public python-mpv
(setenv "HOME" (getcwd)))))))
(native-inputs
(list python-xvfbwrapper)) ; needed for tests only
- (inputs (list mpv))
+ (inputs (list libmpv))
(propagated-inputs (list python-pillow)) ; for raw screenshots
(home-page "https://github.com/jaseg/python-mpv")
(synopsis "Python interface to the mpv media player")
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 6da4897a57..b532181225 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -867,7 +867,7 @@ (define-public celluloid
pkg-config
python-wrapper)) ; for generate-authors.py
(inputs
- (list gtk libadwaita libepoxy mpv))
+ (list gtk libadwaita libepoxy libmpv))
(home-page "https://github.com/celluloid-player/celluloid")
(synopsis "GTK+ frontend for the mpv media player")
(description "Celluloid is a simple GTK+ frontend for the mpv media player.
@@ -2367,8 +2367,7 @@ (define-public mpv
;; Set PYTHONHASHSEED as a workaround for deterministic results.
(setenv "PYTHONHASHSEED" "1"))))
#:configure-flags
- #~(list "-Dlibmpv=true"
- "-Dcdda=enabled"
+ #~(list "-Dcdda=enabled"
"-Ddvdnav=enabled"
"-Dbuild-date=false")))
(native-inputs
@@ -2422,6 +2421,23 @@ (define-public mpv
projects while introducing many more.")
(license license:gpl2+)))
+(define-public libmpv
+ (package
+ (inherit mpv)
+ (name "libmpv")
+ (arguments
+ (substitute-keyword-arguments (package-arguments mpv)
+ ((#:configure-flags flags ''())
+ #~(cons* "-Dcplayer=false"
+ "-Dlibmpv=true"
+ #$flags))))
+ (native-inputs
+ (modify-inputs (package-native-inputs mpv)
+ (delete "perl" "python-docutils")))
+ (propagated-inputs (package-inputs mpv))
+ (inputs '())
+ (synopsis "mpv media player client library")))
+
(define-public smplayer
(package
(name "smplayer")
@@ -2524,7 +2540,7 @@ (define-public mpv-mpris
(native-inputs
(list pkg-config))
(inputs
- (list ffmpeg glib mpv))
+ (list ffmpeg glib libmpv))
(home-page "https://github.com/hoyon/mpv-mpris")
(synopsis "MPRIS plugin for mpv")
(description "This package provides an @dfn{MPRIS} (Media Player Remote

base-commit: be1d05c10766a979dd0720b677889ed950d3b895
--
2.41.0
H
H
Hilton Chain wrote on 5 Jan 06:09 +0100
Re: bug#67814: [PATCH 0/3] gnu: mpv: Update to 0.37.0.
(name . Andrew Tropin)(address . andrew@trop.in)
87sf3c5ptu.wl-hako@ultrarare.space
Hi,

On Mon, 25 Dec 2023 19:33:41 +0800,
Andrew Tropin wrote:
Toggle quote (6 lines)
>
> Hi Hilton!
>
> It seem the mpv update breaks mpv-mpris build. I didn't dive into
> issue yet, only tried to revert this patch.

It's because mpv's pkgconfig file (for libmpv) now includes all its
dependencies in Requires.private. Sorry that I didn't check all the
dependent packages.

Josselin has sent bug#68044, which adds mpv's inputs to mpv-mpris.

However there're actually other packages depend on libmpv, so I think
the proper fix is to split libmpv from the mpv package and propagate
inputs in a new package (as mpv users are likely to include mpv in
their profiles, thus these propagated inputs are usually unwanted).

I tried to add a "lib" output for mpv first but there would be cycles.
As a result, I disabled libmpv in mpv, added a libmpv package which
inherits from mpv, and sent it to bug#68250.

Thanks
H
H
Hilton Chain wrote on 6 Jan 05:23 +0100
[PATCH v2] gnu: mpv: Fix pkgconfig file.
(address . 68250@debbugs.gnu.org)
14315fb383a6560c67bdc6bf3f7cab8b8e36e0bb.1704514279.git.hako@ultrarare.space
This is a follow-up to ce7b2b57aa6da0ceace94ea5fb42392c7ff97d53.

* gnu/packages/video.scm (mpv)[arguments]<#:phases>: Add 'fix-mpv.pc.

Suggested-by: ??? <iyzsong@member.fsf.org>
Change-Id: I9826d5d6c957ca3022fa326aee111edb533f05bc
---
gnu/packages/video.scm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

Toggle diff (21 lines)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index e70aa5352e..10d46db38b 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -2365,7 +2365,13 @@ (define-public mpv
;; and passed as linker flags, but the order in which they are added
;; varies. See <https://github.com/mpv-player/mpv/issues/7855>.
;; Set PYTHONHASHSEED as a workaround for deterministic results.
- (setenv "PYTHONHASHSEED" "1"))))
+ (setenv "PYTHONHASHSEED" "1")))
+ ;; mpv.pc is generated by meson. libmpv's headers don't actually
+ ;; require these dependencies so it's safe to remove these two fields.
+ (add-after 'install 'fix-mpv.pc
+ (lambda _
+ (substitute* (string-append #$output "/lib/pkgconfig/mpv.pc")
+ (("^(Requires|Libs)\\.private:.*") "")))))
#:configure-flags
#~(list "-Dlibmpv=true"
"-Dcdda=enabled"

base-commit: c0e21e523d93081153a2ffc91e5a9f06afe62b91
--
2.41.0
H
H
Hilton Chain wrote on 6 Jan 05:31 +0100
control message for bug #68250
(address . control@debbugs.gnu.org)
87ttnr9j5x.wl-hako@ultrarare.space
retitle 68250 [PATCH v2] gnu: mpv: Fix pkgconfig file.
quit
J
J
Josselin Poiret wrote on 10 Jan 19:24 +0100
Re: [bug#68250] [PATCH v2] gnu: mpv: Fix pkgconfig file.
875y01hwrz.fsf@jpoiret.xyz
Hi Hilton,

Hilton Chain <hako@ultrarare.space> writes:

Toggle quote (4 lines)
> This is a follow-up to ce7b2b57aa6da0ceace94ea5fb42392c7ff97d53.
>
> * gnu/packages/video.scm (mpv)[arguments]<#:phases>: Add 'fix-mpv.pc.

Does this completely replace the previous patch, instead of augmenting it?

Best,
--
Josselin Poiret
-----BEGIN PGP SIGNATURE-----

iQHEBAEBCAAuFiEEOSSM2EHGPMM23K8vUF5AuRYXGooFAmWe4NAQHGRldkBqcG9p
cmV0Lnh5egAKCRBQXkC5FhcaihZfDACM1eHR2b6sjIjiLQuDGRgfkfymdEIvz+Xm
nxJ7SAz5EhpGkJF/ftigLHQiLDZJ3WMf+A9IEMSr50uxaQNPDwq6tGgk/Gf/eVlU
GbsJS53jfCtHfNazu/MOS1ZWcqwUvQuugx2v3iWIMFkyRJrClW9S9d/3z+SzlcLs
9Z04hwDBzWd+nizakzv1+50Jk3YAvwC4xEADjBYsr1bBK85HpPknaIcK+vhXWr5Y
rB17WBCUMmG+FilyWUwZir3fjH2yKp1msKk8HheXnzvFzXGtzJEjXm7FByI7uEdI
W02VBtymvnm7LsjE+dbSA6YQdPUdoCMKnLrfpI3vXbmTcvSMy+wUXY4bcuf3Q1gf
e2rGsCmJPdhFJtSJQqAZ5QwRCpR+l4FHMAsnVkmguONr6iN23KVBm9LFK2ewKFoc
hqCC313xVogNtVVSnfAYdjEMWK5++ZZ/YQt9KxY7hiO05a1I5RBiYreCHBlKdQ7b
S8R7uYrCFgW3j/HK56f5rr0gGbkinG8=
=cvTE
-----END PGP SIGNATURE-----

H
H
Hilton Chain wrote on 13 Jan 07:48 +0100
(name . Josselin Poiret)(address . dev@jpoiret.xyz)
871qalvid8.wl-hako@ultrarare.space
Hi Josselin,

On Thu, 11 Jan 2024 02:24:16 +0800,
Josselin Poiret wrote:
Toggle quote (12 lines)
>
> [1 <text/plain (quoted-printable)>]
> Hi Hilton,
>
> Hilton Chain <hako@ultrarare.space> writes:
>
> > This is a follow-up to ce7b2b57aa6da0ceace94ea5fb42392c7ff97d53.
> >
> > * gnu/packages/video.scm (mpv)[arguments]<#:phases>: Add 'fix-mpv.pc.
>
> Does this completely replace the previous patch, instead of augmenting it?

Yes! I should clarify this before.
M
M
Maxim Cournoyer wrote on 19 Jan 03:05 +0100
Re: bug#68250: [PATCH v2] gnu: mpv: Fix pkgconfig file.
(name . Hilton Chain)(address . hako@ultrarare.space)
8734uukrgq.fsf_-_@gmail.com
Hi,

Hilton Chain <hako@ultrarare.space> writes:

Toggle quote (30 lines)
> This is a follow-up to ce7b2b57aa6da0ceace94ea5fb42392c7ff97d53.
>
> * gnu/packages/video.scm (mpv)[arguments]<#:phases>: Add 'fix-mpv.pc.
>
> Suggested-by: ??? <iyzsong@member.fsf.org>
> Change-Id: I9826d5d6c957ca3022fa326aee111edb533f05bc
> ---
> gnu/packages/video.scm | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
> index e70aa5352e..10d46db38b 100644
> --- a/gnu/packages/video.scm
> +++ b/gnu/packages/video.scm
> @@ -2365,7 +2365,13 @@ (define-public mpv
> ;; and passed as linker flags, but the order in which they are added
> ;; varies. See <https://github.com/mpv-player/mpv/issues/7855>.
> ;; Set PYTHONHASHSEED as a workaround for deterministic results.
> - (setenv "PYTHONHASHSEED" "1"))))
> + (setenv "PYTHONHASHSEED" "1")))
> + ;; mpv.pc is generated by meson. libmpv's headers don't actually
> + ;; require these dependencies so it's safe to remove these two fields.
> + (add-after 'install 'fix-mpv.pc
> + (lambda _
> + (substitute* (string-append #$output "/lib/pkgconfig/mpv.pc")
> + (("^(Requires|Libs)\\.private:.*") "")))))
> #:configure-flags
> #~(list "-Dlibmpv=true"
> "-Dcdda=enabled"

I've just seen this, after pushing a hot fix as
f3fdb4e041cb5740ba0b38b9ad017571f8414d33, which propagates all listed
libraries in Requires.private.

I suppose that someone wanting to build something statically from mpv
would benefit from having the original mpv.pc file without
modifications.

Perhaps we can try it out for a bit, and if the propagation causes
problems, we can fall-back to this change here?

--
Thanks,
Maxim
H
H
Hilton Chain wrote on 1 Feb 06:01 +0100
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87o7d04w1k.wl-hako@ultrarare.space
Hi Maxim,

On Fri, 19 Jan 2024 10:05:41 +0800,
Maxim Cournoyer wrote:
Toggle quote (47 lines)
>
> Hi,
>
> Hilton Chain <hako@ultrarare.space> writes:
>
> > This is a follow-up to ce7b2b57aa6da0ceace94ea5fb42392c7ff97d53.
> >
> > * gnu/packages/video.scm (mpv)[arguments]<#:phases>: Add 'fix-mpv.pc.
> >
> > Suggested-by: ??? <iyzsong@member.fsf.org>
> > Change-Id: I9826d5d6c957ca3022fa326aee111edb533f05bc
> > ---
> > gnu/packages/video.scm | 8 +++++++-
> > 1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
> > index e70aa5352e..10d46db38b 100644
> > --- a/gnu/packages/video.scm
> > +++ b/gnu/packages/video.scm
> > @@ -2365,7 +2365,13 @@ (define-public mpv
> > ;; and passed as linker flags, but the order in which they are added
> > ;; varies. See <https://github.com/mpv-player/mpv/issues/7855>.
> > ;; Set PYTHONHASHSEED as a workaround for deterministic results.
> > - (setenv "PYTHONHASHSEED" "1"))))
> > + (setenv "PYTHONHASHSEED" "1")))
> > + ;; mpv.pc is generated by meson. libmpv's headers don't actually
> > + ;; require these dependencies so it's safe to remove these two fields.
> > + (add-after 'install 'fix-mpv.pc
> > + (lambda _
> > + (substitute* (string-append #$output "/lib/pkgconfig/mpv.pc")
> > + (("^(Requires|Libs)\\.private:.*") "")))))
> > #:configure-flags
> > #~(list "-Dlibmpv=true"
> > "-Dcdda=enabled"
>
> I've just seen this, after pushing a hot fix as
> f3fdb4e041cb5740ba0b38b9ad017571f8414d33, which propagates all listed
> libraries in Requires.private.
>
> I suppose that someone wanting to build something statically from mpv
> would benefit from having the original mpv.pc file without
> modifications.
>
> Perhaps we can try it out for a bit, and if the propagation causes
> problems, we can fall-back to this change here?


Then we should follow the approach in v1 to add libmpv as a separate package.
I'll send v3 later.

Thanks
M
M
Maxim Cournoyer wrote on 5 Feb 20:37 +0100
(name . Hilton Chain)(address . hako@ultrarare.space)
87cyta66sr.fsf@gmail.com
Hi Hilton,

[...]

Toggle quote (15 lines)
>> I've just seen this, after pushing a hot fix as
>> f3fdb4e041cb5740ba0b38b9ad017571f8414d33, which propagates all listed
>> libraries in Requires.private.
>>
>> I suppose that someone wanting to build something statically from mpv
>> would benefit from having the original mpv.pc file without
>> modifications.
>>
>> Perhaps we can try it out for a bit, and if the propagation causes
>> problems, we can fall-back to this change here?
>
>
> Then we should follow the approach in v1 to add libmpv as a separate package.
> I'll send v3 later.

Actually I don't think we need to split out a library for mpv here;
there are two things we can do in the short term:

1. Build MPV strictly as a shared library (-Dbuild=shared) or something
in Meson. Then Meson doesn't output all these Requires.private
dependencies, which are only useful for static linking, and which
pkg-config confusingly uses for its --exists check.

2. On core-updates, I've been experimenting with replacing pkg-config
with pkgconf, which seems to be designed better for avoiding the above
pkg-config's pitfall. Currently stuck on a hard to understand cycle.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 26 Feb 17:01 +0100
(name . Hilton Chain)(address . hako@ultrarare.space)
87cysjkyec.fsf_-_@gmail.com
Hi Hilton,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (31 lines)
> Hi Hilton,
>
> [...]
>
>>> I've just seen this, after pushing a hot fix as
>>> f3fdb4e041cb5740ba0b38b9ad017571f8414d33, which propagates all listed
>>> libraries in Requires.private.
>>>
>>> I suppose that someone wanting to build something statically from mpv
>>> would benefit from having the original mpv.pc file without
>>> modifications.
>>>
>>> Perhaps we can try it out for a bit, and if the propagation causes
>>> problems, we can fall-back to this change here?
>>
>>
>> Then we should follow the approach in v1 to add libmpv as a separate package.
>> I'll send v3 later.
>
> Actually I don't think we need to split out a library for mpv here;
> there are two things we can do in the short term:
>
> 1. Build MPV strictly as a shared library (-Dbuild=shared) or something
> in Meson. Then Meson doesn't output all these Requires.private
> dependencies, which are only useful for static linking, and which
> pkg-config confusingly uses for its --exists check.
>
> 2. On core-updates, I've been experimenting with replacing pkg-config
> with pkgconf, which seems to be designed better for avoiding the above
> pkg-config's pitfall. Currently stuck on a hard to understand cycle.

I've implemented 2. above; see: https://issues.guix.gnu.org/68813,
which removes the need to propagate pkg-config *.private fields, which
should only be needed when doing static builds.

I'm thus closing this issue. Let me know if I've missed anything!

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 26 Feb 17:01 +0100
control message for bug #68250
(address . control@debbugs.gnu.org)
87bk83kye0.fsf@gmail.com
close 68250
quit
H
H
Hilton Chain wrote on 27 Feb 02:31 +0100
Re: bug#68250: [PATCH v2] gnu: mpv: Fix pkgconfig file.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87ttlu3d6v.wl-hako@ultrarare.space
Hi Maxim,

On Tue, 27 Feb 2024 00:01:31 +0800,
Maxim Cournoyer wrote:
Toggle quote (43 lines)
>
> Hi Hilton,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
> > Hi Hilton,
> >
> > [...]
> >
> >>> I've just seen this, after pushing a hot fix as
> >>> f3fdb4e041cb5740ba0b38b9ad017571f8414d33, which propagates all listed
> >>> libraries in Requires.private.
> >>>
> >>> I suppose that someone wanting to build something statically from mpv
> >>> would benefit from having the original mpv.pc file without
> >>> modifications.
> >>>
> >>> Perhaps we can try it out for a bit, and if the propagation causes
> >>> problems, we can fall-back to this change here?
> >>
> >>
> >> Then we should follow the approach in v1 to add libmpv as a separate package.
> >> I'll send v3 later.
> >
> > Actually I don't think we need to split out a library for mpv here;
> > there are two things we can do in the short term:
> >
> > 1. Build MPV strictly as a shared library (-Dbuild=shared) or something
> > in Meson. Then Meson doesn't output all these Requires.private
> > dependencies, which are only useful for static linking, and which
> > pkg-config confusingly uses for its --exists check.
> >
> > 2. On core-updates, I've been experimenting with replacing pkg-config
> > with pkgconf, which seems to be designed better for avoiding the above
> > pkg-config's pitfall. Currently stuck on a hard to understand cycle.
>
> I've implemented 2. above; see: <https://issues.guix.gnu.org/68813>,
> which removes the need to propagate pkg-config *.private fields, which
> should only be needed when doing static builds.
>
> I'm thus closing this issue. Let me know if I've missed anything!


Great to see! Thank you very much!
?