[gnome-multi-writer] Switch to the meson buildsystem



commit eb03a4d75d3b1f2ddb2d00686f124d79ee79f31f
Author: Richard Hughes <richard hughsie com>
Date:   Mon Apr 10 15:25:28 2017 +0100

    Switch to the meson buildsystem

 Makefile.am                                        |   70 -------
 autogen.sh                                         |   26 ---
 configure.ac                                       |  129 -------------
 contrib/gnome-multi-writer.spec.in                 |   10 +-
 data/Makefile.am                                   |   42 ----
 data/appdata/Makefile.am                           |   12 --
 data/appdata/meson.build                           |    8 +
 data/appdata/org.gnome.MultiWriter.appdata.xml.in  |   26 ++--
 data/icons/16x16/Makefile.am                       |    4 -
 ...-multi-writer.png => org.gnome.MultiWriter.png} |  Bin 902 -> 902 bytes
 data/icons/22x22/Makefile.am                       |    4 -
 ...-multi-writer.png => org.gnome.MultiWriter.png} |  Bin 1440 -> 1440 bytes
 data/icons/256x256/Makefile.am                     |    4 -
 ...-multi-writer.png => org.gnome.MultiWriter.png} |  Bin 45025 -> 45025 bytes
 data/icons/32x32/Makefile.am                       |    4 -
 ...-multi-writer.png => org.gnome.MultiWriter.png} |  Bin 1766 -> 1766 bytes
 data/icons/48x48/Makefile.am                       |    4 -
 ...-multi-writer.png => org.gnome.MultiWriter.png} |  Bin 3183 -> 3183 bytes
 data/icons/Makefile.am                             |    8 -
 data/icons/meson.build                             |   10 +
 data/meson.build                                   |   25 +++
 data/org.gnome.MultiWriter.desktop.in              |    8 +-
 git.mk                                             |  200 --------------------
 m4/.gitignore                                      |    1 -
 m4/as-linguas.m4                                   |   24 ---
 man/Makefile.am                                    |   25 ---
 man/meson.build                                    |   10 +
 meson.build                                        |  137 +++++++++++++
 meson_post_install.sh                              |   14 ++
 po/LINGUAS                                         |   30 +++
 po/Makevars                                        |   78 ++++++++
 po/meson.build                                     |    6 +
 src/Makefile.am                                    |   73 -------
 {data => src}/gmw-main.ui                          |    0
 {data => src}/gmw-menus.ui                         |    0
 src/meson.build                                    |   48 +++++
 {data => src}/usb.svg                              |    0
 37 files changed, 388 insertions(+), 652 deletions(-)
---
diff --git a/contrib/gnome-multi-writer.spec.in b/contrib/gnome-multi-writer.spec.in
index c5046aa..45c5d6f 100644
--- a/contrib/gnome-multi-writer.spec.in
+++ b/contrib/gnome-multi-writer.spec.in
@@ -32,11 +32,11 @@ simultaneously.
 %setup -q
 
 %build
-%configure
-make %{?_smp_mflags} V=1
+%meson
+%meson_build
 
 %install
-%make_install
+%meson_install
 
 %find_lang %{name}
 
@@ -58,9 +58,9 @@ fi
 /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
 
 %files -f %{name}.lang
-%doc README.md AUTHORS NEWS COPYING
+%doc README.md AUTHORS
 %{_bindir}/%{name}
-%{_bindir}/%{name}-probe
+%{_libexecdir}/%{name}-probe
 %{_datadir}/appdata/org.gnome.MultiWriter.appdata.xml
 %{_datadir}/applications/org.gnome.MultiWriter.desktop
 %{_datadir}/glib-2.0/schemas/org.gnome.MultiWriter.gschema.xml
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
new file mode 100644
index 0000000..c256226
--- /dev/null
+++ b/data/appdata/meson.build
@@ -0,0 +1,8 @@
+i18n.merge_file(
+  input: 'org.gnome.MultiWriter.appdata.xml.in',
+  output: 'org.gnome.MultiWriter.appdata.xml',
+  type: 'xml',
+  po_dir: join_paths(meson.source_root(), 'po'),
+  install: true,
+  install_dir: join_paths(get_option('datadir'), 'appdata')
+)
diff --git a/data/appdata/org.gnome.MultiWriter.appdata.xml.in 
b/data/appdata/org.gnome.MultiWriter.appdata.xml.in
index b21d8d8..bf7f203 100644
--- a/data/appdata/org.gnome.MultiWriter.appdata.xml.in
+++ b/data/appdata/org.gnome.MultiWriter.appdata.xml.in
@@ -5,29 +5,29 @@
   <metadata_license>CC0-1.0</metadata_license>
   <project_license>GPL-2.0+</project_license>
   <!-- TRANSLATORS: the application name -->
-  <_name>MultiWriter</_name>
+  <name>MultiWriter</name>
   <!-- TRANSLATORS: one-line description for the app -->
-  <_summary>Write an ISO file to multiple USB devices at once</_summary>
+  <summary>Write an ISO file to multiple USB devices at once</summary>
   <description>
     <!-- TRANSLATORS: AppData description marketing paragraph -->
-    <_p>
+    <p>
       GNOME MultiWriter can be used to write an ISO file to multiple USB devices
       at once.
       Supported drive sizes are between 1GB and 32GB.
-    </_p>
+    </p>
     <!-- TRANSLATORS: QA refers to quality assurance, aka people testing stuff,
                       GNOME refers to the desktop environment -->
-    <_p>
+    <p>
       MultiWriter may be useful for QA testing, to create a GNOME Live image
       for a code sprint or to create hundreds of LiveUSB drives for a trade
       show.
-    </_p>
+    </p>
     <!-- TRANSLATORS: saturate as in the throughput can get no more -->
-    <_p>
+    <p>
       Writing a more than 10 devices simultaneously can easy saturate the USB
       bus for most storage devices.
       There are two ways to write more devices in parallel:
-    </_p>
+    </p>
     <ul>
       <!-- TRANSLATORS: storage devices refers to the things we're writing to -->
       <_li>Use USB 3.0 hubs, even if the storage devices are USB 2.0</_li>
@@ -35,26 +35,26 @@
       <_li>Install another USB 2.0 PCIe root hub</_li>
     </ul>
     <!-- TRANSLATORS: the ColorHug is an open hardware product, don't translate the name -->
-    <_p>
+    <p>
       MultiWriter was originally written as part of the ColorHug project but
       was split off as an independent application in 2015.
-    </_p>
+    </p>
   </description>
   <screenshots>
     <screenshot type="default">
       <image>https://git.gnome.org/browse/gnome-multi-writer/plain/data/appdata/gmw-startup.png</image>
       <!-- TRANSLATORS: the 1st screenshot caption -->
-      <_caption>Initial screen for the application</_caption>
+      <caption>Initial screen for the application</caption>
     </screenshot>
     <screenshot>
       <image>https://git.gnome.org/browse/gnome-multi-writer/plain/data/appdata/gmw-progress.png</image>
       <!-- TRANSLATORS: the 2nd screenshot caption -->
-      <_caption>Writing and verifying images</_caption>
+      <caption>Writing and verifying images</caption>
     </screenshot>
     <screenshot>
       <image>https://git.gnome.org/browse/gnome-multi-writer/plain/data/appdata/gmw-finished.png</image>
       <!-- TRANSLATORS: the 3rd screenshot caption -->
-      <_caption>All devices have been written</_caption>
+      <caption>All devices have been written</caption>
     </screenshot>
   </screenshots>
   <!--
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..bc5a49d
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,10 @@
+install_data('16x16/org.gnome.MultiWriter.png',
+             install_dir : 'share/icons/hicolor/16x16/apps')
+install_data('22x22/org.gnome.MultiWriter.png',
+             install_dir : 'share/icons/hicolor/22x22/apps')
+install_data('32x32/org.gnome.MultiWriter.png',
+             install_dir : 'share/icons/hicolor/32x32/apps')
+install_data('48x48/org.gnome.MultiWriter.png',
+             install_dir : 'share/icons/hicolor/48x48/apps')
+install_data('256x256/org.gnome.MultiWriter.png',
+             install_dir : 'share/icons/hicolor/256x256/apps')
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..a022f95
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,25 @@
+subdir('appdata')
+subdir('icons')
+
+compiled = gnome.compile_schemas()
+install_data('org.gnome.MultiWriter.gschema.xml',
+  install_dir : 'share/glib-2.0/schemas'
+)
+
+i18n.merge_file(
+  input: 'org.gnome.MultiWriter.desktop.in',
+  output: 'org.gnome.MultiWriter.desktop',
+  type: 'desktop',
+  po_dir: join_paths(meson.source_root(), 'po'),
+  install: true,
+  install_dir: join_paths(get_option('datadir'), 'applications')
+)
+
+i18n.merge_file(
+  input: 'org.gnome.MultiWriter.policy.in',
+  output: 'org.gnome.MultiWriter.policy',
+  type: 'xml',
+  po_dir: join_paths(meson.source_root(), 'po'),
+  install: true,
+  install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions')
+)
diff --git a/data/org.gnome.MultiWriter.desktop.in b/data/org.gnome.MultiWriter.desktop.in
index 3c6b1d5..b205d41 100644
--- a/data/org.gnome.MultiWriter.desktop.in
+++ b/data/org.gnome.MultiWriter.desktop.in
@@ -1,12 +1,12 @@
 [Desktop Entry]
-_Name=MultiWriter
-_Comment=Write an ISO file to multiple USB devices at once
-Icon=gnome-multi-writer
+Name=MultiWriter
+Comment=Write an ISO file to multiple USB devices at once
+Icon=org.gnome.MultiWriter
 Exec=gnome-multi-writer
 Terminal=false
 Type=Application
 Categories=GNOME;GTK;System;
 # TRANSLATORS: these are desktop keywords - remember the trailing ';' :)
-_Keywords=Image;Writer;ISO;USB;
+Keywords=Image;Writer;ISO;USB;
 StartupNotify=true
 NoDisplay=false
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..b1cf81b
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,10 @@
+docbook2man = find_program('docbook2man', required : false)
+if docbook2man.found()
+  custom_target('gnome-multi-writer-man',
+    output : 'gnome-multi-writer.1',
+    input : 'gnome-multi-writer.sgml',
+    command : [docbook2man, '@INPUT@', '--output', 'man'],
+    install : true,
+    install_dir : 'share/man/man1'
+  )
+endif
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..0e4d999
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,137 @@
+project('gnome-multi-writer', 'c',
+  version : '3.24.1',
+  default_options : ['warning_level=1'],
+  meson_version : '>=0.37.0'
+)
+
+conf = configuration_data()
+conf.set('PACKAGE_VERSION', meson.project_version())
+
+# get suported warning flags
+test_args = [
+  '-Waggregate-return',
+  '-Warray-bounds',
+  '-Wcast-align',
+  '-Wclobbered',
+  '-Wdeclaration-after-statement',
+  '-Wempty-body',
+  '-Wextra',
+  '-Wformat=2',
+  '-Wformat-nonliteral',
+  '-Wformat-security',
+  '-Wformat-signedness',
+  '-Wignored-qualifiers',
+  '-Wimplicit-function-declaration',
+  '-Winit-self',
+  '-Winline',
+  '-Wmissing-declarations',
+  '-Wmissing-format-attribute',
+  '-Wmissing-include-dirs',
+  '-Wmissing-noreturn',
+  '-Wmissing-parameter-type',
+  '-Wmissing-prototypes',
+  '-Wnested-externs',
+  '-Wno-discarded-qualifiers',
+  '-Wno-missing-field-initializers',
+  '-Wno-strict-aliasing',
+  '-Wno-suggest-attribute=format',
+  '-Wno-unused-parameter',
+  '-Wold-style-definition',
+  '-Woverride-init',
+  '-Wpacked',
+  '-Wpointer-arith',
+  '-Wredundant-decls',
+  '-Wreturn-type',
+  '-Wshadow',
+  '-Wsign-compare',
+  '-Wstrict-aliasing',
+  '-Wstrict-prototypes',
+  '-Wswitch-default',
+  '-Wtype-limits',
+  '-Wundef',
+  '-Wuninitialized',
+  '-Wunused-but-set-variable',
+  '-Wwrite-strings'
+]
+cc = meson.get_compiler('c')
+foreach arg: test_args
+  if cc.has_argument(arg)
+    add_project_arguments(arg, language : 'c')
+  endif
+endforeach
+
+# enable full RELRO where possible
+# FIXME: until https://github.com/mesonbuild/meson/issues/1140 is fixed
+global_link_args = []
+test_link_args = [
+  '-Wl,-z,relro',
+  '-Wl,-z,now',
+]
+foreach arg: test_link_args
+  if cc.has_argument(arg)
+    global_link_args += arg
+  endif
+endforeach
+add_global_link_arguments(
+  global_link_args,
+  language: 'c'
+)
+
+gtk = dependency('gtk+-3.0', version : '>= 3.11.2')
+gio = dependency('gio-2.0')
+gusb = dependency('gusb', version : '>= 0.2.7')
+udisks = dependency('udisks2')
+gudev = dependency('gudev-1.0')
+libcanberra = dependency('libcanberra-gtk3', version : '>= 0.10')
+polkit = dependency('polkit-gobject-1')
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('LOCALEDIR',
+                join_paths(get_option('prefix'),
+                           get_option('localedir')))
+conf.set_quoted('LIBEXECDIR',
+                join_paths(get_option('prefix'),
+                           get_option('libexecdir')))
+configure_file(
+  output : 'config.h',
+  configuration : conf
+)
+
+subdir('src')
+subdir('man')
+subdir('po')
+subdir('data')
+
+archiver = find_program('git', required : false)
+if archiver.found()
+  run_target('dist',
+    # git config tar.tar.xz.command "xz -c"
+    command: [
+      'git', 'archive',
+      '--prefix=' + meson.project_name() + '-' + meson.project_version() + '/',
+      'HEAD',
+      '--format=tar.xz',
+      '--output',
+      meson.project_name() + '-' + meson.project_version() + '.tar.xz'
+    ]
+  )
+else
+  message('git not found, you will not be able to run `ninja dist`')
+endif
+
+appstream_util = find_program('appstream-util', required : false)
+if appstream_util.found()
+  custom_target('NEWS',
+    output : 'NEWS',
+    input : 'data/appdata/org.gnome.MultiWriter.appdata.xml.in',
+    command : [appstream_util, 'appdata-to-news', '@INPUT@'],
+    capture : true
+  )
+endif
+
+# FIXME: remove when https://github.com/mesonbuild/meson/issues/837 fixed
+meson.add_install_script('meson_post_install.sh')
diff --git a/meson_post_install.sh b/meson_post_install.sh
new file mode 100755
index 0000000..c523b15
--- /dev/null
+++ b/meson_post_install.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+if [ -z $MESON_INSTALL_PREFIX ]; then
+    echo 'This is meant to be ran from Meson only!'
+    exit 1
+fi
+
+if [ -z $DESTDIR ]; then
+    echo 'Compiling GSchema'
+    glib-compile-schemas "$MESON_INSTALL_PREFIX/share/glib-2.0/schemas"
+    echo 'Updating icon cache'
+    gtk-update-icon-cache -qtf "$MESON_INSTALL_PREFIX/share/icons/hicolor"
+    echo 'Updating desktop database'
+    update-desktop-database -q "$MESON_INSTALL_PREFIX/share/applications"
+fi
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 0000000..d9a46b5
--- /dev/null
+++ b/po/LINGUAS
@@ -0,0 +1,30 @@
+bs
+ca
+cs
+de
+el
+en_GB
+es
+fa
+fi
+fr
+fur
+gl
+he
+hu
+id
+it
+nl
+oc
+pl
+pt_BR
+pt
+ru
+sk
+sl
+sr@latin
+sr
+sv
+tr
+uk
+zh_TW
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 0000000..0dfd398
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,78 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 
--keyword=g_dngettext:2,3
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Richard Hughes
+
+# This tells whether or not to prepend "GNU " prefix to the package
+# name that gets inserted into the header of the $(DOMAIN).pot file.
+# Possible values are "yes", "no", or empty.  If it is empty, try to
+# detect it automatically by scanning the files in $(top_srcdir) for
+# "GNU packagename" string.
+PACKAGE_GNU = no
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = richard hughsie com
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
+
+# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
+# context.  Possible values are "yes" and "no".  Set this to yes if the
+# package uses functions taking also a message context, like pgettext(), or
+# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
+USE_MSGCTXT = no
+
+# These options get passed to msgmerge.
+# Useful options are in particular:
+#   --previous            to keep previous msgids of translated messages,
+#   --quiet               to reduce the verbosity.
+MSGMERGE_OPTIONS = --no-location --no-wrap
+
+# These options get passed to msginit.
+# If you want to disable line wrapping when writing PO files, add
+# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
+# MSGINIT_OPTIONS.
+MSGINIT_OPTIONS = --no-wrap
+
+# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
+# has changed.  Possible values are "yes" and "no".  Set this to no if
+# the POT file is checked in the repository and the version control
+# program ignores timestamps.
+PO_DEPENDS_ON_POT = no
+
+# This tells whether or not to forcibly update $(DOMAIN).pot and
+# regenerate PO files on "make dist".  Possible values are "yes" and
+# "no".  Set this to no if the POT file and PO files are maintained
+# externally.
+DIST_DEPENDS_ON_UPDATE_PO = no
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..964935b
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,6 @@
+i18n.gettext(meson.project_name(),
+  preset : 'glib',
+  args: [
+    '--default-domain=' + meson.project_name()
+  ]
+)
diff --git a/data/gmw-main.ui b/src/gmw-main.ui
similarity index 100%
rename from data/gmw-main.ui
rename to src/gmw-main.ui
diff --git a/data/gmw-menus.ui b/src/gmw-menus.ui
similarity index 100%
rename from data/gmw-menus.ui
rename to src/gmw-menus.ui
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..93f0399
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,48 @@
+cargs = ['-DG_LOG_DOMAIN="Gmw"']
+
+gnome_multi_writer_resources = gnome.compile_resources(
+  'gnome-multi-writer-resources',
+  'gnome-multi-writer.gresource.xml',
+  source_dir : '.',
+  c_name : 'gpm'
+)
+
+executable(
+  'gnome-multi-writer',
+  gnome_multi_writer_resources,
+  sources : [
+    'gmw-device.c',
+    'gmw-main.c',
+  ],
+  include_directories : [
+    include_directories('..'),
+  ],
+  dependencies : [
+    gtk,
+    gusb,
+    udisks,
+    gudev,
+    libcanberra,
+    polkit,
+  ],
+  c_args : cargs,
+  install : true,
+  install_dir : 'bin'
+)
+
+executable(
+  'gnome-multi-writer-probe',
+  sources : [
+    'gmw-probe.c',
+  ],
+  include_directories : [
+    include_directories('..'),
+  ],
+  dependencies : [
+    gudev,
+    gio,
+  ],
+  c_args : cargs,
+  install : true,
+  install_dir : 'libexec'
+)
diff --git a/data/usb.svg b/src/usb.svg
similarity index 100%
rename from data/usb.svg
rename to src/usb.svg


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