[gnome-sound-recorder/port-to-meson: 1/2] Port to meson



commit 98dabf8cf5cba00b65d5e4d6d4bb75fd87e50388
Author: Felipe Borges <felipeborges gnome org>
Date:   Fri Nov 2 18:12:12 2018 +0100

    Port to meson
    
    Fixes #37

 build-aux/meson_post_install.py | 26 +++++++++++++++++++++++
 data/appdata/meson.build        | 14 ++++++++++++
 data/meson.build                | 47 +++++++++++++++++++++++++++++++++++++++++
 meson.build                     | 40 +++++++++++++++++++++++++++++++++++
 po/meson.build                  |  1 +
 src/meson.build                 | 39 ++++++++++++++++++++++++++++++++++
 src/org.gnome.SoundRecorder.in  |  0
 7 files changed, 167 insertions(+)
---
diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py
new file mode 100755
index 0000000..3af818c
--- /dev/null
+++ b/build-aux/meson_post_install.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python3
+
+import os
+import subprocess
+import sys
+
+destdir = os.environ.get('DESTDIR', '')
+datadir = sys.argv[1]
+bindir = os.path.normpath(destdir + os.sep + sys.argv[2])
+
+if not os.path.exists(bindir):
+  os.makedirs(bindir)
+
+src = os.path.join(datadir, 'gnome-sound-recorder', 'org.gnome.SoundRecorder')
+dest = os.path.join(bindir, 'gnome-sound-recorder')
+subprocess.call(['ln', '-s', '-f', src, dest])
+
+if not os.environ.get('DESTDIR'):
+    print('Compiling gsettings schemas...')
+    subprocess.call(['glib-compile-schemas', os.path.join(datadir, 'glib-2.0', 'schemas')])
+
+    print('Updating icon cache...')
+    subprocess.call(['gtk-update-icon-cache', '-qtf', os.path.join(datadir, 'icons', 'hicolor')])
+
+    print('Updating desktop database...')
+    subprocess.call(['update-desktop-database', '-q', os.path.join(datadir, 'icons', 'applications')])
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
new file mode 100644
index 0000000..e3a9a4b
--- /dev/null
+++ b/data/appdata/meson.build
@@ -0,0 +1,14 @@
+appdata_conf = configuration_data()
+appdata_conf.set('appid', application_id)
+i18n.merge_file(
+  'appdata-file',
+  input: configure_file(
+    input: files('org.gnome.SoundRecorder.appdata.xml.in'),
+    output: 'org.gnome.SoundRecorder.appdata.xml.in',
+    configuration: appdata_conf
+  ),
+  output: 'org.gnome.SoundRecorder.appdata.xml',
+  po_dir: po_dir,
+  install: true,
+  install_dir: join_paths(sound_recorder_datadir, 'metainfo')
+)
\ No newline at end of file
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..1a98331
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,47 @@
+foreach icon_size: ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
+  icon_dir = join_paths('icons', 'hicolor', icon_size, 'apps')
+
+  install_data(
+    join_paths(icon_dir, 'org.gnome.SoundRecorder.png'),
+    install_dir: join_paths(sound_recorder_datadir, icon_dir)
+  )
+endforeach
+
+icon_dir = join_paths('icons', 'hicolor', 'symbolic', 'apps')
+install_data(
+  join_paths(icon_dir, 'org.gnome.SoundRecorder-symbolic.svg'),
+  install_dir: join_paths(sound_recorder_datadir, icon_dir)
+)
+
+desktop_conf = configuration_data ()
+desktop_conf.set ('icon', application_id)
+i18n.merge_file(
+  'desktop',
+  input: configure_file(
+    input: files('org.gnome.SoundRecorder.desktop.in.in'),
+    output: 'org.gnome.SoundRecorder.desktop.in',
+    configuration: desktop_conf
+  ),
+  output: 'org.gnome.SoundRecorder.desktop',
+  install: true,
+  install_dir: join_paths(sound_recorder_datadir, 'applications'),
+  po_dir: po_dir,
+  type: 'desktop'
+)
+
+gsettings_conf = configuration_data()
+gsettings_conf.set('GETTEXT_PACKAGE', meson.project_name ())
+configure_file(
+  input: 'org.gnome.gnome-sound-recorder.gschema.xml',
+  output: 'org.gnome.gnound-sound-recorder.gschema.xml',
+  configuration: gsettings_conf,
+  install: true,
+  install_dir: sound_recorder_schemadir
+)
+
+install_data(
+  'application.css',
+  install_dir: sound_recoder_pkgdatadir
+)
+
+subdir('appdata')
\ No newline at end of file
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..7c1cd7b
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,40 @@
+project(
+  'gnome-sound-recorder',
+  version: '3.28.1',
+  license: 'GPL2+',
+  meson_version: '>= 0.42.0'
+)
+
+application_id = 'org.gnome.SoundRecorder'
+
+sound_recorder_prefix = get_option('prefix')
+sound_recorder_bindir = join_paths(sound_recorder_prefix, get_option('bindir'))
+sound_recorder_libdir = join_paths(sound_recorder_prefix, get_option('libdir'))
+sound_recorder_datadir = join_paths(sound_recorder_prefix, get_option('datadir'))
+sound_recoder_pkgdatadir = join_paths(sound_recorder_datadir, meson.project_name())
+
+sound_recorder_schemadir = join_paths(sound_recorder_datadir, 'glib-2.0', 'schemas')
+
+gjs_dep = dependency('gjs-1.0', version: '>= 1.48.0')
+gjs_console = gjs_dep.get_pkgconfig_variable('gjs_console')
+
+# Lets check whether the dependencies exist
+dependency('gio-2.0', version: '>= 2.43.4')
+dependency('glib-2.0', version: '>= 2.39.3')
+dependency('gtk+-3.0', version: '>= 3.12.0')
+dependency('gobject-introspection-1.0', version: '>= 1.31.6')
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+subdir('src')
+subdir('data')
+subdir('po')
+
+meson.add_install_script(
+  join_paths('build-aux', 'meson_post_install.py'),
+  sound_recorder_datadir,
+  sound_recorder_bindir
+)
\ No newline at end of file
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..e14efe6
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,39 @@
+sound_recorder_sources = files(
+  'application.js',
+  'audioProfile.js',
+  'fileUtil.js',
+  'info.js',
+  'listview.js',
+  'main.js',
+  'mainWindow.js',
+  'params.js',
+  'play.js',
+  'preferences.js',
+  'record.js',
+  'util.js',
+  'waveform.js',
+)
+
+app_conf = configuration_data()
+app_conf.set('prefix', sound_recorder_prefix)
+app_conf.set('libdir', sound_recorder_libdir)
+app_conf.set('PACKAGE_VERSION', meson.project_version())
+app_conf.set('GJS', gjs_console)
+
+configure_file(
+  input: 'org.gnome.SoundRecorder.in',
+  output: application_id,
+  install: true,
+  install_dir: sound_recoder_pkgdatadir,
+  configuration: app_conf
+)
+
+gnome.compile_resources(
+  application_id + '.src',
+  'org.gnome.SoundRecorder.src.gresource.xml',
+  source_dir: '.',
+  dependencies: sound_recorder_sources,
+  gresource_bundle: true,
+  install: true,
+  install_dir: sound_recoder_pkgdatadir
+)
\ No newline at end of file
diff --git a/src/org.gnome.SoundRecorder.in b/src/org.gnome.SoundRecorder.in
old mode 100644
new mode 100755


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