438cb1e8669df1c28bfcd7f24a0e11e58be62dc4
[platform/upstream/gstreamer.git] / pkgconfig / meson.build
1 pkgconf = configuration_data()
2
3 pkgconf.set('prefix', join_paths(get_option('prefix')))
4 pkgconf.set('exec_prefix', '${prefix}')
5 pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
6 pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
7 pkgconf.set('GST_API_VERSION', api_version)
8 pkgconf.set('VERSION', gst_version)
9 pkgconf.set('LIBM', libm.found() ? '-lm' : '')
10 pkgconf.set('ZLIB_LIBS', zlib_dep.found() ? '-lz' : '')
11 pkgconf.set('ORC_PC', have_orcc ? 'orc-0.4' : '')
12
13 # needed for generating -uninstalled.pc files
14 pkgconf.set('abs_top_builddir', join_paths(meson.current_build_dir(), '..'))
15 pkgconf.set('abs_top_srcdir', join_paths(meson.current_source_dir(), '..'))
16 pkgconf.set('allocatorslibdir', join_paths(meson.build_root(), gstallocators.outdir()))
17 pkgconf.set('applibdir', join_paths(meson.build_root(), gstapp.outdir()))
18 pkgconf.set('audiolibdir', join_paths(meson.build_root(), gstaudio.outdir()))
19 pkgconf.set('fftlibdir', join_paths(meson.build_root(), gstfft.outdir()))
20 pkgconf.set('pbutilslibdir', join_paths(meson.build_root(), pbutils.outdir()))
21 pkgconf.set('rifflibdir', join_paths(meson.build_root(), gstriff.outdir()))
22 pkgconf.set('rtplibdir', join_paths(meson.build_root(), gst_rtp.outdir()))
23 pkgconf.set('rtsplibdir', join_paths(meson.build_root(), gst_rtsp.outdir()))
24 pkgconf.set('sdplibdir', join_paths(meson.build_root(), gstsdp.outdir()))
25 pkgconf.set('taglibdir', join_paths(meson.build_root(), gsttag.outdir()))
26 pkgconf.set('videolibdir', join_paths(meson.build_root(), gstvideo.outdir()))
27
28 pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir'))
29
30 pkg_files = [
31   'gstreamer-allocators',
32   'gstreamer-app',
33   'gstreamer-audio',
34   'gstreamer-fft',
35   'gstreamer-pbutils',
36   'gstreamer-plugins-base',
37   'gstreamer-riff',
38   'gstreamer-rtp',
39   'gstreamer-rtsp',
40   'gstreamer-sdp',
41   'gstreamer-tag',
42   'gstreamer-video',
43 ]
44
45 # XXX: requires the meson.build to be parsed/executed after gst-libs/gl/meson.build
46 if build_gstgl
47   gllibdir = join_paths(meson.build_root(), gstgl.outdir())
48   pkgconf.set('gllibdir', gllibdir)
49   pkgconf.set('glliblinkerflag', '-L' + gllibdir)
50   pkg_files += ['gstreamer-gl', 'gstreamer-gl-prototypes']
51   pkgconf.set('GL_APIS', ' '.join(enabled_gl_apis))
52   pkgconf.set('GL_WINDOWS', ' '.join(enabled_gl_winsys))
53   pkgconf.set('GL_PLATFORMS', ' '.join(enabled_gl_platforms))
54   pkgconf.set('gl_lib_name', 'gl')
55   gl_proto_requires = ''
56   gl_proto_libs = ''
57   if enabled_gl_apis.contains('gl')
58     if gl_dep.type_name() == 'pkgconfig'
59       gl_proto_requires += ' gl'
60     elif gl_dep.type_name() == 'library'
61       if 'wgl' in enabled_gl_platforms
62         gl_proto_libs += ' -lopengl32'
63       else
64         gl_proto_libs += ' -lGL'
65       endif
66     elif gl_dep.type_name() == 'appleframework'
67       gl_proto_libs += ' -framework OpenGL'
68     endif
69   endif
70   if enabled_gl_apis.contains('gles2')
71     if gles2_dep.type_name() == 'pkgconfig'
72       gl_proto_requires += ' glesv2'
73     elif gles2_dep.type_name() == 'library'
74       gl_proto_libs += ' -lGLESv2'
75     elif gles2_dep.type_name() == 'appleframework'
76       gl_proto_libs += ' -framework OpenGLES'
77     endif
78   endif
79   pkgconf.set('GL_PROTO_EXTRA_REQUIRES', gl_proto_requires)
80   pkgconf.set('GL_PROTO_EXTRA_LIBS', gl_proto_libs)
81   if enabled_gl_platforms.contains('egl')
82     pkg_files += ['gstreamer-gl-egl']
83     if egl_dep.type_name() == 'pkgconfig'
84       pkgconf.set('GL_EGL_EXTRA_REQUIRES', 'egl')
85       pkgconf.set('GL_EGL_EXTRA_LIBS', '')
86     elif egl_dep.type_name() == 'library'
87       pkgconf.set('GL_EGL_EXTRA_REQUIRES', '')
88       pkgconf.set('GL_EGL_EXTRA_LIBS', '-lEGL')
89     endif
90   endif
91   if enabled_gl_winsys.contains('x11')
92     pkg_files += ['gstreamer-gl-x11']
93   endif
94   if enabled_gl_winsys.contains('wayland')
95     pkg_files += ['gstreamer-gl-wayland']
96   endif
97 else
98   pkgconf.set('glliblinkerflag', '')
99   pkgconf.set('gl_lib_name', '')
100 endif
101
102 foreach p : pkg_files
103   infile = p + '.pc.in'
104   outfile = p + '-1.0.pc'
105   configure_file(input : infile,
106     output : outfile,
107     configuration : pkgconf,
108     install_dir : pkg_install_dir)
109
110   infile = p + '-uninstalled.pc.in'
111   outfile = p + '-1.0-uninstalled.pc'
112   configure_file(input : infile,
113     output : outfile,
114     configuration : pkgconf)
115 endforeach