[vlc-commits] contrib: libplacebo: fix pthread link
Thomas Guillem
git at videolan.org
Thu Nov 8 11:48:32 CET 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Nov 8 11:44:22 2018 +0100| [1797b2a4f4e23724af44d5905824d9e2722e48ec] | committer: Thomas Guillem
contrib: libplacebo: fix pthread link
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1797b2a4f4e23724af44d5905824d9e2722e48ec
---
...uild-fix-lpthread-dependency-with-glslang.patch | 48 ++++++++++++++++++++++
...ch => 0002-meson-fix-glslang-search-path.patch} | 18 ++++----
contrib/src/libplacebo/rules.mak | 3 +-
3 files changed, 59 insertions(+), 10 deletions(-)
diff --git a/contrib/src/libplacebo/0001-build-fix-lpthread-dependency-with-glslang.patch b/contrib/src/libplacebo/0001-build-fix-lpthread-dependency-with-glslang.patch
new file mode 100644
index 0000000000..3753fdb61b
--- /dev/null
+++ b/contrib/src/libplacebo/0001-build-fix-lpthread-dependency-with-glslang.patch
@@ -0,0 +1,48 @@
+From e4626984de40115af22041087936c3ad68401f75 Mon Sep 17 00:00:00 2001
+From: Thomas Guillem <thomas at gllm.fr>
+Date: Thu, 8 Nov 2018 10:09:19 +0100
+Subject: [PATCH 1/2] build: fix lpthread dependency with glslang
+
+"-pthread" is enough for a dynamic build. Indeed, the pthread API is used
+within libplacebo, so the compiler know that it shoud link with pthread in that
+case.
+
+However, this may fail with static builds. If the code using libplacebo.a and
+all glslang .a doesn't use the pthread API, the compiler won't link with
+pthread. To work-around this issue, make libplacebo depends on -lpthread, if
+present.
+---
+ src/meson.build | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/meson.build b/src/meson.build
+index 4d791c30d9..25b898b7a4 100644
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -90,6 +90,7 @@ tests = [
+ glslang_combined = disabler()
+ glslang_min_ver = 2763
+ glslang_req = get_option('glslang')
++glslang_pthread_deps = []
+ glslang_deps = [
+ cxx.find_library('glslang', required: glslang_req),
+ cxx.find_library('HLSL', required: glslang_req),
+@@ -105,12 +106,14 @@ foreach d : glslang_deps
+ endforeach
+
+ if glslang_found
++ glslang_pthread_deps += cxx.find_library('pthread', required: false)
++
+ glslang_ver = cxx.get_define('GLSLANG_PATCH_LEVEL',
+ prefix: '#include <glslang/Include/revision.h>'
+ ).to_int()
+
+ if glslang_ver >= glslang_min_ver
+- glslang_combined = declare_dependency(dependencies: glslang_deps)
++ glslang_combined = declare_dependency(dependencies: glslang_deps + glslang_pthread_deps)
+ else
+ error('glslang revision @0@ too old! Must be at least @1@'
+ .format(glslang_ver, glslang_min_ver))
+--
+2.19.1
+
diff --git a/contrib/src/libplacebo/0001-meson-fix-glslang-search-path.patch b/contrib/src/libplacebo/0002-meson-fix-glslang-search-path.patch
similarity index 84%
rename from contrib/src/libplacebo/0001-meson-fix-glslang-search-path.patch
rename to contrib/src/libplacebo/0002-meson-fix-glslang-search-path.patch
index 920402b690..86f7033a3e 100644
--- a/contrib/src/libplacebo/0001-meson-fix-glslang-search-path.patch
+++ b/contrib/src/libplacebo/0002-meson-fix-glslang-search-path.patch
@@ -1,14 +1,14 @@
-From 9b3c97d83d92b2f56120c08cd796e81410da45f2 Mon Sep 17 00:00:00 2001
+From fd85596f1d684be20d383b7d6b01d19a6a576fdc Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas at gllm.fr>
Date: Wed, 24 Oct 2018 10:28:55 +0200
-Subject: [PATCH] meson: fix glslang search path
+Subject: [PATCH 2/2] meson: fix glslang search path
---
src/meson.build | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/meson.build b/src/meson.build
-index 6b2b07d56b..ff58b60f5f 100644
+index 25b898b7a4..c63996f53f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -25,6 +25,12 @@ build_opts = [
@@ -24,9 +24,9 @@ index 6b2b07d56b..ff58b60f5f 100644
cc = meson.get_compiler('c')
cxx = meson.get_compiler('cpp')
-@@ -91,12 +97,12 @@ glslang_combined = disabler()
- glslang_min_ver = 2763
+@@ -92,12 +98,12 @@ glslang_min_ver = 2763
glslang_req = get_option('glslang')
+ glslang_pthread_deps = []
glslang_deps = [
- cxx.find_library('glslang', required: glslang_req),
- cxx.find_library('HLSL', required: glslang_req),
@@ -43,9 +43,9 @@ index 6b2b07d56b..ff58b60f5f 100644
]
glslang_found = true
-@@ -106,11 +112,13 @@ endforeach
+@@ -109,11 +115,13 @@ if glslang_found
+ glslang_pthread_deps += cxx.find_library('pthread', required: false)
- if glslang_found
glslang_ver = cxx.get_define('GLSLANG_PATCH_LEVEL',
- prefix: '#include <glslang/Include/revision.h>'
+ prefix: '#include <glslang/Include/revision.h>',
@@ -53,8 +53,8 @@ index 6b2b07d56b..ff58b60f5f 100644
).to_int()
if glslang_ver >= glslang_min_ver
-- glslang_combined = declare_dependency(dependencies: glslang_deps)
-+ glslang_combined = declare_dependency(dependencies: glslang_deps,
+- glslang_combined = declare_dependency(dependencies: glslang_deps + glslang_pthread_deps)
++ glslang_combined = declare_dependency(dependencies: glslang_deps + glslang_pthread_deps,
+ include_directories : prefix_include)
else
error('glslang revision @0@ too old! Must be at least @1@'
diff --git a/contrib/src/libplacebo/rules.mak b/contrib/src/libplacebo/rules.mak
index f0c83f696c..ed47c0090d 100644
--- a/contrib/src/libplacebo/rules.mak
+++ b/contrib/src/libplacebo/rules.mak
@@ -26,7 +26,8 @@ $(TARBALLS)/$(PLACEBO_ARCHIVE):
libplacebo: $(PLACEBO_ARCHIVE) .sum-libplacebo
$(UNPACK)
- $(APPLY) $(SRC)/libplacebo/0001-meson-fix-glslang-search-path.patch
+ $(APPLY) $(SRC)/libplacebo/0001-build-fix-lpthread-dependency-with-glslang.patch
+ $(APPLY) $(SRC)/libplacebo/0002-meson-fix-glslang-search-path.patch
$(MOVE)
.libplacebo: libplacebo crossfile.meson
More information about the vlc-commits
mailing list