aboutsummaryrefslogtreecommitdiffhomepage
path: root/subprojects/packagefiles/ffmpeg/meson.build
diff options
context:
space:
mode:
authorMaria Lisina <sekoohaka.sarisan@gmail.com>2026-08-10 10:38:14 +0500
committerMaria Lisina <sekoohaka.sarisan@gmail.com>2026-08-10 10:38:14 +0500
commit6dc1149d078fc3b04a19696bfb7d5d6940372175 (patch)
tree169f7f71e6a292a4ab61a0493000e1add4430f8e /subprojects/packagefiles/ffmpeg/meson.build
parent6836426ae183b9a7d0ec99c1e147e8ad6edabd92 (diff)
parent80517840f4ae64469721598e8373d81f2e4493dd (diff)
Merge tag '6.0.0' of https://repo.dec05eba.com/gpu-screen-recorder into debian
Diffstat (limited to 'subprojects/packagefiles/ffmpeg/meson.build')
-rw-r--r--subprojects/packagefiles/ffmpeg/meson.build35
1 files changed, 35 insertions, 0 deletions
diff --git a/subprojects/packagefiles/ffmpeg/meson.build b/subprojects/packagefiles/ffmpeg/meson.build
new file mode 100644
index 0000000..11973f1
--- /dev/null
+++ b/subprojects/packagefiles/ffmpeg/meson.build
@@ -0,0 +1,35 @@
+project('ffmpeg', 'c', version : '9.0')
+
+# Neither ffmpeg nor the libraries it depends on use meson, so they are built with their
+# own build systems into a shared prefix and then exposed to gpu-screen-recorder as
+# regular pkg-config dependencies.
+
+install_prefix = meson.current_build_dir() / 'install'
+c_compiler = ' '.join(meson.get_compiler('c').cmd_array())
+build_library = find_program(meson.global_source_root() / 'extra' / 'build_ffmpeg.sh')
+
+# srt links against mbedtls and ffmpeg links against all of them, so the order matters.
+libraries = ['nv-codec-headers', 'x264', 'opus', 'mbedtls', 'srt', 'ffmpeg']
+
+foreach library : libraries
+ source_dir = library == 'ffmpeg' ? meson.current_source_dir() : subproject(library).get_variable('source_dir')
+ build_result = run_command(build_library, library, source_dir, meson.current_build_dir() / library, install_prefix, c_compiler, check : true)
+ if build_result.stderr().strip() != ''
+ message(build_result.stderr().strip())
+ endif
+endforeach
+
+ffmpeg_libs = ['libavformat', 'libavfilter', 'libavcodec', 'libswresample', 'libavutil']
+
+pkgconfig = find_program('pkg-config')
+pkgconfig_env = environment()
+pkgconfig_env.prepend('PKG_CONFIG_PATH', install_prefix / 'lib' / 'pkgconfig')
+
+ffmpeg_cflags = run_command(pkgconfig, '--cflags', ffmpeg_libs, env : pkgconfig_env, check : true).stdout().split()
+ffmpeg_ldflags = run_command(pkgconfig, '--static', '--libs', ffmpeg_libs, env : pkgconfig_env, check : true).stdout().split()
+
+ffmpeg_dep = declare_dependency(compile_args : ffmpeg_cflags, link_args : ffmpeg_ldflags)
+
+foreach ffmpeg_lib : ffmpeg_libs
+ meson.override_dependency(ffmpeg_lib, ffmpeg_dep)
+endforeach