1db53bede1b893ca3055d04538e1bd3f0a02458f
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-good / ext / soup / meson.build
1 soup_sources = [
2   'gstsoup.c',
3   'gstsoupelement.c',
4   'gstsouphttpclientsink.c',
5   'gstsouphttpsrc.c',
6   'gstsouploader.c',
7   'gstsouputils.c',
8 ]
9
10 soup_opt = get_option('soup')
11 if soup_opt.disabled()
12   subdir_done()
13 endif
14
15 gmodule_dep = dependency('gmodule-2.0', fallback: ['glib', 'libgmodule_dep'])
16 gobject_dep = dependency('gobject-2.0', fallback: ['glib', 'libgobject_dep'])
17
18 libdl_dep = cc.find_library('dl', required: false)
19
20 static_args = []
21 static_deps = []
22 default_library = get_option('default_library')
23 if default_library in ['static', 'both']
24   libsoup2_dep = dependency('libsoup-2.4', version : '>=2.48',
25                             required : false, fallback : ['libsoup', 'libsoup_dep'],
26                             default_options: ['sysprof=disabled'])
27   libsoup3_dep = dependency('libsoup-3.0', required : false,
28                             fallback : ['libsoup3', 'libsoup_dep'])
29   if not libsoup2_dep.found() and not libsoup3_dep.found()
30     if soup_opt.enabled()
31       error('Either libsoup2 or libsoup3 is needed')
32     endif
33     subdir_done()
34   endif
35   if libsoup3_dep.found()
36     static_deps += libsoup3_dep
37     static_args += '-DSTATIC_SOUP=3'
38     message('soup plugin: using libsoup-3.0 for static build')
39   elif libsoup2_dep.found()
40     static_deps += libsoup2_dep
41     static_args += '-DSTATIC_SOUP=2'
42     message('soup plugin: using libsoup-2.4 for static build')
43   endif
44 endif
45
46 soup_library_kwargs = {
47   'sources' : soup_sources,
48   'link_args' : noseh_link_args,
49   'include_directories' : [configinc, libsinc],
50   'install' : true,
51   'install_dir' : plugins_install_dir,
52 }
53 soup_library_deps = [gst_dep, gstbase_dep, gsttag_dep, gmodule_dep, gobject_dep, gio_dep, libdl_dep]
54 soup_library_c_args = gst_plugins_good_args
55
56 if default_library in ['shared', 'both']
57   gstsouphttpsrc_shared = shared_library('gstsoup',
58     c_args : soup_library_c_args,
59     dependencies : soup_library_deps,
60     kwargs: soup_library_kwargs,
61   )
62 endif
63
64 if default_library in ['static', 'both']
65   gstsouphttpsrc_static = static_library('gstsoup',
66     c_args : soup_library_c_args + static_args,
67     dependencies : soup_library_deps + static_deps,
68     kwargs: soup_library_kwargs,
69   )
70 endif
71
72 # Use the static library to generate the .pc file if it's available. The shared
73 # library .pc file does not have a Requires: on libsoup-2.4, and we use plugin
74 # .pc files to generate dependencies for linking plugins statically.
75 if default_library == 'shared'
76   pkgconfig.generate(gstsouphttpsrc_shared, install_dir : plugins_pkgconfig_install_dir)
77 else
78   pkgconfig.generate(gstsouphttpsrc_static, install_dir : plugins_pkgconfig_install_dir)
79 endif
80
81 # Add the shared library to the plugins list if available. We pass this list of
82 # plugins to hotdoc to generate the plugins cache, which introspects the plugin
83 # by loading it. We need the shared plugin for that.
84 if default_library == 'static'
85   plugins += [gstsouphttpsrc_static]
86 else
87   plugins += [gstsouphttpsrc_shared]
88 endif