Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 686440 - =www-client/firefox-67.0*[system-av1] checks for >=dev-lang/nasm-2.13
Summary: =www-client/firefox-67.0*[system-av1] checks for >=dev-lang/nasm-2.13
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords: InOverlay
Depends on:
Blocks:
 
Reported: 2019-05-21 05:35 UTC by Arthur Zamarin
Modified: 2019-08-11 23:44 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (firefox-build.log,28.73 KB, text/plain)
2019-05-21 05:36 UTC, Arthur Zamarin
Details
7002_system_av1_support.patch (7002_system_av1_support.patch,2.68 KB, patch)
2019-06-12 03:10 UTC, Arfrever Frehtes Taifersar Arahesis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2019-05-21 05:35:44 UTC
emerging firefox-67 without nasm got me error

ERROR: nasm 2.13 or greater is required for AV1 support. Either install nasm or add --disable-av1 to your configure options.
Comment 1 Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2019-05-21 05:36:32 UTC
Created attachment 577446 [details]
build.log
Comment 2 Arfrever Frehtes Taifersar Arahesis 2019-05-22 00:40:36 UTC
https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/firefox/firefox-67.0.ebuild?id=1f4ff49d3d677287810b8fad1958f0e2fffca550#n165 contains "!system-av1? ( dev-lang/nasm )" dependency. Probably it should be changed to:
!system-av1? ( >=dev-lang/nasm-2.13 )


https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/firefox/firefox-67.0.ebuild?id=1f4ff49d3d677287810b8fad1958f0e2fffca550#n501 contains:
mozconfig_use_with system-av1
Since the error message says "Either install nasm or add --disable-av1 to your configure options.", this line probably should be changed to:
mozconfig_use_enable system-av1
Comment 3 Arfrever Frehtes Taifersar Arahesis 2019-05-22 00:41:36 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #2)
> mozconfig_use_enable system-av1

mozconfig_use_enable system-av1 av1
Comment 4 Arfrever Frehtes Taifersar Arahesis 2019-06-12 00:58:14 UTC
Actual cause:

--- firefox-66.0.5/toolkit/moz.configure
+++ firefox-67.0/toolkit/moz.configure
@@ -420,23 +431,27 @@
 set_define('MOZ_FFMPEG', ffmpeg)
 imply_option('--enable-fmp4', ffmpeg, '--enable-ffmpeg')
 
-# Libaom AV1 Video Codec Support
+# AV1 Video Codec Support
 # ==============================================================
-option('--enable-av1',
-        help='Enable libaom for av1 video support')
+option('--disable-av1',
+        help='Disable av1 video support')
 
-@depends('--enable-av1', target, c_compiler)
-def av1(value, target, c_compiler):
-    enabled = bool(value)
-    if value.origin == 'default':
-        if target.os == 'WINNT' and target.cpu == 'x86' and \
-                c_compiler and c_compiler.type == 'msvc':
-            enabled = False
-        else:
-            enabled = True
-    if enabled:
+@depends('--enable-av1')
+def av1(value):
+    if value:
         return True
 
+@depends(target, nasm_version, when=av1 & compile_environment)
+def dav1d_asm(target, nasm_version):
+    if target.os != 'Android' and target.cpu in ('x86', 'x86_64'):
+        if nasm_version < '2.13':
+            die('nasm 2.13 or greater is required for AV1 support. '
+                'Either install nasm or add --disable-av1 to your configure options.')
+        return True
+
+
+set_config('MOZ_DAV1D_ASM', dav1d_asm)
+set_define('MOZ_DAV1D_ASM', dav1d_asm)
 set_config('MOZ_AV1', av1)
 set_define('MOZ_AV1', av1)
 


This means that:

1. 7002_system_av1_support.patch should be updated so that the check for nasm is disabled when --with-system-av1 is used.

2. Dependencies should be updated:
-	!system-av1? ( dev-lang/nasm )"
+	!system-av1? ( >=dev-lang/nasm-2.13 )
Comment 5 Arfrever Frehtes Taifersar Arahesis 2019-06-12 03:10:25 UTC
Created attachment 579584 [details, diff]
7002_system_av1_support.patch

Updated version of 7002_system_av1_support.patch

Main addition is:

-@depends(target, nasm_version, when=av1 & compile_environment)
+@depends(target, nasm_version, when=av1 & depends(system_av1)(lambda v: not v) & compile_environment)
 def dav1d_asm(target, nasm_version):
     if target.os != 'Android' and target.cpu in ('x86', 'x86_64'):
         if nasm_version < '2.13':
Comment 6 Arfrever Frehtes Taifersar Arahesis 2019-06-12 03:22:26 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #5)

Patch was successfully tested with media-libs/dav1d and media-libs/libaom installed and /usr/bin/nasm temporarily renamed:
  With USE="system-av1", no error about missing nasm.
  With USE="-system-av1", error about missing nasm.


'depends(system_av1)(lambda v: not v)' is probably the shorted working solution.
Seemingly simpler '(not system_av1)' results in exception:
 0:10.26   File "/var/tmp/portage/www-client/firefox-67.0.2/work/firefox-67.0.2/toolkit/moz.configure", line 484, in <module>
 0:10.26     @depends(target, nasm_version, when=av1 & (not system_av1) & compile_environment)
 0:10.26   File "/var/tmp/portage/www-client/firefox-67.0.2/work/firefox-67.0.2/python/mozbuild/mozbuild/configure/__init__.py", line 103, in __nonzero__
 0:10.26     'Cannot do boolean operations on @depends functions.')
 0:10.26 mozbuild.configure.ConfigureError: Cannot do boolean operations on @depends functions.
 0:10.31 *** Fix above errors and then restart with\
 0:10.31                "./mach build"
 0:10.31 gmake: *** [client.mk:115: configure] Error 1
Comment 7 Jory A. Pratt gentoo-dev 2019-06-13 02:09:06 UTC
Beta ebuilds have the updated dep.
Comment 8 Arfrever Frehtes Taifersar Arahesis 2019-06-13 02:50:42 UTC
https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=0117d35cdf09b986540378992a0d60e5ae0be9c4
https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=aacc29fbfa20f9261b87be5e13055152f152148a


Since upstream build system has "target.cpu in ('x86', 'x86_64')" check, it might be better to specify more accurate dependency in ebuild:
-	!system-av1? ( >=dev-lang/nasm-2.13 )"
+	!system-av1? (
+		amd64? ( >=dev-lang/nasm-2.13 )
+		x86? ( >=dev-lang/nasm-2.13 )
+	)"
Comment 9 Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2019-08-11 06:54:07 UTC
Fixed in tree (When USE="-system-av1" depends on "dev-lang/nasm").
Thank you.