[quadrapassel] ditch autotools and migrate to meson



commit 95f6b76cd61e396ba593ba996e035ea382e20d03
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Thu Dec 13 13:34:57 2018 +0100

    ditch autotools and migrate to meson

 Makefile.am                           | 11 -----
 autogen.sh                            | 46 -------------------
 build-aux/meson_post_install.py       | 14 ++++++
 configure.ac                          | 66 ---------------------------
 data/Makefile.am                      | 47 -------------------
 data/icons/Makefile.am                |  3 --
 data/icons/hicolor/Makefile.am        | 19 --------
 data/meson.build                      | 85 +++++++++++++++++++++++++++++++++++
 help/LINGUAS                          | 22 +++++++++
 help/Makefile.am                      | 35 ---------------
 help/meson.build                      | 36 +++++++++++++++
 meson.build                           | 57 +++++++++++++++++++++++
 po/Makevars                           | 78 --------------------------------
 po/meson.build                        |  1 +
 src/meson.build                       | 33 ++++++++++++++
 src/{ => vapi}/config.vapi            |  0
 src/{ => vapi}/input-event-codes.vapi |  0
 src/vapi/libcanberra-gtk3.vapi        | 33 ++++++++++++++
 18 files changed, 281 insertions(+), 305 deletions(-)
---
diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py
new file mode 100644
index 0000000..b131791
--- /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')])
\ No newline at end of file
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..6712789
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,85 @@
+# Install icons
+icon_sizes = ['16', '22', '24', '32', '48']
+foreach size : icon_sizes
+    install_data(
+        join_paths('icons', 'hicolor', '@0@x@0@'.format(size), '@0@.png'.format(project_id)),
+        install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', '@0@x@0@'.format(size), 'apps')
+    )
+endforeach
+# Install scalable icon
+install_data(
+        join_paths('icons', 'hicolor', 'scalable', '@0@.svg'.format(project_id)),
+    install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', 'scalable', 'apps')
+)
+# Install symbolic icon
+install_data(
+        join_paths('icons', 'hicolor', 'symbolic', '@0 -symbolic svg'.format(project_id)),
+    install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', 'symbolic', 'apps')
+)
+
+# Install gschema
+install_data(
+  '@0  gschema xml'.format('org.gnome.quadrapassel'),
+  install_dir : join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
+)
+
+
+# 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
+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(project_id),
+    output: '@0  appdata xml'.format(project_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', appdata_file.full_path()
+    ]
+  )
+endif
+
+# Install man page
+install_man('@0@.6'.format(meson.project_name()))
+
+# Install sounds
+install_data(
+    [
+        'gameover.ogg',
+        'land.ogg',
+        'lines1.ogg',
+        'lines2.ogg',
+        'lines3.ogg',
+        'quadrapassel.ogg',
+        'slide.ogg',
+        'turn.ogg'
+    ],
+    install_dir: join_paths(get_option('datadir'), meson.project_name(), 'sounds')
+)
\ No newline at end of file
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 0000000..94e58eb
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,22 @@
+ca
+cs
+de
+el
+en_GB
+es
+eu
+fi
+fr
+gl
+hu
+it
+ja
+oc
+pl
+pt_BR
+ro
+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..b4fa049
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,36 @@
+
+help_media = [
+    'media/fig2.png',
+    'media/fig3.png',
+    'media/fig4.png',
+    'media/fig5.png',
+    'media/go-home.png',
+    'media/go-previous.png',
+    'media/part1.jpg',
+    'media/part2.jpg',
+    'media/part3.jpg',
+    'media/part4.jpg',
+    'media/previous.png',
+    'media/quadrapassel.png',
+    'media/quadrapassel22.png'
+]
+help_files = [
+    'bug-filing.page',
+    'develop.page',
+    'documentation.page',
+    'get-involved.page',
+    'index.page',
+    'legal.xml',
+    'license.page',
+    'playgame.page',
+    'preferences.page',
+    'score.page',
+    'translate.page'
+]
+
+
+gnome.yelp(meson.project_name(),
+    sources: help_files,
+    media: help_media,
+    symlink_media: true
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..0c6ae27
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,57 @@
+project('quadrapassel', 'vala', 'c',
+        version: '3.31.3')
+
+project_id = 'quadrapassel'
+i18n = import('i18n')
+# used to install help
+gnome = import('gnome')
+# used to run post install script
+python3 = import('python3')
+
+
+canberra_dependency = dependency('libcanberra')
+canberra_gtk3_dependency = dependency('libcanberra-gtk3', version: '>= 0.26')
+cogl_depepdendy = dependency('cogl-1.0')
+clutter_dependency = dependency('clutter-1.0', version: '>= 1.0.0')
+clutter_gtk_dependency = dependency('clutter-gtk-1.0', version: '>= 0.91.6')
+gtk_dependency = dependency('gtk+-3.0', version: '>= 3.12.0')
+manette_dependency = dependency('manette-0.2', version: '>= 0.2.0')
+pango_depepdency = dependency('pango')
+pango_cairo_dependency = dependency('pangocairo')
+posix_dependency = meson.get_compiler('vala').find_library('posix')
+rsvg_dependency = dependency('librsvg-2.0', version: '>= 2.32.0')
+
+
+        
+
+# Set gettext package name
+add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), language: 'c')
+
+localedir = join_paths(get_option('prefix'), get_option('localedir'))
+datadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
+soundsdir = join_paths(datadir, 'sounds')
+
+conf = configuration_data ()
+conf.set_quoted ('VERSION', meson.project_version())
+conf.set_quoted ('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted ('DATA_DIRECTORY', datadir)
+conf.set_quoted ('SOUND_DIRECTORY', soundsdir)
+conf.set_quoted ('LOCALEDIR', localedir)
+
+
+configure_file(output: 'config.h', configuration: conf)
+config_h_dir = include_directories('.')
+
+
+
+
+subdir('data')
+subdir('po')
+subdir('help')
+subdir('src')
+
+
+
+meson.add_install_script(python3.find_python().path(), join_paths(meson.source_root(), 
+                                                                  'build-aux', 
+                                                                  'meson_post_install.py'))
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/meson.build b/src/meson.build
new file mode 100644
index 0000000..fc83070
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,33 @@
+executable(meson.project_name(),
+    [
+        'vapi/config.vapi',        
+        'vapi/input-event-codes.vapi',
+        'game-view.vala',
+        'game.vala',
+        'history.vala',
+        'preview.vala',
+        'quadrapassel.vala',
+        'score-dialog.vala'
+    ],
+    install: true,
+    c_args: [
+        '-include', 'config.h'
+    ],
+    vala_args: [
+        '--target-glib', '2.44',
+        '--vapidir', join_paths(meson.current_source_dir(), 'vapi')
+    ],
+    dependencies: [
+        canberra_dependency,
+        canberra_gtk3_dependency,
+        cogl_depepdendy,
+        clutter_dependency,
+        clutter_gtk_dependency,
+        gtk_dependency,
+        manette_dependency,
+        pango_depepdency,
+        pango_cairo_dependency,
+        posix_dependency,
+        rsvg_dependency
+    ]
+)
\ No newline at end of file
diff --git a/src/config.vapi b/src/vapi/config.vapi
similarity index 100%
rename from src/config.vapi
rename to src/vapi/config.vapi
diff --git a/src/input-event-codes.vapi b/src/vapi/input-event-codes.vapi
similarity index 100%
rename from src/input-event-codes.vapi
rename to src/vapi/input-event-codes.vapi
diff --git a/src/vapi/libcanberra-gtk3.vapi b/src/vapi/libcanberra-gtk3.vapi
new file mode 100644
index 0000000..b16b11e
--- /dev/null
+++ b/src/vapi/libcanberra-gtk3.vapi
@@ -0,0 +1,33 @@
+/***
+  This file is part of libcanberra.
+  Copyright 2009 Lennart Poettering
+  libcanberra is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation, either version 2.1 of the
+  License, or (at your option) any later version.
+  libcanberra is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+  You should have received a copy of the GNU Lesser General Public
+  License along with libcanberra. If not, see
+  <http://www.gnu.org/licenses/>.
+***/
+
+using Canberra;
+using Gdk;
+using Gtk;
+
+[CCode (cprefix = "CA_GTK_", lower_case_cprefix = "ca_gtk_", cheader_filename = "canberra-gtk.h")]
+namespace CanberraGtk {
+
+        public unowned Context? context_get();
+        public unowned Context? context_get_for_screen(Gdk.Screen? screen);
+
+        public int proplist_set_for_widget(Proplist p, Gtk.Widget w);
+        public int play_for_widget(Gtk.Widget w, uint32 id, ...);
+        public int proplist_set_for_event(Proplist p, Gdk.Event e);
+        public int play_for_event(Gdk.Event e, uint32 id, ...);
+
+        public void widget_disable_sounds(Gtk.Widget w, bool enable = false);
+}
\ No newline at end of file


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