Bug 1471581 - Fix libvpx mingw clang compilation.
MozReview-Commit-ID: GRQSHTvHCIA
--- a/media/libvpx/config/win/mingw32/vpx_config.asm
+++ b/media/libvpx/config/win/mingw32/vpx_config.asm
@@ -12,17 +12,17 @@
%define HAVE_SSE 1
%define HAVE_SSE2 1
%define HAVE_SSE3 1
%define HAVE_SSSE3 1
%define HAVE_SSE4_1 1
%define HAVE_AVX 1
%define HAVE_AVX2 1
%define HAVE_VPX_PORTS 1
-%define HAVE_PTHREAD_H 1
+%define HAVE_PTHREAD_H 0
%define CONFIG_DEPENDENCY_TRACKING 1
%define CONFIG_EXTERNAL_BUILD 1
%define CONFIG_INSTALL_DOCS 0
%define CONFIG_INSTALL_BINS 1
%define CONFIG_INSTALL_LIBS 1
%define CONFIG_INSTALL_SRCS 0
%define CONFIG_DEBUG 0
%define CONFIG_GPROF 0
--- a/media/libvpx/config/win/mingw32/vpx_config.h
+++ b/media/libvpx/config/win/mingw32/vpx_config.h
@@ -24,17 +24,19 @@
#define HAVE_SSE 1
#define HAVE_SSE2 1
#define HAVE_SSE3 1
#define HAVE_SSSE3 1
#define HAVE_SSE4_1 1
#define HAVE_AVX 1
#define HAVE_AVX2 1
#define HAVE_VPX_PORTS 1
-#define HAVE_PTHREAD_H 1
+#ifndef HAVE_PTHREAD_H
+#define HAVE_PTHREAD_H 0
+#endif
#define CONFIG_DEPENDENCY_TRACKING 1
#define CONFIG_EXTERNAL_BUILD 1
#define CONFIG_INSTALL_DOCS 0
#define CONFIG_INSTALL_BINS 1
#define CONFIG_INSTALL_LIBS 1
#define CONFIG_INSTALL_SRCS 0
#define CONFIG_DEBUG 0
#define CONFIG_GPROF 0
--- a/media/libvpx/config/win/mingw64/vpx_config.asm
+++ b/media/libvpx/config/win/mingw64/vpx_config.asm
@@ -12,17 +12,17 @@
%define HAVE_SSE 1
%define HAVE_SSE2 1
%define HAVE_SSE3 1
%define HAVE_SSSE3 1
%define HAVE_SSE4_1 1
%define HAVE_AVX 1
%define HAVE_AVX2 1
%define HAVE_VPX_PORTS 1
-%define HAVE_PTHREAD_H 1
+%define HAVE_PTHREAD_H 0
%define CONFIG_DEPENDENCY_TRACKING 1
%define CONFIG_EXTERNAL_BUILD 1
%define CONFIG_INSTALL_DOCS 0
%define CONFIG_INSTALL_BINS 1
%define CONFIG_INSTALL_LIBS 1
%define CONFIG_INSTALL_SRCS 0
%define CONFIG_DEBUG 0
%define CONFIG_GPROF 0
--- a/media/libvpx/config/win/mingw64/vpx_config.h
+++ b/media/libvpx/config/win/mingw64/vpx_config.h
@@ -24,17 +24,19 @@
#define HAVE_SSE 1
#define HAVE_SSE2 1
#define HAVE_SSE3 1
#define HAVE_SSSE3 1
#define HAVE_SSE4_1 1
#define HAVE_AVX 1
#define HAVE_AVX2 1
#define HAVE_VPX_PORTS 1
-#define HAVE_PTHREAD_H 1
+#ifndef HAVE_PTHREAD_H
+#define HAVE_PTHREAD_H 0
+#endif
#define CONFIG_DEPENDENCY_TRACKING 1
#define CONFIG_EXTERNAL_BUILD 1
#define CONFIG_INSTALL_DOCS 0
#define CONFIG_INSTALL_BINS 1
#define CONFIG_INSTALL_LIBS 1
#define CONFIG_INSTALL_SRCS 0
#define CONFIG_DEBUG 0
#define CONFIG_GPROF 0
--- a/media/libvpx/generate_sources_mozbuild.sh
+++ b/media/libvpx/generate_sources_mozbuild.sh
@@ -198,24 +198,28 @@ arm_platforms="--enable-runtime-cpu-dete
gen_config_files linux/x64 "--target=x86_64-linux-gcc ${all_platforms} ${x86_platforms}"
gen_config_files linux/ia32 "--target=x86-linux-gcc ${all_platforms} ${x86_platforms}"
gen_config_files mac/x64 "--target=x86_64-darwin9-gcc ${all_platforms} ${x86_platforms}"
gen_config_files mac/ia32 "--target=x86-darwin9-gcc ${all_platforms} ${x86_platforms}"
gen_config_files win/x64 "--target=x86_64-win64-vs12 ${all_platforms} ${x86_platforms}"
gen_config_files win/ia32 "--target=x86-win32-gcc ${all_platforms} ${x86_platforms}"
gen_config_files win/mingw32 "--target=x86-win32-gcc ${all_platforms} ${x86_platforms}"
+gen_config_files win/mingw64 "--target=x86_64-win64-gcc ${all_platforms} ${x86_platforms}"
gen_config_files linux/arm "--target=armv7-linux-gcc ${all_platforms} ${arm_platforms}"
gen_config_files generic "--target=generic-gnu ${all_platforms}"
# vpx doesn't know if mingw32 has winpthreads or not, and doesn't try to detect it.
-sed -i 's/HAVE_PTHREAD_H 0/HAVE_PTHREAD_H 1/' $BASE_DIR/$LIBVPX_CONFIG_DIR/win/mingw32/vpx_config.asm
-sed -i 's/HAVE_PTHREAD_H 0/HAVE_PTHREAD_H 1/' $BASE_DIR/$LIBVPX_CONFIG_DIR/win/mingw32/vpx_config.h
+function mingw_pthread_fix {
+ sed -i 's/\(^.*HAVE_PTHREAD_H 0$\)/#ifndef HAVE_PTHREAD_H\n\1\n#endif/' $1
+}
+mingw_pthread_fix $BASE_DIR/$LIBVPX_CONFIG_DIR/win/mingw32/vpx_config.h
+mingw_pthread_fix $BASE_DIR/$LIBVPX_CONFIG_DIR/win/mingw64/vpx_config.h
echo "Remove temporary directory."
cd $BASE_DIR
rm -rf $TEMP_DIR
echo "Create temporary directory."
TEMP_DIR="$LIBVPX_SRC_DIR.temp"
rm -rf $TEMP_DIR
@@ -224,16 +228,17 @@ cd $TEMP_DIR
gen_rtcd_header linux/x64 x86_64
gen_rtcd_header linux/ia32 x86
gen_rtcd_header mac/x64 x86_64
gen_rtcd_header mac/ia32 x86
gen_rtcd_header win/x64 x86_64
gen_rtcd_header win/ia32 x86
gen_rtcd_header win/mingw32 x86
+gen_rtcd_header win/mingw64 x86_64
gen_rtcd_header linux/arm armv7
gen_rtcd_header generic generic
echo "Prepare Makefile."
./configure --target=generic-gnu > /dev/null
--- a/media/libvpx/moz.build
+++ b/media/libvpx/moz.build
@@ -12,17 +12,17 @@ include('sources.mozbuild')
if CONFIG['VPX_USE_YASM']:
USE_YASM = True
# Linux, Mac and Win share file lists for x86* but not configurations.
if CONFIG['CPU_ARCH'] == 'x86_64':
EXPORTS.vpx += files['X64_EXPORTS']
SOURCES += files['X64_SOURCES']
if CONFIG['OS_TARGET'] == 'WINNT':
- if CONFIG['CC_TYPE'] == 'gcc':
+ if CONFIG['CC_TYPE'] in ('gcc', 'clang'):
ASFLAGS += [ '-I%s/media/libvpx/config/win/mingw64/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/win/mingw64/' ]
else:
ASFLAGS += [ '-I%s/media/libvpx/config/win/x64/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/win/x64/' ]
elif CONFIG['OS_TARGET'] == 'Darwin':
ASFLAGS += [ '-I%s/media/libvpx/config/mac/x64/' % TOPSRCDIR ]
LOCAL_INCLUDES += [ '/media/libvpx/config/mac/x64/' ]