Skip to content

Commit

Permalink
Flatpak: Add granite master, polkit, bump Hdy (#960)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Mar 15, 2021
1 parent d07b72e commit 6de4878
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
30 changes: 16 additions & 14 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,20 @@ config_data.set('install_prefix', get_option('prefix'))
config_data.set('bin_dir', get_option('bindir'))
config_data.set('exec_name', meson.project_name())

policy_in = configure_file(
input: 'code.policy.in.in',
output: meson.project_name() + '.policy.in',
configuration: config_data,
install: false,
)
if get_option ('have_pkexec')
policy_in = configure_file(
input: 'code.policy.in.in',
output: meson.project_name() + '.policy.in',
configuration: config_data,
install: false,
)

i18n.merge_file(
'policy',
input: policy_in,
output: meson.project_name() + '.policy',
po_dir: join_paths(meson.source_root (), 'po', 'extra'),
install: true,
install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions'),
)
i18n.merge_file(
'policy',
input: policy_in,
output: meson.project_name() + '.policy',
po_dir: join_paths(meson.source_root (), 'po', 'extra'),
install: true,
install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions'),
)
endif
10 changes: 9 additions & 1 deletion io.elementary.code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ cleanup:
- '*.a'
- '*.la'
modules:
- name: granite
buildsystem: meson
sources:
- type: git
url: https://github.com/elementary/granite.git

- name: gtksourceview
buildsystem: meson
sources:
Expand All @@ -41,7 +47,7 @@ modules:
sources:
- type: git
url: https://gitlab.gnome.org/GNOME/libhandy.git
tag: '1.0.1'
tag: '1.0.3'

- name: peas
buildsystem: meson
Expand Down Expand Up @@ -132,6 +138,8 @@ modules:

- name: code
buildsystem: meson
config-opts:
- '-Dhave_pkexec=false'
sources:
- type: dir
path: .
4 changes: 4 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ add_project_arguments(
language: 'vala'
)

if get_option('have_pkexec')
add_project_arguments('--define=HAVE_PKEXEC', language: 'vala')
endif

libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'), meson.project_name())
pluginsdir = join_paths(get_option('prefix'), get_option('libdir'), meson.project_name(), 'plugins')

Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
option ('plugins', type : 'boolean', value : true)
option('have_pkexec', type : 'boolean', value : 'true', description : 'Allow launching with pkexec. Should not be used in FlatPak')
2 changes: 2 additions & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ namespace Scratch {
public override int command_line (GLib.ApplicationCommandLine command_line) {
/* Only allow running with root privileges using pkexec, not using sudo */
if (Posix.getuid () == 0 && GLib.Environment.get_variable ("PKEXEC_UID") == null) {
#if HAVE_PKEXEC
warning ("Running Code using sudo is not possible. Use: pkexec io.elementary.code");
#endif
quit ();
return 1;
};
Expand Down

0 comments on commit 6de4878

Please sign in to comment.