[gnome-robots: 1/4] buildsystem: switch to using meson



commit 260b6600739350c4be11f87c775df8c03250b195
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Sun Jan 13 12:45:19 2019 +0100

    buildsystem: switch to using meson

 .gitignore                                         |   1 +
 build-aux/meson_post_install.py                    |  14 +++
 data/Makefile.am                                   |   2 +-
 data/{ => cursors}/cursor-down-left.png            | Bin
 data/{ => cursors}/cursor-down-right.png           | Bin
 data/{ => cursors}/cursor-down.png                 | Bin
 data/{ => cursors}/cursor-hold.png                 | Bin
 data/{ => cursors}/cursor-left.png                 | Bin
 data/{ => cursors}/cursor-right.png                | Bin
 data/{ => cursors}/cursor-up-left.png              | Bin
 data/{ => cursors}/cursor-up-right.png             | Bin
 data/{ => cursors}/cursor-up.png                   | Bin
 data/{ => games}/classic_robots.cfg                |   0
 data/{ => games}/nightmare.cfg                     |   0
 data/{ => games}/robots2.cfg                       |   0
 data/{ => games}/robots2_easy.cfg                  |   0
 data/{ => games}/robots_with_safe_teleport.cfg     |   0
 .../{gnome-robots.png => org.gnome.Robots.png}     | Bin
 .../{gnome-robots.png => org.gnome.Robots.png}     | Bin
 .../{gnome-robots.png => org.gnome.Robots.png}     | Bin
 .../{gnome-robots.png => org.gnome.Robots.png}     | Bin
 .../{gnome-robots.png => org.gnome.Robots.png}     | Bin
 ...-symbolic.svg => org.gnome.Robots-symbolic.svg} |   0
 .../{gnome-robots.svg => org.gnome.Robots.svg}     |   0
 data/icons/meson.build                             |  24 +++++
 data/meson.build                                   |  98 +++++++++++++++++++++
 ...data.xml.in => org.gnome.Robots.appdata.xml.in} |   0
 ...bots.desktop.in => org.gnome.Robots.desktop.in} |   0
 ...ts.gschema.xml => org.gnome.Robots.gschema.xml} |   2 +-
 data/{ => pixmaps}/aieee.png                       | Bin
 data/{ => pixmaps}/splat.png                       | Bin
 data/{ => pixmaps}/yahoo.png                       | Bin
 data/{ => sounds}/die.ogg                          | Bin
 data/{ => sounds}/splat.ogg                        | Bin
 data/{ => sounds}/teleport.ogg                     | Bin
 data/{ => sounds}/victory.ogg                      | Bin
 data/{ => sounds}/yahoo.ogg                        | Bin
 data/{ => themes}/anthills.png                     | Bin
 data/{ => themes}/boo.svg                          |   0
 data/{ => themes}/cows.png                         | Bin
 data/{ => themes}/eggs.png                         | Bin
 data/{ => themes}/gnomes.png                       | Bin
 data/{ => themes}/mice.png                         | Bin
 data/{ => themes}/robots.svg                       |   0
 data/{ => themes}/spills.png                       | Bin
 data/{ => themes}/stormclouds.png                  | Bin
 data/{ => themes}/toasters.png                     | Bin
 data/{ => themes}/ufo.svg                          |   0
 help/LINGUAS                                       |  18 ++++
 help/meson.build                                   |  43 +++++++++
 meson.build                                        |  40 +++++++++
 po/meson.build                                     |   1 +
 ...ts.gresource.xml => gnome-robots.gresource.xml} |   0
 src/meson.build                                    |  43 +++++++++
 54 files changed, 284 insertions(+), 2 deletions(-)
---
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c6a151b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+_build/
\ No newline at end of file
diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py
new file mode 100644
index 0000000..6d18340
--- /dev/null
+++ b/build-aux/meson_post_install.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+
+from os import environ, path
+from subprocess import call
+
+if not environ.get('DESTDIR', ''):
+    PREFIX = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
+    DATA_DIR = path.join(PREFIX, 'share')
+    print('Updating icon cache...')
+    call(['gtk-update-icon-cache', '-qtf', path.join(DATA_DIR, 'icons/hicolor')])
+    print("Compiling new schemas")
+    call(["glib-compile-schemas", path.join(DATA_DIR, 'glib-2.0/schemas')])
+    print("Updating desktop database")
+    call(["update-desktop-database", path.join(DATA_DIR, 'applications')])
diff --git a/data/Makefile.am b/data/Makefile.am
index 8de46a6..f94b1ea 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -23,7 +23,7 @@ pixmapdir = $(datadir)/gnome-robots/pixmaps
 pixmap_DATA = yahoo.png \
               aieee.png \
               splat.png
-
+    
 soundsdir = $(datadir)/gnome-robots/sounds
 sounds_DATA = \
        die.ogg \
diff --git a/data/cursor-down-left.png b/data/cursors/cursor-down-left.png
similarity index 100%
rename from data/cursor-down-left.png
rename to data/cursors/cursor-down-left.png
diff --git a/data/cursor-down-right.png b/data/cursors/cursor-down-right.png
similarity index 100%
rename from data/cursor-down-right.png
rename to data/cursors/cursor-down-right.png
diff --git a/data/cursor-down.png b/data/cursors/cursor-down.png
similarity index 100%
rename from data/cursor-down.png
rename to data/cursors/cursor-down.png
diff --git a/data/cursor-hold.png b/data/cursors/cursor-hold.png
similarity index 100%
rename from data/cursor-hold.png
rename to data/cursors/cursor-hold.png
diff --git a/data/cursor-left.png b/data/cursors/cursor-left.png
similarity index 100%
rename from data/cursor-left.png
rename to data/cursors/cursor-left.png
diff --git a/data/cursor-right.png b/data/cursors/cursor-right.png
similarity index 100%
rename from data/cursor-right.png
rename to data/cursors/cursor-right.png
diff --git a/data/cursor-up-left.png b/data/cursors/cursor-up-left.png
similarity index 100%
rename from data/cursor-up-left.png
rename to data/cursors/cursor-up-left.png
diff --git a/data/cursor-up-right.png b/data/cursors/cursor-up-right.png
similarity index 100%
rename from data/cursor-up-right.png
rename to data/cursors/cursor-up-right.png
diff --git a/data/cursor-up.png b/data/cursors/cursor-up.png
similarity index 100%
rename from data/cursor-up.png
rename to data/cursors/cursor-up.png
diff --git a/data/classic_robots.cfg b/data/games/classic_robots.cfg
similarity index 100%
rename from data/classic_robots.cfg
rename to data/games/classic_robots.cfg
diff --git a/data/nightmare.cfg b/data/games/nightmare.cfg
similarity index 100%
rename from data/nightmare.cfg
rename to data/games/nightmare.cfg
diff --git a/data/robots2.cfg b/data/games/robots2.cfg
similarity index 100%
rename from data/robots2.cfg
rename to data/games/robots2.cfg
diff --git a/data/robots2_easy.cfg b/data/games/robots2_easy.cfg
similarity index 100%
rename from data/robots2_easy.cfg
rename to data/games/robots2_easy.cfg
diff --git a/data/robots_with_safe_teleport.cfg b/data/games/robots_with_safe_teleport.cfg
similarity index 100%
rename from data/robots_with_safe_teleport.cfg
rename to data/games/robots_with_safe_teleport.cfg
diff --git a/data/icons/hicolor/16x16/gnome-robots.png b/data/icons/hicolor/16x16/org.gnome.Robots.png
similarity index 100%
rename from data/icons/hicolor/16x16/gnome-robots.png
rename to data/icons/hicolor/16x16/org.gnome.Robots.png
diff --git a/data/icons/hicolor/22x22/gnome-robots.png b/data/icons/hicolor/22x22/org.gnome.Robots.png
similarity index 100%
rename from data/icons/hicolor/22x22/gnome-robots.png
rename to data/icons/hicolor/22x22/org.gnome.Robots.png
diff --git a/data/icons/hicolor/24x24/gnome-robots.png b/data/icons/hicolor/24x24/org.gnome.Robots.png
similarity index 100%
rename from data/icons/hicolor/24x24/gnome-robots.png
rename to data/icons/hicolor/24x24/org.gnome.Robots.png
diff --git a/data/icons/hicolor/32x32/gnome-robots.png b/data/icons/hicolor/32x32/org.gnome.Robots.png
similarity index 100%
rename from data/icons/hicolor/32x32/gnome-robots.png
rename to data/icons/hicolor/32x32/org.gnome.Robots.png
diff --git a/data/icons/hicolor/48x48/gnome-robots.png b/data/icons/hicolor/48x48/org.gnome.Robots.png
similarity index 100%
rename from data/icons/hicolor/48x48/gnome-robots.png
rename to data/icons/hicolor/48x48/org.gnome.Robots.png
diff --git a/data/icons/hicolor/scalable/gnome-robots-symbolic.svg 
b/data/icons/hicolor/scalable/org.gnome.Robots-symbolic.svg
similarity index 100%
rename from data/icons/hicolor/scalable/gnome-robots-symbolic.svg
rename to data/icons/hicolor/scalable/org.gnome.Robots-symbolic.svg
diff --git a/data/icons/hicolor/scalable/gnome-robots.svg b/data/icons/hicolor/scalable/org.gnome.Robots.svg
similarity index 100%
rename from data/icons/hicolor/scalable/gnome-robots.svg
rename to data/icons/hicolor/scalable/org.gnome.Robots.svg
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..0078c01
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,24 @@
+sizes = ['16x16', '22x22', '24x24', '32x32', '48x48']
+theme_dir = join_paths(get_option('prefix'), get_option('datadir'), 'icons', 'hicolor')
+foreach size: sizes
+    install_data(
+        join_paths('hicolor', size, '@0@.png'.format(application_id)),
+        install_dir: join_paths(theme_dir, size, 'apps')
+    )
+endforeach
+
+install_data(
+    [
+        'hicolor/teleport-random.png',
+        'hicolor/teleport.png'
+    ],
+    install_dir: join_paths(theme_dir, '24x24', 'actions')
+)
+install_data(
+    'hicolor/scalable/@0 -symbolic svg'.format(application_id),
+    install_dir: join_paths(theme_dir, 'symbolic', 'apps')
+)
+install_data(
+    'hicolor/scalable/@0@.svg'.format(application_id),
+    install_dir: join_paths(theme_dir, 'scalable', 'apps')
+)
\ No newline at end of file
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..62550f3
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,98 @@
+# Desktop file
+desktop_file = i18n.merge_file(
+    input: '@0  desktop in'.format(application_id),
+    output: '@0@.desktop'.format(application_id),
+    po_dir: join_paths(meson.source_root(), 'po'),
+    type: 'desktop',
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'applications')
+)
+
+# Validate desktop file
+desktop_file_validate = find_program('desktop-file-validate', required: false)
+if desktop_file_validate.found()
+  test(
+    'validate-desktop',
+    desktop_file_validate,
+    args: [
+      desktop_file.full_path()
+    ]
+  )
+endif
+
+# AppData file
+appdata_file = i18n.merge_file(
+    input: '@0  appdata xml in'.format(application_id),
+    output: '@0  appdata xml'.format(application_id),
+    po_dir: join_paths(meson.source_root(), 'po'),
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'metainfo')
+)
+
+# Validate AppData file
+appstream_util = find_program('appstream-util', required: false)
+if appstream_util.found()
+  test(
+    'validate-appdata', appstream_util,
+    args: [
+      'validate-relax', '--nonet', appdata_file.full_path()
+    ]
+  )
+endif
+
+# Install man page
+install_man('@0@.6'.format(meson.project_name()))
+
+# Install GSchema file
+install_data(
+  '@0  gschema xml'.format(application_id),
+  install_dir : join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
+)
+
+install_data(
+    [
+        'games/classic_robots.cfg',
+        'games/nightmare.cfg',
+        'games/robots2.cfg',
+        'games/robots2_easy.cfg',
+        'games/robots_with_safe_teleport.cfg'
+    ],
+    install_dir: join_paths(datadir, 'games') 
+)
+
+install_data(
+    [
+        'pixmaps/aieee.png',
+        'pixmaps/splat.png',
+        'pixmaps/yahoo.png'
+    ],
+    install_dir: join_paths(datadir, 'pixmaps')
+)
+
+install_data(
+    [
+        'sounds/die.ogg',
+        'sounds/splat.ogg',
+        'sounds/teleport.ogg',
+        'sounds/victory.ogg',
+        'sounds/yahoo.ogg'
+    ],
+    install_dir: join_paths(datadir, 'sounds')
+)
+
+install_data(
+    [
+        'themes/anthills.png',
+        'themes/boo.svg',
+        'themes/cows.png',
+        'themes/eggs.png',
+        'themes/gnomes.png',
+        'themes/mice.png',
+        'themes/robots.svg',
+        'themes/spills.png',
+        'themes/stormclouds.png',
+        'themes/toasters.png',
+        'themes/ufo.svg'
+    ],
+    install_dir: join_paths(datadir, 'themes')
+)
\ No newline at end of file
diff --git a/data/gnome-robots.appdata.xml.in b/data/org.gnome.Robots.appdata.xml.in
similarity index 100%
rename from data/gnome-robots.appdata.xml.in
rename to data/org.gnome.Robots.appdata.xml.in
diff --git a/data/gnome-robots.desktop.in b/data/org.gnome.Robots.desktop.in
similarity index 100%
rename from data/gnome-robots.desktop.in
rename to data/org.gnome.Robots.desktop.in
diff --git a/data/org.gnome.robots.gschema.xml b/data/org.gnome.Robots.gschema.xml
similarity index 98%
rename from data/org.gnome.robots.gschema.xml
rename to data/org.gnome.Robots.gschema.xml
index 71e9f3e..5d75b9a 100644
--- a/data/org.gnome.robots.gschema.xml
+++ b/data/org.gnome.Robots.gschema.xml
@@ -1,5 +1,5 @@
 <schemalist>
-  <schema id="org.gnome.robots" path="/org/gnome/robots/" gettext-domain="gnome-robots">
+  <schema id="org.gnome.Robots" path="/org/gnome/Robots/" gettext-domain="gnome-robots">
     <key name="show-toolbar" type="b">
       <default>true</default>
       <summary>Show toolbar</summary>
diff --git a/data/aieee.png b/data/pixmaps/aieee.png
similarity index 100%
rename from data/aieee.png
rename to data/pixmaps/aieee.png
diff --git a/data/splat.png b/data/pixmaps/splat.png
similarity index 100%
rename from data/splat.png
rename to data/pixmaps/splat.png
diff --git a/data/yahoo.png b/data/pixmaps/yahoo.png
similarity index 100%
rename from data/yahoo.png
rename to data/pixmaps/yahoo.png
diff --git a/data/die.ogg b/data/sounds/die.ogg
similarity index 100%
rename from data/die.ogg
rename to data/sounds/die.ogg
diff --git a/data/splat.ogg b/data/sounds/splat.ogg
similarity index 100%
rename from data/splat.ogg
rename to data/sounds/splat.ogg
diff --git a/data/teleport.ogg b/data/sounds/teleport.ogg
similarity index 100%
rename from data/teleport.ogg
rename to data/sounds/teleport.ogg
diff --git a/data/victory.ogg b/data/sounds/victory.ogg
similarity index 100%
rename from data/victory.ogg
rename to data/sounds/victory.ogg
diff --git a/data/yahoo.ogg b/data/sounds/yahoo.ogg
similarity index 100%
rename from data/yahoo.ogg
rename to data/sounds/yahoo.ogg
diff --git a/data/anthills.png b/data/themes/anthills.png
similarity index 100%
rename from data/anthills.png
rename to data/themes/anthills.png
diff --git a/data/boo.svg b/data/themes/boo.svg
similarity index 100%
rename from data/boo.svg
rename to data/themes/boo.svg
diff --git a/data/cows.png b/data/themes/cows.png
similarity index 100%
rename from data/cows.png
rename to data/themes/cows.png
diff --git a/data/eggs.png b/data/themes/eggs.png
similarity index 100%
rename from data/eggs.png
rename to data/themes/eggs.png
diff --git a/data/gnomes.png b/data/themes/gnomes.png
similarity index 100%
rename from data/gnomes.png
rename to data/themes/gnomes.png
diff --git a/data/mice.png b/data/themes/mice.png
similarity index 100%
rename from data/mice.png
rename to data/themes/mice.png
diff --git a/data/robots.svg b/data/themes/robots.svg
similarity index 100%
rename from data/robots.svg
rename to data/themes/robots.svg
diff --git a/data/spills.png b/data/themes/spills.png
similarity index 100%
rename from data/spills.png
rename to data/themes/spills.png
diff --git a/data/stormclouds.png b/data/themes/stormclouds.png
similarity index 100%
rename from data/stormclouds.png
rename to data/themes/stormclouds.png
diff --git a/data/toasters.png b/data/themes/toasters.png
similarity index 100%
rename from data/toasters.png
rename to data/themes/toasters.png
diff --git a/data/ufo.svg b/data/themes/ufo.svg
similarity index 100%
rename from data/ufo.svg
rename to data/themes/ufo.svg
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 0000000..eef3cc9
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,18 @@
+ca
+cs
+da
+de
+el
+en_GB
+es
+eu
+fr
+hu
+it
+oc
+pl
+sl
+sr
+sr@latin
+sv
+zh_CN
\ No newline at end of file
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..5eb9579
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,43 @@
+help_media = [
+    'anthills-high-risk.png',
+    'anthills-low-risk.png',
+    'boo-high-risk.png',
+    'boo-low-risk.png',
+    'cows-high-risk.png',
+    'cows-low-risk.png',
+    'eggs-high-risk.png',
+    'eggs-low-risk.png',
+    'gnome-robots.png',
+    'gnomes-high-risk.png',
+    'gnomes-low-risk.png',
+    'mice-high-risk.png',
+    'mice-low-risk.png',
+    'robots-high-risk.png',
+    'robots-low-risk.png',
+    'spills-high-risk.png',
+    'spills-low-risk.png',
+    'stormclouds-high-risk.png',
+    'stormclouds-low-risk.png',
+    'toasters-high-risk.png',
+    'toasters-low-risk.png',
+    'ufo-high-risk.png',
+    'ufo-low-risk.png'
+]
+
+help_pages = [
+    'appearance.page',
+    'basics.page',
+    'controls-change.page',
+    'controls-default.page',
+    'game-types.page',
+    'index.page',
+    'legal.xml',
+    'moves.pages',
+    'scores.page'
+]
+
+gnome.yelp(meson.project_name(),
+    sources: help_pages,
+    media: help_media,
+    symlink_media: true
+)
\ No newline at end of file
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..b3d8252
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,40 @@
+project('gnome-robots', 'c',
+    version: '3.31.3')
+
+python3 = import('python3')
+gnome = import('gnome')
+i18n = import('i18n')
+
+application_id = 'org.gnome.Robots'
+
+gtk_dependency = dependency('gtk+-3.0', version: '>= 3.15.0')
+glib_dependency = dependency('glib-2.0', version: '>= 2.32')
+gio_dependency = dependency('gio-2.0', version: '>= 2.32')
+rsvg_dependency = dependency('librsvg-2.0', version: '>= 2.36.2')
+gnome_games_dependency = dependency('libgnome-games-support-1')
+canberra_gtk3_dependency = dependency('libcanberra-gtk3', version: '>= 0.26')
+
+datadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
+
+config_h = configuration_data()
+config_h.set_quoted('PACKAGE', meson.project_name())
+config_h.set_quoted('PACKAGE_NAME', 'Robots')
+config_h.set_quoted('PACKAGE_TARNAME', meson.project_name())
+config_h.set_quoted('PACKAGE_STRING', 'Robots @0@'.format(meson.project_version()))
+config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
+config_h.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.gnome.org/GNOME/gnome-robots/issues')
+config_h.set_quoted('PACKAGE_URL', 'https://wiki.gnome.org/Apps/Robots')
+config_h.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
+config_h.set_quoted('VERSION', meson.project_version())
+config_h.set_quoted('DATA_DIRECTORY', datadir)
+
+
+subdir('data')
+subdir('help')
+subdir('po')
+subdir('src')
+
+meson.add_install_script(python3.find_python().path(), join_paths(meson.source_root(), 
+                                                                  'build-aux', 
+                                                                  'meson_post_install.py'))
\ No newline at end of file
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..5eab52e
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(meson.project_name(), preset: 'glib')
\ No newline at end of file
diff --git a/src/robots.gresource.xml b/src/gnome-robots.gresource.xml
similarity index 100%
rename from src/robots.gresource.xml
rename to src/gnome-robots.gresource.xml
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..e8096e3
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,43 @@
+sources = files(
+    'cursors.c',
+    'find-file.c',
+    'game.c',
+    'gameconfig.c',
+    'games-controls.c',
+    'games-file-list.c',
+    'games-preimage.c',
+    'gnome-robots.c',
+    'graphics.c',
+    'keyboard.c',
+    'properties.c'
+)
+resources = gnome.compile_resources(
+    'resources', 
+    '@0  gresource xml'.format(meson.project_name()),
+    source_dir: '../'
+)
+
+config_header = configure_file(
+    output: 'config.h',
+    configuration: config_h
+)
+
+executable(
+    meson.project_name(),
+    sources + resources,
+    config_header,
+    dependencies: [
+        gtk_dependency,
+        glib_dependency,
+        gio_dependency,
+        rsvg_dependency,
+        gnome_games_dependency,
+        canberra_gtk3_dependency
+    ],
+    c_args: [
+        '-DHAVE_CONFIG_H',
+        '-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name())
+    ],
+    install_dir: get_option('bindir'),
+    install: true
+)
\ No newline at end of file


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