Bug 1259275 - Don't check for yasm when building with --disable-compile-environment. r?ted
new file mode 100644
--- /dev/null
+++ b/build/moz.configure/toolchain.configure
@@ -0,0 +1,61 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# yasm detection
+# ==============================================================
+yasm = check_prog('YASM', ['yasm'], allow_missing=True)
+
+@depends(yasm)
+@checking('yasm version')
+@advanced
+def yasm_version(yasm):
+ if yasm:
+ import subprocess
+ try:
+ version = Version(subprocess.check_output(
+ [yasm, '--version']
+ ).splitlines()[0].split()[1])
+ return version
+ except subprocess.CalledProcessError as e:
+ error('Failed to get yasm version: %s' % e.message)
+
+# Until we move all the yasm consumers out of old-configure.
+# bug 1257904
+add_old_configure_assignment('_YASM_MAJOR_VERSION',
+ delayed_getattr(yasm_version, 'major'))
+add_old_configure_assignment('_YASM_MINOR_VERSION',
+ delayed_getattr(yasm_version, 'minor'))
+
+@depends(yasm, target)
+def yasm_asflags(yasm, target):
+ if yasm:
+ asflags = {
+ ('OSX', 'x86'): '-f macho32',
+ ('OSX', 'x86_64'): '-f macho64',
+ ('WINNT', 'x86'): '-f win32',
+ ('WINNT', 'x86_64'): '-f x64',
+ }.get((target.os, target.cpu), None)
+ if asflags is None:
+ # We're assuming every x86 platform we support that's
+ # not Windows or Mac is ELF.
+ if target.cpu == 'x86':
+ asflags = '-f elf32'
+ elif target.cpu == 'x86_64':
+ asflags = '-f elf64'
+ if asflags:
+ asflags += ' -rnasm -pnasm'
+ return asflags
+
+set_config('YASM_ASFLAGS', yasm_asflags)
+
+@depends(yasm_asflags)
+def have_yasm(value):
+ if value:
+ return True
+
+set_config('HAVE_YASM', have_yasm)
+# Until the YASM variable is not necessary in old-configure.
+add_old_configure_assignment('YASM', have_yasm)
--- a/moz.configure
+++ b/moz.configure
@@ -49,16 +49,23 @@ option('--disable-compile-environment',
@depends('--disable-compile-environment')
def compile_environment(value):
if value:
return True
set_config('COMPILE_ENVIRONMENT', compile_environment)
add_old_configure_assignment('COMPILE_ENVIRONMENT', compile_environment)
+@depends('--disable-compile-environment', '--help')
+def toolchain_include(value, help):
+ if value:
+ return 'build/moz.configure/toolchain.configure'
+
+include(toolchain_include)
+
@depends('--help')
@advanced
def build_backends_choices(help):
from mozbuild.backend import backends
return tuple(backends)
@@ -130,73 +137,16 @@ def perl_version_check(min_version):
def require_full_perl_installation(has_full_perl_installation):
if not has_full_perl_installation:
error('Cannot find Config.pm or $Config{archlib}. '
'A full perl installation is required.')
perl_version_check('5.006')
-# yasm detection
-# ==============================================================
-yasm = check_prog('YASM', ['yasm'], allow_missing=True)
-
-@depends(yasm)
-@checking('yasm version')
-@advanced
-def yasm_version(yasm):
- if yasm:
- import subprocess
- try:
- version = Version(subprocess.check_output(
- [yasm, '--version']
- ).splitlines()[0].split()[1])
- return version
- except subprocess.CalledProcessError as e:
- error('Failed to get yasm version: %s' % e.message)
-
-# Until we move all the yasm consumers out of old-configure.
-# bug 1257904
-add_old_configure_assignment('_YASM_MAJOR_VERSION',
- delayed_getattr(yasm_version, 'major'))
-add_old_configure_assignment('_YASM_MINOR_VERSION',
- delayed_getattr(yasm_version, 'minor'))
-
-@depends(yasm, target)
-def yasm_asflags(yasm, target):
- if yasm:
- asflags = {
- ('OSX', 'x86'): '-f macho32',
- ('OSX', 'x86_64'): '-f macho64',
- ('WINNT', 'x86'): '-f win32',
- ('WINNT', 'x86_64'): '-f x64',
- }.get((target.os, target.cpu), None)
- if asflags is None:
- # We're assuming every x86 platform we support that's
- # not Windows or Mac is ELF.
- if target.cpu == 'x86':
- asflags = '-f elf32'
- elif target.cpu == 'x86_64':
- asflags = '-f elf64'
- if asflags:
- asflags += ' -rnasm -pnasm'
- return asflags
-
-set_config('YASM_ASFLAGS', yasm_asflags)
-
-@depends(yasm_asflags)
-def have_yasm(value):
- if value:
- return True
-
-set_config('HAVE_YASM', have_yasm)
-# Until the YASM variable is not necessary in old-configure.
-add_old_configure_assignment('YASM', have_yasm)
-
-
# Miscellaneous programs
# ==============================================================
check_prog('DOXYGEN', ('doxygen',), allow_missing=True)
check_prog('TAR', ('gnutar', 'gtar', 'tar'))
check_prog('UNZIP', ('unzip',))
check_prog('XARGS', ('xargs',))
check_prog('ZIP', ('zip',))
--- a/old-configure.in
+++ b/old-configure.in
@@ -4818,17 +4818,17 @@ MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
fi
dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
dnl files.
-if test -n "$MOZ_LIBJPEG_TURBO"; then
+if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
dnl Do we support libjpeg-turbo on this platform?
case "$OS_ARCH:$CPU_ARCH" in
Darwin:x86)
LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
;;
Darwin:x86_64)
LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
@@ -4905,17 +4905,17 @@ case "$OS_ARCH:$CPU_ARCH" in
;;
*:x86_64)
MOZ_LIBAV_FFT=1
;;
esac
dnl Detect if we can use yasm to compile libav's assembly
-if test -n "$MOZ_LIBAV_FFT"; then
+if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
AC_DEFINE(MOZ_LIBAV_FFT)
dnl Do we support libav-fft on this platform?
case "$OS_ARCH:$CPU_ARCH" in
Darwin:x86_64)
LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
;;
WINNT:x86)
LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"