soup: Link to libsoup in all cases on non-Linux

We have unsolvable issues on macOS because of this, and the feature
was added specifically for issues that occur on Linux distros since
they ship both libsoup 2.4 and 3.0.

Everyone else should just pick one and use it, since you cannot mix
the two in a single process anyway.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6156>
This commit is contained in:
Nirbheek Chauhan 2024-02-21 02:30:11 +05:30
parent f7e494f348
commit 11f6984bf5
12 changed files with 201 additions and 230 deletions

View file

@ -418,7 +418,6 @@ build fedora clang:
-Dgst-plugins-base:pango=enabled -Dgst-plugins-base:pango=enabled
-Dgst-plugins-good:cairo=enabled -Dgst-plugins-good:cairo=enabled
-Dgst-plugins-good:soup=enabled -Dgst-plugins-good:soup=enabled
-Dgst-plugins-good:soup-lookup-dep=true
-Dgst-plugins-bad:d3d11-wgc=enabled -Dgst-plugins-bad:d3d11-wgc=enabled
rules: rules:
- !reference [.upstream-branch-rules, rules] - !reference [.upstream-branch-rules, rules]
@ -513,7 +512,6 @@ build vs2022 arm64:
MESON_CROSS_ARGS: >- MESON_CROSS_ARGS: >-
-Dgst-plugins-base:pango=disabled -Dgst-plugins-base:pango=disabled
-Dgst-plugins-good:cairo=disabled -Dgst-plugins-good:cairo=disabled
-Dgst-plugins-good:soup-lookup-dep=false
-Dgst-devtools:cairo=disabled -Dgst-devtools:cairo=disabled
-Dpython=disabled -Dpython=disabled
-Dintrospection=disabled -Dintrospection=disabled
@ -565,7 +563,6 @@ build macos:
-Dgst-plugins-base:pango=enabled -Dgst-plugins-base:pango=enabled
-Dgst-plugins-good:cairo=enabled -Dgst-plugins-good:cairo=enabled
-Dgst-plugins-good:soup=enabled -Dgst-plugins-good:soup=enabled
-Dgst-plugins-good:soup-lookup-dep=true
# ---- Tests ----- # # ---- Tests ----- #

View file

@ -36,7 +36,7 @@ adaptivedemux2_base_element_init (GstPlugin * plugin)
"adaptivedemux2"); "adaptivedemux2");
g_once_init_leave (&res, TRUE); g_once_init_leave (&res, TRUE);
} }
#ifndef STATIC_SOUP #ifndef LINK_SOUP
if (!gst_soup_load_library ()) { if (!gst_soup_load_library ()) {
GST_WARNING ("Failed to load libsoup library"); GST_WARNING ("Failed to load libsoup library");
return FALSE; return FALSE;

View file

@ -56,6 +56,7 @@ hls_dep = dependency('', required : false)
adaptivedemux2_dep = dependency('', required : false) adaptivedemux2_dep = dependency('', required : false)
adaptivedemux2_opt = get_option('adaptivedemux2') adaptivedemux2_opt = get_option('adaptivedemux2')
soup_ver_opt = get_option('soup-version')
if adaptivedemux2_opt.disabled() if adaptivedemux2_opt.disabled()
message('Not building adaptivedemux2 plugin because it was disabled') message('Not building adaptivedemux2 plugin because it was disabled')
subdir_done() subdir_done()
@ -74,60 +75,71 @@ plugin_sources += dash_sources
plugin_sources += smoothstreaming_sources plugin_sources += smoothstreaming_sources
plugin_sources += hls_sources plugin_sources += hls_sources
libdl = cc.find_library('dl', required: false)
soup_loader_args = ['-DBUILDING_ADAPTIVEDEMUX2'] soup_loader_args = ['-DBUILDING_ADAPTIVEDEMUX2']
soup_link_args = []
soup_link_deps = []
default_library = get_option('default_library') default_library = get_option('default_library')
if default_library in ['static', 'both'] if host_system != 'linux' or default_library in ['static', 'both']
libsoup2_dep = dependency('libsoup-2.4', version : '>=2.48', if soup_ver_opt in ['auto', '3']
required : false, fallback : ['libsoup', 'libsoup_dep'], libsoup3_dep = dependency('libsoup-3.0', allow_fallback: true,
default_options: ['sysprof=disabled']) required: soup_ver_opt == '3' and soup_opt.enabled())
libsoup3_dep = dependency('libsoup-3.0', required : false, endif
fallback : ['libsoup3', 'libsoup_dep']) if soup_ver_opt in ['auto', '2']
libsoup2_dep = dependency('libsoup-2.4', version : '>=2.48', allow_fallback: true,
if libsoup3_dep.found() default_options: ['sysprof=disabled'],
soup_dep = libsoup3_dep required: soup_ver_opt == '2' and soup_opt.enabled())
static_soup_loader_args = ['-DSTATIC_SOUP=3']
elif libsoup2_dep.found()
soup_dep = libsoup2_dep
static_soup_loader_args = ['-DSTATIC_SOUP=2']
else
if adaptivedemux2_opt.enabled()
error(f'adaptivedemux2: Either libsoup2 or libsoup3 is needed for build with default_library=@default_library@')
endif
message(f'Not building adaptivedemux2 plugin: either libsoup2 or libsoup3 is needed for build with default_library=@default_library@')
subdir_done()
endif endif
# Static plugin links to libsoup directly at build time if libsoup3_dep.found()
adaptivedemux2_static = static_library('gstadaptivedemux2', soup_link_deps += [libsoup3_dep]
plugin_sources, soup_link_args = ['-DLINK_SOUP=3']
include_directories: [configinc, libsinc], elif libsoup2_dep.found()
c_args: [gst_plugins_good_args, soup_loader_args, soup_loader_args, hls_cargs, soup_link_deps += [libsoup2_dep]
'-DGST_ISOFF_API=G_GNUC_INTERNAL'], soup_link_args = ['-DLINK_SOUP=2']
dependencies: [gst_dep, gsttag_dep, gstnet_dep, gstbase_dep, else
gstpbutils_dep, gstapp_dep, soup_dep, if adaptivedemux2_opt.enabled()
gio_dep, adaptive_xml2_dep, error(f'adaptivedemux2: Either libsoup2 or libsoup3 is needed')
hls_crypto_dep, libm], endif
install: true, message(f'Not building adaptivedemux2 plugin: either libsoup2 or libsoup3 is needed')
install_dir: plugins_install_dir) subdir_done()
endif
endif endif
if default_library in ['shared', 'both'] # Shared plugin doesn't link to libsoup but dlopen()s it at runtime
# Shared plugin doesn't link to libsoup but dlopen()s it at runtime adaptive_kwargs = {
libdl = cc.find_library('dl', required: false) 'sources': plugin_sources,
'include_directories': [configinc, libsinc],
'install': true,
'install_dir': plugins_install_dir,
}
adaptive_deps = [gmodule_dep, gst_dep, gsttag_dep, gstnet_dep, gstbase_dep, gstpbutils_dep,
gstapp_dep, gio_dep, adaptive_xml2_dep, hls_crypto_dep, libdl, libm]
adaptive_args = [gst_plugins_good_args, soup_loader_args, hls_cargs,
'-DGST_ISOFF_API=G_GNUC_INTERNAL']
adaptivedemux2_shared = shared_library('gstadaptivedemux2', if host_system != 'linux'
plugin_sources, adaptivedemux2 = library('gstadaptivedemux2',
include_directories: [configinc, libsinc], c_args: [adaptive_args, soup_link_args],
c_args: [gst_plugins_good_args, soup_loader_args, hls_cargs, dependencies: [adaptive_deps, soup_link_deps],
'-DGST_ISOFF_API=G_GNUC_INTERNAL'], kwargs: adaptive_kwargs)
dependencies: [gsttag_dep, gstnet_dep, gstbase_dep, adaptivedemux2_static = adaptivedemux2
gstpbutils_dep, gstapp_dep, gio_dep, adaptivedemux2_shared = adaptivedemux2
gmodule_dep, adaptive_xml2_dep, else
hls_crypto_dep, libm, libdl], if default_library in ['static', 'both']
install: true, # Static plugin links to libsoup directly at build time
install_dir: plugins_install_dir) adaptivedemux2_static = static_library('gstadaptivedemux2',
c_args: [adaptive_args, soup_link_args],
dependencies: [adaptive_deps, soup_link_deps],
kwargs: adaptive_kwargs)
endif
if default_library in ['shared', 'both']
adaptivedemux2_shared = shared_library('gstadaptivedemux2',
c_args: adaptive_args,
dependencies: adaptive_deps,
kwargs: adaptive_kwargs)
endif
endif endif
# Use the static library to generate the .pc file if it's available. The shared # Use the static library to generate the .pc file if it's available. The shared

View file

@ -56,7 +56,7 @@ soup_element_init (GstPlugin * plugin)
g_once_init_leave (&res, TRUE); g_once_init_leave (&res, TRUE);
} }
#ifndef STATIC_SOUP #ifndef LINK_SOUP
if (!gst_soup_load_library ()) { if (!gst_soup_load_library ()) {
GST_WARNING ("Failed to load libsoup library"); GST_WARNING ("Failed to load libsoup library");
return FALSE; return FALSE;

View file

@ -1049,11 +1049,11 @@ thread_func (gpointer user_data)
NULL); NULL);
g_object_unref (proxy_resolver); g_object_unref (proxy_resolver);
} }
#if !defined(STATIC_SOUP) || STATIC_SOUP == 2 #if !defined(LINK_SOUP) || LINK_SOUP == 2
} else { } else {
g_object_set (session->session, "ssl-strict", src->ssl_strict, NULL); g_object_set (session->session, "ssl-strict", src->ssl_strict, NULL);
if (src->proxy != NULL) { if (src->proxy != NULL) {
/* Need #if because there's no proxy->soup_uri when STATIC_SOUP == 3 */ /* Need #if because there's no proxy->soup_uri when LINK_SOUP == 3 */
g_object_set (session->session, "proxy-uri", src->proxy->soup_uri, NULL); g_object_set (session->session, "proxy-uri", src->proxy->soup_uri, NULL);
} }
#endif #endif
@ -1655,7 +1655,7 @@ gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src)
} }
/* SOUP_STATUS_IS_TRANSPORT_ERROR was replaced with GError in libsoup-3.0 */ /* SOUP_STATUS_IS_TRANSPORT_ERROR was replaced with GError in libsoup-3.0 */
#if !defined(STATIC_SOUP) || STATIC_SOUP == 2 #if !defined(LINK_SOUP) || LINK_SOUP == 2
if (SOUP_STATUS_IS_TRANSPORT_ERROR (status_code)) { if (SOUP_STATUS_IS_TRANSPORT_ERROR (status_code)) {
switch (status_code) { switch (status_code) {
case SOUP_STATUS_CANT_RESOLVE: case SOUP_STATUS_CANT_RESOLVE:
@ -1816,7 +1816,7 @@ gst_soup_http_src_build_message (GstSoupHTTPSrc * src, const gchar * method)
/* SOUP_MESSAGE_OVERWRITE_CHUNKS is gone in libsoup-3.0, and /* SOUP_MESSAGE_OVERWRITE_CHUNKS is gone in libsoup-3.0, and
* soup_message_body_set_accumulate() requires SoupMessageBody, which * soup_message_body_set_accumulate() requires SoupMessageBody, which
* can only be fetched from SoupServerMessage, not SoupMessage */ * can only be fetched from SoupServerMessage, not SoupMessage */
#if !defined(STATIC_SOUP) || STATIC_SOUP == 2 #if !defined(LINK_SOUP) || LINK_SOUP == 2
if (gst_soup_loader_get_api_version () == 2) if (gst_soup_loader_get_api_version () == 2)
flags |= SOUP_MESSAGE_OVERWRITE_CHUNKS; flags |= SOUP_MESSAGE_OVERWRITE_CHUNKS;
#endif #endif

View file

@ -23,13 +23,6 @@
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
#ifdef G_OS_WIN32
#include <windows.h>
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#define GST_WINAPI_ONLY_APP
#endif
#endif /* G_OS_WIN32 */
#ifdef BUILDING_ADAPTIVEDEMUX2 #ifdef BUILDING_ADAPTIVEDEMUX2
GST_DEBUG_CATEGORY (gst_adaptivedemux_soup_debug); GST_DEBUG_CATEGORY (gst_adaptivedemux_soup_debug);
#define GST_CAT_DEFAULT gst_adaptivedemux_soup_debug #define GST_CAT_DEFAULT gst_adaptivedemux_soup_debug
@ -39,17 +32,14 @@ GST_DEBUG_CATEGORY (gst_soup_debug);
#endif #endif
#ifndef STATIC_SOUP #ifndef LINK_SOUP
/* G_OS_WIN32 is handled separately below */ #if defined(__APPLE__) || defined(G_OS_WIN32)
#ifdef __APPLE__ #error "dlopen of libsoup is only supported on Linux"
#define LIBSOUP_3_SONAME "libsoup-3.0.0.dylib"
#define LIBSOUP_2_SONAME "libsoup-2.4.1.dylib"
#else
#define LIBSOUP_3_SONAME "libsoup-3.0.so.0"
#define LIBSOUP_2_SONAME "libsoup-2.4.so.1"
#endif #endif
#define LIBSOUP_3_SONAME "libsoup-3.0.so.0"
#define LIBSOUP_2_SONAME "libsoup-2.4.so.1"
#define LOAD_SYMBOL(name) G_STMT_START { \ #define LOAD_SYMBOL(name) G_STMT_START { \
if (!g_module_symbol (module, G_STRINGIFY (name), (gpointer *) &G_PASTE (vtable->_, name))) { \ if (!g_module_symbol (module, G_STRINGIFY (name), (gpointer *) &G_PASTE (vtable->_, name))) { \
@ -187,52 +177,9 @@ gst_soup_load_library (void)
g_clear_pointer (&handle, dlclose); g_clear_pointer (&handle, dlclose);
} }
#else /* !HAVE_RTLD_NOLOAD */
#ifdef G_OS_WIN32
#define LIBSOUP2_MSVC_DLL "soup-2.4-1.dll"
#define LIBSOUP3_MSVC_DLL "soup-3.0-0.dll"
#define LIBSOUP2_MINGW_DLL "libsoup-2.4-1.dll"
#define LIBSOUP3_MINGW_DLL "libsoup-3.0-0.dll"
{
#ifdef _MSC_VER
const char *candidates[5] = { LIBSOUP3_MSVC_DLL, LIBSOUP2_MSVC_DLL,
LIBSOUP3_MINGW_DLL, LIBSOUP2_MINGW_DLL, 0
};
#else #else
const char *candidates[5] = { LIBSOUP3_MINGW_DLL, LIBSOUP2_MINGW_DLL,
LIBSOUP3_MSVC_DLL, LIBSOUP2_MSVC_DLL, 0
};
#endif /* _MSC_VER */
guint len = g_strv_length ((gchar **) candidates);
#if !GST_WINAPI_ONLY_APP
for (guint i = 0; i < len; i++) {
HMODULE phModule;
BOOL loaded =
GetModuleHandleExA (GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
candidates[i], &phModule);
if (loaded) {
GST_DEBUG ("%s is resident. Using it.", candidates[i]);
libsoup_sonames[0] = candidates[i];
break;
}
}
#endif
if (libsoup_sonames[0] == NULL) {
GST_DEBUG ("No resident libsoup, trying them all");
for (guint i = 0; i < len; i++) {
libsoup_sonames[i] = candidates[i];
}
}
}
#else /* !G_OS_WIN32 */
libsoup_sonames[0] = LIBSOUP_3_SONAME; libsoup_sonames[0] = LIBSOUP_3_SONAME;
libsoup_sonames[1] = LIBSOUP_2_SONAME; libsoup_sonames[1] = LIBSOUP_2_SONAME;
#endif /* G_OS_WIN32 */
#endif /* HAVE_RTLD_NOLOAD */ #endif /* HAVE_RTLD_NOLOAD */
vtable = &gst_soup_vtable; vtable = &gst_soup_vtable;
@ -317,13 +264,13 @@ gst_soup_load_library (void)
return vtable->loaded; return vtable->loaded;
} }
#endif /* !STATIC_SOUP */ #endif /* !LINK_SOUP */
guint guint
gst_soup_loader_get_api_version (void) gst_soup_loader_get_api_version (void)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return STATIC_SOUP; return LINK_SOUP;
#else #else
return gst_soup_vtable.lib_version; return gst_soup_vtable.lib_version;
#endif #endif
@ -346,10 +293,10 @@ _soup_session_new_with_options (const char *optname1, ...)
SoupLogger * SoupLogger *
_soup_logger_new (SoupLoggerLogLevel level) _soup_logger_new (SoupLoggerLogLevel level)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
return soup_logger_new (level, -1); return soup_logger_new (level, -1);
#elif STATIC_SOUP == 3 #elif LINK_SOUP == 3
return soup_logger_new (level); return soup_logger_new (level);
#endif #endif
#else #else
@ -366,7 +313,7 @@ void
_soup_logger_set_printer (SoupLogger * logger, SoupLoggerPrinter printer, _soup_logger_set_printer (SoupLogger * logger, SoupLoggerPrinter printer,
gpointer printer_data, GDestroyNotify destroy) gpointer printer_data, GDestroyNotify destroy)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_logger_set_printer (logger, printer, printer_data, destroy); soup_logger_set_printer (logger, printer, printer_data, destroy);
#else #else
g_assert (gst_soup_vtable._soup_logger_set_printer != NULL); g_assert (gst_soup_vtable._soup_logger_set_printer != NULL);
@ -378,7 +325,7 @@ _soup_logger_set_printer (SoupLogger * logger, SoupLoggerPrinter printer,
void void
_soup_session_add_feature (SoupSession * session, SoupSessionFeature * feature) _soup_session_add_feature (SoupSession * session, SoupSessionFeature * feature)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_session_add_feature (session, feature); soup_session_add_feature (session, feature);
#else #else
g_assert (gst_soup_vtable._soup_session_add_feature != NULL); g_assert (gst_soup_vtable._soup_session_add_feature != NULL);
@ -390,8 +337,8 @@ GstSoupUri *
gst_soup_uri_new (const char *uri_string) gst_soup_uri_new (const char *uri_string)
{ {
GstSoupUri *uri = g_new0 (GstSoupUri, 1); GstSoupUri *uri = g_new0 (GstSoupUri, 1);
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
uri->soup_uri = soup_uri_new (uri_string); uri->soup_uri = soup_uri_new (uri_string);
#else #else
uri->uri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS, NULL); uri->uri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS, NULL);
@ -412,48 +359,48 @@ gst_soup_uri_new (const char *uri_string)
void void
gst_soup_uri_free (GstSoupUri * uri) gst_soup_uri_free (GstSoupUri * uri)
{ {
#if (defined(STATIC_SOUP) && STATIC_SOUP == 3) || (!defined(STATIC_SOUP) && GLIB_CHECK_VERSION(2, 66, 0)) #if (defined(LINK_SOUP) && LINK_SOUP == 3) || (!defined(LINK_SOUP) && GLIB_CHECK_VERSION(2, 66, 0))
if (uri->uri) { if (uri->uri) {
g_uri_unref (uri->uri); g_uri_unref (uri->uri);
} }
#endif #endif
#if defined(STATIC_SOUP) #if defined(LINK_SOUP)
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
if (uri->soup_uri) { if (uri->soup_uri) {
soup_uri_free (uri->soup_uri); soup_uri_free (uri->soup_uri);
} }
#endif #endif
#else /* !STATIC_SOUP */ #else /* !LINK_SOUP */
if (uri->soup_uri) { if (uri->soup_uri) {
g_assert (gst_soup_vtable._soup_uri_free_2 != NULL); g_assert (gst_soup_vtable._soup_uri_free_2 != NULL);
gst_soup_vtable._soup_uri_free_2 (uri->soup_uri); gst_soup_vtable._soup_uri_free_2 (uri->soup_uri);
} }
#endif /* STATIC_SOUP */ #endif /* LINK_SOUP */
g_free (uri); g_free (uri);
} }
char * char *
gst_soup_uri_to_string (GstSoupUri * uri) gst_soup_uri_to_string (GstSoupUri * uri)
{ {
#if (defined(STATIC_SOUP) && STATIC_SOUP == 3) || (!defined(STATIC_SOUP) && GLIB_CHECK_VERSION(2, 66, 0)) #if (defined(LINK_SOUP) && LINK_SOUP == 3) || (!defined(LINK_SOUP) && GLIB_CHECK_VERSION(2, 66, 0))
if (uri->uri) { if (uri->uri) {
return g_uri_to_string_partial (uri->uri, G_URI_HIDE_PASSWORD); return g_uri_to_string_partial (uri->uri, G_URI_HIDE_PASSWORD);
} }
#endif #endif
#if defined(STATIC_SOUP) #if defined(LINK_SOUP)
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
if (uri->soup_uri) { if (uri->soup_uri) {
return soup_uri_to_string (uri->soup_uri, FALSE); return soup_uri_to_string (uri->soup_uri, FALSE);
} }
#endif #endif
#else /* !STATIC_SOUP */ #else /* !LINK_SOUP */
if (uri->soup_uri) { if (uri->soup_uri) {
g_assert (gst_soup_vtable._soup_uri_to_string_2 != NULL); g_assert (gst_soup_vtable._soup_uri_to_string_2 != NULL);
return gst_soup_vtable._soup_uri_to_string_2 (uri->soup_uri, FALSE); return gst_soup_vtable._soup_uri_to_string_2 (uri->soup_uri, FALSE);
} }
#endif /* STATIC_SOUP */ #endif /* LINK_SOUP */
g_assert_not_reached (); g_assert_not_reached ();
return NULL; return NULL;
@ -462,12 +409,12 @@ gst_soup_uri_to_string (GstSoupUri * uri)
char * char *
gst_soup_message_uri_to_string (SoupMessage * msg) gst_soup_message_uri_to_string (SoupMessage * msg)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
SoupURI *uri = NULL; SoupURI *uri = NULL;
uri = soup_message_get_uri (msg); uri = soup_message_get_uri (msg);
return soup_uri_to_string (uri, FALSE); return soup_uri_to_string (uri, FALSE);
#elif STATIC_SOUP == 3 #elif LINK_SOUP == 3
GUri *uri = NULL; GUri *uri = NULL;
uri = soup_message_get_uri (msg); uri = soup_message_get_uri (msg);
return g_uri_to_string_partial (uri, G_URI_HIDE_PASSWORD); return g_uri_to_string_partial (uri, G_URI_HIDE_PASSWORD);
@ -499,7 +446,7 @@ gst_soup_message_uri_to_string (SoupMessage * msg)
guint guint
_soup_get_major_version (void) _soup_get_major_version (void)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_get_major_version (); return soup_get_major_version ();
#else #else
g_assert (gst_soup_vtable._soup_get_major_version != NULL); g_assert (gst_soup_vtable._soup_get_major_version != NULL);
@ -510,7 +457,7 @@ _soup_get_major_version (void)
guint guint
_soup_get_minor_version (void) _soup_get_minor_version (void)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_get_minor_version (); return soup_get_minor_version ();
#else #else
g_assert (gst_soup_vtable._soup_get_minor_version != NULL); g_assert (gst_soup_vtable._soup_get_minor_version != NULL);
@ -521,7 +468,7 @@ _soup_get_minor_version (void)
guint guint
_soup_get_micro_version (void) _soup_get_micro_version (void)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_get_micro_version (); return soup_get_micro_version ();
#else #else
g_assert (gst_soup_vtable._soup_get_micro_version != NULL); g_assert (gst_soup_vtable._soup_get_micro_version != NULL);
@ -533,12 +480,12 @@ void
_soup_message_set_request_body_from_bytes (SoupMessage * msg, _soup_message_set_request_body_from_bytes (SoupMessage * msg,
const char *content_type, GBytes * bytes) const char *content_type, GBytes * bytes)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
gsize size; gsize size;
gconstpointer data = g_bytes_get_data (bytes, &size); gconstpointer data = g_bytes_get_data (bytes, &size);
soup_message_body_append (msg->request_body, SOUP_MEMORY_COPY, data, size); soup_message_body_append (msg->request_body, SOUP_MEMORY_COPY, data, size);
#elif STATIC_SOUP == 3 #elif LINK_SOUP == 3
soup_message_set_request_body_from_bytes (msg, content_type, bytes); soup_message_set_request_body_from_bytes (msg, content_type, bytes);
#endif #endif
#else #else
@ -561,7 +508,7 @@ _soup_message_set_request_body_from_bytes (SoupMessage * msg,
GType GType
_soup_session_get_type (void) _soup_session_get_type (void)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_session_get_type (); return soup_session_get_type ();
#else #else
g_assert (gst_soup_vtable._soup_session_get_type != NULL); g_assert (gst_soup_vtable._soup_session_get_type != NULL);
@ -572,7 +519,7 @@ _soup_session_get_type (void)
GType GType
_soup_logger_log_level_get_type (void) _soup_logger_log_level_get_type (void)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_logger_log_level_get_type (); return soup_logger_log_level_get_type ();
#else #else
g_assert (gst_soup_vtable._soup_logger_log_level_get_type != NULL); g_assert (gst_soup_vtable._soup_logger_log_level_get_type != NULL);
@ -583,7 +530,7 @@ _soup_logger_log_level_get_type (void)
GType GType
_soup_content_decoder_get_type (void) _soup_content_decoder_get_type (void)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_content_decoder_get_type (); return soup_content_decoder_get_type ();
#else #else
g_assert (gst_soup_vtable._soup_content_decoder_get_type != NULL); g_assert (gst_soup_vtable._soup_content_decoder_get_type != NULL);
@ -594,7 +541,7 @@ _soup_content_decoder_get_type (void)
GType GType
_soup_cookie_jar_get_type (void) _soup_cookie_jar_get_type (void)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_cookie_jar_get_type (); return soup_cookie_jar_get_type ();
#else #else
g_assert (gst_soup_vtable._soup_cookie_jar_get_type != NULL); g_assert (gst_soup_vtable._soup_cookie_jar_get_type != NULL);
@ -605,7 +552,7 @@ _soup_cookie_jar_get_type (void)
void void
_soup_session_abort (SoupSession * session) _soup_session_abort (SoupSession * session)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_session_abort (session); soup_session_abort (session);
#else #else
g_assert (gst_soup_vtable._soup_session_abort != NULL); g_assert (gst_soup_vtable._soup_session_abort != NULL);
@ -616,7 +563,7 @@ _soup_session_abort (SoupSession * session)
SoupMessage * SoupMessage *
_soup_message_new (const char *method, const char *uri_string) _soup_message_new (const char *method, const char *uri_string)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_message_new (method, uri_string); return soup_message_new (method, uri_string);
#else #else
g_assert (gst_soup_vtable._soup_message_new != NULL); g_assert (gst_soup_vtable._soup_message_new != NULL);
@ -627,10 +574,10 @@ _soup_message_new (const char *method, const char *uri_string)
SoupMessageHeaders * SoupMessageHeaders *
_soup_message_get_request_headers (SoupMessage * msg) _soup_message_get_request_headers (SoupMessage * msg)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
return msg->request_headers; return msg->request_headers;
#elif STATIC_SOUP == 3 #elif LINK_SOUP == 3
return soup_message_get_request_headers (msg); return soup_message_get_request_headers (msg);
#endif #endif
#else #else
@ -647,10 +594,10 @@ _soup_message_get_request_headers (SoupMessage * msg)
SoupMessageHeaders * SoupMessageHeaders *
_soup_message_get_response_headers (SoupMessage * msg) _soup_message_get_response_headers (SoupMessage * msg)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
return msg->response_headers; return msg->response_headers;
#elif STATIC_SOUP == 3 #elif LINK_SOUP == 3
return soup_message_get_response_headers (msg); return soup_message_get_response_headers (msg);
#endif #endif
#else #else
@ -667,7 +614,7 @@ _soup_message_get_response_headers (SoupMessage * msg)
void void
_soup_message_headers_remove (SoupMessageHeaders * hdrs, const char *name) _soup_message_headers_remove (SoupMessageHeaders * hdrs, const char *name)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_message_headers_remove (hdrs, name); soup_message_headers_remove (hdrs, name);
#else #else
g_assert (gst_soup_vtable._soup_message_headers_remove != NULL); g_assert (gst_soup_vtable._soup_message_headers_remove != NULL);
@ -679,7 +626,7 @@ void
_soup_message_headers_append (SoupMessageHeaders * hdrs, const char *name, _soup_message_headers_append (SoupMessageHeaders * hdrs, const char *name,
const char *value) const char *value)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_message_headers_append (hdrs, name, value); soup_message_headers_append (hdrs, name, value);
#else #else
g_assert (gst_soup_vtable._soup_message_headers_append != NULL); g_assert (gst_soup_vtable._soup_message_headers_append != NULL);
@ -690,7 +637,7 @@ _soup_message_headers_append (SoupMessageHeaders * hdrs, const char *name,
void void
_soup_message_set_flags (SoupMessage * msg, SoupMessageFlags flags) _soup_message_set_flags (SoupMessage * msg, SoupMessageFlags flags)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_message_set_flags (msg, flags); soup_message_set_flags (msg, flags);
#else #else
g_assert (gst_soup_vtable._soup_message_set_flags != NULL); g_assert (gst_soup_vtable._soup_message_set_flags != NULL);
@ -701,7 +648,7 @@ _soup_message_set_flags (SoupMessage * msg, SoupMessageFlags flags)
void void
_soup_session_add_feature_by_type (SoupSession * session, GType feature_type) _soup_session_add_feature_by_type (SoupSession * session, GType feature_type)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_session_add_feature_by_type (session, feature_type); soup_session_add_feature_by_type (session, feature_type);
#else #else
g_assert (gst_soup_vtable._soup_session_add_feature_by_type != NULL); g_assert (gst_soup_vtable._soup_session_add_feature_by_type != NULL);
@ -713,7 +660,7 @@ void
_soup_message_headers_foreach (SoupMessageHeaders * hdrs, _soup_message_headers_foreach (SoupMessageHeaders * hdrs,
SoupMessageHeadersForeachFunc func, gpointer user_data) SoupMessageHeadersForeachFunc func, gpointer user_data)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_message_headers_foreach (hdrs, func, user_data); soup_message_headers_foreach (hdrs, func, user_data);
#else #else
g_assert (gst_soup_vtable._soup_message_headers_foreach != NULL); g_assert (gst_soup_vtable._soup_message_headers_foreach != NULL);
@ -724,7 +671,7 @@ _soup_message_headers_foreach (SoupMessageHeaders * hdrs,
SoupEncoding SoupEncoding
_soup_message_headers_get_encoding (SoupMessageHeaders * hdrs) _soup_message_headers_get_encoding (SoupMessageHeaders * hdrs)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_message_headers_get_encoding (hdrs); return soup_message_headers_get_encoding (hdrs);
#else #else
g_assert (gst_soup_vtable._soup_message_headers_get_encoding != NULL); g_assert (gst_soup_vtable._soup_message_headers_get_encoding != NULL);
@ -735,7 +682,7 @@ _soup_message_headers_get_encoding (SoupMessageHeaders * hdrs)
goffset goffset
_soup_message_headers_get_content_length (SoupMessageHeaders * hdrs) _soup_message_headers_get_content_length (SoupMessageHeaders * hdrs)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_message_headers_get_content_length (hdrs); return soup_message_headers_get_content_length (hdrs);
#else #else
g_assert (gst_soup_vtable._soup_message_headers_get_content_length != NULL); g_assert (gst_soup_vtable._soup_message_headers_get_content_length != NULL);
@ -746,10 +693,10 @@ _soup_message_headers_get_content_length (SoupMessageHeaders * hdrs)
SoupStatus SoupStatus
_soup_message_get_status (SoupMessage * msg) _soup_message_get_status (SoupMessage * msg)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
return msg->status_code; return msg->status_code;
#elif STATIC_SOUP == 3 #elif LINK_SOUP == 3
return soup_message_get_status (msg); return soup_message_get_status (msg);
#endif #endif
#else #else
@ -766,10 +713,10 @@ _soup_message_get_status (SoupMessage * msg)
const char * const char *
_soup_message_get_reason_phrase (SoupMessage * msg) _soup_message_get_reason_phrase (SoupMessage * msg)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
return msg->reason_phrase; return msg->reason_phrase;
#elif STATIC_SOUP == 3 #elif LINK_SOUP == 3
return soup_message_get_reason_phrase (msg); return soup_message_get_reason_phrase (msg);
#endif #endif
#else #else
@ -786,7 +733,7 @@ _soup_message_get_reason_phrase (SoupMessage * msg)
const char * const char *
_soup_message_headers_get_one (SoupMessageHeaders * hdrs, const char *name) _soup_message_headers_get_one (SoupMessageHeaders * hdrs, const char *name)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_message_headers_get_one (hdrs, name); return soup_message_headers_get_one (hdrs, name);
#else #else
g_assert (gst_soup_vtable._soup_message_headers_get_one != NULL); g_assert (gst_soup_vtable._soup_message_headers_get_one != NULL);
@ -797,7 +744,7 @@ _soup_message_headers_get_one (SoupMessageHeaders * hdrs, const char *name)
void void
_soup_message_disable_feature (SoupMessage * msg, GType feature_type) _soup_message_disable_feature (SoupMessage * msg, GType feature_type)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_message_disable_feature (msg, feature_type); soup_message_disable_feature (msg, feature_type);
#else #else
g_assert (gst_soup_vtable._soup_message_disable_feature != NULL); g_assert (gst_soup_vtable._soup_message_disable_feature != NULL);
@ -809,7 +756,7 @@ const char *
_soup_message_headers_get_content_type (SoupMessageHeaders * hdrs, _soup_message_headers_get_content_type (SoupMessageHeaders * hdrs,
GHashTable ** params) GHashTable ** params)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_message_headers_get_content_type (hdrs, params); return soup_message_headers_get_content_type (hdrs, params);
#else #else
g_assert (gst_soup_vtable._soup_message_headers_get_content_type != NULL); g_assert (gst_soup_vtable._soup_message_headers_get_content_type != NULL);
@ -821,7 +768,7 @@ gboolean
_soup_message_headers_get_content_range (SoupMessageHeaders * hdrs, _soup_message_headers_get_content_range (SoupMessageHeaders * hdrs,
goffset * start, goffset * end, goffset * total_length) goffset * start, goffset * end, goffset * total_length)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_message_headers_get_content_range (hdrs, start, end, return soup_message_headers_get_content_range (hdrs, start, end,
total_length); total_length);
#else #else
@ -835,7 +782,7 @@ void
_soup_message_headers_set_range (SoupMessageHeaders * hdrs, goffset start, _soup_message_headers_set_range (SoupMessageHeaders * hdrs, goffset start,
goffset end) goffset end)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_message_headers_set_range (hdrs, start, end); soup_message_headers_set_range (hdrs, start, end);
#else #else
g_assert (gst_soup_vtable._soup_message_headers_set_range != NULL); g_assert (gst_soup_vtable._soup_message_headers_set_range != NULL);
@ -847,7 +794,7 @@ void
_soup_auth_authenticate (SoupAuth * auth, const char *username, _soup_auth_authenticate (SoupAuth * auth, const char *username,
const char *password) const char *password)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_auth_authenticate (auth, username, password); soup_auth_authenticate (auth, username, password);
#else #else
g_assert (gst_soup_vtable._soup_auth_authenticate != NULL); g_assert (gst_soup_vtable._soup_auth_authenticate != NULL);
@ -858,10 +805,10 @@ _soup_auth_authenticate (SoupAuth * auth, const char *username,
const char * const char *
_soup_message_get_method (SoupMessage * msg) _soup_message_get_method (SoupMessage * msg)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
return msg->method; return msg->method;
#elif STATIC_SOUP == 3 #elif LINK_SOUP == 3
return soup_message_get_method (msg); return soup_message_get_method (msg);
#endif #endif
#else #else
@ -880,8 +827,8 @@ _soup_session_send_async (SoupSession * session, SoupMessage * msg,
GCancellable * cancellable, GAsyncReadyCallback callback, GCancellable * cancellable, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#if STATIC_SOUP == 2 #if LINK_SOUP == 2
soup_session_send_async (session, msg, cancellable, callback, user_data); soup_session_send_async (session, msg, cancellable, callback, user_data);
#else #else
soup_session_send_async (session, msg, G_PRIORITY_DEFAULT, cancellable, soup_session_send_async (session, msg, G_PRIORITY_DEFAULT, cancellable,
@ -904,7 +851,7 @@ GInputStream *
_soup_session_send_finish (SoupSession * session, _soup_session_send_finish (SoupSession * session,
GAsyncResult * result, GError ** error) GAsyncResult * result, GError ** error)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_session_send_finish (session, result, error); return soup_session_send_finish (session, result, error);
#else #else
g_assert (gst_soup_vtable._soup_session_send_finish != NULL); g_assert (gst_soup_vtable._soup_session_send_finish != NULL);
@ -916,7 +863,7 @@ GInputStream *
_soup_session_send (SoupSession * session, SoupMessage * msg, _soup_session_send (SoupSession * session, SoupMessage * msg,
GCancellable * cancellable, GError ** error) GCancellable * cancellable, GError ** error)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_session_send (session, msg, cancellable, error); return soup_session_send (session, msg, cancellable, error);
#else #else
g_assert (gst_soup_vtable._soup_session_send != NULL); g_assert (gst_soup_vtable._soup_session_send != NULL);
@ -928,8 +875,8 @@ void
gst_soup_session_cancel_message (SoupSession * session, SoupMessage * msg, gst_soup_session_cancel_message (SoupSession * session, SoupMessage * msg,
GCancellable * cancellable) GCancellable * cancellable)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#if STATIC_SOUP == 3 #if LINK_SOUP == 3
g_cancellable_cancel (cancellable); g_cancellable_cancel (cancellable);
#else #else
soup_session_cancel_message (session, msg, SOUP_STATUS_CANCELLED); soup_session_cancel_message (session, msg, SOUP_STATUS_CANCELLED);
@ -948,7 +895,7 @@ gst_soup_session_cancel_message (SoupSession * session, SoupMessage * msg,
SoupCookie * SoupCookie *
_soup_cookie_parse (const char *header) _soup_cookie_parse (const char *header)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
return soup_cookie_parse (header, NULL); return soup_cookie_parse (header, NULL);
#else #else
g_assert (gst_soup_vtable._soup_cookie_parse != NULL); g_assert (gst_soup_vtable._soup_cookie_parse != NULL);
@ -960,7 +907,7 @@ _soup_cookie_parse (const char *header)
void void
_soup_cookies_to_request (GSList * cookies, SoupMessage * msg) _soup_cookies_to_request (GSList * cookies, SoupMessage * msg)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_cookies_to_request (cookies, msg); soup_cookies_to_request (cookies, msg);
#else #else
g_assert (gst_soup_vtable._soup_cookies_to_request != NULL); g_assert (gst_soup_vtable._soup_cookies_to_request != NULL);
@ -971,7 +918,7 @@ _soup_cookies_to_request (GSList * cookies, SoupMessage * msg)
void void
_soup_cookies_free (GSList * cookies) _soup_cookies_free (GSList * cookies)
{ {
#ifdef STATIC_SOUP #ifdef LINK_SOUP
soup_cookies_free (cookies); soup_cookies_free (cookies);
#else #else
g_assert (gst_soup_vtable._soup_cookies_free != NULL); g_assert (gst_soup_vtable._soup_cookies_free != NULL);

View file

@ -15,7 +15,7 @@
#ifndef __GST_SOUP_LOADER_H__ #ifndef __GST_SOUP_LOADER_H__
#define __GST_SOUP_LOADER_H__ #define __GST_SOUP_LOADER_H__
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#include <libsoup/soup.h> #include <libsoup/soup.h>
#else #else
#include "stub/soup.h" #include "stub/soup.h"
@ -89,10 +89,10 @@ void _soup_session_add_feature (SoupSession *session,
void _soup_session_add_feature_by_type (SoupSession *session, GType feature_type); void _soup_session_add_feature_by_type (SoupSession *session, GType feature_type);
typedef struct _GstSoupUri { typedef struct _GstSoupUri {
#if (defined(STATIC_SOUP) && STATIC_SOUP == 3) || (!defined(STATIC_SOUP) && GLIB_CHECK_VERSION(2, 66, 0)) #if (defined(LINK_SOUP) && LINK_SOUP == 3) || (!defined(LINK_SOUP) && GLIB_CHECK_VERSION(2, 66, 0))
GUri *uri; GUri *uri;
#endif #endif
#if (defined(STATIC_SOUP) && STATIC_SOUP == 2) || !defined(STATIC_SOUP) #if (defined(LINK_SOUP) && LINK_SOUP == 2) || !defined(LINK_SOUP)
SoupURI *soup_uri; SoupURI *soup_uri;
#endif #endif
} GstSoupUri; } GstSoupUri;

View file

@ -21,7 +21,7 @@
#include <glib.h> #include <glib.h>
#include <gst/gst.h> #include <gst/gst.h>
#ifdef STATIC_SOUP #ifdef LINK_SOUP
#include <libsoup/soup.h> #include <libsoup/soup.h>
#else #else
#include "stub/soup.h" #include "stub/soup.h"

View file

@ -8,36 +8,43 @@ soup_sources = [
] ]
soup_opt = get_option('soup') soup_opt = get_option('soup')
soup_ver_opt = get_option('soup-version')
if soup_opt.disabled() if soup_opt.disabled()
subdir_done() subdir_done()
endif endif
libdl_dep = cc.find_library('dl', required: false) libdl_dep = cc.find_library('dl', required: false)
static_args = [] soup_link_args = []
static_deps = [] soup_link_deps = []
libsoup2_dep = disabler()
libsoup3_dep = disabler()
default_library = get_option('default_library') default_library = get_option('default_library')
if default_library in ['static', 'both'] or get_option('soup-lookup-dep') if host_system != 'linux' or default_library in ['static', 'both']
libsoup2_dep = dependency('libsoup-2.4', version : '>=2.48', if soup_ver_opt in ['auto', '3']
required : false, fallback : ['libsoup', 'libsoup_dep'], libsoup3_dep = dependency('libsoup-3.0', allow_fallback: true,
default_options: ['sysprof=disabled']) required: soup_ver_opt == '3' and soup_opt.enabled())
libsoup3_dep = dependency('libsoup-3.0', required : false, endif
fallback : ['libsoup3', 'libsoup_dep']) if soup_ver_opt in ['auto', '2']
if not libsoup2_dep.found() and not libsoup3_dep.found() libsoup2_dep = dependency('libsoup-2.4', version : '>=2.48', allow_fallback: true,
default_options: ['sysprof=disabled'],
required: soup_ver_opt == '2' and soup_opt.enabled())
endif
if libsoup3_dep.found()
soup_link_deps += libsoup3_dep
soup_link_args += '-DLINK_SOUP=3'
message('soup plugin: linking to libsoup-3.0')
elif libsoup2_dep.found()
soup_link_deps += libsoup2_dep
soup_link_args += '-DLINK_SOUP=2'
message('soup plugin: linking to libsoup-2.4')
else
if soup_opt.enabled() if soup_opt.enabled()
error('Either libsoup2 or libsoup3 is needed') error('Either libsoup2 or libsoup3 is needed')
endif endif
subdir_done() subdir_done()
endif endif
if libsoup3_dep.found()
static_deps += libsoup3_dep
static_args += '-DSTATIC_SOUP=3'
message('soup plugin: using libsoup-3.0 for static build')
elif libsoup2_dep.found()
static_deps += libsoup2_dep
static_args += '-DSTATIC_SOUP=2'
message('soup plugin: using libsoup-2.4 for static build')
endif
endif endif
soup_library_kwargs = { soup_library_kwargs = {
@ -50,25 +57,35 @@ soup_library_kwargs = {
soup_library_deps = [gst_dep, gstbase_dep, gsttag_dep, gmodule_dep, gio_dep, libdl_dep] soup_library_deps = [gst_dep, gstbase_dep, gsttag_dep, gmodule_dep, gio_dep, libdl_dep]
soup_library_c_args = gst_plugins_good_args soup_library_c_args = gst_plugins_good_args
if default_library in ['shared', 'both'] if host_system != 'linux'
gstsouphttpsrc_shared = shared_library('gstsoup', gstsouphttpsrc = library('gstsoup',
c_args : soup_library_c_args, c_args : soup_library_c_args + soup_link_args,
dependencies : soup_library_deps, dependencies : soup_library_deps + soup_link_deps,
kwargs: soup_library_kwargs, kwargs: soup_library_kwargs,
) )
gstsouphttpsrc_shared = gstsouphttpsrc
gstsouphttpsrc_static = gstsouphttpsrc
else
if default_library in ['static', 'both']
gstsouphttpsrc_static = static_library('gstsoup',
c_args : soup_library_c_args + soup_link_args,
dependencies : soup_library_deps + soup_link_deps,
kwargs: soup_library_kwargs,
)
endif
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
endif endif
if default_library in ['static', 'both'] # Use the static library to generate the .pc file on Linux if it's available.
gstsouphttpsrc_static = static_library('gstsoup', # In that case, the shared library .pc file does not have a Requires: on
c_args : soup_library_c_args + static_args, # libsoup-2.4, and we use plugin .pc files to generate dependencies for linking
dependencies : soup_library_deps + static_deps, # plugins statically.
kwargs: soup_library_kwargs,
)
endif
# Use the static library to generate the .pc file if it's available. The shared
# library .pc file does not have a Requires: on libsoup-2.4, and we use plugin
# .pc files to generate dependencies for linking plugins statically.
if default_library == 'shared' if default_library == 'shared'
pkgconfig.generate(gstsouphttpsrc_shared, install_dir : plugins_pkgconfig_install_dir) pkgconfig.generate(gstsouphttpsrc_shared, install_dir : plugins_pkgconfig_install_dir)
else else

View file

@ -87,8 +87,8 @@ option('rpi-lib-dir', type : 'string', value : '/opt/vc/lib', description : 'Dir
# soup plugin options # soup plugin options
option('soup', type : 'feature', value : 'auto', description : 'libsoup HTTP client source/sink plugin') option('soup', type : 'feature', value : 'auto', description : 'libsoup HTTP client source/sink plugin')
option('soup-lookup-dep', type : 'boolean', value : false, option('soup-version', type : 'combo', value : 'auto', choices : ['auto', '2', '3'],
description : 'Lookup libsoup dep at build time even when building a shared plugin') description: 'Force a specific libsoup version if linking to it (N/A for shared builds on Linux)')
# Qt plugin options # Qt plugin options
option('qt-method', type: 'combo', value: 'auto', choices: ['auto', 'pkg-config', 'qmake'], option('qt-method', type: 'combo', value: 'auto', choices: ['auto', 'pkg-config', 'qmake'],

View file

@ -152,12 +152,6 @@ if host_machine.system() != 'windows'
endif endif
if get_option('soup').allowed() if get_option('soup').allowed()
libsoup3_dep = dependency('libsoup-3.0', required : false,
fallback : ['libsoup3', 'libsoup_dep'])
libsoup2_dep = dependency('libsoup-2.4', version : '>=2.48',
required : false, fallback : ['libsoup', 'libsoup_dep'],
default_options: ['sysprof=disabled'])
if libsoup3_dep.found() if libsoup3_dep.found()
good_tests += [['elements/souphttpsrc', false, [libsoup3_dep], []]] good_tests += [['elements/souphttpsrc', false, [libsoup3_dep], []]]
elif libsoup2_dep.found() elif libsoup2_dep.found()

View file

@ -4,3 +4,7 @@ source_url = https://download.gnome.org/sources/libsoup/2.74/libsoup-2.74.3.tar.
source_fallback_url = https://ftp.acc.umu.se/pub/gnome/sources/libsoup/2.74/libsoup-2.74.3.tar.xz source_fallback_url = https://ftp.acc.umu.se/pub/gnome/sources/libsoup/2.74/libsoup-2.74.3.tar.xz
source_filename = libsoup-2.74.3.tar.xz source_filename = libsoup-2.74.3.tar.xz
source_hash = e4b77c41cfc4c8c5a035fcdc320c7bc6cfb75ef7c5a034153df1413fa1d92f13 source_hash = e4b77c41cfc4c8c5a035fcdc320c7bc6cfb75ef7c5a034153df1413fa1d92f13
[provide]
libsoup-2.4 = libsoup_dep
libsoup-gnome-2.4 = libsoup_gnome_dep