[vlc-commits] tools: meson: don't use "allow-shlib-undefined" with LLVM if not supported

Steve Lhomme git at videolan.org
Thu Jun 18 14:54:22 CEST 2020


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jan 31 12:01:53 2020 +0100| [1b33544d8fd6347d4f85e56a4fe41dce0e869317] | committer: Steve Lhomme

tools: meson: don't use "allow-shlib-undefined" with LLVM if not supported

>From https://github.com/mesonbuild/meson/pull/5912

This solves the -lpthread detection issue with libplacebo when compiling with
LLVM for Windows.

(cherry picked from commit f079504ccf7ec7ba0156adf962815dfa7da01aea)

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

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

 extras/package/win32/build.sh            |  2 +-
 extras/tools/meson-shlib-undefined.patch | 21 +++++++++++++++++++++
 extras/tools/tools.mak                   |  1 +
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index 8d70328371..fdfb3afa01 100755
--- a/extras/package/win32/build.sh
+++ b/extras/package/win32/build.sh
@@ -111,7 +111,7 @@ mkdir -p extras/tools
 cd extras/tools
 
 export PATH="$PWD/build/bin":"$PATH"
-# Force meson 0.51.1 as newer versions don't add -lpthread properly in libplacebo.pc
+# Force patched meson as newer versions don't add -lpthread properly in libplacebo.pc
 FORCED_TOOLS="meson"
 # Force libtool build when compiling with clang
 if [ "$COMPILING_WITH_CLANG" -gt 0 ] && [ ! -d "libtool" ]; then
diff --git a/extras/tools/meson-shlib-undefined.patch b/extras/tools/meson-shlib-undefined.patch
new file mode 100644
index 0000000000..a10f459251
--- /dev/null
+++ b/extras/tools/meson-shlib-undefined.patch
@@ -0,0 +1,21 @@
+--- meson/mesonbuild/linkers.py.shlib	2020-01-31 11:54:36.928015800 +0100
++++ meson/mesonbuild/linkers.py	2020-01-31 11:54:55.088659900 +0100
+@@ -659,8 +659,17 @@ class LLVMDynamicLinker(GnuLikeDynamicLi
+     This is only the posix-like linker.
+     """
+ 
+-    pass
++    def __init__(self, *args, **kwargs):
++        super().__init__(*args, **kwargs)
+ 
++        # Some targets don't seem to support this argument (windows, wasm, ...)
++        _, _, e = mesonlib.Popen_safe(self.exelist + self._apply_prefix('--allow-shlib-undefined'))
++        self.has_allow_shlib_undefined = not ('unknown argument: --allow-shlib-undefined' in e)
++
++    def get_allow_undefined_args(self) -> T.List[str]:
++        if self.has_allow_shlib_undefined:
++            return self._apply_prefix('--allow-shlib-undefined')
++        return []
+ 
+ class CcrxDynamicLinker(DynamicLinker):
+ 
diff --git a/extras/tools/tools.mak b/extras/tools/tools.mak
index d1bbcc0956..4cce9b982f 100644
--- a/extras/tools/tools.mak
+++ b/extras/tools/tools.mak
@@ -388,6 +388,7 @@ meson-$(MESON_VERSION).tar.gz:
 
 meson: meson-$(MESON_VERSION).tar.gz
 	$(UNPACK)
+	$(APPLY) $(TOOLS)/meson-shlib-undefined.patch
 	$(MOVE)
 
 .buildmeson: meson



More information about the vlc-commits mailing list