From 2e3a575533b41fe71abe39d6211693e7cb90848c Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 2 Mar 2022 23:22:39 +0530 Subject: [PATCH] soup: Fix static build when default_library=both Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1007 Part-of: --- subprojects/gst-plugins-good/ext/soup/meson.build | 56 ++++++++++++++++------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/soup/meson.build b/subprojects/gst-plugins-good/ext/soup/meson.build index bba7c94..897fcb0 100644 --- a/subprojects/gst-plugins-good/ext/soup/meson.build +++ b/subprojects/gst-plugins-good/ext/soup/meson.build @@ -17,9 +17,10 @@ gobject_dep = dependency('gobject-2.0', fallback: ['glib', 'libgobject_dep']) libdl_dep = cc.find_library('dl', required: false) -extra_args = [] -extra_deps = [] -if get_option('default_library') == 'static' +static_args = [] +static_deps = [] +default_library = get_option('default_library') +if default_library in ['static', 'both'] libsoup2_dep = dependency('libsoup-2.4', version : '>=2.48', required : false, fallback : ['libsoup', 'libsoup_dep'], default_options: ['sysprof=disabled']) @@ -32,22 +33,45 @@ if get_option('default_library') == 'static' subdir_done() endif if libsoup3_dep.found() - extra_deps += libsoup3_dep - extra_args += '-DSTATIC_SOUP=3' + static_deps += libsoup3_dep + static_args += '-DSTATIC_SOUP=3' elif libsoup2_dep.found() - extra_deps += libsoup2_dep - extra_args += '-DSTATIC_SOUP=2' + static_deps += libsoup2_dep + static_args += '-DSTATIC_SOUP=2' endif endif -gstsouphttpsrc = library('gstsoup', - soup_sources, - c_args : gst_plugins_good_args + extra_args, - link_args : noseh_link_args, - include_directories : [configinc, libsinc], - dependencies : [gst_dep, gstbase_dep, gsttag_dep, gmodule_dep, gobject_dep, gio_dep, libdl_dep] + extra_deps, - install : true, - install_dir : plugins_install_dir, -) +soup_library_kwargs = { + 'sources' : soup_sources, + 'link_args' : noseh_link_args, + 'include_directories' : [configinc, libsinc], + 'install' : true, + 'install_dir' : plugins_install_dir, +} +soup_library_deps = [gst_dep, gstbase_dep, gsttag_dep, gmodule_dep, gobject_dep, gio_dep, libdl_dep] +soup_library_c_args = gst_plugins_good_args + +if default_library in ['shared', 'both'] + gstsouphttpsrc_shared = shared_library('gstsoup', + c_args : soup_library_c_args, + dependencies : soup_library_deps, + kwargs: soup_library_kwargs, + ) +endif + +if default_library in ['static', 'both'] + gstsouphttpsrc_static = static_library('gstsoup', + c_args : soup_library_c_args + static_args, + dependencies : soup_library_deps + static_deps, + kwargs: soup_library_kwargs, + ) +endif + +if default_library == 'static' + gstsouphttpsrc = gstsouphttpsrc_static +else + gstsouphttpsrc = gstsouphttpsrc_shared +endif + pkgconfig.generate(gstsouphttpsrc, install_dir : plugins_pkgconfig_install_dir) plugins += [gstsouphttpsrc] -- 2.7.4