Bug 1406542 Enable PTHREAD for vpx and aom under MinGW because we do in fact have them. r?rillian draft
authorTom Ritter <tom@mozilla.com>
Tue, 24 Oct 2017 16:57:51 -0500
changeset 685583 6957434ecb1e16c7e28c0afe0d587f6aaa1de77a
parent 685582 470346c4a39dd9fcb329245d243de29fdb231983
child 737197 6af0ba6fb227324419b30b35c158233a474f5fcf
push id85984
push userbmo:tom@mozilla.com
push dateTue, 24 Oct 2017 21:58:32 +0000
reviewersrillian
bugs1406542
milestone58.0a1
Bug 1406542 Enable PTHREAD for vpx and aom under MinGW because we do in fact have them. r?rillian We were getting warnings that HAVE_PTHREAD_H was being redeclared with the wrong value. Let's correct that. MozReview-Commit-ID: KVAsYofozIT
media/libaom/config/win/mingw32/aom_config.asm
media/libaom/config/win/mingw32/aom_config.h
media/libaom/generate_sources_mozbuild.sh
media/libvpx/config/win/ia32/vpx_config.asm
media/libvpx/config/win/ia32/vpx_config.h
media/libvpx/config/win/mingw32/vp8_rtcd.h
media/libvpx/config/win/mingw32/vp9_rtcd.h
media/libvpx/config/win/mingw32/vpx_config.asm
media/libvpx/config/win/mingw32/vpx_config.c
media/libvpx/config/win/mingw32/vpx_config.h
media/libvpx/config/win/mingw32/vpx_dsp_rtcd.h
media/libvpx/config/win/mingw32/vpx_scale_rtcd.h
media/libvpx/generate_sources_mozbuild.sh
media/libvpx/moz.build
old mode 100644
new mode 100755
--- a/media/libaom/config/win/mingw32/aom_config.asm
+++ b/media/libaom/config/win/mingw32/aom_config.asm
@@ -13,17 +13,17 @@ HAVE_SSE equ 1
 HAVE_SSE2 equ 1
 HAVE_SSE3 equ 1
 HAVE_SSSE3 equ 1
 HAVE_SSE4_1 equ 1
 HAVE_AVX equ 1
 HAVE_AVX2 equ 1
 HAVE_AOM_PORTS equ 1
 HAVE_FEXCEPT equ 1
-HAVE_PTHREAD_H equ 0
+HAVE_PTHREAD_H equ 1
 HAVE_WXWIDGETS equ 0
 CONFIG_DEPENDENCY_TRACKING equ 1
 CONFIG_EXTERNAL_BUILD equ 1
 CONFIG_INSTALL_DOCS equ 1
 CONFIG_INSTALL_BINS equ 1
 CONFIG_INSTALL_LIBS equ 1
 CONFIG_INSTALL_SRCS equ 0
 CONFIG_DEBUG equ 0
@@ -156,8 +156,9 @@ CONFIG_LGT equ 0
 CONFIG_SBL_SYMBOL equ 0
 CONFIG_NCOBMC_ADAPT_WEIGHT equ 0
 CONFIG_BGSPRITE equ 0
 CONFIG_VAR_TX_NO_TX_MODE equ 0
 CONFIG_MRC_TX equ 0
 CONFIG_LPF_DIRECT equ 0
 CONFIG_UV_LVL equ 0
 CONFIG_ANALYZER equ 0
+
old mode 100644
new mode 100755
--- a/media/libaom/config/win/mingw32/aom_config.h
+++ b/media/libaom/config/win/mingw32/aom_config.h
@@ -26,17 +26,17 @@
 #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_AOM_PORTS 1
 #define HAVE_FEXCEPT 1
-#define HAVE_PTHREAD_H 0
+#define HAVE_PTHREAD_H 1
 #define HAVE_WXWIDGETS 0
 #define CONFIG_DEPENDENCY_TRACKING 1
 #define CONFIG_EXTERNAL_BUILD 1
 #define CONFIG_INSTALL_DOCS 1
 #define CONFIG_INSTALL_BINS 1
 #define CONFIG_INSTALL_LIBS 1
 #define CONFIG_INSTALL_SRCS 0
 #define CONFIG_DEBUG 0
@@ -172,8 +172,9 @@
 #define CONFIG_VAR_TX_NO_TX_MODE 0
 #define CONFIG_MRC_TX 0
 #define CONFIG_LPF_DIRECT 0
 #define CONFIG_UV_LVL 0
 #define CONFIG_ANALYZER 0
 #define DECODE_WIDTH_LIMIT 8192
 #define DECODE_HEIGHT_LIMIT 4608
 #endif /* AOM_CONFIG_H */
+
--- a/media/libaom/generate_sources_mozbuild.sh
+++ b/media/libaom/generate_sources_mozbuild.sh
@@ -188,27 +188,33 @@ rm -rf $TEMP_DIR
 cp -R $LIBAOM_SRC_DIR $TEMP_DIR
 cd $TEMP_DIR
 
 echo "Generating config files."
 all_platforms="--enable-external-build --disable-examples --disable-docs --disable-unit-tests"
 all_platforms="${all_platforms} --size-limit=8192x4608 --enable-pic"
 x86_platforms="--enable-postproc --as=yasm"
 arm_platforms="--enable-runtime-cpu-detect --enable-realtime-only"
+
 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 win/x64 "--target=x86_64-win64-vs14 ${all_platforms} ${x86_platforms}"
 gen_config_files win/ia32 "--target=x86-win32-vs14 ${all_platforms} ${x86_platforms}"
 gen_config_files win/mingw32 "--target=x86-win32-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}"
 
+# AOM doesn't know if mingw32 has winpthreads or not, and doesn't try to detect it.
+sed -i 's/HAVE_PTHREAD_H equ 0/HAVE_PTHREAD_H equ 1/' $BASE_DIR/$LIBAOM_CONFIG_DIR/win/mingw32/aom_config.asm
+sed -i 's/HAVE_PTHREAD_H 0/HAVE_PTHREAD_H 1/' $BASE_DIR/$LIBAOM_CONFIG_DIR/win/mingw32/aom_config.h
+
+
 echo "Remove temporary directory."
 cd $BASE_DIR
 rm -rf $TEMP_DIR
 
 echo "Create temporary directory."
 TEMP_DIR="$BASE_DIR/.temp"
 rm -rf $TEMP_DIR
 cp -R $LIBAOM_SRC_DIR $TEMP_DIR
old mode 100644
new mode 100755
old mode 100644
new mode 100755
copy from media/libvpx/config/win/ia32/vp8_rtcd.h
copy to media/libvpx/config/win/mingw32/vp8_rtcd.h
copy from media/libvpx/config/win/ia32/vp9_rtcd.h
copy to media/libvpx/config/win/mingw32/vp9_rtcd.h
old mode 100644
new mode 100755
copy from media/libvpx/config/win/ia32/vpx_config.asm
copy to media/libvpx/config/win/mingw32/vpx_config.asm
--- a/media/libvpx/config/win/ia32/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 0
+%define HAVE_PTHREAD_H 1
 %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
copy from media/libvpx/config/win/ia32/vpx_config.c
copy to media/libvpx/config/win/mingw32/vpx_config.c
old mode 100644
new mode 100755
copy from media/libvpx/config/win/ia32/vpx_config.h
copy to media/libvpx/config/win/mingw32/vpx_config.h
--- a/media/libvpx/config/win/ia32/vpx_config.h
+++ b/media/libvpx/config/win/mingw32/vpx_config.h
@@ -24,17 +24,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 0
+#define HAVE_PTHREAD_H 1
 #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
copy from media/libvpx/config/win/ia32/vpx_dsp_rtcd.h
copy to media/libvpx/config/win/mingw32/vpx_dsp_rtcd.h
copy from media/libvpx/config/win/ia32/vpx_scale_rtcd.h
copy to media/libvpx/config/win/mingw32/vpx_scale_rtcd.h
--- a/media/libvpx/generate_sources_mozbuild.sh
+++ b/media/libvpx/generate_sources_mozbuild.sh
@@ -166,17 +166,17 @@ function gen_config_files {
   ./configure $2 > /dev/null
 
   # Disable HAVE_UNISTD_H.
   ( echo '/HAVE_UNISTD_H'; echo 'd' ; echo 'w' ; echo 'q' ) | ed -s vpx_config.h
 
   local ASM_CONV=ads2gas.pl
 
   # Generate vpx_config.asm.
-  if [[ "$1" == *x64* ]] || [[ "$1" == *ia32* ]]; then
+  if [[ "$1" == *x64* ]] || [[ "$1" == *ia32* ]] || [[ "$1" == *mingw* ]]; then
     egrep "#define [A-Z0-9_]+ [01]" vpx_config.h | awk '{print "%define " $2 " " $3}' > vpx_config.asm
   else
     egrep "#define [A-Z0-9_]+ [01]" vpx_config.h | awk '{print $2 " EQU " $3}' | perl $BASE_DIR/$LIBVPX_SRC_DIR/build/make/$ASM_CONV > vpx_config.asm
   fi
 
   cp vpx_config.* $BASE_DIR/$LIBVPX_CONFIG_DIR/$1
   make_clean
   rm -rf vpx_config.*
@@ -190,43 +190,51 @@ rm -rf $TEMP_DIR
 cp -R $LIBVPX_SRC_DIR $TEMP_DIR
 cd $TEMP_DIR
 
 echo "Generate config files."
 all_platforms="--enable-external-build --disable-examples --disable-install-docs --disable-unit-tests"
 all_platforms="${all_platforms} --enable-multi-res-encoding --size-limit=8192x4608 --enable-pic"
 x86_platforms="--enable-postproc --enable-vp9-postproc --as=yasm"
 arm_platforms="--enable-runtime-cpu-detect --enable-realtime-only"
+
 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 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
+
 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
 cp -R $LIBVPX_SRC_DIR $TEMP_DIR
 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 linux/arm armv7
 
 gen_rtcd_header generic generic
 
 echo "Prepare Makefile."
 ./configure --target=generic-gnu > /dev/null
 make_clean
old mode 100644
new mode 100755
--- a/media/libvpx/moz.build
+++ b/media/libvpx/moz.build
@@ -24,18 +24,22 @@ if CONFIG['CPU_ARCH'] == 'x86_64':
         LOCAL_INCLUDES += [ '/media/libvpx/config/mac/x64/' ]
     else: # Android, Linux, BSDs, etc.
         ASFLAGS += [ '-I%s/media/libvpx/config/linux/x64/' % TOPSRCDIR ]
         LOCAL_INCLUDES += [ '/media/libvpx/config/linux/x64/' ]
 elif CONFIG['CPU_ARCH'] == 'x86':
     EXPORTS.vpx += files['IA32_EXPORTS']
     SOURCES += files['IA32_SOURCES']
     if CONFIG['OS_TARGET'] == 'WINNT':
-        ASFLAGS += [ '-I%s/media/libvpx/config/win/ia32/' % TOPSRCDIR ]
-        LOCAL_INCLUDES += [ '/media/libvpx/config/win/ia32/' ]
+        if CONFIG['CC_TYPE'] == 'gcc':
+            ASFLAGS += [ '-I%s/media/libvpx/config/win/mingw32/' % TOPSRCDIR ]
+            LOCAL_INCLUDES += [ '/media/libvpx/config/win/mingw32/' ]
+        else:
+            ASFLAGS += [ '-I%s/media/libvpx/config/win/ia32/' % TOPSRCDIR ]
+            LOCAL_INCLUDES += [ '/media/libvpx/config/win/ia32/' ]
     elif CONFIG['OS_TARGET'] == 'Darwin':
         ASFLAGS += [ '-I%s/media/libvpx/config/mac/ia32/' % TOPSRCDIR ]
         LOCAL_INCLUDES += [ '/media/libvpx/config/mac/ia32/' ]
     else: # Android, Linux, BSDs, etc.
         ASFLAGS += [ '-I%s/media/libvpx/config/linux/ia32/' % TOPSRCDIR ]
         LOCAL_INCLUDES += [ '/media/libvpx/config/linux/ia32/' ]
 elif CONFIG['CPU_ARCH'] == 'arm':
     EXPORTS.vpx += files['ARM_EXPORTS']