Patchwork [v3] libav: set LICENSE and LICENSE_FLAGS according to PACKAGECONFIG options

login
register
mail settings
Submitter Matthieu CRAPET
Date July 15, 2014, 2:54 p.m.
Message ID <1405436079-13220-1-git-send-email-Matthieu.Crapet@ingenico.com>
Download mbox | patch
Permalink /patch/75649/
State New
Headers show

Comments

Matthieu CRAPET - July 15, 2014, 2:54 p.m.
+ fix: drop unwanted --enable-libtheora & --enable-libvorbis in EXTRA_OECONF

Reported-by: Andreas Oberritter <obi@opendreambox.org>
Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
---
 meta/recipes-multimedia/libav/libav.inc | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
Andreas Oberritter - July 15, 2014, 4:39 p.m.
Hello Matthieu,

On 15.07.2014 16:54, Matthieu Crapet wrote:
> + fix: drop unwanted --enable-libtheora & --enable-libvorbis in EXTRA_OECONF
> 
> Reported-by: Andreas Oberritter <obi@opendreambox.org>
> Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
> ---
>  meta/recipes-multimedia/libav/libav.inc | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/meta/recipes-multimedia/libav/libav.inc b/meta/recipes-multimedia/libav/libav.inc
> index 1d617a2..cd5ac5f 100644
> --- a/meta/recipes-multimedia/libav/libav.inc
> +++ b/meta/recipes-multimedia/libav/libav.inc
> @@ -7,8 +7,7 @@ DESCRIPTION = "Libav is a friendly and community-driven effort to provide its us
>  HOMEPAGE = "http://libav.org/"
>  SECTION = "libs"
>  
> -LICENSE = "GPLv2+"
> -LICENSE_FLAGS = "commercial"
> +LICENSE = "GPLv2+ & LGPLv2.1+"

I think this is wrong (if it means dual licensed). To quote from the
LICENSE file:

"Most files in Libav are under the GNU Lesser General Public License
version 2.1 or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for
details. Some other files have MIT/X11/BSD-style licenses. In
combination the LGPL v2.1+ applies to Libav.

Some optional parts of Libav are licensed under the GNU General Public
License version 2 or later (GPL v2+). See the file COPYING.GPLv2 for
details. None of these parts are used by default, you have to explicitly
pass --enable-gpl to configure to activate them. In this case, Libav's
license changes to GPL v2+."

So with --enable-gpl hardcoded in EXTRA_OECONF, GPLv2+ was the right choice.

>  
>  # Provides ffmpeg compat, see http://libav.org/about.html
>  PROVIDES = "ffmpeg"
> @@ -44,14 +43,20 @@ PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
>  PACKAGECONFIG[x11] = "--enable-x11grab,--disable-x11grab,virtual/libx11 libxfixes libxext xproto virtual/libsdl"
>  PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
>  
> -# Check codecs that require --enable-nonfree
> -USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'faac', 'openssl' ], 'yes', '', d)}"
> +# Check codecs that trigger nonfree license
> +python () {
> +	pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split()
> +	nonfree = [ 'faac', 'openssl' ]
> +	if set(pkgconfig) & set(nonfree):
> +		d.setVar('LICENSE', 'Proprietary')
> +		d.setVar('LICENSE_FLAGS', 'commercial')
> +}

Do you think it would be feasible to add code which decides whether to
set --enable-gpl or not? Because --enable-gpl forbids linking libav for
programs with incompatible licenses.

While your approach is to set the license according to enabled codecs,
my approach is to choose the license and then enable all possible
codecs, because for me the license is more important than some codecs. I
think libav would abort configuration anyway if it encountered
incompatible flags.

Regards,
Andreas
Matthieu CRAPET - July 16, 2014, 6:43 a.m.
Hi again,

> Some optional parts of Libav are licensed under the GNU General Public License version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. 
> None of these parts are used by default, you have to explicitly pass --enable-gpl to configure to activate them. In this case, Libav's license changes to GPL v2+."

I may misunderstood something here.

For example:
- libavfiler. It contains yadif code which is GPLv2+ and frei0r code is LGPLv2.1+. Libavfiler is clearly contaminated: 
LICENSE_libavfilter = "GPLv2+"
- libavutils is 100% LGPL
LICENSE_libavutils = " LGPLv2.1+"

Giving --enable-gpl to configure does not convert pure 100% LGPL licensed library to GPL license. Am I wrong?

> Do you think it would be feasible to add code which decides whether to set --enable-gpl or not? Because --enable-gpl forbids linking libav for programs with incompatible licenses.
Yes it's possible.

Regards,
M
Andreas Oberritter - July 16, 2014, 8:31 a.m.
On 16.07.2014 08:43, Matthieu CRAPET wrote:
> Hi again,
> 
>> Some optional parts of Libav are licensed under the GNU General Public License version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. 
>> None of these parts are used by default, you have to explicitly pass --enable-gpl to configure to activate them. In this case, Libav's license changes to GPL v2+."
> 
> I may misunderstood something here.
> 
> For example:
> - libavfiler. It contains yadif code which is GPLv2+ and frei0r code is LGPLv2.1+. Libavfiler is clearly contaminated: 

Yadif needs to be enabled explicitly with --enable-gpl. frei0r is 
disabled by default. If enabled, it's linked at runtime using dlopen. 
At least, this is what the 'configure' script suggests.

> LICENSE_libavfilter = "GPLv2+"
> - libavutils is 100% LGPL
> LICENSE_libavutils = " LGPLv2.1+"
> 
> Giving --enable-gpl to configure does not convert pure 100% LGPL licensed library to GPL license. Am I wrong?

If you combine GPL'ed and LGPL'ed code, the resulting binary will be GPL'ed.

https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License#Compatibility

Regards,
Andreas
Andreas Oberritter - July 16, 2014, 8:42 a.m.
On 16.07.2014 10:31, Andreas Oberritter wrote:
> On 16.07.2014 08:43, Matthieu CRAPET wrote:
>> Giving --enable-gpl to configure does not convert pure 100% LGPL licensed library to GPL license. Am I wrong?
> 
> If you combine GPL'ed and LGPL'ed code, the resulting binary will be GPL'ed.
> 
> https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License#Compatibility

Sorry, I misunderstood that part of your question. If libavutils
contains LGPL'ed code only, then there's no technical reason to
automatically convert the license of libavutils to GPL, just because
--enable-gpl was given on the comand-line. However, the libav 'LICENSE'
clearly states that it's still the case anyway, but for non-technical
reasons.

Regards,
Andreas
Matthieu CRAPET - July 16, 2014, 9:05 a.m.
>> However, the libav 'LICENSE' clearly states that it's still the case anyway, but for non-technical reasons.

If so, I'll post a v4 patch asap.

Regards,
M
Saul Wold - July 16, 2014, 4:31 p.m.
On 07/16/2014 02:05 AM, Matthieu CRAPET wrote:
>>> However, the libav 'LICENSE' clearly states that it's still the case anyway, but for non-technical reasons.
>
> If so, I'll post a v4 patch asap.
>

We also saw a build failure with this patch last night, please see this 
log file:

https://autobuilder.yoctoproject.org/main/builders/nightly-world/builds/164/steps/BuildImages/logs/stdio

>
> You can also run generated qemu images with a command like 'runqemu qemux86'
> Parsing recipes...done.
> Parsing of 889 .bb files complete (0 cached, 889 parsed). 2154 targets, 166 skipped, 0 masked, 0 errors.
> NOTE: Resolving any missing task queue dependencies
> ERROR: Nothing PROVIDES 'lib32-x264' (but virtual:multilib:lib32:/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/meta/recipes-multimedia/libav/libav_0.8.11.bb DEPENDS on or otherwise requires it)
> ERROR: lib32-x264 was skipped: because it has a restricted license not whitelisted in LICENSE_FLAGS_WHITELIST
> ERROR: Nothing PROVIDES 'x264' (but /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/meta/recipes-multimedia/libav/libav_0.8.11.bb DEPENDS on or otherwise requires it)
> ERROR: x264 was skipped: because it has a restricted license not whitelisted in LICENSE_FLAGS_WHITELIST
> ERROR: Nothing RPROVIDES 'lib32-libav' (but virtual:multilib:lib32:/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/meta/recipes-multimedia/libav/libav_0.8.11.bb RDEPENDS on or otherwise requires it)
> ERROR: No eligible RPROVIDERs exist for 'lib32-libav'
> NOTE: Runtime target 'lib32-libav' is unbuildable, removing...
> Missing or unbuildable dependency chain was: ['lib32-libav']
> ERROR: Nothing RPROVIDES 'lib32-libav-dev' (but virtual:multilib:lib32:/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/meta/recipes-multimedia/libav/libav_0.8.11.bb RDEPENDS on or otherwise requires it)
> ERROR: No eligible RPROVIDERs exist for 'lib32-libav-dev'
> NOTE: Runtime target 'lib32-libav-dev' is unbuildable, removing...
> Missing or unbuildable dependency chain was: ['lib32-libav-dev']
> ERROR: Nothing RPROVIDES 'libav' (but /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/meta/recipes-multimedia/libav/libav_0.8.11.bb RDEPENDS on or otherwise requires it)
> ERROR: No eligible RPROVIDERs exist for 'libav'
> NOTE: Runtime target 'libav' is unbuildable, removing...
> Missing or unbuildable dependency chain was: ['libav']
> ERROR: Nothing RPROVIDES 'libav-dev' (but /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/meta/recipes-multimedia/libav/libav_0.8.11.bb RDEPENDS on or otherwise requires it)
> ERROR: No eligible RPROVIDERs exist for 'libav-dev'
> NOTE: Runtime target 'libav-dev' is unbuildable, removing...
> Missing or unbuildable dependency chain was: ['libav-dev']


Please look into this failure as you work on your next version of the patch.

Sau!

> Regards,
> M
>

Patch

diff --git a/meta/recipes-multimedia/libav/libav.inc b/meta/recipes-multimedia/libav/libav.inc
index 1d617a2..cd5ac5f 100644
--- a/meta/recipes-multimedia/libav/libav.inc
+++ b/meta/recipes-multimedia/libav/libav.inc
@@ -7,8 +7,7 @@  DESCRIPTION = "Libav is a friendly and community-driven effort to provide its us
 HOMEPAGE = "http://libav.org/"
 SECTION = "libs"
 
-LICENSE = "GPLv2+"
-LICENSE_FLAGS = "commercial"
+LICENSE = "GPLv2+ & LGPLv2.1+"
 
 # Provides ffmpeg compat, see http://libav.org/about.html
 PROVIDES = "ffmpeg"
@@ -44,14 +43,20 @@  PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
 PACKAGECONFIG[x11] = "--enable-x11grab,--disable-x11grab,virtual/libx11 libxfixes libxext xproto virtual/libsdl"
 PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
 
-# Check codecs that require --enable-nonfree
-USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'faac', 'openssl' ], 'yes', '', d)}"
+# Check codecs that trigger nonfree license
+python () {
+	pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split()
+	nonfree = [ 'faac', 'openssl' ]
+	if set(pkgconfig) & set(nonfree):
+		d.setVar('LICENSE', 'Proprietary')
+		d.setVar('LICENSE_FLAGS', 'commercial')
+}
 
 EXTRA_OECONF = " \
     --enable-shared \
     --enable-pthreads \
     --enable-gpl \
-    ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
+    ${@bb.utils.contains('LICENSE', 'Proprietary', '--enable-nonfree', '', d)} \
     --enable-avfilter \
     \
     --cross-prefix=${TARGET_PREFIX} \
@@ -60,8 +65,6 @@  EXTRA_OECONF = " \
     --enable-avserver \
     --enable-avplay \
     --ld="${CCLD}" \
-    --enable-libtheora  \
-    --enable-libvorbis \
     --arch=${TARGET_ARCH} \
     --target-os="linux" \
     --enable-cross-compile \