# HG changeset patch # User Mike Hommey # Date 1545219548 0 # Wed Dec 19 11:39:08 2018 +0000 # Node ID 1a8798cea67c7c12354545172447be1c70cd6549 # Parent c346081894bfba20e1976f8920210650059bd2f2 Bug 1515257 - Move --with-system-libvpx to python configure. r=firefox-build-system-reviewers,ted Depends on D14951 Differential Revision: https://phabricator.services.mozilla.com/D14952 diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure --- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -245,17 +245,16 @@ def old_configure_options(*options): '--with-nss-prefix', '--with-qemu-exe', '--with-sixgill', '--with-soft-float', '--with-system-bz2', '--with-system-icu', '--with-system-jpeg', '--with-system-libevent', - '--with-system-libvpx', '--with-system-nspr', '--with-system-nss', '--with-system-png', '--with-system-zlib', '--with-thumb', '--with-thumb-interwork', '--with-unify-dist', '--with-user-appdir', diff --git a/old-configure.in b/old-configure.in --- a/old-configure.in +++ b/old-configure.in @@ -1779,18 +1779,16 @@ dnl ==================================== MOZ_ARG_HEADER(Application) ENABLE_SYSTEM_EXTENSION_DIRS=1 MOZ_BRANDING_DIRECTORY= MOZ_OFFICIAL_BRANDING= MOZ_FEEDS=1 MOZ_AUTH_EXTENSION=1 -VPX_USE_YASM= -VPX_ASFLAGS= LIBJPEG_TURBO_AS= LIBJPEG_TURBO_ASFLAGS= MOZ_PREF_EXTENSIONS=1 MOZ_SPELLCHECK=1 MOZ_TOOLKIT_SEARCH=1 MOZ_UNIVERSALCHARDET=1 MOZ_XUL=1 MOZ_ZIPWRITER=1 @@ -2155,123 +2153,16 @@ if test -n "$MOZ_APPLEMEDIA"; then # We load VideoToolbox and CoreMedia dynamically, so they don't appear here. LDFLAGS="$LDFLAGS -framework AudioToolbox" dnl Verify CoreMedia is available. AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [], [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])]) fi fi # COMPILE_ENVIRONMENT -dnl system libvpx Support -dnl ======================================================== -MOZ_ARG_WITH_BOOL(system-libvpx, -[ --with-system-libvpx Use system libvpx (located with pkgconfig)], - MOZ_SYSTEM_LIBVPX=1) - -MOZ_LIBVPX_CFLAGS= -MOZ_LIBVPX_LIBS= - -_SAVE_CFLAGS=$CFLAGS -_SAVE_LIBS=$LIBS -if test -n "$MOZ_SYSTEM_LIBVPX"; then - dnl ============================ - dnl === libvpx Version check === - dnl ============================ - dnl Check to see if we have a system libvpx package. - PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0) - - CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS" - LIBS="$LIBS $MOZ_LIBVPX_LIBS" - - MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], - [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])]) - - AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], - [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])]) -fi -CFLAGS=$_SAVE_CFLAGS -LIBS=$_SAVE_LIBS - -AC_SUBST(MOZ_SYSTEM_LIBVPX) -AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS) -AC_SUBST_LIST(MOZ_LIBVPX_LIBS) - -if test -z "$MOZ_SYSTEM_LIBVPX"; then - - dnl Detect if we can use an assembler to compile optimized assembly for libvpx. - dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32. - dnl We currently require gcc on all arm platforms. - - dnl See if we have assembly on this platform. - case "$OS_ARCH:$CPU_ARCH" in - Darwin:x86) - VPX_USE_YASM=1 - ;; - Darwin:x86_64) - VPX_USE_YASM=1 - ;; - WINNT:x86_64) - VPX_USE_YASM=1 - ;; - WINNT:x86) - dnl Check for yasm 1.1 or greater. - if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then - AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed. Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.]) - elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then - AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.]) - else - VPX_USE_YASM=1 - dnl The encoder needs obj_int_extract to get asm offsets. - fi # COMPILE_ENVIRONMENT and others - ;; - *:arm*) - if test -n "$GNU_AS" ; then - dnl These flags are a lie; they're just used to enable the requisite - dnl opcodes; actual arch detection is done at runtime. - VPX_ASFLAGS="-march=armv7-a -mfpu=neon" - dnl Building with -mfpu=neon requires either the "softfp" or the - dnl "hardfp" ABI. Depending on the compiler's default target, and the - dnl CFLAGS, the default ABI might be neither, in which case it is the - dnl "softfloat" ABI. - dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so - dnl we can safely mix code built with both ABIs. So, if we detect - dnl that compiling uses the "softfloat" ABI, force the use of the - dnl "softfp" ABI instead. - dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the - dnl "softfloat" ABI, not the "softfp" ABI. - dnl Note: VPX_ASFLAGS is also used in CFLAGS. - AC_TRY_COMPILE([], - [#ifndef __SOFTFP__ - #error "compiler target supports -mfpu=neon, so we don't have to add extra flags" - #endif], - VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp" - ) - fi - ;; - *:x86) - if $CC -E -dM -= 1.5.0') + + check_header('vpx/vpx_decoder.h', flags=vpx.cflags, onerror=lambda: die( + "Couldn't find vpx/vpx_decoder.h, which is required to build " + "with system libvpx. Use --without-system-libvpx to build " + "with in-tree libvpx.")) + + check_symbol('vpx_codec_dec_init_ver', flags=vpx.libs, onerror=lambda: die( + "--with-system-libvpx requested but symbol vpx_codec_dec_init_ver " + "not found" + )) + + set_config('MOZ_SYSTEM_LIBVPX', True) + + + @depends('--with-system-libvpx', target, yasm_version, gnu_as) + def in_tree_vpx(system_libvpx, target, yasm_version, gnu_as): + if system_libvpx: + return + + use_yasm = (target.cpu in ('x86', 'x86_64')) or None + arm_asm = (target.cpu == 'arm' and gnu_as) or None + + if use_yasm: + if not yasm_version: + die('Yasm is required to build on this architecture.') + if target.kernel == 'WINNT' and yasm_version < '1.1': + die('Yasm 1.1 or greater is required to build libvpx for Windows.') + + return namespace(arm_asm=arm_asm, use_yasm=use_yasm) + + + # Building with -mfpu=neon requires either the "softfp" or the + # "hardfp" ABI. Depending on the compiler's default target, and the + # CFLAGS, the default ABI might be neither, in which case it is the + # "softfloat" ABI. + # The "softfloat" ABI is binary-compatible with the "softfp" ABI, so + # we can safely mix code built with both ABIs. So, if we detect + # that compiling uses the "softfloat" ABI, force the use of the + # "softfp" ABI instead. + # Confusingly, the __SOFTFP__ preprocessor variable indicates the + # "softfloat" ABI, not the "softfp" ABI. + # Note: VPX_ASFLAGS is also used in CFLAGS. + softfp = cxx_compiler.try_compile(body=''' + #ifndef __SOFTFP__ + #error "compiler target supports -mfpu=neon, so we don't have to add extra flags" + #endif''', when=in_tree_vpx.arm_asm) + + + @depends(in_tree_vpx, softfp, target) + def vpx_as_flags(vpx, softfp, target): + flags = [] + if vpx and vpx.arm_asm: + # These flags are a lie; they're just used to enable the requisite + # opcodes; actual arch detection is done at runtime. + flags = ['-march=armv7-a', '-mfpu=neon'] + if softfp: + flags.append('-mfloat-abi=softfp') + elif vpx and vpx.use_yasm and target.os != 'WINNT' and target.cpu != 'x86_64': + flags = ['-DPIC'] + return flags + + + set_config('VPX_USE_YASM', in_tree_vpx.use_yasm) + set_config('VPX_ASFLAGS', vpx_as_flags) + add_old_configure_assignment('VPX_ASFLAGS', vpx_as_flags) + + # Alternative Crashreporter setting option("--with-crashreporter-url", env="MOZ_CRASHREPORTER_URL", default="https://crash-reports.mozilla.com/", nargs=1, help="Set an alternative crashreporter url") set_config("MOZ_CRASHREPORTER_URL", depends("--with-crashreporter-url")(lambda x: x[0].rstrip("/")))