[vlc-devel] [PATCH 3.0 01/17] contrib: clean dependency on win32 pthread

Hugo Beauzée-Luyssen hugo at beauzee.fr
Fri Mar 27 18:13:40 CET 2020


On Fri, Mar 27, 2020, at 4:57 PM, Steve Lhomme wrote:
> and define the macros to force using the static version
> 
> (cherry picked from commit f52ef651974696f59261d699241d622e323a32df)
> ---
>  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        |  6 +++++-
>  contrib/src/zvbi/rules.mak       |  5 +----
>  8 files changed, 47 insertions(+), 11 deletions(-)
> 
> diff --git a/contrib/src/aom/rules.mak b/contrib/src/aom/rules.mak
> index ae33807c73..13f41bec9f 100644
> --- a/contrib/src/aom/rules.mak
> +++ b/contrib/src/aom/rules.mak
> @@ -32,7 +32,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)
>  
> @@ -89,7 +96,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)" CFLAGS="$(AOM_CFLAGS)" 
> CXXFLAGS="$(AOM_CXXFLAGS)" $(HOSTVARS) $(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 7e899d898e..bdee3dd394 100644
> --- a/contrib/src/vpx/rules.mak
> +++ b/contrib/src/vpx/rules.mak
> @@ -25,8 +25,12 @@ endif
>  
>  DEPS_vpx =
>  
> +VPX_CFLAGS   := $(CFLAGS)
> +VPX_CXXFLAGS := $(CXXFLAGS)
>  ifdef HAVE_WIN32
>  DEPS_vpx += pthreads $(DEPS_pthreads)
> +VPX_CFLAGS   += -DPTW32_STATIC_LIB
> +VPX_CXXFLAGS += -DPTW32_STATIC_LIB
>  endif
>  
>  ifdef HAVE_CROSS_COMPILE
> @@ -171,7 +175,7 @@ endif
>  
>  .vpx: libvpx
>  	rm -rf $(PREFIX)/include/vpx
> -	cd $< && LDFLAGS="$(VPX_LDFLAGS)" CROSS=$(VPX_CROSS) $(VPX_HOSTVARS) 
> ./configure --target=$(VPX_TARGET) \
> +	cd $< && LDFLAGS="$(VPX_LDFLAGS)" CROSS=$(VPX_CROSS) 
> CFLAGS="$(VPX_CFLAGS)" CXXFLAGS="$(VPX_CXXFLAGS)"  ./configure 
> --target=$(VPX_TARGET) \
>  		$(VPX_CONF) --prefix=$(PREFIX)
>  	cd $< && $(MAKE)
>  	cd $< && ../../../contrib/src/pkg-static.sh vpx.pc
> diff --git a/contrib/src/zvbi/rules.mak b/contrib/src/zvbi/rules.mak
> index 3378618622..7070aca162 100644
> --- a/contrib/src/zvbi/rules.mak
> +++ b/contrib/src/zvbi/rules.mak
> @@ -27,7 +27,7 @@ ifdef HAVE_ANDROID
>  endif
>  	$(MOVE)
>  
> -DEPS_zvbi = pthreads png $(DEPS_png) iconv $(DEPS_iconv)
> +DEPS_zvbi = png $(DEPS_png) iconv $(DEPS_iconv)
>  
>  ZVBI_CFLAGS := $(CFLAGS)
>  ZVBICONF := \
> @@ -39,9 +39,6 @@ ZVBICONF := \
>  ifdef HAVE_MACOSX
>  ZVBI_CFLAGS += -fnested-functions
>  endif
> -ifdef HAVE_WIN32
> -ZVBI_CFLAGS += -DPTW32_STATIC_LIB
> -endif
>  
>  .zvbi: zvbi
>  	$(UPDATE_AUTOCONFIG)

No objection with the set, but could you send it through the CI to be sure?

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list