[sound-juicer/wip/subpop/convert-meson: 1/3] build: initial port to meson



commit c0d6477f79523e6043358f65ae5ac785484a216f
Author: Link Dupont <link sub-pop net>
Date:   Fri Feb 21 23:09:47 2020 -0500

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

 data/meson.build                      | 82 +++++++++++++++++++++++++++++++
 data/org.gnome.SoundJuicer.service.in |  3 ++
 help/meson.build                      |  5 ++
 libjuicer/meson.build                 | 18 +++++++
 meson.build                           | 92 +++++++++++++++++++++++++++++++++++
 meson_options.txt                     |  5 ++
 meson_post_install.py                 | 15 ++++++
 po/meson.build                        |  1 +
 src/meson.build                       | 31 ++++++++++++
 tests/meson.build                     |  7 +++
 10 files changed, 259 insertions(+)
---
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 00000000..ed1f8f6e
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,82 @@
+# 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
+icons = [
+  'sound-juicer-16.png',
+  'sound-juicer-22.png',
+  'sound-juicer-24.png',
+  'sound-juicer-32.png',
+  'sound-juicer-48.png',
+  'sound-juicer-256.png',
+]
+icondir = join_paths(sound_juicer_datadir, 'icons', 'hicolor')
+foreach icon : icons
+  name = icon.split('.')[0].split('-')
+  size = name[2]
+  install_data(icon, install_dir: join_paths(icondir, size + 'x' + size, 'apps'), rename: 'sound-juicer.png')
+endforeach
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..409e9a67
--- /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..cbc68e40
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,92 @@
+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',
+]
+
+if not get_option('enable-deprecations')
+  c_flags += '-Wno-deprecated-declarations'
+endif
+
+add_project_arguments(c_flags, language: 'c')
+
+deps = [
+  dependency('glib-2.0', version: '>=2.49.5'),
+  dependency('gthread-2.0'),
+  dependency('gobject-2.0'),
+  dependency('gio-2.0'),
+  dependency('gtk+-3.0', version: '>=3.21.6'),
+  dependency('gmodule-export-2.0'),
+  dependency('libcanberra-gtk3'),
+  dependency('gsettings-desktop-schemas'),
+  dependency('libbrasero-media3'),
+  dependency('gstreamer-1.0'),
+  dependency('gstreamer-plugins-base-1.0'),
+  dependency('gstreamer-pbutils-1.0'),
+  dependency('libmusicbrainz5', version: '>=5.0.1'),
+  dependency('iso-codes'),
+  dependency('libdiscid', version: '>=0.4.0'),
+]
+
+gst_inspect = find_program('gst-inspect-1.0')
+elements = ['vorbisenc', 'flacenc', 'wavenc', 'giosink']
+foreach element : elements
+  run_command(gst_inspect, '--exists', '--atleast-version=1.0', element, check: true)
+endforeach
+
+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_options.txt b/meson_options.txt
new file mode 100644
index 00000000..ea6b749b
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,5 @@
+option('enable-deprecations',
+  type: 'boolean',
+  value: false,
+  description: 'whether to enable deprecation warnings'
+)
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..c5216920
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,7 @@
+executable(
+  'mb-test',
+  'mb-test.c',
+  link_with: libjuicer,
+  include_directories: [top_inc, '../libjuicer'],
+  dependencies: deps,
+)


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