File: meson.build

package info (click to toggle)
foundry 1.1~beta-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,552 kB
  • sloc: ansic: 167,487; xml: 417; makefile: 21; sh: 19; javascript: 10
file content (220 lines) | stat: -rw-r--r-- 6,784 bytes parent folder | download | duplicates (2)
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# Unified plugin dictionary structure
# Each plugin has:
# - options: array of feature options that must be enabled
# - library: 'gtk' for libfoundry-gtk, 'adw' for libfoundry-adw, omitted for libfoundry
# - fallback: true if this is a fallback plugin (always built)

plugins_dict = {
  # Fallback plugins (always built)
  'buildconfig': {'fallback': true},
  'content-types': {'fallback': true},
  'doc-bridge': {'fallback': true, 'options': ['feature-docs']},
  'flatpak': {'fallback': true, 'options': ['feature-flatpak']},
  'git': {'fallback': true, 'options': ['feature-git']},
  'grep': {'fallback': true},
  'gsettings': {'fallback': true, 'options': ['feature-text']},
  'host-sdk': {'fallback': true},
  'hover-bridge': {'fallback': true, 'options': ['feature-text']},
  'internal-tweaks': {'fallback': true},
  'language-defaults': {'fallback': true, 'options': ['feature-text']},
  'linked-workspace': {'fallback': true},
  'llm-build': {'fallback': true, 'options': ['feature-llm']},
  'local-device': {'fallback': true},
  'lsp-bridge': {'fallback': true, 'options': ['feature-lsp']},
  'no-sdk': {'fallback': true},
  'no-vcs': {'fallback': true, 'options': ['feature-vcs']},
  'plugin-tweaks': {'fallback': true},
  'tty-auth': {'fallback': true},

  # Core plugins (no special requirements)
  'autotools': {},
  'buildstream': {},
  'cargo': {},
  'cmake': {},
  'codesearch': {},
  'codespell': {},
  'deviced': {},
  'distcc': {},
  'dub': {},
  'eslint': {},
  'file-search': {},
  'flake8': {},
  'gdiagnose': {},
  'gettext': {},
  'go': {},
  'gradle': {},
  'jhbuild': {},
  'just': {},
  'make': {},
  'maven': {},
  'meson': {},
  'npm': {},
  'phpize': {},
  'podman': {},
  'qemu': {},
  'shellcheck': {},
  'sarif': {},
  'waf': {},

  # Documentation plugins
  'devhelp': {'options': ['feature-docs']},

  # LLM plugins
  'ollama': {'options': ['feature-llm']},
  'openai': {'options': ['feature-llm']},

  # Forge plugins
  'gitlab': {'options': ['feature-forge']},

  # LSP plugins
  'astro-ls': {'options': ['feature-lsp']},
  'bash-language-server': {'options': ['feature-lsp']},
  'blueprint': {'options': ['feature-lsp']},
  'clangd': {'options': ['feature-lsp']},
  'elixir-ls': {'options': ['feature-lsp']},
  'glsl-language-server': {'options': ['feature-lsp']},
  'gopls': {'options': ['feature-lsp']},
  'intelephense': {'options': ['feature-lsp']},
  'jdtls': {'options': ['feature-lsp']},
  'jedi-language-server': {'options': ['feature-lsp']},
  'lua-language-server': {'options': ['feature-lsp']},
  'mesonlsp': {'options': ['feature-lsp']},
  'pylsp': {'options': ['feature-lsp']},
  'pyrefly': {'options': ['feature-lsp']},
  'ruff': {'options': ['feature-lsp']},
  'rust-analyzer': {'options': ['feature-lsp']},
  'serve-d': {'options': ['feature-lsp']},
  'sourcekit-lsp': {'options': ['feature-lsp']},
  'ts-language-server': {'options': ['feature-lsp']},
  'ty': {'options': ['feature-lsp']},
  'vala-language-server': {'options': ['feature-lsp']},
  'vhdl-language-server': {'options': ['feature-lsp']},
  'zls': {'options': ['feature-lsp']},

  # Text plugins
  'ctags': {'options': ['feature-text']},
  'editorconfig': {'options': ['feature-text']},
  'modelines': {'options': ['feature-text']},

  # Template plugins
  'make-templates': {'options': ['feature-templates']},
  'meson-templates': {'options': ['feature-templates']},
  'simple-templates': {'options': ['feature-templates']},

  # Debugger plugins (require both debugger and dap features)
  'gdb': {'options': ['feature-debugger', 'feature-dap']},
  'lldb': {'options': ['feature-debugger', 'feature-dap']},

  # GTK plugins (go into libfoundry-gtk)
  'spellcheck': {'library': 'gtk'},
  'word-completion': {'library': 'gtk'},
}

foundry_plugin_manifest_xml = ''

foreach plugin, params: plugins_dict
  # Only plugins that do not have a library specified
  if params.has_key('library')
    continue
  endif

  # Check if plugin option is enabled (skip for fallback plugins)
  is_fallback = params.get('fallback', false)
  if not is_fallback
    if not get_option('plugin-@0@'.format(plugin))
      continue
    endif
  endif

  # Check if all required feature options are enabled
  required_options = params.get('options', [])
  has_all_options = true
  foreach option: required_options
    if not get_option(option)
      has_all_options = false
      break
    endif
  endforeach

  if not has_all_options
    continue
  endif

  # Build the plugin
  if is_fallback
    subdir(join_paths('fallbacks', plugin))
    foundry_plugin_manifest_xml += '    <file alias="@0@/@0@.plugin">fallbacks/@0@/@0@.plugin</file>\n'.format(plugin)
  else
    subdir(plugin)
    foundry_plugin_manifest_xml += '    <file>@0@/@0@.plugin</file>\n'.format(plugin)
  endif

  config_h.set10('HAVE_PLUGIN_@0@'.format(plugin.replace('-','_').to_upper()), true)
endforeach

foundry_plugin_manifests_data = configuration_data()
foundry_plugin_manifests_data.set('XML', foundry_plugin_manifest_xml)
foundry_plugins_gresource_xml = configure_file(
          input: 'plugins.gresource.xml.in',
         output: 'foundry-plugins.gresource.xml',
  configuration: foundry_plugin_manifests_data)

foundry_private_sources += [
  gnome.compile_resources(
    'foundry-plugins-resources',
    foundry_plugins_gresource_xml,
    c_name: '_foundry_plugins',
  )
]

foundry_include_directories += [include_directories('.')]

if get_option('gtk')
  foundry_gtk_plugin_manifest_xml = ''

  foreach plugin, params: plugins_dict
    # Only process GTK plugins
    if params.get('library', '') != 'gtk'
      continue
    endif

    # Check if plugin option is enabled
    if not get_option('plugin-@0@'.format(plugin))
      continue
    endif

    # Check if all required feature options are enabled
    required_options = params.get('options', [])
    has_all_options = true
    foreach option: required_options
      if not get_option(option)
        has_all_options = false
        break
      endif
    endforeach

    if not has_all_options
      continue
    endif

    subdir(plugin)
    foundry_gtk_plugin_manifest_xml += '    <file>@0@/@0@.plugin</file>\n'.format(plugin)
  endforeach

  foundry_gtk_plugin_manifests_data = configuration_data()
  foundry_gtk_plugin_manifests_data.set('XML', foundry_gtk_plugin_manifest_xml)
  foundry_gtk_plugins_gresource_xml = configure_file(
            input: 'plugins.gresource.xml.in',
           output: 'foundry-gtk-plugins.gresource.xml',
    configuration: foundry_gtk_plugin_manifests_data)

  foundry_gtk_private_sources += [
    gnome.compile_resources(
      'foundry-gtk-plugins-resources',
      foundry_gtk_plugins_gresource_xml,
      c_name: '_foundry_gtk_plugins',
    )
  ]

  foundry_gtk_include_directories += [include_directories('.')]
endif