From f401bf9d8077e5bf35d7a27f363d1d74d6744fb5 Mon Sep 17 00:00:00 2001 From: Filippe LeMarchand Date: Sun, 9 Jun 2024 12:32:39 +0300 Subject: [PATCH] Gate appending electron args by meson feature --- editor.sh | 5 +++++ meson.build | 12 ++++++++++++ meson_options.txt | 1 + 3 files changed, 18 insertions(+) diff --git a/editor.sh b/editor.sh index 5d05857..0d032ae 100644 --- a/editor.sh +++ b/editor.sh @@ -21,6 +21,11 @@ function update_display_server_args () { fi fi + # shellcheck disable=SC2050 + if [ "@ELECTRON_ENABLED@" -eq 0 ]; then + return 0 + fi + if [ -e "$wayland_socket" ]; then DISPLAY_SERVER_ARGS=( "--ozone-platform=wayland" diff --git a/meson.build b/meson.build index 29ef743..6bda4d7 100644 --- a/meson.build +++ b/meson.build @@ -31,6 +31,17 @@ else sdk_version = get_option('sdk_version') endif +if get_option('electron').enabled() + electron_enabled = true +elif get_option('electron').auto() + electron_enabled = get_option('zypak').enabled() +else + if get_option('zypak').enabled() + error('`electron` feature is required if `zypak` is enabled') + endif + electron_enabled = false +endif + editor_args = [] foreach arg : get_option('editor_args') editor_args += '"@0@"'.format(arg) @@ -67,6 +78,7 @@ wrapper_data = configuration_data({ 'WRAPPER_PATH': wrapper_path, 'EDITOR_BINARY': editor_path, 'EDITOR_ARGS': ' '.join(editor_args), + 'ELECTRON_ENABLED': electron_enabled.to_int(), 'ZYPAK_ARGS': ' '.join(zypak_args), 'EXPORT_ENVS': ' && '.join(export_envs), 'EXPORT_ENVS_INNER': ' && '.join(export_envs_inner), diff --git a/meson_options.txt b/meson_options.txt index 0095e6a..8f0a4b9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -8,6 +8,7 @@ option('first_run_template', type: 'string', value: 'first_run.txt') option('sdk_update_template', type: 'string', value: 'sdk_update.txt') option('flagfile_prefix', type: 'string', value: 'flatpak-vscode') option('default_loglevel', type: 'string', value: '1') +option('electron', type: 'feature', value: 'auto') option('zypak', type: 'feature', value: 'disabled') option('zypak_args', type: 'array', value: ['host']) option('envs', type: 'array', value: [])