[gnome-chess] Ported build system to Meson.



commit ce6465a9e29c0697d61decf2d247a58226360d72
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Tue Sep 5 23:38:28 2017 +0200

    Ported build system to Meson.
    
    See the following links for more info:
    * https://mesonbuild.com
    * https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
    
    Signed-off-by: Niels De Graef <nielsdegraef gmail com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787346

 Makefile.am                              |   11 -
 autogen.sh                               |   46 ----
 configure.ac                             |   92 ---------
 data/Makefile.am                         |   45 ----
 data/icons/Makefile.am                   |    3 -
 data/icons/hicolor/22x22/gnome-chess.png |  Bin 1255 -> 0 bytes
 data/icons/hicolor/Makefile.am           |   21 --
 data/icons/meson.build                   |    7 +
 data/meson.build                         |   34 +++
 data/pieces/Makefile.am                  |    3 -
 data/pieces/simple/Makefile.am           |   18 --
 git.mk                                   |  329 ------------------------------
 help/Makefile.am                         |   14 --
 help/meson.build                         |   39 ++++
 lib/Makefile.am                          |   44 ----
 lib/meson.build                          |   38 ++++
 meson.build                              |   62 ++++++
 meson_post_install.py                    |   15 ++
 org.gnome.chess.json                     |    1 +
 po/meson.build                           |    3 +
 src/Makefile.am                          |   58 ------
 src/meson.build                          |   46 ++++
 tests/Makefile.am                        |   45 ----
 tests/meson.build                        |   31 +++
 24 files changed, 276 insertions(+), 729 deletions(-)
---
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..8838915
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,7 @@
+# The app icon, in different sizes
+iconsdir = join_paths(datadir, 'icons', 'hicolor')
+foreach size: ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256', '512x512', 'scalable']
+  install_subdir('hicolor/' + size,
+    install_dir: iconsdir
+  )
+endforeach
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..ea0db12
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,34 @@
+subdir('icons')
+
+# The SVG's of the chess pieces
+install_subdir('pieces',
+  install_dir: join_paths(datadir, meson.project_name(), 'pieces')
+)
+
+# The engines.conf file
+install_data('engines.conf',
+  install_dir: pkgsysconfdir,
+)
+
+# The desktop file
+i18n.merge_file(
+  input: 'gnome-chess.desktop.in',
+  output: 'gnome-chess.desktop',
+  type: 'desktop',
+  po_dir: po_dir,
+  install: true,
+  install_dir: join_paths(datadir, 'applications')
+)
+
+# The appdata file
+i18n.merge_file(
+  input: 'gnome-chess.appdata.xml.in',
+  output: 'gnome-chess.appdata.xml',
+  type: 'xml',
+  po_dir: po_dir,
+  install: true,
+  install_dir: join_paths(datadir, 'metainfo')
+)
+
+# The man page
+install_man('gnome-chess.6')
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..a4f9ad5
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,39 @@
+help_sources = [
+  'index.docbook',
+  'legal.xml',
+]
+
+help_media = [
+  'figures/game-3-12.png',
+  'figures/preferences-game-3-12.png',
+  'figures/preferences-appearance-3-12.png',
+]
+
+help_languages = [
+  'ca',
+  'cs',
+  'da',
+  'de',
+  'el',
+  'en_GB',
+  'es',
+  'eu',
+  'fr',
+  'gl',
+  'ja',
+  'ko',
+  'oc',
+  'pt_BR',
+  'ru',
+  'sl',
+  'sr',
+  'sr@latin',
+  'sv',
+  'zh_CN',
+]
+
+gnome.yelp(meson.project_name(),
+  sources: help_sources,
+  media: help_media,
+  languages: help_languages,
+)
diff --git a/lib/meson.build b/lib/meson.build
new file mode 100644
index 0000000..577ec2e
--- /dev/null
+++ b/lib/meson.build
@@ -0,0 +1,38 @@
+# The gnome-chess internal library
+libchess_sources = [
+  'chess-bitboard.vala',
+  'chess-clock.vala',
+  'chess-game.vala',
+  'chess-move.vala',
+  'chess-pgn.vala',
+  'chess-piece.vala',
+  'chess-player.vala',
+  'chess-state.vala',
+]
+
+libchess_vala_args = [
+  '--target-glib=@0@'.format(min_glib_version),
+]
+
+libchess_c_args = [
+  '-include', 'config.h',
+]
+
+libchess_deps = [
+  glib,
+  gio,
+  posix,
+]
+
+libchess = library('gnome-libchess', libchess_sources,
+  include_directories: config_h_dir,
+  vala_args: libchess_vala_args,
+  c_args: libchess_c_args,
+  dependencies: libchess_deps,
+  install: true,
+)
+
+libchess_dep = declare_dependency(
+  link_with: libchess,
+  include_directories: include_directories('.'),
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..1623bf4
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,62 @@
+project('gnome-chess', [ 'vala', 'c' ],
+  version: '3.25.4',
+  license: 'GPL3+',
+  meson_version: '>= 0.37',
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+# Add our config VAPI
+add_project_arguments(
+  [
+    '--vapidir', join_paths(meson.source_root(), 'src'),
+    '--pkg', 'config',
+  ],
+  language: 'vala'
+)
+
+# Some variables
+config_h_dir = include_directories('.')
+localedir = join_paths(get_option('prefix'), get_option('localedir'))
+datadir = join_paths(get_option('prefix'), get_option('datadir'))
+pkgdatadir = join_paths(datadir, meson.project_name())
+sysconfdir = join_paths(get_option('prefix'), get_option('sysconfdir'))
+pkgsysconfdir = join_paths(sysconfdir, meson.project_name())
+po_dir = join_paths(meson.source_root(), 'po')
+
+# Dependencies
+min_glib_version = '2.44.0'
+
+gio = dependency('gio-unix-2.0', version: '>=' + min_glib_version)
+glib = dependency('glib-2.0', version: '>=' + min_glib_version)
+gmodule = dependency('gmodule-2.0', version: '>=' + min_glib_version)
+gtk = dependency('gtk+-3.0', version: '>= 3.19.0')
+librsvg = dependency('librsvg-2.0', version: '>= 2.32.0')
+
+posix = meson.get_compiler('vala').find_library('posix')
+has_prctl = meson.get_compiler('c').has_header('sys/prctl.h')
+
+# Configuration
+conf = configuration_data()
+conf.set10('HAVE_PRCTL', has_prctl)
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('LOCALEDIR', localedir)
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_STRING', meson.project_name())
+conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('PKGDATADIR', pkgdatadir)
+conf.set_quoted('SYSCONFDIR', sysconfdir)
+conf.set_quoted('VERSION', meson.project_version())
+configure_file(output: 'config.h', configuration: conf)
+
+# Post-install scripts
+meson.add_install_script('meson_post_install.py')
+
+# Subfolders
+subdir('data')
+subdir('po')
+subdir('lib')
+subdir('src')
+subdir('tests')
+subdir('help')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..bf320a9
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+install_prefix = os.environ['MESON_INSTALL_PREFIX']
+icondir = os.path.join(install_prefix, 'share', 'icons', 'hicolor')
+schemadir = os.path.join(install_prefix, 'share', 'glib-2.0', 'schemas')
+
+if not os.environ.get('DESTDIR'):
+  print('Update icon cache...')
+  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
+
+  print('Compiling gsettings schemas...')
+  subprocess.call(['glib-compile-schemas', schemadir])
diff --git a/org.gnome.chess.json b/org.gnome.chess.json
index b37776e..28cefc5 100644
--- a/org.gnome.chess.json
+++ b/org.gnome.chess.json
@@ -35,6 +35,7 @@
         },
         {
             "name": "gnome-chess",
+            "buildsystem": "meson",
             "sources": [
                 {
                     "type": "git",
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..f904cde
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+i18n.gettext(meson.project_name(),
+  preset: 'glib'
+)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..db2ab9d
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,46 @@
+# The resource file
+resource_files = files('chess.gresource.xml')
+resources = gnome.compile_resources('org.gnome.chess', resource_files,
+  c_name: 'resources'
+)
+
+# The gnome-chess binary
+chess_sources = [
+  resources,
+
+  'portability.c',
+  'portability.vapi',
+
+  'ai-profile.vala',
+  'chess-engine-cecp.vala',
+  'chess-engine-uci.vala',
+  'chess-engine.vala',
+  'chess-scene.vala',
+  'chess-view.vala',
+  'gnome-chess.vala',
+]
+
+chess_vala_args = [
+  '--target-glib=@0@'.format(min_glib_version),
+]
+
+chess_c_args = [
+  '-include', 'config.h',
+]
+
+chess_deps = [
+  glib,
+  gmodule,
+  gtk,
+  librsvg,
+  posix,
+  libchess_dep,
+]
+
+executable('gnome-chess', chess_sources,
+  include_directories: config_h_dir,
+  vala_args: chess_vala_args,
+  c_args: chess_c_args,
+  dependencies: chess_deps,
+  install: true,
+)
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..1ca77e9
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,31 @@
+tests = [
+  'test-chess-game',
+  'test-chess-pgn',
+]
+
+tests_vala_args = [
+  '--target-glib=@0@'.format(min_glib_version),
+]
+
+tests_c_args = [
+  '-include', 'config.h',
+]
+
+tests_deps = [
+  glib,
+  gio,
+  libchess_dep,
+]
+
+foreach _test: tests
+  test_bin = executable(_test,
+    '@0@.vala'.format(_test),
+    include_directories: config_h_dir,
+    vala_args: tests_vala_args,
+    c_args: tests_c_args,
+    dependencies: tests_deps,
+    install: true,
+  )
+
+  test(_test, test_bin)
+endforeach


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