summaryrefslogtreecommitdiff
path: root/libmate-panel-applet/meson.build
blob: 4eb4fe2727a8bfcf2c1957bfe92d9f8abbb5e6db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
libmate_panel_applet_inc = include_directories('.')

glib_mkenums = find_program('glib-mkenums')

# generated marshallers
libmate_panel_applet_marshal = gnome.genmarshal('mate-panel-applet-marshal',
  sources: 'mate-panel-applet-marshal.list',
  prefix: 'mate_panel_applet_marshal',
)

# generated enumerations
mate_panel_applet_enum_headers = files('mate-panel-applet.h')

libmate_panel_applet_enums_h = custom_target('mate-panel-applet-enums.h',
  input: mate_panel_applet_enum_headers,
  output: 'mate-panel-applet-enums.h',
  install: true,
  install_dir: join_paths(get_option('includedir'),
    'mate-panel-@0@/libmate-panel-applet'.format(mate_panel_api_version)),
  command: [
    glib_mkenums,
    '--fhead', '#ifndef __MATE_PANEL_APPLET_ENUMS_H__\n#define __MATE_PANEL_APPLET_ENUMS_H__\n\n#ifdef __cplusplus\nextern "C" {\n#endif\n\n',
    '--ftail', '#ifdef __cplusplus\n}\n#endif\n\n#endif /* __MATE_PANEL_APPLET_ENUMS_H__ */\n',
    '--fprod', '\n/* --- @filename@ --- */',
    '--eprod', '#define PANEL_TYPE_@ENUMNAME@ @enum_name@_get_type()\nGType @enum_name@_get_type (void);\n',
    '--output', '@OUTPUT@',
    '@INPUT@',
  ],
)

libmate_panel_applet_enums_c = custom_target('mate-panel-applet-enums.c',
  input: mate_panel_applet_enum_headers,
  output: 'mate-panel-applet-enums.c',
  command: [
    glib_mkenums,
    '--fhead', '#include <glib-object.h>\n#include "mate-panel-applet-enums.h"\n',
    '--fprod', '\n/* enumerations from "@filename@" */\n#include "@filename@"\n',
    '--vhead', 'static const G@Type@Value _@enum_name@_values[] = {',
    '--vprod', '  { @VALUENAME@, "@VALUENAME@", "@valuenick@" },',
    '--vtail', '  { 0, NULL, NULL }\n};\n\n',
    '--vtail', 'GType\n@enum_name@_get_type (void)\n{\n',
    '--vtail', '  static GType type = 0;\n\n',
    '--vtail', '  if (!type)\n',
    '--vtail', '    type = g_@type@_register_static ("@EnumName@", _@enum_name@_values);\n\n',
    '--vtail', '  return type;\n}\n\n',
    '--output', '@OUTPUT@',
    '@INPUT@',
  ],
)

libmate_panel_applet_sources = [
  'mate-panel-applet.h',
  'mate-panel-applet.c',
  'mate-panel-applet-factory.h',
  'mate-panel-applet-factory.c',
  'mate-panel-applet-gsettings.c',
  'mate-panel-applet-gsettings.h',
  'panel-applet-private.h',
  libmate_panel_applet_marshal,
  libmate_panel_applet_enums_c,
  libmate_panel_applet_enums_h,
]

if have_x11
  libmate_panel_applet_sources += ['panel-plug.c', 'panel-plug-private.h']
endif

libmate_panel_applet_deps_local = libmate_panel_applet_deps
if have_x11
  libmate_panel_applet_deps_local += x11_dep
endif

libmate_panel_applet_lib = library('mate-panel-applet-4',
  libmate_panel_applet_sources,
  version: '@0@.@1@.@2@'.format(libmate_panel_applet_current, libmate_panel_applet_age, libmate_panel_applet_revision),
  include_directories: libmate_panel_applet_inc,
  dependencies: libmate_panel_applet_deps_local,
  c_args: disable_deprecated_flags,
  install: true,
)

install_headers(
  'mate-panel-applet.h',
  'mate-panel-applet-gsettings.h',
  subdir: 'mate-panel-@0@/libmate-panel-applet'.format(mate_panel_api_version),
)

pkg = import('pkgconfig')

pkg.generate(libmate_panel_applet_lib,
  filebase: 'libmatepanelapplet-@0@'.format(mate_panel_api_version),
  name: 'libmate-panel-applet-4',
  description: 'libmate-panel-applet-4',
  version: mate_panel_version,
  requires: ['glib-2.0', 'gio-2.0', 'gtk+-3.0'],
  subdirs: 'mate-panel-@0@/libmate-panel-applet'.format(mate_panel_api_version),
  install_dir: join_paths(mate_panel_libdir, 'pkgconfig'),
)

# test program
executable('test-dbus-applet',
  'test-dbus-applet.c',
  include_directories: libmate_panel_applet_inc,
  dependencies: libmate_panel_applet_deps_local,
  link_with: libmate_panel_applet_lib,
)

# test applet desktop file (not installed)
test_applet_desktop = i18n.merge_file(
  input: 'org.mate.panel.TestApplet.mate-panel-applet.desktop.in',
  output: 'org.mate.panel.TestApplet.mate-panel-applet',
  type: 'desktop',
  po_dir: '../po',
  install: false,
)

# introspection
if enable_introspection.allowed()
  introspection_sources = [
    'mate-panel-applet.c',
    'mate-panel-applet.h',
    'mate-panel-applet-gsettings.c',
    'mate-panel-applet-gsettings.h',
  ]
  built_introspection_sources = [
    libmate_panel_applet_enums_c,
    libmate_panel_applet_enums_h,
  ]

  mate_panel_applet_gir = gnome.generate_gir(libmate_panel_applet_lib,
    sources: introspection_sources + built_introspection_sources,
    nsversion: mate_panel_gir_version,
    namespace: mate_panel_gir_ns,
    symbol_prefix: 'mate_panel_applet',
    identifier_prefix: 'MatePanelApplet',
    export_packages: 'libmatepanelapplet-@0@'.format(mate_panel_api_version),
    includes: ['GObject-2.0', 'Gtk-3.0', 'Gio-2.0'],
    install: true,
    extra_args: [
      '--warn-all',
      '--strip-prefix=MatePanel',
      '--add-include-path=@0@'.format(meson.current_source_dir()),
    ],
  )
endif