[gnome-disk-utility/wip/inigomartinez/meson: 2/3] build: Port to meson build system
- From: Iñigo Martínez <inigomartinez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility/wip/inigomartinez/meson: 2/3] build: Port to meson build system
- Date: Sun, 16 Jul 2017 11:18:22 +0000 (UTC)
commit 3841b8cec3f5753666ec52c69613b815635d7828
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Sat Jul 15 11:02:29 2017 +0200
build: Port to meson build system
data/icons/meson.build | 25 ++++
data/meson.build | 48 ++++++++
doc/man/meson.build | 25 ++++
meson.build | 212 ++++++++++++++++++++++++++++++++++++
meson_options.txt | 2 +
meson_post_install.py | 15 +++
po/meson.build | 1 +
src/disk-image-mounter/meson.build | 25 ++++
src/disks/meson.build | 105 ++++++++++++++++++
src/libgdu/meson.build | 46 ++++++++
src/notify/meson.build | 34 ++++++
11 files changed, 538 insertions(+), 0 deletions(-)
---
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..995a551
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,25 @@
+icon_sizes = [
+ '16x16',
+ '22x22',
+ '24x24',
+ '32x32',
+ '48x48',
+ '256x256'
+]
+
+foreach icon_size: icon_sizes
+ install_data(
+ 'hicolor/' + icon_size + '/gnome-disks.png',
+ install_dir: join_paths(gdu_datadir, 'icons', 'hicolor', icon_size, 'apps')
+ )
+endforeach
+
+scalable_icons = files(
+ 'hicolor/scalable/gnome-disks-state-standby-symbolic.svg',
+ 'hicolor/scalable/gnome-disks-symbolic.svg'
+)
+
+install_data(
+ scalable_icons,
+ install_dir: join_paths(gdu_datadir, 'icons', 'hicolor', 'scalable', 'apps')
+)
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..2c9d8e7
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,48 @@
+subdir('icons')
+
+desktops = [
+ 'org.gnome.DiskUtility.desktop',
+ 'gnome-disk-image-mounter.desktop',
+ 'gnome-disk-image-writer.desktop'
+]
+
+foreach desktop: desktops
+ i18n.merge_file (
+ desktop,
+ type: 'desktop',
+ input: desktop + '.in',
+ output: desktop,
+ po_dir: po_dir,
+ install: true,
+ install_dir: join_paths(gdu_datadir, 'applications')
+ )
+endforeach
+
+service_conf = configuration_data()
+service_conf.set('bindir', gdu_bindir)
+
+service = 'org.gnome.DiskUtility.service'
+
+configure_file(
+ input: service + '.in',
+ output: service,
+ install: true,
+ install_dir: join_paths(gdu_datadir, 'dbus-1', 'services'),
+ configuration: service_conf
+)
+
+install_data(
+ 'org.gnome.Disks.gschema.xml',
+ install_dir: join_paths(gdu_datadir, 'glib-2.0', 'schemas')
+)
+
+info = 'org.gnome.DiskUtility.metainfo.xml'
+
+i18n.merge_file(
+ info,
+ input: 'org.gnome.DiskUtility.appdata.xml.in',
+ output: info,
+ po_dir: po_dir,
+ install: true,
+ install_dir: join_paths(gdu_datadir, 'metainfo')
+)
diff --git a/doc/man/meson.build b/doc/man/meson.build
new file mode 100644
index 0000000..1a16fa0
--- /dev/null
+++ b/doc/man/meson.build
@@ -0,0 +1,25 @@
+xsltproc_cmd = [
+ find_program('xsltproc'),
+ '--output', '@OUTPUT@',
+ '--nonet',
+ 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+ '@INPUT@'
+]
+
+mans = [
+ 'gnome-disks',
+ 'gnome-disk-image-mounter'
+]
+
+foreach man: mans
+ output = man + '.1'
+
+ custom_target(
+ output,
+ input: man + '.xml',
+ output: output,
+ command: xsltproc_cmd,
+ install: true,
+ install_dir: join_paths(gdu_mandir, 'man1')
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..22f3628
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,212 @@
+project(
+ 'GNOME Disk Utility', 'c',
+ version: '3.25.2',
+ license: 'GPL2.0',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'warning_level=1'
+ ],
+ meson_version: '>= 0.41.0'
+)
+
+gdu_name = 'gnome-disk-utility'
+gdu_version = meson.project_version()
+
+gdu_prefix = get_option('prefix')
+gdu_bindir = join_paths(gdu_prefix, get_option('bindir'))
+gdu_datadir = join_paths(gdu_prefix, get_option('datadir'))
+gdu_libexecdir = join_paths(gdu_prefix, get_option('libexecdir'))
+gdu_localedir = join_paths(gdu_prefix, get_option('localedir'))
+gdu_mandir = join_paths(gdu_prefix, get_option('mandir'))
+gdu_sysconfdir = join_paths(gdu_prefix, get_option('sysconfdir'))
+
+cc = meson.get_compiler('c')
+
+config_h = configuration_data()
+
+# package
+set_defines = [
+ ['PACKAGE', gdu_name],
+ ['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=' + gdu_name],
+ ['PACKAGE_NAME', meson.project_name()],
+ ['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), gdu_version)],
+ ['PACKAGE_TARNAME', gdu_name],
+ ['PACKAGE_URL', ''],
+ ['PACKAGE_VERSION', gdu_version],
+ ['VERSION', gdu_version],
+ ['GETTEXT_PACKAGE', gdu_name]
+]
+
+foreach define: set_defines
+ config_h.set_quoted(define[0], define[1])
+endforeach
+
+# headers
+check_headers = [
+ ['HAVE_DLFCN_H', 'dlfcn.h'],
+ ['HAVE_INTTYPES_H', 'inttypes.h'],
+ ['HAVE_MEMORY_H', 'memory.h'],
+ ['HAVE_STDINT_H', 'stdint.h'],
+ ['HAVE_STDLIB_H', 'stdlib.h'],
+ ['HAVE_STRINGS_H', 'strings.h'],
+ ['HAVE_STRING_H', 'string.h'],
+ ['HAVE_SYS_STAT_H', 'sys/stat.h'],
+ ['HAVE_SYS_TYPES_H', 'sys/types.h'],
+ ['HAVE_UNISTD_H', 'unistd.h']
+]
+
+foreach header: check_headers
+ if cc.has_header(header[1])
+ config_h.set(header[0], true)
+ endif
+endforeach
+
+# functions
+check_functions = [
+ ['HAVE_DCGETTEXT', 'dcgettext'],
+ ['HAVE_GETTEXT', 'gettext'],
+ ['HAVE_ICONV', 'iconv'],
+ ['HAVE_MEMSET', 'memset'],
+ ['HAVE_SETLOCALE', 'setlocale'],
+ ['HAVE_STRSTR', 'strstr']
+]
+
+if host_machine.system().contains('darwin')
+ check_functions += [
+ ['HAVE_CFLOCALECOPYCURRENT', 'CFLocaleCopyCurrent'],
+ ['HAVE_CFPREFERENCESCOPYAPPVALUE', 'CFPreferencesCopyAppValue']
+ ]
+endif
+
+foreach func: check_functions
+ if cc.has_function(func[1])
+ config_h.set(func[0], true)
+ endif
+endforeach
+
+message('Checking for valid fallocate() function')
+
+fallocate_src = '''
+ #include <unistd.h>
+ #include <sys/types.h>
+ #include <linux/falloc.h>
+ #include <fcntl.h>
+ int main() {
+ long ret;
+
+ ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
+ if (ret != 0) {
+ return 1;
+ }
+ };
+'''
+config_h.set('HAVE_FALLOCATE', cc.run(fallocate_src).returncode())
+
+# compiler flags
+common_flags = ['-DHAVE_CONFIG_H']
+gdu_cflags = []
+
+buildtype = get_option('buildtype')
+if buildtype == 'debug' or buildtype == 'debugoptimized'
+ test_cflags = [
+ '-fno-strict-aliasing',
+ '-Wcast-align',
+ '-Wdeclaration-after-statement',
+ '-Wformat=2',
+ '-Winit-self',
+ '-Winline',
+ '-Wmissing-declarations',
+ '-Wmissing-format-attribute',
+ '-Wmissing-include-dirs',
+ '-Wmissing-noreturn',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wno-error=missing-field-initializers',
+ '-Wno-error=unused-parameter',
+ '-Wno-missing-field-initializers',
+ '-Wno-unused-parameter',
+ '-Wold-style-definition',
+ '-Wpacked',
+ '-Wredundant-decls',
+ '-Wshadow',
+ '-Wsign-compare',
+ '-Wstrict-aliasing',
+ '-Wstrict-prototypes',
+ '-Wswitch-default',
+ '-Wswitch-enum',
+ '-Wundef',
+ '-Wunused-but-set-variable',
+ '-Wwrite-strings'
+ ]
+
+ foreach cflag: test_cflags
+ if cc.has_argument(cflag)
+ gdu_cflags += [cflag]
+ endif
+ endforeach
+endif
+
+add_project_arguments(common_flags + gdu_cflags, language: 'c')
+
+gmodule_dep = dependency('gmodule-2.0')
+gio_unix_dep = dependency('gio-unix-2.0', version: '>= 2.31.0')
+udisk_dep = dependency('udisks2', version: '>= 2.1.1')
+gtk_dep = dependency('gtk+-3.0', version: '>= 3.16.0')
+libsecret_dep = dependency('libsecret-1', version: '>= 0.7')
+pwquality_dep = dependency('pwquality', version: '>= 1.0.0')
+libcanberra_dep = dependency('libcanberra-gtk3', version: '>= 0.1')
+dvdread_dep = dependency('dvdread', version: '>= 4.2.0')
+libnotify_dep = dependency('libnotify', version: '>= 0.7')
+liblzma_dep = dependency('liblzma', version: '>= 5.0.5')
+m_dep = cc.find_library('m')
+
+# *** Check for libsystemd ***
+enable_libsystemd = get_option('enable-libsystemd')
+if enable_libsystemd
+ libsystemd_dep = dependency('libsystemd', version: '>= 209', required: false)
+ config_h.set('HAVE_LIBSYSTEMD', libsystemd_dep.found(),
+ description: 'Define to 1 if libsystemd is available')
+endif
+
+configure_file(
+ output: 'config.h',
+ configuration: config_h
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+top_inc = include_directories('.', 'src')
+
+subdir('src/libgdu')
+subdir('src/disks')
+subdir('src/disk-image-mounter')
+
+# *** gnome-settings-daemon plug-in ***
+enable_gsd_plugin = get_option('enable-gsd-plugin')
+if enable_gsd_plugin
+ subdir('src/notify')
+endif
+
+subdir('data')
+subdir('po')
+subdir('doc/man')
+
+meson.add_install_script('meson_post_install.py')
+
+output = '\n gnome-disk-utility ' + gdu_version + '\n'
+output += ' =========================\n\n'
+output += ' prefix: ' + gdu_prefix + '\n'
+output += ' bindir: ' + gdu_bindir + '\n'
+output += ' datadir: ' + gdu_datadir + '\n'
+output += ' libexecdir: ' + gdu_libexecdir + '\n'
+output += ' localedir: ' + gdu_localedir + '\n'
+output += ' mandir: ' + gdu_mandir + '\n'
+output += ' sysconfdir: ' + gdu_sysconfdir + '\n\n'
+output += ' Use libsystemd: ' + enable_libsystemd.to_string() + '\n'
+output += ' Build g-s-d plug-in: ' + enable_gsd_plugin.to_string() + '\n\n'
+output += ' compiler: ' + cc.get_id() + '\n'
+output += ' cflags: ' + ' '.join(gdu_cflags) + '\n'
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..6474b48
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,2 @@
+option('enable-libsystemd', type: 'boolean', value: true, description: 'build with libsystemd')
+option('enable-gsd-plugin', type: 'boolean', value: true, description: 'build gnome-settings-daemon plug-in')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..bf320a9
--- /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 0000000..74eacaf
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(gdu_name, preset: 'glib')
diff --git a/src/disk-image-mounter/meson.build b/src/disk-image-mounter/meson.build
new file mode 100644
index 0000000..8a43f23
--- /dev/null
+++ b/src/disk-image-mounter/meson.build
@@ -0,0 +1,25 @@
+name = 'gnome-disk-image-mounter'
+
+deps = [
+ gmodule_dep,
+ gio_unix_dep,
+ udisk_dep,
+ gtk_dep,
+ libgdu_dep
+]
+
+cflags = [
+ '-DPACKAGE_DATA_DIR="@0@"'.format(gdu_datadir),
+ '-DG_LOG_DOMAIN="@0@"'.format(name),
+ '-DGNOMELOCALEDIR="@0@"'.format(gdu_localedir)
+]
+
+executable(
+ name,
+ ['main.c'] + libgduenumtypes,
+ include_directories: top_inc,
+ dependencies: deps,
+ c_args: cflags,
+ install: true,
+ install_dir: gdu_bindir
+)
diff --git a/src/disks/meson.build b/src/disks/meson.build
new file mode 100644
index 0000000..6c0c0e7
--- /dev/null
+++ b/src/disks/meson.build
@@ -0,0 +1,105 @@
+name = 'GNOME-Disks'
+
+enum_headers = files('gduenums.h')
+
+sources = files(
+ 'gduapplication.c',
+ 'gduatasmartdialog.c',
+ 'gdubenchmarkdialog.c',
+ 'gduchangepassphrasedialog.c',
+ 'gducreatediskimagedialog.c',
+ 'gducreatefilesystemwidget.c',
+ 'gducreatepartitiondialog.c',
+ 'gducrypttabdialog.c',
+ 'gdudevicetreemodel.c',
+ 'gdudisksettingsdialog.c',
+ 'gdudvdsupport.c',
+ 'gduestimator.c',
+ 'gdufilesystemdialog.c',
+ 'gduformatdiskdialog.c',
+ 'gduformatvolumedialog.c',
+ 'gdufstabdialog.c',
+ 'gdulocaljob.c',
+ 'gdunewdiskimagedialog.c',
+ 'gdupartitiondialog.c',
+ 'gdupasswordstrengthwidget.c',
+ 'gdurestorediskimagedialog.c',
+ 'gduunlockdialog.c',
+ 'gduvolumegrid.c',
+ 'gduwindow.c',
+ 'gduxzdecompressor.c',
+ 'main.c'
+)
+
+resource_data = files(
+ 'ui/about-dialog.ui',
+ 'ui/app-menu.ui',
+ 'ui/benchmark-dialog.ui',
+ 'ui/change-passphrase-dialog.ui',
+ 'ui/create-disk-image-dialog.ui',
+ 'ui/create-partition-dialog.ui',
+ 'ui/disk-settings-dialog.ui',
+ 'ui/disks.ui',
+ 'ui/edit-crypttab-dialog.ui',
+ 'ui/edit-dos-partition-dialog.ui',
+ 'ui/edit-gpt-partition-dialog.ui',
+ 'ui/edit-filesystem-dialog.ui',
+ 'ui/edit-fstab-dialog.ui',
+ 'ui/edit-partition-dialog.ui',
+ 'ui/erase-multiple-disks-dialog.ui',
+ 'ui/filesystem-create.ui',
+ 'ui/format-disk-dialog.ui',
+ 'ui/format-volume-dialog.ui',
+ 'ui/gdu.css',
+ 'ui/new-disk-image-dialog.ui',
+ 'ui/restore-disk-image-dialog.ui',
+ 'ui/smart-dialog.ui',
+ 'ui/unlock-device-dialog.ui'
+)
+
+sources += gnome.compile_resources(
+ 'resources',
+ 'gnome-disks.gresource.xml',
+ source_dir: '.',
+ dependencies: resource_data,
+ export: true
+)
+
+enum = 'gduenumtypes'
+
+sources += gnome.mkenums(
+ enum,
+ sources: enum_headers,
+ c_template: enum + '.c.template',
+ h_template: enum + '.h.template'
+)
+
+deps = [
+ gmodule_dep,
+ gio_unix_dep,
+ udisk_dep,
+ gtk_dep,
+ libsecret_dep,
+ pwquality_dep,
+ libcanberra_dep,
+ dvdread_dep,
+ liblzma_dep,
+ libgdu_dep,
+ m_dep
+]
+
+cflags = [
+ '-DPACKAGE_DATA_DIR="@0@"'.format(gdu_datadir),
+ '-DG_LOG_DOMAIN="@0@"'.format(name),
+ '-DGNOMELOCALEDIR="@0@"'.format(gdu_localedir)
+]
+
+executable(
+ name.to_lower(),
+ sources,
+ include_directories: top_inc,
+ dependencies: deps,
+ c_args: cflags,
+ install: true,
+ install_dir: gdu_bindir
+)
diff --git a/src/libgdu/meson.build b/src/libgdu/meson.build
new file mode 100644
index 0000000..00f7edd
--- /dev/null
+++ b/src/libgdu/meson.build
@@ -0,0 +1,46 @@
+enum_headers = files('libgduenums.h')
+
+sources = files('gduutils.c')
+
+enum = 'libgduenumtypes'
+
+libgduenumtypes = gnome.mkenums(
+ enum,
+ sources: enum_headers,
+ c_template: enum + '.c.template',
+ h_template: enum + '.h.template'
+)
+
+deps = [
+ gmodule_dep,
+ gio_unix_dep,
+ udisk_dep,
+ gtk_dep,
+ libsecret_dep,
+ pwquality_dep,
+ m_dep
+]
+
+if enable_libsystemd
+ deps += libsystemd_dep
+endif
+
+cflags = [
+ '-DPACKAGE_DATA_DIR="@0@"'.format(gdu_datadir),
+ '-DG_LOG_DOMAIN="libgdu"',
+ '-DGNOMELOCALEDIR="@0@"'.format(gdu_localedir)
+]
+
+libgdu = static_library(
+ 'gdu',
+ sources: sources + libgduenumtypes,
+ include_directories: top_inc,
+ dependencies: deps,
+ c_args: cflags
+)
+
+libgdu_dep = declare_dependency(
+ link_with: libgdu,
+ include_directories: include_directories('.'),
+ dependencies: deps
+)
diff --git a/src/notify/meson.build b/src/notify/meson.build
new file mode 100644
index 0000000..5a22a47
--- /dev/null
+++ b/src/notify/meson.build
@@ -0,0 +1,34 @@
+sources = files(
+ 'gdusdmonitor.c',
+ 'main.c'
+)
+
+deps = [
+ gmodule_dep,
+ gio_unix_dep,
+ udisk_dep,
+ gtk_dep,
+ libnotify_dep
+]
+
+executable(
+ 'gsd-disk-utility-notify',
+ sources,
+ include_directories: top_inc,
+ dependencies: deps,
+ install: true,
+ install_dir: gdu_libexecdir
+)
+
+desktop_conf = configuration_data()
+desktop_conf.set('libexecdir', gdu_libexecdir)
+
+desktop = 'org.gnome.SettingsDaemon.DiskUtilityNotify.desktop'
+
+configure_file(
+ input: desktop + '.in',
+ output: desktop,
+ configuration: desktop_conf,
+ install: true,
+ install_dir: join_paths(gdu_sysconfdir, 'xdg', 'autostart')
+)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]