[atomix] Fixed #10: Initial meson port



commit b83cd7d5fa7112fc6f6300c615c453ffa1a5dc0a
Author: Robert Roth <robert roth off gmail com>
Date:   Mon Mar 19 06:04:17 2018 +0200

    Fixed #10: Initial meson port

 data/level/meson.build | 42 +++++++++++++++++++++++++++++++++
 data/meson.build       | 49 +++++++++++++++++++++++++++++++++++++++
 meson.build            | 39 +++++++++++++++++++++++++++++++
 meson_post_install.py  | 15 ++++++++++++
 po/meson.build         |  4 ++++
 src/meson.build        | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 212 insertions(+)
---
diff --git a/data/level/meson.build b/data/level/meson.build
new file mode 100644
index 0000000..bcd3a86
--- /dev/null
+++ b/data/level/meson.build
@@ -0,0 +1,42 @@
+levelsdir = join_paths(pkgdatadir, 'level')
+
+# Level files
+levels = [
+          'aceticacid.atomix.xml',
+          'acetone.atomix.xml',
+          'butanol.atomix.xml',
+          'cyclobutane.atomix.xml',
+          'dimethylether.atomix.xml',
+          'ethane.atomix.xml',
+          'ethanal.atomix.xml',
+          'ethanol.atomix.xml',
+          'ethylene.atomix.xml',
+          'glycerin.atomix.xml',
+          'lactic-acid.atomix.xml',
+          'methanal.atomix.xml',
+          'methane.atomix.xml',
+          'methanol.atomix.xml',
+          'propanal.atomix.xml',
+          'propylene.atomix.xml',
+          'pyran.atomix.xml',
+          'transbutylen.atomix.xml',
+          'water.atomix.xml',
+         ]
+
+# Translate level files
+foreach level : levels
+  i18n.merge_file(
+    input: level + '.in',
+    output: level,
+    type: 'xml',
+    po_dir: podir,
+    install: true,
+    install_dir: levelsdir,
+    data_dirs: itsdir,
+  )
+endforeach
+
+# Level sequence file
+install_data('sequence',
+  install_dir: levelsdir,
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..d110f56
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,49 @@
+# Icons
+install_subdir('icons',
+  install_dir: datadir,
+  exclude_files: [ 'Makefile', 'Makefile.in', 'Makefile.am', 
+                   'hicolor/Makefile', 'hicolor/Makefile.in', 'hicolor/Makefile.am', '.gitignore' ],
+)
+
+# UI files
+install_data('atomix-logo.png',
+  install_dir: pkgdatadir,
+)
+
+install_subdir('ui',
+  install_dir: pkgdatadir,
+  exclude_files: [ 'Makefile', 'Makefile.in', 'Makefile.am', '.gitignore' ],
+)
+
+# Themes
+install_subdir('themes',
+  install_dir: pkgdatadir,
+  exclude_files: [ 'Makefile', 'Makefile.in', 'Makefile.am', 
+                   'default/Makefile', 'default/Makefile.in', 'default/Makefile.am'],
+)
+
+# Desktop file
+desktop = 'atomix.desktop'
+
+# Desktop file
+i18n.merge_file(
+  input: desktop + '.in',
+  output: desktop,
+  type: 'desktop',
+  po_dir: podir,
+  install: true,
+  install_dir: join_paths(datadir, 'applications'),
+)
+
+# Appdata
+appdata = 'atomix.appdata.xml'
+
+i18n.merge_file(
+  input: appdata + '.in',
+  output: appdata,
+  po_dir: podir,
+  install: true,
+  install_dir: join_paths(datadir, 'metainfo')
+)
+
+subdir('level')
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..7537330
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,39 @@
+project('atomix', ['c'],
+  version: '3.29.1',
+  meson_version: '>= 0.41',
+  license: 'GPLv2+',
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+localedir = join_paths(get_option('prefix'), get_option('localedir'))
+datadir = join_paths (get_option ('prefix'), get_option ('datadir'))
+pkgdatadir = join_paths (datadir, 'atomix')
+
+podir = join_paths(meson.source_root(), 'po')
+itsdir = join_paths(meson.source_root(), 'data')
+# Dependencies
+
+gtk_dep = dependency('gtk+-3.0', version: '>= 3.10')
+gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.0.5')
+glib_dep = dependency('glib-2.0', version: '>= 2.36.0')
+
+cc = meson.get_compiler('c')
+
+conf = configuration_data()
+
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('PACKAGE_URL', 'https://wiki.gnome.org/Apps/Atomix')
+conf.set_quoted('VERSION', meson.project_version())
+
+config_h_inc = include_directories('.')
+
+# Subdirs
+subdir('data')
+subdir('src')
+subdir('po')
+
+config_file = configure_file(output: 'config.h', configuration: conf)
+# Extra scripts
+meson.add_install_script('meson_post_install.py', datadir)
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..ff705a2
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+
+if not os.environ.get('DESTDIR'):
+  icon_dir = os.path.join(sys.argv[1], 'icons', 'hicolor')
+#  schema_dir = os.path.join(sys.argv[1], 'glib-2.0', 'schemas')
+  print('Update icon cache...')
+  subprocess.call(['gtk-update-icon-cache', '-f', '-t', icon_dir])
+
+#  print('Compiling gsettings schemas...')
+#  subprocess.call(['glib-compile-schemas', schema_dir])
+
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..b72f8e3
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,4 @@
+i18n.gettext(meson.project_name(),
+  preset: 'glib',
+  data_dirs: itsdir,
+)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..c936fae
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,63 @@
+app_sources = [
+    'atomix-application.h',
+    'main.c', 'main.h',
+    'board-gtk.c', 'board-gtk.h',
+    'undo.c', 'undo.h',
+    'goal.c', 'goal.h',
+    'goal-view.c', 'goal-view.h',
+    'clock.c', 'clock.h',
+]
+
+app_c_flags = [
+  '-DPKGDATADIR="@0@"'.format(pkgdatadir),
+  '-DDATADIR="@0@"'.format(datadir),
+  '-DGNOMELOCALEDIR="@0@"'.format(localedir),
+  '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name())
+]
+
+library_sources = [
+    'tile.c','tile.h',
+    'xml-util.c','xml-util.h',
+    'theme.c','theme.h','theme-private.h',
+    'theme-manager.c','theme-manager.h',
+    'level.c','level.h','level-private.h',
+    'level-manager.c','level-manager.h',
+    'canvas_helper.c','canvas_helper.h',
+    'playfield.c','playfield.h',
+]
+
+app_dependencies = [
+    gtk_dep,
+    glib_dep,
+    gdk_pixbuf_dep,
+]
+
+atomix_lib = static_library('atomix', library_sources,
+    install: false,
+    dependencies: app_dependencies,
+    c_args: app_c_flags,
+)
+
+executable('atomix', app_sources,
+    dependencies: app_dependencies,
+    link_with:atomix_lib,
+    include_directories: config_h_inc,
+    c_args: app_c_flags,
+    install: true,
+)
+
+playfield_test_sources = [
+    'playfield.h', 'playfield.c',
+    'tile.c', 'tile.h',
+    'theme.c', 'theme.h',
+    'xml-util.c', 'xml-util.h',
+    'pf-test.c'
+]
+
+executable('pf-test', playfield_test_sources,
+    dependencies: app_dependencies,
+    link_with:atomix_lib,
+    include_directories: config_h_inc,
+    c_args: app_c_flags,
+    install: false,
+)


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