[gnome-shell-extensions/wip/fmuellner/meson: 1/4] build: Support the meson build system



commit 8d9621533c56e4dd6e76e0c93980b5ce86921010
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Apr 9 06:09:04 2017 +0200

    build: Support the meson build system
    
    Meson is on track to replace autotools as the build system of choice,
    so support it in addition to autotools.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/31

 data/meson.build                               | 58 ++++++++++++++++
 data/update-theme.sh                           |  9 +++
 extensions/alternate-tab/meson.build           |  7 ++
 extensions/apps-menu/meson.build               |  5 ++
 extensions/auto-move-windows/meson.build       |  8 +++
 extensions/drive-menu/meson.build              |  5 ++
 extensions/example/meson.build                 |  8 +++
 extensions/launch-new-instance/meson.build     |  5 ++
 extensions/meson.build                         | 26 +++++++
 extensions/native-window-placement/meson.build |  7 ++
 extensions/places-menu/meson.build             |  7 ++
 extensions/screenshot-window-sizer/meson.build |  7 ++
 extensions/user-theme/meson.build              |  7 ++
 extensions/window-list/meson.build             | 12 ++++
 extensions/windowsNavigator/meson.build        |  5 ++
 extensions/workspace-indicator/meson.build     |  7 ++
 meson.build                                    | 94 ++++++++++++++++++++++++++
 meson_options.txt                              | 18 +++++
 po/meson.build                                 |  3 +
 19 files changed, 298 insertions(+)
---
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..7cd388d
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,58 @@
+sessions = [
+  ['gnome-classic.session.desktop', sessiondir],
+  ['gnome-classic.desktop', xsessiondir]
+]
+foreach s : sessions
+  i18n.merge_file('',
+    input:  s[0] + '.in',
+    output: s[0],
+    po_dir: '../po',
+    install: true,
+    install_dir: s[1],
+    type: 'desktop'
+  )
+endforeach
+
+mode_conf = configuration_data()
+mode_conf.set('CLASSIC_EXTENSIONS', ','.join(classic_extensions))
+
+mode_file = 'classic.json'
+configure_file(
+  input: mode_file + '.in',
+  output: mode_file,
+  configuration: mode_conf,
+  install_dir: modedir
+)
+
+theme_sources = files(
+  'gnome-shell-sass/_colors.scss',
+  'gnome-shell-sass/_common.scss',
+  'gnome-shell-sass/_drawing.scss',
+  'gnome-shell-sass/_high-contrast-colors.scss'
+)
+
+theme_data = [
+  'calendar-today.svg',
+  'classic-process-working.svg',
+  'classic-toggle-off-intl.svg',
+  'classic-toggle-off-us.svg',
+  'classic-toggle-on-intl.svg',
+  'classic-toggle-on-us.svg',
+  'gnome-classic.css',
+  'gnome-classic-high-contrast.css'
+]
+
+update_theme = files('update-theme.sh')
+
+if sassc.found()
+  style = 'gnome-classic'
+  custom_target(style + '.css',
+    input: style + '.scss',
+    output: style + '.css',
+    depend_files: theme_sources + files(style + '.css'),
+    command: [update_theme, '@INPUT@', '@OUTPUT@'],
+    build_by_default: true
+  )
+endif
+
+install_data(theme_data, install_dir: themedir)
diff --git a/data/update-theme.sh b/data/update-theme.sh
new file mode 100755
index 0000000..f8d2a0d
--- /dev/null
+++ b/data/update-theme.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+INPUT=$1
+OUTPUT=$2
+
+if [ `which sassc` ]
+then
+  sassc -a $INPUT | tee ${INPUT%%.scss}.css > $OUTPUT
+fi
diff --git a/extensions/alternate-tab/meson.build b/extensions/alternate-tab/meson.build
new file mode 100644
index 0000000..451dbe2
--- /dev/null
+++ b/extensions/alternate-tab/meson.build
@@ -0,0 +1,7 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
+
+extension_sources += files('prefs.js')
diff --git a/extensions/apps-menu/meson.build b/extensions/apps-menu/meson.build
new file mode 100644
index 0000000..49c09b1
--- /dev/null
+++ b/extensions/apps-menu/meson.build
@@ -0,0 +1,5 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
diff --git a/extensions/auto-move-windows/meson.build b/extensions/auto-move-windows/meson.build
new file mode 100644
index 0000000..c4a56c5
--- /dev/null
+++ b/extensions/auto-move-windows/meson.build
@@ -0,0 +1,8 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
+
+extension_sources += files('prefs.js')
+extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml')
diff --git a/extensions/drive-menu/meson.build b/extensions/drive-menu/meson.build
new file mode 100644
index 0000000..49c09b1
--- /dev/null
+++ b/extensions/drive-menu/meson.build
@@ -0,0 +1,5 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
diff --git a/extensions/example/meson.build b/extensions/example/meson.build
new file mode 100644
index 0000000..c4a56c5
--- /dev/null
+++ b/extensions/example/meson.build
@@ -0,0 +1,8 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
+
+extension_sources += files('prefs.js')
+extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml')
diff --git a/extensions/launch-new-instance/meson.build b/extensions/launch-new-instance/meson.build
new file mode 100644
index 0000000..49c09b1
--- /dev/null
+++ b/extensions/launch-new-instance/meson.build
@@ -0,0 +1,5 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
diff --git a/extensions/meson.build b/extensions/meson.build
new file mode 100644
index 0000000..79208e6
--- /dev/null
+++ b/extensions/meson.build
@@ -0,0 +1,26 @@
+extension_schemas = []
+
+foreach e : enabled_extensions
+  uuid = e + '@gnome-shell-extensions.gcampax.github.com'
+
+  metadata_conf = configuration_data()
+  metadata_conf.set('extension_id', e)
+  metadata_conf.set('uuid', uuid)
+  metadata_conf.set('gschemaname', 'org.gnome.shell.extensions.' + e)
+  metadata_conf.set('gettext_domain', meson.project_name())
+  metadata_conf.set('shell_current', shell_version)
+  metadata_conf.set('url', 'https://gitlab.gnome.org/GNOME/gnome-shell-extensions')
+
+  extension_sources = files(e + '/extension.js')
+  extension_data = files(e + '/stylesheet.css')
+
+  subdir(e)
+
+  install_data (extension_sources + extension_data + extensionlib,
+    install_dir: join_paths(extensiondir, uuid)
+  )
+endforeach
+
+install_data (extension_schemas,
+  install_dir: schemadir
+)
diff --git a/extensions/native-window-placement/meson.build b/extensions/native-window-placement/meson.build
new file mode 100644
index 0000000..8519167
--- /dev/null
+++ b/extensions/native-window-placement/meson.build
@@ -0,0 +1,7 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
+
+extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml')
diff --git a/extensions/places-menu/meson.build b/extensions/places-menu/meson.build
new file mode 100644
index 0000000..2bf9bb7
--- /dev/null
+++ b/extensions/places-menu/meson.build
@@ -0,0 +1,7 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
+
+extension_sources += files('placeDisplay.js')
diff --git a/extensions/screenshot-window-sizer/meson.build b/extensions/screenshot-window-sizer/meson.build
new file mode 100644
index 0000000..8519167
--- /dev/null
+++ b/extensions/screenshot-window-sizer/meson.build
@@ -0,0 +1,7 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
+
+extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml')
diff --git a/extensions/user-theme/meson.build b/extensions/user-theme/meson.build
new file mode 100644
index 0000000..8519167
--- /dev/null
+++ b/extensions/user-theme/meson.build
@@ -0,0 +1,7 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
+
+extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml')
diff --git a/extensions/window-list/meson.build b/extensions/window-list/meson.build
new file mode 100644
index 0000000..2f8c087
--- /dev/null
+++ b/extensions/window-list/meson.build
@@ -0,0 +1,12 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
+
+extension_sources += files('prefs.js')
+extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml')
+
+if classic_mode_enabled
+  extension_data += files('classic.css')
+endif
diff --git a/extensions/windowsNavigator/meson.build b/extensions/windowsNavigator/meson.build
new file mode 100644
index 0000000..49c09b1
--- /dev/null
+++ b/extensions/windowsNavigator/meson.build
@@ -0,0 +1,5 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
diff --git a/extensions/workspace-indicator/meson.build b/extensions/workspace-indicator/meson.build
new file mode 100644
index 0000000..451dbe2
--- /dev/null
+++ b/extensions/workspace-indicator/meson.build
@@ -0,0 +1,7 @@
+extension_data += configure_file(
+  input: 'metadata.json.in',
+  output: 'metadata.json',
+  configuration: metadata_conf
+)
+
+extension_sources += files('prefs.js')
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..ef18c93
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,94 @@
+project('gnome-shell-extensions',
+  version: '3.27.1',
+  meson_version: '>= 0.37.0',
+  license: 'GPL2+'
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+datadir = get_option('datadir')
+
+shelldir = join_paths(datadir, 'gnome-shell')
+extensiondir = join_paths(shelldir, 'extensions')
+modedir = join_paths(shelldir, 'modes')
+themedir = join_paths(shelldir, 'theme')
+
+schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
+sessiondir = join_paths(datadir, 'gnome-session', 'sessions')
+xsessiondir = join_paths(datadir, 'xsession')
+
+extensionlib = files('lib/convenience.js')
+
+sassc = find_program('sassc', required: false)
+
+ver_arr = meson.project_version().split('.')
+if ver_arr[1].to_int().is_even()
+  shell_version = '@0@.@1@'.format(ver_arr[0], ver_arr[1])
+else
+  shell_version = '.'.join(ver_arr)
+endif
+
+classic_extensions = [
+  'alternate-tab',
+  'apps-menu',
+  'places-menu',
+  'launch-new-instance',
+  'window-list'
+]
+
+default_extensions = classic_extensions
+default_extensions += [
+  'drive-menu',
+  'screenshot-window-sizer',
+  'windowsNavigator',
+  'workspace-indicator'
+]
+
+all_extensions = default_extensions
+all_extensions += [
+  'auto-move-windows',
+  'example',
+  'native-window-placement',
+  'user-theme'
+]
+
+enabled_extensions = get_option('enable_extensions').split()
+
+if enabled_extensions.length() == 0
+  set = get_option('extension_set')
+
+  if set == 'classic'
+    enabled_extensions += classic_extensions
+  elif set == 'default'
+    enabled_extensions += default_extensions
+  elif set == 'all'
+    enabled_extensions += all_extensions
+  endif
+endif
+
+classic_mode_enabled = get_option('classic_mode')
+
+if classic_mode_enabled
+  # Sanity check: Make sure all classic extensions are enabled
+  foreach e : classic_extensions
+    if not enabled_extensions.contains(e)
+      error('Classic mode is enabled, ' +
+            'but the required extension @0@ is not.'.format(e))
+    endif
+  endforeach
+endif
+
+# Sanity check: Make sure enabled extensions are valid
+foreach e : enabled_extensions
+  if not all_extensions.contains(e)
+    error('Invalid extension @0@.'.format(e))
+  endif
+endforeach
+
+if classic_mode_enabled
+  subdir('data')
+endif
+
+subdir('extensions')
+subdir('po')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..5a157df
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,18 @@
+option('extension_set',
+  type: 'combo',
+  choices: ['classic', 'default', 'all'],
+  value: 'default',
+  description: 'Predefined sets of extensions'
+)
+
+option('enable_extensions',
+  type: 'string',
+  value: '',
+  description: 'Space separated list of extensions to enable instead of a predefined set.'
+)
+
+option('classic_mode',
+  type: 'boolean',
+  value: false,
+  description: 'Enable installing data files for classic mode.'
+)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..1a1715e
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+i18n.gettext('gnome-shell-extensions',
+  args: ['--from-code=UTF-8']
+)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]