[vlc-commits] contrib: clean dependency on win32 pthread

Steve Lhomme git at videolan.org
Wed Jun 17 11:39:52 CEST 2020


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue May 15 08:23:31 2018 +0200| [8f67e420cb1615b3b38e51c6b80917297698ccb7] | committer: Steve Lhomme

contrib: clean dependency on win32 pthread

and define the macros to force using the static version

(cherry picked from commit f52ef651974696f59261d699241d622e323a32df) (edited)

edited:
- aom had the wrong position for the new CFLAGS/CXXFLAGS
- vpx already depended on the pthreads package, also add missing VPX_HOSTVARS
- vpx pass the flags via VPX_HOSTVARS not to disturb android builds
- zbvi still needs the dependency so leave it unchanged

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=8f67e420cb1615b3b38e51c6b80917297698ccb7
---

 contrib/src/aom/rules.mak        |  9 ++++++++-
 contrib/src/libplacebo/rules.mak |  6 +++++-
 contrib/src/mysofa/rules.mak     | 11 +++++++++--
 contrib/src/openjpeg/rules.mak   | 10 +++++++++-
 contrib/src/protobuf/rules.mak   |  9 ++++++++-
 contrib/src/srt/rules.mak        |  2 ++
 contrib/src/vpx/rules.mak        |  1 +
 7 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/contrib/src/aom/rules.mak b/contrib/src/aom/rules.mak
index 7143ab76b0..0d78922f1d 100644
--- a/contrib/src/aom/rules.mak
+++ b/contrib/src/aom/rules.mak
@@ -29,7 +29,14 @@ ifdef HAVE_ANDROID
 	cp $(ANDROID_NDK)/sources/android/cpufeatures/cpu-features.c $(ANDROID_NDK)/sources/android/cpufeatures/cpu-features.h aom/aom_ports/
 endif
 
+AOM_CFLAGS   := $(CFLAGS)
+AOM_CXXFLAGS := $(CXXFLAGS)
 DEPS_aom =
+ifdef HAVE_WIN32
+DEPS_aom += pthreads $(DEPS_pthreads)
+AOM_CFLAGS   += -DPTW32_STATIC_LIB
+AOM_CXXFLAGS += -DPTW32_STATIC_LIB
+endif
 
 AOM_LDFLAGS := $(LDFLAGS)
 
@@ -86,7 +93,7 @@ endif
 # libaom doesn't allow in-tree builds
 .aom: aom toolchain.cmake
 	cd $< && mkdir -p aom_build
-	cd $</aom_build && LDFLAGS="$(AOM_LDFLAGS)" $(HOSTVARS) $(CMAKE) ../ $(AOM_CONF)
+	cd $</aom_build && LDFLAGS="$(AOM_LDFLAGS)" $(HOSTVARS) CFLAGS="$(AOM_CFLAGS)" CXXFLAGS="$(AOM_CXXFLAGS)" $(CMAKE) ../ $(AOM_CONF)
 	cd $</aom_build && $(MAKE)
 	cd $</aom_build && ../../../../contrib/src/pkg-static.sh aom.pc
 	cd $</aom_build && $(MAKE) install
diff --git a/contrib/src/libplacebo/rules.mak b/contrib/src/libplacebo/rules.mak
index b9871a0056..b2bfa3ca01 100644
--- a/contrib/src/libplacebo/rules.mak
+++ b/contrib/src/libplacebo/rules.mak
@@ -4,9 +4,13 @@ PLACEBO_VERSION := 0.2.1
 PLACEBO_URL := https://github.com/haasn/libplacebo/archive/v$(PLACEBO_VERSION).tar.gz
 PLACEBO_ARCHIVE = libplacebo-$(PLACEBO_VERSION).tar.gz
 
+LIBPLACEBO_CFLAGS   := $(CFLAGS)
+LIBPLACEBO_CXXFLAGS := $(CXXFLAGS)
 ifdef HAVE_WIN32
 LIBPLACEBO_WIN32 = HAVE_WIN32=1
 DEPS_libplacebo += pthreads $(DEPS_pthreads)
+LIBPLACEBO_CFLAGS   += -DPTW32_STATIC_LIB
+LIBPLACEBO_CXXFLAGS += -DPTW32_STATIC_LIB
 endif
 
 PKGS += libplacebo
@@ -33,5 +37,5 @@ libplacebo: $(PLACEBO_ARCHIVE) .sum-libplacebo
 # we don't want to depend on meson/ninja for VLC 3.0
 #cd $< && $(HOSTVARS) meson $(PLACEBOCONF) build
 #cd $< && cd build && ninja install
-	cd $< && $(HOSTVARS_PIC) PREFIX=$(PREFIX) $(LIBPLACEBO_WIN32) make install
+	cd $< && $(HOSTVARS_PIC) PREFIX=$(PREFIX) $(LIBPLACEBO_WIN32) CFLAGS="$(LIBPLACEBO_CFLAGS)" CXXFLAGS="$(LIBPLACEBO_CXXFLAGS)" make install
 	touch $@
diff --git a/contrib/src/mysofa/rules.mak b/contrib/src/mysofa/rules.mak
index fcaab5098a..0a0377ecc1 100644
--- a/contrib/src/mysofa/rules.mak
+++ b/contrib/src/mysofa/rules.mak
@@ -9,7 +9,14 @@ ifeq ($(call need_pkg,"libmysofa"),)
 PKGS_FOUND += mysofa
 endif
 
-DEPS_mysofa += pthreads zlib $(DEPS_pthreads) $(DEPS_zlib)
+MYSOFA_CFLAGS   := $(CFLAGS)
+MYSOFA_CXXFLAGS := $(CXXFLAGS)
+DEPS_mysofa += zlib $(DEPS_zlib)
+ifdef HAVE_WIN32
+DEPS_mysofa += pthreads $(DEPS_pthreads)
+MYSOFA_CFLAGS   += -DPTW32_STATIC_LIB
+MYSOFA_CXXFLAGS += -DPTW32_STATIC_LIB
+endif
 
 $(TARBALLS)/libmysofa-$(MYSOFA_VERSION).tar.gz:
 	$(call download_pkg,$(MYSOFA_URL),mysofa)
@@ -22,7 +29,7 @@ mysofa: libmysofa-$(MYSOFA_VERSION).tar.gz .sum-mysofa
 
 .mysofa: mysofa toolchain.cmake
 	-cd $< && rm CMakeCache.txt
-	cd $< && $(HOSTVARS) $(CMAKE) -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF
+	cd $< && $(HOSTVARS) CFLAGS="$(MYSOFA_CFLAGS)" CXXFLAGS="$(MYSOFA_CXXFLAGS)" $(CMAKE) -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF
 	cd $< && $(MAKE) install
 	touch $@
 
diff --git a/contrib/src/openjpeg/rules.mak b/contrib/src/openjpeg/rules.mak
index e41056c10d..005bf24bfa 100644
--- a/contrib/src/openjpeg/rules.mak
+++ b/contrib/src/openjpeg/rules.mak
@@ -3,6 +3,14 @@
 OPENJPEG_VERSION := 2.3.0
 OPENJPEG_URL := https://github.com/uclouvain/openjpeg/archive/v$(OPENJPEG_VERSION).tar.gz
 
+OPENJPEG_CFLAGS   := $(CFLAGS)
+OPENJPEG_CXXFLAGS := $(CXXFLAGS)
+ifdef HAVE_WIN32
+DEPS_openjpeg += pthreads $(DEPS_pthreads)
+OPENJPEG_CFLAGS   += -DPTW32_STATIC_LIB
+OPENJPEG_CXXFLAGS += -DPTW32_STATIC_LIB
+endif
+
 $(TARBALLS)/openjpeg-v$(OPENJPEG_VERSION).tar.gz:
 	$(call download_pkg,$(OPENJPEG_URL),openjpeg)
 
@@ -22,7 +30,7 @@ endif
 	$(MOVE)
 
 .openjpeg: openjpeg toolchain.cmake
-	cd $< && $(HOSTVARS) $(CMAKE) \
+	cd $< && $(HOSTVARS) CFLAGS="$(OPENJPEG_CFLAGS)" CXXFLAGS="$(OPENJPEG_CXXFLAGS)" $(CMAKE) \
 		-DBUILD_SHARED_LIBS:bool=OFF -DBUILD_PKGCONFIG_FILES=ON \
 			-DBUILD_CODEC:bool=OFF \
 		.
diff --git a/contrib/src/protobuf/rules.mak b/contrib/src/protobuf/rules.mak
index 87c1b73af7..2a9a0f3c78 100644
--- a/contrib/src/protobuf/rules.mak
+++ b/contrib/src/protobuf/rules.mak
@@ -12,7 +12,14 @@ $(TARBALLS)/protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz:
 
 .sum-protobuf: protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz
 
+PROTOBUF_CFLAGS   := $(CFLAGS)
+PROTOBUF_CXXFLAGS := $(CXXFLAGS)
 DEPS_protobuf = zlib $(DEPS_zlib)
+ifdef HAVE_WIN32
+DEPS_protobuf += pthreads $(DEPS_pthreads)
+PROTOBUF_CFLAGS   += -DPTW32_STATIC_LIB
+PROTOBUF_CXXFLAGS += -DPTW32_STATIC_LIB
+endif
 
 protobuf: protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz .sum-protobuf
 	$(UNPACK)
@@ -22,6 +29,6 @@ protobuf: protobuf-$(PROTOBUF_VERSION)-cpp.tar.gz .sum-protobuf
 
 .protobuf: protobuf
 	$(RECONF)
-	cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --with-protoc="$(PROTOC)"
+	cd $< && CFLAGS="$(PROTOBUF_CFLAGS)" CXXFLAGS="$(PROTOBUF_CXXFLAGS)" $(HOSTVARS) ./configure $(HOSTCONF) --with-protoc="$(PROTOC)"
 	cd $< && $(MAKE) && $(MAKE) install
 	touch $@
diff --git a/contrib/src/srt/rules.mak b/contrib/src/srt/rules.mak
index 0f0e4bf362..bef15200f2 100644
--- a/contrib/src/srt/rules.mak
+++ b/contrib/src/srt/rules.mak
@@ -13,6 +13,8 @@ endif
 
 ifdef HAVE_WIN32
 DEPS_srt += pthreads $(DEPS_pthreads)
+SRT_CFLAGS   += -DPTW32_STATIC_LIB
+SRT_CXXFLAGS += -DPTW32_STATIC_LIB
 endif
 
 $(TARBALLS)/srt-$(SRT_VERSION).tar.gz:
diff --git a/contrib/src/vpx/rules.mak b/contrib/src/vpx/rules.mak
index fe3dc1538c..ffd2b1a07f 100644
--- a/contrib/src/vpx/rules.mak
+++ b/contrib/src/vpx/rules.mak
@@ -30,6 +30,7 @@ DEPS_vpx =
 
 ifdef HAVE_WIN32
 DEPS_vpx += pthreads $(DEPS_pthreads)
+VPX_HOSTVARS = $(HOSTVARS) CFLAGS="$(CFLAGS) -DPTW32_STATIC_LIB" CXXFLAGS="$(CXXFLAGS) -DPTW32_STATIC_LIB"
 endif
 
 ifdef HAVE_CROSS_COMPILE



More information about the vlc-commits mailing list