soup: Fix static build when default_library=both

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1007

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1846>
This commit is contained in:
Nirbheek Chauhan 2022-03-02 23:22:39 +05:30 committed by Tim-Philipp Müller
parent 06e79311c5
commit 299703f297

View file

@ -17,9 +17,10 @@ gobject_dep = dependency('gobject-2.0', fallback: ['glib', 'libgobject_dep'])
libdl_dep = cc.find_library('dl', required: false) libdl_dep = cc.find_library('dl', required: false)
extra_args = [] static_args = []
extra_deps = [] static_deps = []
if get_option('default_library') == 'static' default_library = get_option('default_library')
if default_library in ['static', 'both']
libsoup2_dep = dependency('libsoup-2.4', version : '>=2.48', libsoup2_dep = dependency('libsoup-2.4', version : '>=2.48',
required : false, fallback : ['libsoup', 'libsoup_dep'], required : false, fallback : ['libsoup', 'libsoup_dep'],
default_options: ['sysprof=disabled']) default_options: ['sysprof=disabled'])
@ -32,22 +33,45 @@ if get_option('default_library') == 'static'
subdir_done() subdir_done()
endif endif
if libsoup3_dep.found() if libsoup3_dep.found()
extra_deps += libsoup3_dep static_deps += libsoup3_dep
extra_args += '-DSTATIC_SOUP=3' static_args += '-DSTATIC_SOUP=3'
elif libsoup2_dep.found() elif libsoup2_dep.found()
extra_deps += libsoup2_dep static_deps += libsoup2_dep
extra_args += '-DSTATIC_SOUP=2' static_args += '-DSTATIC_SOUP=2'
endif endif
endif endif
gstsouphttpsrc = library('gstsoup', soup_library_kwargs = {
soup_sources, 'sources' : soup_sources,
c_args : gst_plugins_good_args + extra_args, 'link_args' : noseh_link_args,
link_args : noseh_link_args, 'include_directories' : [configinc, libsinc],
include_directories : [configinc, libsinc], 'install' : true,
dependencies : [gst_dep, gstbase_dep, gsttag_dep, gmodule_dep, gobject_dep, gio_dep, libdl_dep] + extra_deps, 'install_dir' : plugins_install_dir,
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) pkgconfig.generate(gstsouphttpsrc, install_dir : plugins_pkgconfig_install_dir)
plugins += [gstsouphttpsrc] plugins += [gstsouphttpsrc]