Skip to content

Commit

Permalink
bug 1248020 - convert a bunch of moz.build files to use USE_YASM. r=m…
Browse files Browse the repository at this point in the history
…shal

MozReview-Commit-ID: n59TejhJq6

--HG--
extra : rebase_source : a5fd47c48ae4f03fcd2b699d7283a8838d24449c
extra : amend_source : cdd00e6f76195956dd83f8a2e3109d453459d158
extra : histedit_source : 4e36a2c2ff01a2cb352a46b2f4d9062f14be5232
  • Loading branch information
luser committed Mar 3, 2016
1 parent a673bd6 commit 86995dd
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 86 deletions.
7 changes: 0 additions & 7 deletions config/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,7 @@ ifneq (,$(MOZ_DEBUG)$(MOZ_DEBUG_SYMBOLS))
_DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
endif

ifeq ($(YASM),$(AS))
# yasm doesn't like the GNU as flags we may already have in ASFLAGS, so reset.
ASFLAGS := $(_DEBUG_ASFLAGS)
# yasm doesn't like -c
AS_DASH_C_FLAG=
else
ASFLAGS += $(_DEBUG_ASFLAGS)
endif
OS_CFLAGS += $(_DEBUG_CFLAGS)
OS_CXXFLAGS += $(_DEBUG_CFLAGS)
OS_LDFLAGS += $(_DEBUG_LDFLAGS)
Expand Down
3 changes: 2 additions & 1 deletion media/ffvpx/ffvpxcommon.mozbuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
ASFLAGS += CONFIG['FFVPX_ASFLAGS']
ASFLAGS += ['-I%s/media/ffvpx' % TOPSRCDIR]

if CONFIG['FFVPX_AS']:
if CONFIG['FFVPX_ASFLAGS']:
USE_YASM = True
if CONFIG['OS_ARCH'] == 'WINNT':
# Fix inline symbols and math defines for windows.
DEFINES['_USE_MATH_DEFINES'] = True
Expand Down
2 changes: 1 addition & 1 deletion media/ffvpx/libavcodec/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Due to duplicate file names, we compile libavutil/x86 in its own
# moz.build file.
if CONFIG['FFVPX_AS']:
if CONFIG['FFVPX_ASFLAGS']:
DIRS += ['x86']

SharedLibrary('mozavcodec')
Expand Down
7 changes: 0 additions & 7 deletions media/ffvpx/libavcodec/x86/Makefile.in

This file was deleted.

2 changes: 1 addition & 1 deletion media/ffvpx/libavutil/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Due to duplicate file names, we compile libavutil/x86 in its own
# moz.build file.
if CONFIG['FFVPX_AS']:
if CONFIG['FFVPX_ASFLAGS']:
DIRS += ['x86']

SharedLibrary('mozavutil')
Expand Down
6 changes: 0 additions & 6 deletions media/ffvpx/libavutil/x86/Makefile.in

This file was deleted.

6 changes: 0 additions & 6 deletions media/libav/Makefile.in

This file was deleted.

6 changes: 4 additions & 2 deletions media/libav/libavcommon.mozbuild
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Add assembler flags and includes
ASFLAGS += CONFIG['LIBAV_FFT_ASFLAGS']
ASFLAGS += ['-I%s/media/libav' % TOPSRCDIR]
if CONFIG['LIBAV_FFT_ASFLAGS']:
ASFLAGS += CONFIG['LIBAV_FFT_ASFLAGS']
ASFLAGS += ['-I%s/media/libav' % TOPSRCDIR]
USE_YASM = True

if CONFIG['OS_ARCH'] == 'WINNT':
# Fix inline symbols and math defines for windows.
Expand Down
6 changes: 0 additions & 6 deletions media/libav/libavutil/x86/Makefile.in

This file was deleted.

9 changes: 0 additions & 9 deletions media/libjpeg/Makefile.in

This file was deleted.

5 changes: 4 additions & 1 deletion media/libjpeg/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ SOURCES += [
'jctrans.c',
]

if CONFIG['LIBJPEG_TURBO_AS']:
if CONFIG['LIBJPEG_TURBO_USE_YASM']:
USE_YASM = True

if CONFIG['LIBJPEG_TURBO_ASFLAGS']:
if CONFIG['CPU_ARCH'] == 'arm':
SOURCES += [
'simd/jsimd_arm.c',
Expand Down
2 changes: 0 additions & 2 deletions media/libvpx/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# Set up the libvpx assembler config.

AS=$(VPX_AS)

ifdef VPX_ARM_ASM

ifdef VPX_AS_CONVERSION
Expand Down
3 changes: 3 additions & 0 deletions media/libvpx/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ SOURCES += files['SOURCES']
if CONFIG['MOZ_VPX_ERROR_CONCEALMENT']:
SOURCES += files['ERROR_CONCEALMENT']

if CONFIG['VPX_USE_YASM']:
USE_YASM = True

if CONFIG['VPX_X86_ASM']:
SOURCES += files['X86_ASM']

Expand Down
65 changes: 28 additions & 37 deletions old-configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -3596,7 +3596,7 @@ MOZ_WEBSPEECH=1
MOZ_WEBSPEECH_MODELS=
MOZ_WEBSPEECH_POCKETSPHINX=
MOZ_WEBSPEECH_TEST_BACKEND=1
VPX_AS=
VPX_USE_YASM=
VPX_ASFLAGS=
VPX_AS_CONVERSION=
VPX_X86_ASM=
Expand Down Expand Up @@ -5268,21 +5268,20 @@ if test -z "$MOZ_NATIVE_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.
VPX_AS=$YASM
VPX_NEED_OBJ_INT_EXTRACT=

dnl See if we have assembly on this platform.
case "$OS_ARCH:$CPU_ARCH" in
Darwin:x86)
VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
VPX_USE_YASM=1
VPX_X86_ASM=1
;;
Darwin:x86_64)
VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
VPX_USE_YASM=1
VPX_X86_ASM=1
;;
WINNT:x86_64)
VPX_ASFLAGS="-f x64 -rnasm -pnasm"
VPX_USE_YASM=1
VPX_X86_ASM=1
;;
WINNT:x86)
Expand All @@ -5292,14 +5291,13 @@ if test -z "$MOZ_NATIVE_LIBVPX"; then
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_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
VPX_USE_YASM=1
VPX_X86_ASM=1
dnl The encoder needs obj_int_extract to get asm offsets.
fi # COMPILE_ENVIRONMENT and others
;;
*:arm*)
if test -n "$GNU_AS" ; then
VPX_AS=$AS
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"
Expand All @@ -5326,22 +5324,26 @@ if test -z "$MOZ_NATIVE_LIBVPX"; then
;;
*:x86)
if $CC -E -dM -</dev/null | grep -q __ELF__; then
VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
VPX_USE_YASM=1
VPX_X86_ASM=1
fi
;;
*:x86_64)
if $CC -E -dM -</dev/null | grep -q __ELF__; then
VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
VPX_USE_YASM=1
VPX_X86_ASM=1
fi
;;
esac

if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
fi # COMPILE_ENVIRONMENT and others

if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
VPX_ASFLAGS="-DPIC"
fi

if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
dnl We prefer to get asm offsets using inline assembler, which the above
dnl compilers can do. When we're not using one of those, we have to fall
Expand Down Expand Up @@ -5880,6 +5882,7 @@ dnl ========================================================
dnl = libjpeg-turbo configuration
dnl ========================================================
MOZ_LIBJPEG_TURBO=
LIBJPEG_TURBO_USE_YASM=
if test -z "$MOZ_NATIVE_JPEG"; then
MOZ_LIBJPEG_TURBO=1
fi
Expand All @@ -5901,18 +5904,18 @@ if test -n "$MOZ_LIBJPEG_TURBO"; then
dnl Do we support libjpeg-turbo on this platform?
case "$OS_ARCH:$CPU_ARCH" in
Darwin:x86)
LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
;;
Darwin:x86_64)
LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
;;
Darwin:arm*)
;;
WINNT:x86)
LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
;;
WINNT:x86_64)
LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
;;
*:arm)
LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
Expand All @@ -5925,12 +5928,12 @@ if test -n "$MOZ_LIBJPEG_TURBO"; then
;;
*:x86)
if $CC -E -dM -</dev/null | grep -q __ELF__; then
LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
fi
;;
*:x86_64)
if $CC -E -dM -</dev/null | grep -q __ELF__; then
LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
fi
;;
esac
Expand All @@ -5942,9 +5945,9 @@ dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
dnl it doesn't exist or we have too old of a version.
x86_64|x86)
LIBJPEG_TURBO_AS=$YASM
LIBJPEG_TURBO_USE_YASM=1

if test -z "$LIBJPEG_TURBO_AS" ; then
if test -z "$YASM" ; then
AC_MSG_ERROR([Yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have Yasm installed. Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
fi

Expand All @@ -5960,15 +5963,7 @@ dnl it doesn't exist or we have too old of a version.
fi
fi
;;
dnl On other platforms, use the C compiler as the assembler.
*)
LIBJPEG_TURBO_AS=$AS
;;
esac
elif test -n "$MOZ_LIBJPEG_TURBO"; then
dnl Warn if we're not building the optimized routines, even though the user
dnl didn't specify --disable-libjpeg-turbo.
AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
fi

dnl ========================================================
Expand Down Expand Up @@ -5996,17 +5991,17 @@ if test -n "$MOZ_LIBAV_FFT"; then
dnl Do we support libav-fft on this platform?
case "$OS_ARCH:$CPU_ARCH" in
Darwin:x86_64)
LIBAV_FFT_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
;;
WINNT:x86)
LIBAV_FFT_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
;;
WINNT:x86_64)
LIBAV_FFT_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
;;
*:x86_64)
if $CC -E -dM -</dev/null | grep -q __ELF__; then
LIBAV_FFT_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
fi
;;
*)
Expand All @@ -6019,8 +6014,7 @@ if test -n "$LIBAV_FFT_ASFLAGS"; then
dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
dnl check for Yasm, and error out if it doesn't exist or we have too old of a
dnl version.
LIBAV_FFT_AS=$YASM
if test -z "$LIBAV_FFT_AS" ; then
if test -z "$YASM" ; then
AC_MSG_ERROR([Yasm is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
fi
dnl Check that we have the right yasm version. We require 1.0.1 or newer
Expand Down Expand Up @@ -6056,7 +6050,6 @@ esac
dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
if test -n "$MOZ_LIBAV_FFT"; then
FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
FFVPX_AS=$LIBAV_FFT_AS
fi
if test -n "$MOZ_FFVPX"; then
AC_DEFINE(MOZ_FFVPX)
Expand Down Expand Up @@ -8720,7 +8713,6 @@ AC_SUBST(MOZ_TREMOR)
AC_SUBST(MOZ_WMF)
AC_SUBST(MOZ_FFMPEG)
AC_SUBST(MOZ_FFVPX)
AC_SUBST(FFVPX_AS)
AC_SUBST_LIST(FFVPX_ASFLAGS)
AC_SUBST(MOZ_FMP4)
AC_SUBST(MOZ_EME)
Expand All @@ -8730,18 +8722,17 @@ AC_SUBST(MOZ_APPLEMEDIA)
AC_SUBST(MOZ_OMX_PLUGIN)
AC_SUBST(MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE)
AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
AC_SUBST(VPX_AS)
AC_SUBST(VPX_USE_YASM)
AC_SUBST_LIST(VPX_ASFLAGS)
AC_SUBST(VPX_AS_CONVERSION)
AC_SUBST(VPX_X86_ASM)
AC_SUBST(VPX_ARM_ASM)
AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
AC_SUBST(MOZ_CODE_COVERAGE)
AC_SUBST(LIBJPEG_TURBO_AS)
AC_SUBST(LIBJPEG_TURBO_USE_YASM)
AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
AC_SUBST(MOZ_LIBAV_FFT)
AC_SUBST(LIBAV_FFT_AS)
AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
AC_SUBST(MOZ_DEVTOOLS)

Expand Down

0 comments on commit 86995dd

Please sign in to comment.