[gnome-taquin/meson: 1/5] buildsystem: switch to meson



commit 032827197d26ebae4edf616e5a5d8e6f0d6a9f4c
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Sun Jan 20 14:35:00 2019 +0100

    buildsystem: switch to meson

 build-aux/meson_post_install.py                    |  14 ++++++
 .../org.gnome.taquin.json                          |   0
 data/Makefile.am                                   |   5 --
 .../{gnome-taquin.png => org.gnome.Taquin.png}     | Bin
 .../{gnome-taquin.png => org.gnome.Taquin.png}     | Bin
 .../{gnome-taquin.png => org.gnome.Taquin.png}     | Bin
 .../{gnome-taquin.png => org.gnome.Taquin.png}     | Bin
 .../{gnome-taquin.png => org.gnome.Taquin.png}     | Bin
 .../{gnome-taquin.png => org.gnome.Taquin.png}     | Bin
 .../org.gnome.Taquin-symbolic.svg}                 |   0
 data/icons/meson.build                             |  15 ++++++
 data/meson.build                                   |  53 +++++++++++++++++++++
 ...data.xml.in => org.gnome.Taquin.appdata.xml.in} |   8 ++--
 ...quin.desktop.in => org.gnome.Taquin.desktop.in} |   2 +-
 ...in.gschema.xml => org.gnome.Taquin.gschema.xml} |   6 +--
 data/themes/meson.build                            |  22 +++++++++
 help/LINGUAS                                       |  10 ++++
 help/meson.build                                   |  23 +++++++++
 meson.build                                        |  44 +++++++++++++++++
 po/meson.build                                     |   1 +
 src/game-window.vala                               |   2 +-
 src/meson.build                                    |  25 ++++++++++
 src/taquin-main.vala                               |  12 ++---
 src/taquin.gresource.xml                           |   4 +-
 24 files changed, 224 insertions(+), 22 deletions(-)
---
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/org.gnome.taquin.json b/build-aux/org.gnome.taquin.json
similarity index 100%
rename from org.gnome.taquin.json
rename to build-aux/org.gnome.taquin.json
diff --git a/data/Makefile.am b/data/Makefile.am
index eb51e3d..411575a 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -9,11 +9,6 @@ dist_noinst_DATA = \
        schema-15.png \
        schema-16.png
 
-soundsdir = $(datadir)/gnome-taquin/sounds
-sounds_DATA = \
-       sliding-1.ogg \
-       sliding-n.ogg \
-       gameover.ogg
 
 desktopdir = $(datadir)/applications
 desktop_in_files = org.gnome.taquin.desktop.in
diff --git a/data/icons/hicolor/16x16/gnome-taquin.png b/data/icons/hicolor/16x16/org.gnome.Taquin.png
similarity index 100%
rename from data/icons/hicolor/16x16/gnome-taquin.png
rename to data/icons/hicolor/16x16/org.gnome.Taquin.png
diff --git a/data/icons/hicolor/22x22/gnome-taquin.png b/data/icons/hicolor/22x22/org.gnome.Taquin.png
similarity index 100%
rename from data/icons/hicolor/22x22/gnome-taquin.png
rename to data/icons/hicolor/22x22/org.gnome.Taquin.png
diff --git a/data/icons/hicolor/24x24/gnome-taquin.png b/data/icons/hicolor/24x24/org.gnome.Taquin.png
similarity index 100%
rename from data/icons/hicolor/24x24/gnome-taquin.png
rename to data/icons/hicolor/24x24/org.gnome.Taquin.png
diff --git a/data/icons/hicolor/256x256/gnome-taquin.png b/data/icons/hicolor/256x256/org.gnome.Taquin.png
similarity index 100%
rename from data/icons/hicolor/256x256/gnome-taquin.png
rename to data/icons/hicolor/256x256/org.gnome.Taquin.png
diff --git a/data/icons/hicolor/32x32/gnome-taquin.png b/data/icons/hicolor/32x32/org.gnome.Taquin.png
similarity index 100%
rename from data/icons/hicolor/32x32/gnome-taquin.png
rename to data/icons/hicolor/32x32/org.gnome.Taquin.png
diff --git a/data/icons/hicolor/48x48/gnome-taquin.png b/data/icons/hicolor/48x48/org.gnome.Taquin.png
similarity index 100%
rename from data/icons/hicolor/48x48/gnome-taquin.png
rename to data/icons/hicolor/48x48/org.gnome.Taquin.png
diff --git a/data/icons/hicolor/scalable/gnome-taquin-symbolic.svg 
b/data/icons/hicolor/symbolic/org.gnome.Taquin-symbolic.svg
similarity index 100%
rename from data/icons/hicolor/scalable/gnome-taquin-symbolic.svg
rename to data/icons/hicolor/symbolic/org.gnome.Taquin-symbolic.svg
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..155307c
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,15 @@
+icons_sizes = ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
+
+iconsdir = join_paths(get_option('prefix'), get_option('datadir'), 'icons', 'hicolor')
+
+foreach size: icons_sizes
+    install_data(
+        join_paths('hicolor', size, '@0@.png'.format(project_id)),
+        install_dir: join_paths(iconsdir, size, 'apps')
+    )
+endforeach
+
+install_data(
+    join_paths('hicolor', 'symbolic', '@0 -symbolic svg'.format(project_id)),
+    install_dir: join_paths(iconsdir, 'symbolic', 'apps')
+)
\ No newline at end of file
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..12233f6
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,53 @@
+install_data(
+    [
+        'gameover.ogg',
+        'sliding-1.ogg',
+        'sliding-n.ogg'    
+    ],
+    install_dir: soundsdir
+)
+
+# Desktop file
+desktop_file = i18n.merge_file(
+    input: '@0  desktop in'.format(project_id),
+    output: '@0@.desktop'.format(project_id),
+    po_dir: join_paths(meson.source_root(), 'po'),
+    type: 'desktop',
+    install: true,
+    install_dir: join_paths(get_option('datadir'), 'applications')
+)
+
+# Validate desktop file
+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
+if appstream_util.found()
+  test(
+    'validate-appdata', appstream_util,
+    args: [
+      'validate-relax', '--nonet', appdata_file.full_path()
+    ]
+  )
+endif
+
+install_man('@0@.6'.format(meson.project_name()))
+
+subdir('icons')
+subdir('themes')
\ No newline at end of file
diff --git a/data/org.gnome.taquin.appdata.xml.in b/data/org.gnome.Taquin.appdata.xml.in
similarity index 92%
rename from data/org.gnome.taquin.appdata.xml.in
rename to data/org.gnome.Taquin.appdata.xml.in
index d3336af..bb6de94 100644
--- a/data/org.gnome.taquin.appdata.xml.in
+++ b/data/org.gnome.Taquin.appdata.xml.in
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Copyright 2014-2016 Arnaud Bonatti and contributors -->
-<component type="desktop">
-  <id>org.gnome.taquin.desktop</id>
+<component type="desktop-application">
+  <id>org.gnome.Taquin</id>
   <metadata_license>CC0-1.0</metadata_license>
   <project_license>GPL-3.0+</project_license>
   <_name>GNOME Taquin</_name>
@@ -21,14 +21,14 @@
       <_caption>A GNOME taquin game preview</_caption>
     </screenshot>
   </screenshots>
+  <launchable type="desktop-id">org.gnome.Taquin.desktop</launchable>
   <url type="homepage">https://wiki.gnome.org/Apps/Taquin</url>
-  <url type="bugtracker">https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-taquin</url>
+  <url type="bugtracker">https://gitlab.gnome.org/GNOME/gnome-taquin/issues/</url>
   <url type="donation">http://www.gnome.org/friends/</url>
   <url type="translate">https://wiki.gnome.org/TranslationProject</url>
   <update_contact>arnaud.bonatti_at_gmail.com</update_contact>
   <project_group>GNOME</project_group>
   <kudos>
-    <kudo>AppMenu</kudo>
     <kudo>HiDpiIcon</kudo>
     <kudo>ModernToolkit</kudo>
     <kudo>UserDocs</kudo>
diff --git a/data/org.gnome.taquin.desktop.in b/data/org.gnome.Taquin.desktop.in
similarity index 97%
rename from data/org.gnome.taquin.desktop.in
rename to data/org.gnome.Taquin.desktop.in
index 55f5ae2..33c724b 100644
--- a/data/org.gnome.taquin.desktop.in
+++ b/data/org.gnome.Taquin.desktop.in
@@ -1,6 +1,6 @@
 [Desktop Entry]
 # Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=gnome-taquin
+Icon=org.gnome.Taquin
 _Name=Taquin
 # Translators: a GenericName that gives the application goal, as defined in the desktop file spec
 _GenericName=15-puzzle
diff --git a/data/org.gnome.taquin.gschema.xml b/data/org.gnome.Taquin.gschema.xml
similarity index 94%
rename from data/org.gnome.taquin.gschema.xml
rename to data/org.gnome.Taquin.gschema.xml
index 7531308..65c4237 100644
--- a/data/org.gnome.taquin.gschema.xml
+++ b/data/org.gnome.Taquin.gschema.xml
@@ -1,11 +1,11 @@
 <schemalist>
-  <enum id="org.gnome.taquin.GameType">
+  <enum id="org.gnome.Taquin.GameType">
     <value value="0" nick="fifteen"/>
     <value value="1" nick="sixteen"/>
   </enum>
 
-  <schema id="org.gnome.taquin" path="/org/gnome/taquin/" gettext-domain="gnome-taquin">
-    <key name="type" enum="org.gnome.taquin.GameType">
+  <schema id="org.gnome.Taquin" path="/org/gnome/taquin/" gettext-domain="gnome-taquin">
+    <key name="type" enum="org.gnome.Taquin.GameType">
       <default>'fifteen'</default>
       <!-- TODO add summary and description -->
     </key>
diff --git a/data/themes/meson.build b/data/themes/meson.build
new file mode 100644
index 0000000..0437edc
--- /dev/null
+++ b/data/themes/meson.build
@@ -0,0 +1,22 @@
+install_data(
+    [
+        'cats/1-Cat_face_day.jpg',
+        'cats/1-Jasmina.jpg',
+        'cats/1-maine.jpg',
+        'cats/1-march.jpg',
+        'cats/1-Tortoiseshell.jpg'
+    ],
+    install_dir: join_paths(pkgdatadir, 'themes', 'cats')
+)
+
+install_data(
+    [
+        'numbers/03-numbers.svg',
+        'numbers/04-numbers.svg',
+        'numbers/05-numbers.svg',
+        'numbers/3-numbers.png',
+        'numbers/4-numbers.png',
+        'numbers/5-numbers.png'
+    ],
+    install_dir: join_paths(pkgdatadir, 'themes', 'numbers')
+)
\ No newline at end of file
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 0000000..d6a2b49
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,10 @@
+cs
+de
+el
+es
+fr
+gl
+hu
+pl
+pt_BR
+sv
\ No newline at end of file
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..b2348d7
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,23 @@
+help_pages = [
+    '15-Puzzle.page',
+    '16-Puzzle.page',
+    'beginning.page',
+    'index.page',
+    'legal.xml',
+    'license.page',
+    'shortcuts.page',
+    'start-screen.page',
+]
+help_media = [
+    'figures/fifteen.png',
+    'figures/logo.png',
+    'figures/logo32.png',
+    'figures/sixteen.png',
+    'figures/start-screen.png',
+]
+
+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..7f1c09b
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,44 @@
+project('gnome-taquin', 'vala', 'c',
+    version: '3.31.4')
+
+project_id = 'org.gnome.Taquin'
+
+gnome = import('gnome')
+i18n = import('i18n')
+python3 = import('python3')
+
+glib_dependency = dependency('glib-2.0', version: '>= 2.40.0')
+gtk_dependency = dependency('gtk+-3.0', version: '>= 3.15.0')
+rsvg_dependency = dependency('librsvg-2.0', version: '>= 2.32.0')
+canberra_depenency = dependency('libcanberra')
+canberra_gtk3_depenency = dependency('libcanberra-gtk3', version: '>= 0.26')
+posix_dependency = 
+
+desktop_file_validate = find_program('desktop-file-valdiate', required: false)
+appstream_util = find_program('appstream-util', required: false)
+glib_compile_schema = find_program('glib-compile-schemas', required: true)
+
+add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), language: 'c')
+
+pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
+localedir = join_paths(get_option('prefix'), get_option('localedir'))
+soundsdir = join_paths(pkgdatadir, 'sounds')
+
+conf = configuration_data ()
+conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('SOUND_DIRECTORY', soundsdir)
+conf.set_quoted('LOCALEDIR', localedir)
+conf.set_quoted('DATA_DIRECTORY', pkgdatadir)
+
+configure_file(output: 'config.h', configuration: conf)
+config_h_dir = include_directories('.')
+
+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..e9b77d7
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(meson.project_name(), preset: 'glib')
diff --git a/src/game-window.vala b/src/game-window.vala
index c2d4dde..ba0590f 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -28,7 +28,7 @@ public enum GameWindowFlags {
     SHOW_START_BUTTON;
 }
 
-[GtkTemplate (ui = "/org/gnome/taquin/ui/game-window.ui")]
+[GtkTemplate (ui = "/org/gnome/Taquin/ui/game-window.ui")]
 public class GameWindow : ApplicationWindow
 {
     /* settings */
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..6983a8c
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,25 @@
+resources = gnome.compile_resources (meson.project_name(), 'taquin.gresources.xml')
+
+executable(meson.project_name(),[
+        'config.vapi',
+        'gnome-window.vala',
+        'taquin-game.vala',
+        'taquin-main.vala',
+        'taquin-view.vala'
+     ] + resources,
+    install: true,
+    c_args: [
+        '-include', 'config.h'
+    ],
+    vala_args: [
+        '--vapidir', join_paths(meson.current_source_dir(), 'vapi')
+    ],
+    dependencies: [
+        gee_dependency,
+        glib_dependency,
+        gnome_games_support_dependency,
+        gtk_dependency,
+        posix_dependency,
+        rsvg_dependency
+    ]
+)
diff --git a/src/taquin-main.vala b/src/taquin-main.vala
index 1155382..a68d2eb 100644
--- a/src/taquin-main.vala
+++ b/src/taquin-main.vala
@@ -90,14 +90,14 @@ public class Taquin : Gtk.Application
         Intl.textdomain (GETTEXT_PACKAGE);
 
         Environment.set_application_name (PROGRAM_NAME);
-        Window.set_default_icon_name ("gnome-taquin");
+        Window.set_default_icon_name ("org.gnome.Taquin");
 
         return new Taquin ().run (args);
     }
 
     private Taquin ()
     {
-        Object (application_id: "org.gnome.taquin", flags: ApplicationFlags.FLAGS_NONE);
+        Object (application_id: "org.gnome.Taquin", flags: ApplicationFlags.FLAGS_NONE);
 
         add_main_option_entries (option_entries);
     }
@@ -131,7 +131,7 @@ public class Taquin : Gtk.Application
     {
         base.startup ();
 
-        settings = new GLib.Settings ("org.gnome.taquin");
+        settings = new GLib.Settings ("org.gnome.Taquin");
         if (sound != null)
             settings.set_boolean ("sound", sound);
         if (tmp_size > 1)
@@ -142,10 +142,10 @@ public class Taquin : Gtk.Application
         /* UI parts */
         view = new TaquinView ();
 
-        Builder builder = new Builder.from_resource ("/org/gnome/taquin/ui/taquin-screens.ui");
+        Builder builder = new Builder.from_resource ("/org/gnome/Taquin/ui/taquin-screens.ui");
 
         /* Window */
-        window = new GameWindow ("/org/gnome/taquin/ui/taquin.css",
+        window = new GameWindow ("/org/gnome/Taquin/ui/taquin.css",
                                  PROGRAM_NAME,
                                  settings.get_int ("window-width"),
                                  settings.get_int ("window-height"),
@@ -265,7 +265,7 @@ public class Taquin : Gtk.Application
                            "documenters", documenters,
                             /* Translators: about dialog text; this string should be replaced by a text 
crediting yourselves and your translation team, or should be left empty. Do not translate literally! */
                            "translator-credits", _("translator-credits"),
-                           "logo-icon-name", "gnome-taquin",
+                           "logo-icon-name", "org.gnome.Taquin",
                            "website", "https://wiki.gnome.org/Apps/Taquin";,
                            null);
     }
diff --git a/src/taquin.gresource.xml b/src/taquin.gresource.xml
index 65c360d..704da09 100644
--- a/src/taquin.gresource.xml
+++ b/src/taquin.gresource.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/gnome/taquin/images">
+  <gresource prefix="/org/gnome/Taquin/images">
     <file preprocess="to-pixdata" alias="15-Puzzle.png">../data/schema-15.png</file>
     <file preprocess="to-pixdata" alias="16-Puzzle.png">../data/schema-16.png</file>
   </gresource>
-  <gresource prefix="/org/gnome/taquin/ui">
+  <gresource prefix="/org/gnome/Taquin/ui">
     <file preprocess="xml-stripblanks" alias="game-window.ui">../data/taquin.ui</file>
     <file preprocess="xml-stripblanks" alias="taquin-screens.ui">../data/taquin-screens.ui</file>
     <file alias="taquin.css">../data/taquin.css</file>


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