[gnome-2048/meson: 1/2] build: Add meson support



commit 90566616984272cedc2c1a88b5395a469947a8c8
Author: Jan Tojnar <jtojnar gmail com>
Date:   Sun Sep 30 03:47:00 2018 +0200

    build: Add meson support

 data/meson.build                         | 58 ++++++++++++++++++++++++++++++++
 data/org.gnome.gnome-2048.appdata.xml.in | 24 ++++++-------
 data/org.gnome.gnome-2048.desktop.in     |  6 ++--
 help/LINGUAS                             |  9 +++++
 help/meson.build                         | 10 ++++++
 meson.build                              | 30 +++++++++++++++++
 po/meson.build                           |  6 ++++
 src/meson.build                          | 36 ++++++++++++++++++++
 8 files changed, 164 insertions(+), 15 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..cd8dbe2
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,58 @@
+icon_sizes = [
+  '16x16',
+  '22x22',
+  '24x24',
+  '32x32',
+  '48x48',
+  '256x256',
+  '512x512',
+]
+foreach size : icon_sizes
+  install_data(
+    join_paths('icons', 'hicolor', size, 'gnome-2048.png'),
+    install_dir: join_paths(datadir, 'icons', 'hicolor', size, 'apps'),
+  )
+endforeach
+install_data(
+  join_paths('icons', 'hicolor', 'symbolic', 'gnome-2048-symbolic.svg'),
+  install_dir: join_paths(datadir, 'icons', 'hicolor', 'symbolic', 'apps'),
+)
+
+install_data(
+  'org.gnome.2048.gschema.xml',
+  install_dir: schemadir,
+)
+meson.add_install_script('glib-compile-schemas', schemadir)
+
+desktop_file = i18n.merge_file(
+  'desktop-file',
+  input: 'org.gnome.gnome-2048.desktop.in',
+  output: 'org.gnome.gnome-2048.desktop',
+  install: true,
+  install_dir: join_paths(datadir, 'applications'),
+  po_dir: '../po',
+  type: 'desktop',
+)
+if desktop_file_validate.found()
+  test(
+    'Validating @0@'.format(desktop_file),
+    desktop_file_validate,
+    args: [desktop_file],
+  )
+endif
+
+appdata_file = i18n.merge_file(
+  'appdata-file',
+  input: 'org.gnome.gnome-2048.appdata.xml.in',
+  output: 'org.gnome.gnome-2048.appdata.xml',
+  install: true,
+  install_dir: join_paths(datadir, 'metainfo'),
+  po_dir: '../po',
+)
+if appstream_util.found()
+  test(
+    'Validating @0@'.format(appdata_file),
+    appstream_util,
+    args: ['validate', '--nonet', appdata_file],
+  )
+endif
diff --git a/data/org.gnome.gnome-2048.appdata.xml.in b/data/org.gnome.gnome-2048.appdata.xml.in
index 171f20a..a9953bf 100644
--- a/data/org.gnome.gnome-2048.appdata.xml.in
+++ b/data/org.gnome.gnome-2048.appdata.xml.in
@@ -5,35 +5,35 @@
   <id>org.gnome.gnome-2048.desktop</id>
   <metadata_license>CC-BY-SA-3.0</metadata_license>
   <project_license>GPL-3.0+</project_license>
-  <_name>GNOME 2048</_name>
-  <_summary>Obtain the 2048 tile</_summary>
+  <name>GNOME 2048</name>
+  <summary>Obtain the 2048 tile</summary>
   <description>
-    <_p>
+    <p>
      Play the highly addictive 2048 game. GNOME 2048 is a clone of the popular
      single-player puzzle game. Gameplay consists of joining numbers in a grid
      and obtain the 2048 tile.
-    </_p>
-    <_p>
+    </p>
+    <p>
      Use your keyboard's arrow keys to slide all tiles in the desired direction.
      Be careful: all tiles slide to their farthest possible positions, you cannot
      slide just one tile or one row or column. Tiles with the same value are
      joined when slided one over the other.
-    </_p>
-    <_p>
+    </p>
+    <p>
      With every new tile obtained you increase your score. If you think you can easily
      get the 2048 tile, do not let it stop you, the game does not end there, you can
      continue joining tiles and improving your score.
-    </_p>
-    <_p>
+    </p>
+    <p>
      Originally created by Gabriele Cirulli, 2048 has gained much popularity
      due to it being highly addictive. Cirulli's 2048 is in turn a clone of
      the 1024 game and includes ideas from other clones.
-    </_p>
+    </p>
   </description>
   <screenshots>
     <screenshot type="default" height="702" width="1248">
       <image>https://gitlab.gnome.org/GNOME/gnome-2048/raw/master/data/screenshot.png</image>
-      <_caption>A running game having reached the 2048 tile</_caption>
+      <caption>A running game having reached the 2048 tile</caption>
     </screenshot>
   </screenshots>
   <url type="homepage">https://wiki.gnome.org/Apps/2048</url>
@@ -42,7 +42,7 @@
   <update_contact>arnaud.bonatti_at_gmail.com</update_contact>
   <project_group>GNOME</project_group>
   <!-- this is a translatable version of project_group-->
-  <_developer_name>The GNOME Project</_developer_name>
+  <developer_name>The GNOME Project</developer_name>
 
   <kudos>
     <kudo>AppMenu</kudo>
diff --git a/data/org.gnome.gnome-2048.desktop.in b/data/org.gnome.gnome-2048.desktop.in
index 70860eb..eef6e02 100644
--- a/data/org.gnome.gnome-2048.desktop.in
+++ b/data/org.gnome.gnome-2048.desktop.in
@@ -1,6 +1,6 @@
 [Desktop Entry]
-_Name=2048
-_Comment=Obtain the 2048 tile
+Name=2048
+Comment=Obtain the 2048 tile
 TryExec=gnome-2048
 Exec=gnome-2048
 Icon=gnome-2048
@@ -8,4 +8,4 @@ Terminal=false
 Type=Application
 StartupNotify=true
 Categories=GNOME;GTK;Game;
-_Keywords=puzzle;
+Keywords=puzzle;
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 0000000..e614b51
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,9 @@
+# Please keep this list sorted alphabetically
+cs
+de
+el
+es
+hu
+pl
+pt_BR
+sv
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..d4dc51e
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,10 @@
+gnome.yelp(
+  'gnome-2048',
+  media: [
+    'media/gnome-2048.png',
+    'media/gnome-204822.png',
+  ],
+  sources: [
+    'index.page',
+  ],
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..86f888b
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,30 @@
+project(
+  'gnome-2048', ['vala', 'c'],
+  version: '3.30.0',
+  license: 'GPLv3+',
+  meson_version: '>= 0.37.1',
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+# Paths
+localedir = join_paths(get_option('prefix'), get_option('localedir'))
+datadir = join_paths(get_option('prefix'), get_option('datadir'))
+pkgdatadir = join_paths(datadir, 'gnome-2048')
+schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
+
+# Dependencies
+gtk_dep = dependency('gtk+-3.0', version: '>= 3.12.0')
+clutter_dep = dependency('clutter-1.0', version: '>= 1.12.0')
+clutter_gtk_dep = dependency('clutter-gtk-1.0', version: '>= 1.6.0')
+gee_dep = dependency('gee-0.8', version: '>= 0.14.0')
+libgnome_games_support_dep = dependency('libgnome-games-support-1')
+
+appstream_util = find_program('appstream-util', required: false)
+desktop_file_validate = find_program('desktop-file-validate', required: false)
+
+subdir('po')
+subdir('data')
+subdir('help')
+subdir('src')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..067d264
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,6 @@
+i18n.gettext(
+  'gnome-2048',
+  preset: 'glib',
+)
+
+podir = meson.current_source_dir()
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..20e6f9e
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,36 @@
+resources = gnome.compile_resources(
+  'resources',
+  'gnome-2048.gresource.xml',
+  source_dir: '..',
+  c_name: 'resources',
+)
+
+gnome_2048_sources = [
+  'application.vala',
+  'config.vapi',
+  'game.vala',
+  'grid.vala',
+  'view.vala',
+] + resources
+
+gnome_2048 = executable(
+  'gnome-2048',
+  gnome_2048_sources,
+  dependencies: [
+    gtk_dep,
+    clutter_dep,
+    clutter_gtk_dep,
+    gee_dep,
+    libgnome_games_support_dep,
+  ],
+  vala_args: [
+    '--pkg=posix',
+  ],
+  c_args: [
+    '-DVERSION="@0@"'.format(meson.project_version()),
+    '-DGETTEXT_PACKAGE="gnome-2048"',
+    '-DDATA_DIRECTORY="@0@"'.format(pkgdatadir),
+    '-DLOCALEDIR="@0@"'.format(localedir),
+  ],
+  install: true,
+)


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