Skip to content

Commit

Permalink
libplacebo.wrap: backport change required to build with meson v1.2.1+
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed Sep 20, 2023
1 parent 5c6ade8 commit 858cb2b
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ jobs:
with:
msystem: ${{ matrix.sys }}
update: true
install: git
install: git patch
pacboy: >-
angleproject:p
ca-certificates:p
Expand Down
1 change: 1 addition & 0 deletions subprojects/libplacebo.wrap
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ url = https://code.videolan.org/videolan/libplacebo.git
revision = v6.292.0
depth = 1
clone-recursive = true
diff_files = 0a203be35563bb2904a9d2e4ee88c0787acdbf36.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
From 0a203be35563bb2904a9d2e4ee88c0787acdbf36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Mon, 14 Aug 2023 19:10:56 +0200
Subject: [PATCH] meson: don't use declare_dependency for UCRT import lib

Starting from meson v1.2.1 it is unallowed to link to uninstalled static
libraries. This is how declare_dependency(link_with: ...) is treated. In
fact we want to use UCRT import lib only internaly and only when linking
shared library and/or executable. We don't want for it to be treated as
dependency of anykind, just as a directive for linker. Similar to linker
script.

Unfortunately there is not way to specify link_depends for all targets,
so we have to specify it for all of them.

Thanks to @xclaesse for his patience and idea with link_depends.

Fixes: https://github.com/haasn/libplacebo/issues/191
---
demos/meson.build | 8 ++++++++
src/meson.build | 16 ++++++++++++++--
src/tests/meson.build | 2 ++
3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/demos/meson.build b/demos/meson.build
index c707d6bed..1a52975f3 100644
--- a/demos/meson.build
+++ b/demos/meson.build
@@ -113,11 +113,15 @@ else
# Graphical demo programs
executable('colors', 'colors.c',
dependencies: [ dep, pl_clock, libm ],
+ link_args: link_args,
+ link_depends: link_depends,
)

if sdl_image.found()
executable('sdlimage', 'sdlimage.c',
dependencies: [ dep, libm, sdl_image ],
+ link_args: link_args,
+ link_depends: link_depends,
)
endif

@@ -131,6 +135,8 @@ else
endif
executable('plplay', 'plplay.c',
dependencies: plplay_deps,
+ link_args: link_args,
+ link_depends: link_depends,
install: true,
)
endif
@@ -142,5 +148,7 @@ if components.get('vk-proc-addr')
executable('video-filtering', 'video-filtering.c',
dependencies: [ libplacebo, vulkan_loader ],
c_args: '-O2',
+ link_args: link_args,
+ link_depends: link_depends,
)
endif
diff --git a/src/meson.build b/src/meson.build
index 4a7dd6bc1..63c05d8cc 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -15,6 +15,9 @@ elif has_execinfo
build_deps += libexecinfo
endif

+link_args = []
+link_depends = []
+
# Looks like meson in certain configuration returns ' ' instead of empty string
mingw32 = cc.get_define('__MINGW32__').strip()
if host_machine.system() == 'windows' and mingw32 != '' and host_machine.cpu() in ['aarch64', 'arm', 'x86_64']
@@ -28,7 +31,8 @@ if host_machine.system() == 'windows' and mingw32 != '' and host_machine.cpu() i
output : ['ucrt_math.lib'],
input : 'ucrt_math.def',
command : [dlltool, '-d', '@INPUT@', '-l', '@OUTPUT@'])
- build_deps += declare_dependency(link_with: ucrt_math)
+ link_args += ucrt_math.full_path()
+ link_depends += ucrt_math
# MinGW-w64 inlines functions like powf, rewriting them to pow. We want to use
# the powf specialization from UCRT, so disable inlining.
add_project_arguments(['-D__CRT__NO_INLINE'], language: ['c', 'cpp'])
@@ -221,6 +225,7 @@ lib = library('placebo', sources,
soversion: apiver,
include_directories: inc,
link_args: link_args,
+ link_depends: link_depends,
gnu_symbol_visibility: 'hidden',
name_prefix: 'lib'
)
@@ -290,7 +295,12 @@ if get_option('bench')
error('Compiling the benchmark suite requires vulkan support!')
endif

- bench = executable('bench', 'tests/bench.c', dependencies: [tdep_shared, vulkan_headers])
+ bench = executable('bench',
+ 'tests/bench.c',
+ dependencies: [tdep_shared, vulkan_headers],
+ link_args: link_args,
+ link_depends: link_depends,
+ )
test('benchmark', bench, is_parallel: false, timeout: 600)
endif

@@ -299,6 +309,8 @@ if get_option('fuzz')
executable('fuzz.' + f, 'tests/fuzz/' + f,
objects: lib.extract_all_objects(recursive: false),
dependencies: tdep_static,
+ link_args: link_args,
+ link_depends: link_depends,
)
endforeach
endif
diff --git a/src/tests/meson.build b/src/tests/meson.build
index dd054b339..4affbf650 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -29,6 +29,8 @@ foreach t : ts
objects: t.get('objects', []),
c_args: [ '-Wno-unused-function' ],
dependencies: t.get('deps', []),
+ link_args: link_args,
+ link_depends: link_depends,
)

test(t['source'], e)
--
GitLab

0 comments on commit 858cb2b

Please sign in to comment.