[gnome-sound-recorder/port-to-meson: 8/9] Port to meson



commit ca2006a1363c5c6b4c863f23d6f835660a03fe50
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                           |  8 +++++
 .../appdata/org.gnome.SoundRecorder.appdata.xml.in | 16 ++++-----
 data/meson.build                                   | 41 ++++++++++++++++++++++
 ...op.in.in => org.gnome.SoundRecorder.desktop.in} |  6 ++--
 meson.build                                        | 40 +++++++++++++++++++++
 po/meson.build                                     |  1 +
 src/meson.build                                    | 39 ++++++++++++++++++++
 src/org.gnome.SoundRecorder.in                     |  0
 9 files changed, 166 insertions(+), 11 deletions(-)
---
diff --git a/build-aux/meson_post_install.py b/build-aux/meson_post_install.py
new file mode 100755
index 0000000..897a1db
--- /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, 'applications')])
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
new file mode 100644
index 0000000..42fa900
--- /dev/null
+++ b/data/appdata/meson.build
@@ -0,0 +1,8 @@
+i18n.merge_file(
+  'appdata-file',
+  input: '@0  appdata xml in'.format(application_id),
+  output: '@0  appdata xml'.format(application_id),
+  po_dir: po_dir,
+  install: true,
+  install_dir: join_paths(sound_recorder_datadir, 'metainfo')
+)
diff --git a/data/appdata/org.gnome.SoundRecorder.appdata.xml.in 
b/data/appdata/org.gnome.SoundRecorder.appdata.xml.in
index 09f969f..03685a4 100644
--- a/data/appdata/org.gnome.SoundRecorder.appdata.xml.in
+++ b/data/appdata/org.gnome.SoundRecorder.appdata.xml.in
@@ -2,23 +2,23 @@
 <!-- Copyright 2014 Richard Hughes <richard hughsie com> -->
 <component type="desktop">
   <id>org.gnome.SoundRecorder.desktop</id>
-  <_name>Sound Recorder</_name>
-  <_summary>A simple, modern sound recorder for GNOME</_summary>
+  <name>Sound Recorder</name>
+  <summary>A simple, modern sound recorder for GNOME</summary>
   <project_license>GPL-2.0+</project_license>
   <metadata_license>CC0-1.0</metadata_license>
   <description>
-    <_p>
+    <p>
       Sound Recorder provides a simple and modern interface that provides a
       straight-forward way to record and play audio.
       It allows you to do basic editing, and create voice memos.
-    </_p>
-    <_p>
+    </p>
+    <p>
       Sound Recorder automatically handles the saving process so that you
       do not need to worry about accidentally discarding the previous recording.
-    </_p>
-    <_p>Supported audio formats:</_p>
+    </p>
+    <p>Supported audio formats:</p>
     <ul>
-      <_li>Ogg Vorbis, Opus, FLAC, MP3 and MOV</_li>
+      <li>Ogg Vorbis, Opus, FLAC, MP3 and MOV</li>
     </ul>
   </description>
   <screenshots>
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..38345a5
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,41 @@
+foreach icon_size: ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
+  icon_dir = join_paths('icons', 'hicolor', icon_size, 'apps')
+
+  install_data(
+    join_paths(icon_dir, '@0@.png'.format(application_id)),
+    install_dir: join_paths(sound_recorder_datadir, icon_dir)
+  )
+endforeach
+
+icon_dir = join_paths('icons', 'hicolor', 'symbolic', 'apps')
+install_data(
+  join_paths(icon_dir, '@0 -symbolic svg'.format(application_id)),
+  install_dir: join_paths(sound_recorder_datadir, icon_dir)
+)
+
+i18n.merge_file(
+  'desktop',
+  input: '@0  desktop in'.format(application_id),
+  output: '.@0@desktop'.format(application_id),
+  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')
diff --git a/data/org.gnome.SoundRecorder.desktop.in.in b/data/org.gnome.SoundRecorder.desktop.in
similarity index 56%
rename from data/org.gnome.SoundRecorder.desktop.in.in
rename to data/org.gnome.SoundRecorder.desktop.in
index c5e69bb..eb0c129 100644
--- a/data/org.gnome.SoundRecorder.desktop.in.in
+++ b/data/org.gnome.SoundRecorder.desktop.in
@@ -1,10 +1,10 @@
 [Desktop Entry]
 Type=Application
-_Name=Sound Recorder
-_Comment=Record sound via the microphone and play it back
+Name=Sound Recorder
+Comment=Record sound via the microphone and play it back
 Icon=org.gnome.SoundRecorder
 Categories=GNOME;GTK;Audio;AudioVideo;
-_Keywords=Audio;Application;Record;
+Keywords=Audio;Application;Record;
 Exec=gnome-sound-recorder
 StartupNotify=true
 
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..1edfa2d
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,40 @@
+project(
+  'gnome-sound-recorder',
+  version: '3.28.1',
+  license: 'GPL2+',
+  meson_version: '>= 0.46.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]