From f728ac670d8f6bb7600a007d92034b711471fab6 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Sat, 13 Jul 2019 19:06:20 -0400 Subject: [PATCH 1/2] Build with Meson Has the following meson build options: * default-wallpaper * plank-dockitems * default-gsettings-overrides All default to true. We also split the default-settings gsettings override into another that only sets plank's default dockitems. This is installed when plank-dockitems is true. We need to have this because those settings are dependent on those dockitems actually being installed and we have it optional. --- accountsservice/create-symlink.py | 24 ++++++ accountsservice/meson.build | 25 ++++++ .../appcenter.blacklist | 0 .../default-testpage.pdf | Bin settings.ini => gtk/settings.ini | 0 .inputrc => inputrc/.inputrc | 0 meson.build | 79 ++++++++++++++++++ meson/post_install.py | 12 +++ meson_options.txt | 14 ++++ ...e => default-settings.gschema.override.in} | 3 +- overrides/meson.build | 21 +++++ overrides/plank-dockitems.gschema.override | 2 + .../sessioninstaller.desktop | 0 13 files changed, 178 insertions(+), 2 deletions(-) create mode 100644 accountsservice/create-symlink.py create mode 100644 accountsservice/meson.build rename appcenter.blacklist => appcenter/appcenter.blacklist (100%) rename default-testpage.pdf => cups/default-testpage.pdf (100%) rename settings.ini => gtk/settings.ini (100%) rename .inputrc => inputrc/.inputrc (100%) create mode 100644 meson.build create mode 100755 meson/post_install.py create mode 100644 meson_options.txt rename overrides/{default-settings.gschema.override => default-settings.gschema.override.in} (92%) create mode 100644 overrides/meson.build create mode 100644 overrides/plank-dockitems.gschema.override rename sessioninstaller.desktop => sessioninstaller/sessioninstaller.desktop (100%) diff --git a/accountsservice/create-symlink.py b/accountsservice/create-symlink.py new file mode 100644 index 0000000..e502134 --- /dev/null +++ b/accountsservice/create-symlink.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +import os +import sys + +if len(sys.argv) < 3: + print('Usage: create-symlink.py SOURCE DESTINATION') + sys.exit(1) + +src = sys.argv[1] +dest = sys.argv[2] + +if 'MESON_INSTALL_DESTDIR_PREFIX' in os.environ: + src = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], src) + dest = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], dest) + +if os.path.isabs(src): + src = os.path.relpath(src, os.path.dirname(os.path.realpath(dest))) + +if not os.path.exists(dest): + print('Creating symbolic link: ' + dest + ' -> ' + src) + if not os.path.exists(os.path.dirname(dest)): + os.makedirs(os.path.dirname(dest)) + os.symlink(src, dest) diff --git a/accountsservice/meson.build b/accountsservice/meson.build new file mode 100644 index 0000000..6d18459 --- /dev/null +++ b/accountsservice/meson.build @@ -0,0 +1,25 @@ +dbus_dep = dependency('dbus-1') +dbus_interfaces_dir = dbus_dep.get_pkgconfig_variable('interfaces_dir', define_variable: ['datadir', datadir]) + +install_data( + 'io.elementary.pantheon.AccountsService.xml', + install_dir: dbus_interfaces_dir +) + + +polkit_dep = dependency('polkit-gobject-1') +polkit_actiondir = polkit_dep.get_pkgconfig_variable('actiondir', define_variable: ['prefix', prefix]) + +install_data( + 'io.elementary.pantheon.AccountsService.policy', + install_dir: polkit_actiondir +) + +act_dep = dependency('accountsservice') +act_interfacesdir = act_dep.get_pkgconfig_variable('interfacesdir', define_variable: ['datadir', datadir]) + +meson.add_install_script( + 'create-symlink.py', + join_paths(dbus_interfaces_dir, 'io.elementary.pantheon.AccountsService.xml'), + join_paths(act_interfacesdir, 'io.elementary.pantheon.AccountsService.xml'), +) diff --git a/appcenter.blacklist b/appcenter/appcenter.blacklist similarity index 100% rename from appcenter.blacklist rename to appcenter/appcenter.blacklist diff --git a/default-testpage.pdf b/cups/default-testpage.pdf similarity index 100% rename from default-testpage.pdf rename to cups/default-testpage.pdf diff --git a/settings.ini b/gtk/settings.ini similarity index 100% rename from settings.ini rename to gtk/settings.ini diff --git a/.inputrc b/inputrc/.inputrc similarity index 100% rename from .inputrc rename to inputrc/.inputrc diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..7740a34 --- /dev/null +++ b/meson.build @@ -0,0 +1,79 @@ +project( + 'elementary-default-settings', + version: '5.1.0', + default_options: 'sysconfdir=/etc', +) + +prefix = get_option('prefix') +datadir = join_paths(prefix, get_option('datadir')) +sysconfdir = get_option('sysconfdir') + +meson.add_install_script('meson/post_install.py', datadir) + +# Planks Default DockItems +if get_option('plank-dockitems') + install_subdir( + 'plank', + install_dir: join_paths(sysconfdir, 'skel', '.config') + ) +endif + +# Setup system wide global environment for applications +install_subdir( + 'profile.d', + install_dir: join_paths(sysconfdir, 'profile.d'), + strip_directory : true +) + +# elementary Plymouth Theme +install_subdir( + 'plymouth/elementary', + install_dir: join_paths(datadir, 'plymouth', 'themes') +) + +install_data( + 'plymouth/ubuntu-text.plymouth', + install_dir: join_paths(datadir, 'plymouth', 'themes') +) + +# Sudo password feedback in terminals +install_data( + 'sudoers.d/pwfeedback', + install_dir: join_paths(sysconfdir, 'sudoers.d') +) + +# CUPS Printing testpage +install_data( + 'cups/default-testpage.pdf', + install_dir: join_paths(datadir, 'cups', 'data') +) + +# GTK3 Settings +install_data( + 'gtk/settings.ini', + install_dir: join_paths(sysconfdir, 'gtk-3.0') +) + +# So SessionInstaller can have an Icon +install_data( + 'sessioninstaller/sessioninstaller.desktop', + install_dir: join_paths(datadir, 'applications') +) + +# Default Appcenter Blacklist +install_data( + 'appcenter/appcenter.blacklist', + install_dir: join_paths(sysconfdir, 'appcenter') +) + +# Configuration file of GNU readline +install_data( + 'inputrc/.inputrc', + install_dir: join_paths(sysconfdir, 'skel') +) + +# Default gsettings overrides +subdir('overrides') + +# AccountsService extension for Greeter. +subdir('accountsservice') diff --git a/meson/post_install.py b/meson/post_install.py new file mode 100755 index 0000000..c6b5617 --- /dev/null +++ b/meson/post_install.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import os +import sys +import subprocess + +if 'DESTDIR' not in os.environ: + default_settings_datadir = sys.argv[1] + + print('Compiling GSettings schemas...') + subprocess.call(['glib-compile-schemas', + os.path.join(default_settings_datadir, 'glib-2.0', 'schemas')]) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..8fd19ba --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,14 @@ +option('default-wallpaper', + type: 'string', + value: '/usr/share/backgrounds/elementaryos-default', + description: 'Path to default wallpaper to use in Pantheon.') + +option('plank-dockitems', + type: 'boolean', + value: true, + description: 'Install default Pantheon Plank dockitems') + +option('default-gsettings-overrides', + type: 'boolean', + value: true, + description: 'Install default Pantheon GSettings Overrides') diff --git a/overrides/default-settings.gschema.override b/overrides/default-settings.gschema.override.in similarity index 92% rename from overrides/default-settings.gschema.override rename to overrides/default-settings.gschema.override.in index 1aef29c..69d272b 100644 --- a/overrides/default-settings.gschema.override +++ b/overrides/default-settings.gschema.override.in @@ -1,5 +1,4 @@ [net.launchpad.plank.dock.settings] -dock-items=['gala-multitaskingview.dockitem','org.gnome.Epiphany.dockitem','org.pantheon.mail.dockitem','io.elementary.calendar.dockitem','io.elementary.music.dockitem','io.elementary.videos.dockitem','io.elementary.photos.dockitem','io.elementary.switchboard.dockitem','io.elementary.appcenter.dockitem'] hide-delay=250 hide-mode='window-dodge' show-dock-item=false @@ -11,7 +10,7 @@ triggers=['space'] [org.gnome.desktop.background] draw-background=true picture-options='zoom' -picture-uri='file:///usr/share/backgrounds/elementaryos-default' +picture-uri='file://@DEFAULT_WALLPAPER@' primary-color='#000000' show-desktop-icons=false diff --git a/overrides/meson.build b/overrides/meson.build new file mode 100644 index 0000000..ad80644 --- /dev/null +++ b/overrides/meson.build @@ -0,0 +1,21 @@ +if get_option('default-gsettings-overrides') + default_wallpaper = get_option('default-wallpaper') + + wallpaper_configuration = configuration_data() + wallpaper_configuration.set('DEFAULT_WALLPAPER', default_wallpaper) + + settings_override = configure_file( + input: 'default-settings.gschema.override.in', + output: '@BASENAME@', + configuration: wallpaper_configuration, + install_dir: join_paths(datadir, 'glib-2.0', 'schemas') + ) +endif + +# Install conditionally because it's dependent on our dockitems being installed +if get_option('plank-dockitems') + install_data( + 'plank-dockitems.gschema.override', + install_dir: join_paths(datadir, 'glib-2.0', 'schemas') + ) +endif diff --git a/overrides/plank-dockitems.gschema.override b/overrides/plank-dockitems.gschema.override new file mode 100644 index 0000000..72b38d4 --- /dev/null +++ b/overrides/plank-dockitems.gschema.override @@ -0,0 +1,2 @@ +[net.launchpad.plank.dock.settings] +dock-items=['gala-multitaskingview.dockitem','org.gnome.Epiphany.dockitem','org.pantheon.mail.dockitem','io.elementary.calendar.dockitem','io.elementary.music.dockitem','io.elementary.videos.dockitem','io.elementary.photos.dockitem','io.elementary.switchboard.dockitem','io.elementary.appcenter.dockitem'] diff --git a/sessioninstaller.desktop b/sessioninstaller/sessioninstaller.desktop similarity index 100% rename from sessioninstaller.desktop rename to sessioninstaller/sessioninstaller.desktop -- 2.23.0