[sound-juicer/wip/subpop/convert-meson: 2/4] build: initial port to meson
- From: Link Dupont <link src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sound-juicer/wip/subpop/convert-meson: 2/4] build: initial port to meson
- Date: Sat, 22 Feb 2020 04:13:45 +0000 (UTC)
commit e669fd594b56a4a29a02e58643eac9cec90ca5cb
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 +++++++
m4/appstream-xml.m4 | 86 ++++++++++++++++++++++++++++++++
meson.build | 92 +++++++++++++++++++++++++++++++++++
meson_options.txt | 5 ++
meson_post_install.py | 15 ++++++
po/meson.build | 1 +
src/meson.build | 31 ++++++++++++
tests/meson.build | 7 +++
11 files changed, 345 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/m4/appstream-xml.m4 b/m4/appstream-xml.m4
new file mode 100644
index 00000000..11ed91ac
--- /dev/null
+++ b/m4/appstream-xml.m4
@@ -0,0 +1,86 @@
+# appstream-xml.m4
+#
+# serial 6
+
+dnl APPSTREAM_XML
+dnl Installs and validates AppData XML files.
+dnl
+dnl Call APPSTREAM_XML in configure.ac to check for the appstream-util tool.
+dnl Add @APPSTREAM_XML_RULES@ to a Makefile.am to substitute the make rules. Add
+dnl .appdata.xml files to appstream_XML in Makefile.am and they will be validated
+dnl at make check time, if appstream-util is installed, as well as installed
+dnl to the correct location automatically. Add --enable-appstream-util to
+dnl AM_DISTCHECK_CONFIGURE_FLAGS in Makefile.am to require valid AppData XML when
+dnl doing a distcheck.
+dnl
+dnl Adding files to appstream_XML does not distribute them automatically.
+
+AC_DEFUN([APPSTREAM_XML],
+[
+ m4_pattern_allow([AM_V_GEN])
+ AC_ARG_ENABLE([appstream-util],
+ [AS_HELP_STRING([--disable-appstream-util],
+ [Disable validating AppData XML files during check phase])])
+
+ AS_IF([test "x$enable_appstream_validate" != "xno"],
+ [AC_PATH_PROG([APPSTREAM_UTIL], [appstream-util])
+ AS_IF([test "x$APPSTREAM_UTIL" = "x"],
+ [have_appstream_validate=no],
+ [have_appstream_validate=yes
+ AC_SUBST([APPSTREAM_UTIL])])],
+ [have_appstream_validate=no])
+
+ AS_IF([test "x$have_appstream_validate" != "xno"],
+ [appstream_validate=yes],
+ [appstream_validate=no
+ AS_IF([test "x$enable_appstream_validate" = "xyes"],
+ [AC_MSG_ERROR([AppData validation was requested but appstream-util was not found])])])
+
+ AC_SUBST([appstreamxmldir], [${datadir}/metainfo])
+
+ APPSTREAM_XML_RULES='
+.PHONY : uninstall-appstream-xml install-appstream-xml clean-appstream-xml
+
+mostlyclean-am: clean-appstream-xml
+
+%.appdata.valid: %.appdata.xml
+ $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; \
+ if test -n "$(APPSTREAM_UTIL)"; \
+ then $(APPSTREAM_UTIL) --nonet validate $${d}$<; fi \
+ && touch [$]@
+
+check-am: $(appstream_XML:.appdata.xml=.appdata.valid)
+uninstall-am: uninstall-appstream-xml
+install-data-am: install-appstream-xml
+
+.SECONDARY: $(appstream_XML)
+
+install-appstream-xml: $(appstream_XML)
+ @$(NORMAL_INSTALL)
+ if test -n "$^"; then \
+ test -z "$(appstreamxmldir)" || $(MKDIR_P) "$(DESTDIR)$(appstreamxmldir)"; \
+ $(INSTALL_DATA) $^ "$(DESTDIR)$(appstreamxmldir)"; \
+ fi
+
+uninstall-appstream-xml:
+ @$(NORMAL_UNINSTALL)
+ @list='\''$(appstream_XML)'\''; test -n "$(appstreamxmldir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '\''$(DESTDIR)$(appstreamxmldir)'\'' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(appstreamxmldir)" && rm -f $$files
+
+clean-appstream-xml:
+ rm -f $(appstream_XML:.appdata.xml=.appdata.valid)
+'
+ _APPSTREAM_XML_SUBST(APPSTREAM_XML_RULES)
+])
+
+dnl _APPSTREAM_XML_SUBST(VARIABLE)
+dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
+AC_DEFUN([_APPSTREAM_XML_SUBST],
+[
+AC_SUBST([$1])
+m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
+]
+)
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]