[sound-juicer/wip/subpop/convert-meson: 1/2] build: Initial port to meson



commit d2c0f4589ac2d71e772635be3b656182b03f458e
Author: Link Dupont <link sub-pop net>
Date:   Tue Feb 18 00:26:12 2020 -0500

    build: Initial port to meson
    
    Signed-off-by: Link Dupont <link sub-pop net>

 data/meson.build                      | 75 +++++++++++++++++++++++++++++
 data/org.gnome.SoundJuicer.service.in |  3 ++
 help/meson.build                      |  5 ++
 libjuicer/meson.build                 | 18 +++++++
 meson.build                           | 89 +++++++++++++++++++++++++++++++++++
 meson_post_install.py                 | 15 ++++++
 po/meson.build                        |  1 +
 src/meson.build                       | 31 ++++++++++++
 tests/meson.build                     |  9 ++++
 9 files changed, 246 insertions(+)
---
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 00000000..7bcd7d79
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,75 @@
+# Desktop file
+i18n.merge_file(
+    'desktop',
+    input: configure_file(
+        input: 'org.gnome.SoundJuicer.desktop.in.in',
+        output: 'org.gnome.SoundJuicer.desktop.in',
+        configuration: configuration_data({
+            'VERSION': meson.project_version(),
+        }),
+    ),
+    output: 'org.gnome.SoundJuicer.desktop',
+    type: 'desktop',
+    po_dir: po_dir,
+    install: true,
+    install_dir: join_paths(sound_juicer_datadir, 'applications')
+)
+
+# DBus service
+configure_file(
+    input: 'org.gnome.SoundJuicer.service.in',
+    output: 'org.gnome.SoundJuicer.service',
+    configuration: configuration_data({
+        'name': 'org.gnome.SoundJuicer',
+        'exec': join_paths(sound_juicer_bindir, meson.project_name()),
+    }),
+    install: true,
+    install_dir: join_paths(sound_juicer_datadir, 'dbus-1', 'services'),
+)
+
+# Appdata
+i18n.merge_file(
+    'appdata',
+    input: files(join_paths('appdata', 'org.gnome.SoundJuicer.appdata.xml.in')),
+    output: 'org.gnome.SoundJuicer.appdata.xml',
+    po_dir: po_dir,
+    install: true,
+    install_dir: join_paths(sound_juicer_datadir, 'metainfo'),
+)
+
+# GSettings
+gnome.compile_schemas(
+  build_by_default: true,
+  depend_files: 'org.gnome.sound-juicer.gschema.xml'
+)
+
+install_data(
+  'org.gnome.sound-juicer.gschema.xml',
+  install_dir: join_paths(sound_juicer_datadir, 'glib-2.0', 'schemas')
+)
+
+
+# Data files
+install_data(
+    'sound-juicer.convert',
+    install_dir: join_paths(sound_juicer_datadir, 'GConf', 'gsettings'),
+)
+
+install_data(
+    'rhythmbox.gep',
+    install_dir: join_paths(sound_juicer_datadir, meson.project_name()),
+)
+
+# manpage
+install_man(
+    'sound-juicer.1',
+)
+
+# icons
+icondir = join_paths(sound_juicer_datadir, 'icons', 'hicolor')
+install_data('sound-juicer-16.png', install_dir: join_paths(icondir, '16', 'apps'))
+install_data('sound-juicer-22.png', install_dir: join_paths(icondir, '22', 'apps'))
+install_data('sound-juicer-24.png', install_dir: join_paths(icondir, '24', 'apps'))
+install_data('sound-juicer-32.png', install_dir: join_paths(icondir, '32', 'apps'))
+install_data('sound-juicer-48.png', install_dir: join_paths(icondir, '48', 'apps'))
+install_data('sound-juicer-256.png', install_dir: join_paths(icondir, '256', 'apps'))
diff --git a/data/org.gnome.SoundJuicer.service.in b/data/org.gnome.SoundJuicer.service.in
new file mode 100644
index 00000000..d2cc950e
--- /dev/null
+++ b/data/org.gnome.SoundJuicer.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=@name@
+Exec=@exec@ --gapplication-service
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 00000000..63d24594
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,5 @@
+gnome.yelp(
+    meson.project_name(),
+    sources: 'index.docbook',
+    media: ['figures/prefs.png', 'figures/startup.png'],
+)
diff --git a/libjuicer/meson.build b/libjuicer/meson.build
new file mode 100644
index 00000000..185f941d
--- /dev/null
+++ b/libjuicer/meson.build
@@ -0,0 +1,18 @@
+sources = [
+       'rb-gst-media-types.c',
+       'sj-error.c',
+       'sj-extractor.c',
+       'sj-metadata.c',
+       'sj-metadata-getter.c',
+       'sj-metadata-gvfs.c',
+       'sj-metadata-musicbrainz5.c',
+       'sj-structures.c',
+       'sj-util.c',
+]
+
+libjuicer = static_library(
+       'libjuicer',
+       sources,
+       include_directories: top_inc,
+       dependencies: deps
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..d8acab68
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,89 @@
+project('sound-juicer', 'c', version: '3.24.0')
+
+sound_juicer_prefix = get_option('prefix')
+sound_juicer_bindir = join_paths(sound_juicer_prefix, get_option('bindir'))
+sound_juicer_datadir = join_paths(sound_juicer_prefix, get_option('datadir'))
+sound_juicer_libdir = join_paths(sound_juicer_prefix, get_option('libdir'))
+sound_juicer_libexecdir = join_paths(sound_juicer_prefix, get_option('libexecdir'))
+sound_juicer_localedir = join_paths(sound_juicer_prefix, get_option('localedir'))
+
+sound_juicer_docdir = join_paths(sound_juicer_prefix, 'doc', meson.project_name())
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+source_root = meson.current_source_dir()
+po_dir = join_paths(source_root, 'po')
+data_dir = join_paths(source_root, 'data')
+
+top_inc = include_directories('.')
+
+config_h = configuration_data()
+
+config_h.set_quoted('PACKAGE', meson.project_name())
+config_h.set_quoted('PACKAGE_TARNAME', meson.project_name())
+config_h.set_quoted('PACKAGE_URL', 'https://wiki.gnome.org/Apps/SoundJuicer')
+config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
+config_h.set_quoted('VERSION', meson.project_version())
+config_h.set_quoted('PACKAGE_BUGREPORT', 'https://gitlab.gnome.org/GNOME/sound-juicer/issues/new')
+config_h.set_quoted('ISO_CODES_PREFIX', dependency('iso-codes').get_pkgconfig_variable('prefix'))
+
+c_flags = [
+  '-DTOPSRCDIR="@0@"'.format(source_root),
+  '-DPREFIX="@0@"'.format(sound_juicer_prefix),
+  '-DDATADIR="@0@"'.format(sound_juicer_datadir),
+  '-DLOCALEDIR="@0@"'.format(sound_juicer_localedir),
+  '-DLIBDIR="@0@"'.format(sound_juicer_libdir),
+  '-DPKGDATADIR="@0@"'.format(join_paths(sound_juicer_datadir, meson.project_name())),
+  '-DHAVE_CONFIG_H',
+]
+add_project_arguments(c_flags, language: 'c')
+
+deps = []
+deps += dependency('glib-2.0', version: '>=2.49.5')
+deps += dependency('gthread-2.0')
+deps += dependency('gobject-2.0')
+deps += dependency('gio-2.0')
+
+deps += dependency('gtk+-3.0', version: '>=3.21.6')
+deps += dependency('gmodule-export-2.0')
+deps += dependency('libcanberra-gtk3')
+deps += dependency('gsettings-desktop-schemas')
+
+deps += dependency('libbrasero-media3')
+deps += dependency('gstreamer-1.0')
+deps += dependency('gstreamer-plugins-base-1.0')
+deps += dependency('gstreamer-pbutils-1.0')
+
+gst_inspect = find_program('gst-inspect-1.0')
+run_command(gst_inspect, '--exists', '--atleast-version=1.0', 'vorbisenc', check: true)
+run_command(gst_inspect, '--exists', '--atleast-version=1.0', 'flacenc', check: true)
+run_command(gst_inspect, '--exists', '--atleast-version=1.0', 'wavenc', check: true)
+run_command(gst_inspect, '--exists', '--atleast-version=1.0', 'giosink', check: true)
+
+deps += dependency('libmusicbrainz5', version: '>=5.0.1')
+deps += dependency('libdiscid', version: '>=0.4.0')
+deps += dependency('iso-codes')
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h,
+)
+
+doc_data = files(
+  'COPYING',
+  'NEWS',
+  'README',
+  'AUTHORS'
+)
+
+install_data(doc_data, install_dir: sound_juicer_docdir)
+
+meson.add_install_script('meson_post_install.py')
+
+subdir('po')
+subdir('help')
+subdir('data')
+subdir('libjuicer')
+subdir('src')
+subdir('tests')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 00000000..b26c88a8
--- /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/po/meson.build b/po/meson.build
new file mode 100644
index 00000000..e9b77d79
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(meson.project_name(), preset: 'glib')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 00000000..555eabf7
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,31 @@
+sources = [
+    'sj-album-chooser-dialog.c',
+    'egg-play-preview.c',
+    'sj-about.c',
+    'sj-cell-renderer-text.c',
+    'sj-extracting.c',
+    'sj-genres.c',
+    'sj-main.c',
+    'sj-play.c',
+    'sj-prefs.c',
+    'sj-tree-view.c',
+    'sj-window-state.c',
+]
+
+sj_resources= gnome.compile_resources(
+    'sj-resources',
+    join_paths(data_dir, 'sound-juicer.gresource.xml'),
+    source_dir: data_dir,
+    gresource_bundle: false,
+)
+
+sources += sj_resources[0]
+
+executable(
+    meson.project_name(),
+    sources,
+    link_with: libjuicer,
+    dependencies: deps,
+    include_directories: [top_inc, '../libjuicer'],
+    install: true,
+)
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 00000000..2e054ef4
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,9 @@
+mb_test = executable(
+    'mb-test',
+    'mb-test.c',
+    link_with: libjuicer,
+     include_directories: [top_inc, '../libjuicer'],
+    dependencies: deps,
+)
+
+test('mb-test', mb_test)


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