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



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

    build: Initial port to meson

 .gitlab-ci.yml                        | 115 +---------------------------------
 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 +++
 10 files changed, 248 insertions(+), 113 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9c55eadd..a88c4de3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,115 +1,4 @@
-.flatpak:
-  image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master'
-  stage: '.pre'
-  script:
-    - flatpak-builder --stop-at=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
-    # Make sure to keep this in sync with the Flatpak manifest, all arguments
-    # are passed except the config-args because we build it ourselves
-    - flatpak build flatpak_app ./autogen.sh --prefix=/app --disable-Werror
-    - flatpak build flatpak_app make install
-    - |
-      flatpak build flatpak_app bash -c \
-      'for lang in $(ls /app/share/locale/); do \
-        ll=$(echo ${lang} | egrep -o '^[a-z]+'); \
-        test ${ll} == en && continue; \
-        test -L /app/share/locale/${lang} && continue; \
-        mkdir -p /app/share/runtime/locale/${ll}/share; \
-        mv /app/share/locale/${lang} /app/share/runtime/locale/${ll}/share/; \
-        ln -s ../../share/runtime/locale/${ll}/share/${lang} /app/share/locale; \
-      done'
-    - |
-      flatpak build flatpak_app bash -c \
-      "find /app -type f '(' -perm -111 -o -name '*.so*' ')' -print0 | while read -r -d $'\\0' file; do \
-        read -n4 hdr < \${file} || continue; \
-        if [ \"\$hdr\" != \$(printf \\\\x7fELF) ]; then \
-          continue; \
-        fi; \
-        if objdump -j .gnu_debuglink -s \${file} &> /dev/null; then \
-          continue; \
-        fi; \
-        case \${file} in /app/lib/debug/*) \
-            continue ;; \
-        esac; \
-        debugedit -i --list-file=source-files.part --base-dir=\${PWD} 
--dest-dir=/app/lib/debug/source//${FLATPAK_MODULE} \${file} &> /dev/null; \
-        cat source-files.part >> source-files; \
-        realpath=\$(realpath -s --relative-to=/app \${file}); \
-        debugfile=/app/lib/debug/\${realpath}.debug; \
-        mkdir -p \$(dirname \${debugfile}); \
-        objcopy --only-keep-debug --compress-debug-sections \${file} \${debugfile}; \
-        chmod 644 \${debugfile}; \
-        mode=\$(stat -c 0%a \${file}); \
-        [ -w \${file} ] || chmod +w \${file}; \
-        strip --remove-section=.comment --remove-section=.note --strip-unneeded 
--remove-section=.gnu_debugaltlink \${file}; \
-        objcopy --add-gnu-debuglink \${debugfile} \${file}; \
-        chmod \${mode} \${file}; \
-      done; \
-      sort -zu < source-files | while read -r -d \$'\\0' source; do \
-        dst=/app/lib/debug/source/${FLATPAK_MODULE}/\${source}; \
-        src=\${source}; \
-        if [ -d \${src} ]; then \
-          install -m0755 -d \${dst}; \
-          continue; \
-        fi; \
-        [ -f \${src} ] || continue; \
-        install -m0644 -D \${src} \${dst}; \
-      done"
-
-    - flatpak-builder --finish-only --repo=repo ${BRANCH:+--default-branch=$BRANCH} flatpak_app 
${MANIFEST_PATH}
-
-    # Generate a Flatpak bundle
-    - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} ${BRANCH}
-  artifacts:
-    name: 'Flatpak artifacts'
-    expose_as: 'Get Flatpak bundle here'
-    when: 'always'
-    paths:
-      - "${BUNDLE}"
-      - 'repo/'
-      - '_build/meson-logs/meson-log.txt'
-      - '_build/meson-logs/testlog.txt'
-    expire_in: 14 days
-  cache:
-    key: "$CI_JOB_NAME"
-    paths:
-      - '.flatpak-builder/downloads'
-      - '.flatpak-builder/git'
-
-.review:
-  stage: '.post'
-  script:
-    - echo "This job has been deprecated and is no longer needed!"
-  except:
-    refs:
-      - 'tags'
-      - 'master'
-      - 'branches'
-
-.stop_review:
-  stage: '.post'
-  script:
-    - echo "This job has been deprecated and is no longer needed!"
-  except:
-    refs:
-      - 'tags'
-      - 'master'
-      - 'branches'
-
-.publish_nightly:
-  image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/flat-manager-client'
-  stage: '.post'
-  script:
-    - BUILD_ID=$(flat-manager-client create ${FLAT_MANAGER_URL} ${FLATPAK_REPO})
-    - flat-manager-client push --commit --publish --wait ${BUILD_ID} repo/ || result=$?
-    - flat-manager-client purge ${BUILD_ID}
-    - exit $result
-  variables:
-    FLAT_MANAGER_URL: https://nightly.gnome.org/
-    FLATPAK_REPO: nightly
-  only:
-    refs:
-      - master
-    variables:
-      - $REPO_TOKEN
+include: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml'
 
 stages:
 - test
@@ -125,7 +14,7 @@ flatpak:master:
     variables:
         BUNDLE: "sound-juicer-dev.flatpak"
         MANIFEST_PATH: "build-aux/org.gnome.SoundJuicer.json"
-        #MESON_ARGS: "-Dprofile=development"
+        MESON_ARGS: "-Dprofile=development"
         FLATPAK_MODULE: "sound-juicer"
         RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo";
         APP_ID: "org.gnome.SoundJuicer"
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 00000000..9b1d559a
--- /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, '16x16', 'apps'), rename: 
'sound-juicer.png')
+install_data('sound-juicer-22.png', install_dir: join_paths(icondir, '22x22', 'apps'), rename: 
'sound-juicer.png')
+install_data('sound-juicer-24.png', install_dir: join_paths(icondir, '24x24', 'apps'), rename: 
'sound-juicer.png')
+install_data('sound-juicer-32.png', install_dir: join_paths(icondir, '32x32', 'apps'), rename: 
'sound-juicer.png')
+install_data('sound-juicer-48.png', install_dir: join_paths(icondir, '48x48', 'apps'), rename: 
'sound-juicer.png')
+install_data('sound-juicer-256.png', install_dir: join_paths(icondir, '256x256', 'apps'), rename: 
'sound-juicer.png')
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..e753ff1a
--- /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]