Skip to content

Instantly share code, notes, and snippets.

@PatTheMav
Created December 25, 2021 16:25
Show Gist options
  • Save PatTheMav/5708ff44c40ff8591cde3b7f2fe8e24d to your computer and use it in GitHub Desktop.
Save PatTheMav/5708ff44c40ff8591cde3b7f2fe8e24d to your computer and use it in GitHub Desktop.
diff --git a/CI/windows/build_libaom.sh b/CI/windows/build_libaom.sh
index 9eeb228d..0a419b02 100755
--- a/CI/windows/build_libaom.sh
+++ b/CI/windows/build_libaom.sh
@@ -11,6 +11,13 @@
# Halt on errors
set -eE
+_patch_product() {
+ cd "${PRODUCT_FOLDER}"
+
+ step "Apply patches..."
+ apply_patch "${CHECKOUT_DIR}/CI/windows/patches/libaom/libaom-crosscompile-win-dll.patch" "6fa9ca74001c5fa3a6521a2b4944be2a8b4350d31c0234aede9a7052a8f1890b"
+}
+
_build_product() {
ensure_dir "${PRODUCT_FOLDER}/build_${ARCH}"
diff --git a/CI/windows/build_libvpx.sh b/CI/windows/build_libvpx.sh
index 19a1b23c..c405840d 100755
--- a/CI/windows/build_libvpx.sh
+++ b/CI/windows/build_libvpx.sh
@@ -46,7 +46,7 @@ _build_product() {
--disable-examples \
--enable-shared \
--disable-static \
- --disable-multithread \
+ --enable-multithread \
--enable-runtime-cpu-detect \
--enable-realtime-only \
--disable-install-bins \
diff --git a/CI/windows/patches/libaom/libaom-crosscompile-win-dll.patch b/CI/windows/patches/libaom/libaom-crosscompile-win-dll.patch
new file mode 100644
index 00000000..88063812
--- /dev/null
+++ b/CI/windows/patches/libaom/libaom-crosscompile-win-dll.patch
@@ -0,0 +1,12 @@
+diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
+@@ -15,7 +15,9 @@
+
+ include(FindGit)
+ include(FindPerl)
+-include(FindThreads)
++if(NOT CROSS STREQUAL "x86_64-w64-mingw32-")
++ include(FindThreads)
++endif()
+
+ include("${AOM_ROOT}/build/cmake/aom_config_defaults.cmake")
+ include("${AOM_ROOT}/build/cmake/aom_experiment_deps.cmake")
diff --git a/CI/windows/patches/libvpx/libvpx-crosscompile-win-dll.patch b/CI/windows/patches/libvpx/libvpx-crosscompile-win-dll.patch
index 86a90f94..1ec9488f 100644
--- a/CI/windows/patches/libvpx/libvpx-crosscompile-win-dll.patch
+++ b/CI/windows/patches/libvpx/libvpx-crosscompile-win-dll.patch
@@ -65,6 +65,15 @@ index 472e7de..3dc602f 100644
}
post_process_cmdline() {
+@@ -1495,6 +1495,8 @@
+ # Almost every platform uses pthreads.
+ if enabled multithread; then
+ case ${toolchain} in
++ *-win*-gcc)
++ ;;
+ *-win*-vs*)
+ ;;
+ *-android-gcc)
diff --git a/configure b/configure
index d29e00a..379a2e3 100755
--- a/configure
@@ -93,6 +102,23 @@ index d29e00a..379a2e3 100755
fi
;;
esac
+@@ -590,11 +590,14 @@
+
+ # Use both check_header and check_lib here, since check_lib
+ # could be a stub that always returns true.
+- check_header pthread.h && check_lib -lpthread <<EOF || disable_feature pthread_h
++ if ! enabled win32 && ! enabled win64; then
++ check_header pthread.h && check_lib -lpthread <<EOF || disable_feature pthread_h
+ #include <pthread.h>
+ #include <stddef.h>
+ int main(void) { return pthread_create(NULL, NULL, NULL, NULL); }
+ EOF
++ fi
++
+ check_header unistd.h # for sysconf(3) and friends.
+
+ check_header vpx/vpx_integer.h -I${source_path} && enable_feature vpx_ports
+
diff --git a/examples.mk b/examples.mk
index 758ca7f..23f8690 100644
--- a/examples.mk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment