[gnome-user-share] build: Port to meson build system
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-user-share] build: Port to meson build system
- Date: Thu, 11 Apr 2019 11:06:08 +0000 (UTC)
commit 2c76854a4ba1d05a05e26425b844716275067e7c
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Mon Apr 8 10:04:02 2019 +0200
build: Port to meson build system
meson is a build system focused on speed and ease of use, which
helps speed up software development. This patch adds meson support
alongside autotools.
data/meson.build | 47 ++++++++++++++++++
meson.build | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 6 +++
meson_post_install.py | 9 ++++
po/meson.build | 1 +
src/meson.build | 70 +++++++++++++++++++++++++++
6 files changed, 264 insertions(+)
---
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..bedfe11
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,47 @@
+desktop = 'gnome-user-share-webdav.desktop'
+
+desktop_in = configure_file(
+ input: desktop + '.in.in',
+ output: '@BASENAME@',
+ configuration: {'libexecdir': user_share_prefix / user_share_libexecdir},
+)
+
+i18n.merge_file(
+ desktop,
+ type: 'desktop',
+ input: desktop_in,
+ output: '@BASENAME@',
+ po_dir: po_dir,
+ install: true,
+ install_dir: user_share_datadir / 'applications',
+)
+
+configure_file(
+ input: 'gnome-user-share-webdav.service.in',
+ output: '@BASENAME@',
+ configuration: {'libexecdir': user_share_prefix / user_share_libexecdir},
+ install: true,
+ install_dir: systemd_systemduserunitdir,
+)
+
+app_data = files(
+ 'dav_user_2.0.conf',
+ 'dav_user_2.2.conf',
+ 'dav_user_2.4.conf',
+ 'dav_groupfile',
+)
+
+install_data(
+ app_data,
+ install_dir: user_share_pkgdatadir,
+)
+
+install_data(
+ 'org.gnome.desktop.file-sharing.gschema.xml',
+ install_dir: gio_schemasdir,
+)
+
+install_data(
+ 'gnome-user-share.convert',
+ install_dir: user_share_datadir / 'GConf/gsettings',
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..9ebadd2
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,131 @@
+project(
+ 'gnome-user-share', 'c',
+ version: '3.32.0.1',
+ license: 'GPL2',
+ default_options: 'buildtype=debugoptimized',
+ meson_version: '>= 0.50.0',
+)
+
+user_share_name = meson.project_name()
+
+user_share_prefix = get_option('prefix')
+user_share_bindir = get_option('bindir')
+user_share_datadir = get_option('datadir')
+user_share_libdir = get_option('libdir')
+user_share_libexecdir = get_option('libexecdir')
+user_share_localedir = get_option('localedir')
+
+user_share_pkgdatadir = user_share_datadir / user_share_name
+
+i18n = import('i18n')
+
+source_root = meson.current_source_dir()
+
+po_dir = source_root / 'po'
+
+top_inc = include_directories('.')
+
+cc = meson.get_compiler('c')
+
+config_h = configuration_data()
+
+# i18n
+config_h.set_quoted('GETTEXT_PACKAGE', user_share_name)
+
+# compiler flags
+common_flags = []
+if get_option('buildtype').contains('debug')
+ common_flags += cc.get_supported_arguments([
+ '-Wmissing-declarations',
+ '-Wmissing-prototypes',
+ '-Wcast-align',
+ '-Wnested-externs',
+ '-Wstrict-prototypes',
+ '-Werror=format=2',
+ '-Werror=implicit-function-declaration',
+ '-Werror=init-self',
+ '-Werror=missing-include-dirs',
+ '-Werror=missing-prototypes',
+ '-Werror=pointer-arith',
+ '-Werror=return-type',
+ '-Wno-sign-compare',
+ '-Wno-strict-aliasing',
+ ])
+endif
+
+add_project_arguments(common_flags, language: 'c')
+
+gio_dep = dependency('gio-2.0', version: '>= 2.26')
+gio_unix_dep = dependency('gio-unix-2.0')
+glib_dep = dependency('glib-2.0', version: '>= 2.58')
+gtk_dep = dependency('gtk+-3.0')
+
+# GIO schemas
+gio_schemasdir = gio_dep.get_pkgconfig_variable(
+ 'schemasdir',
+ define_variable: ['datadir', user_share_prefix / user_share_datadir],
+ default: user_share_prefix / user_share_datadir / 'glib-2.0/schemas',
+)
+
+# systemd user unit directory
+systemd_systemduserunitdir = get_option('systemduserunitdir')
+if systemd_systemduserunitdir == ''
+ # FIXME: this would ideally use the systemduserunitdir pkgconfig variable, but
+ # it does not depend on variables we can override to install within prefix.
+ #systemd_systemduserunitdir = dependency('systemd').get_pkgconfig_variable('systemduserunitdir')
+ systemd_systemduserunitdir = user_share_prefix / user_share_libdir / 'systemd/user'
+endif
+
+httpd = find_program(get_option('httpd'), required: false)
+httpd_path = (httpd.found() ? httpd.path() : '')
+
+sockets_deps = []
+if not cc.has_function('socket')
+ # socket is not in the default libraries. See if it's in some other.
+ foreach lib: ['bsd', 'socket', 'inet']
+ socket_dep = cc.find_library(
+ lib,
+ has_function: 'socket',
+ required: false,
+ )
+
+ if socket_dep.found()
+ sockets_deps += socket_dep
+ break
+ endif
+ endforeach
+endif
+
+# Check for SELinux
+libselinux_dep = dependency('libselinux', required: false)
+have_selinux = libselinux_dep.found() and cc.has_function('is_selinux_enabled', dependencies: libselinux_dep)
+config_h.set('HAVE_SELINUX', have_selinux)
+
+# Check for the HTTPD modules path
+modules_path = get_option('modules_path')
+
+# Check for nautilus for the share bar
+libnautilus_extension_dep = dependency('libnautilus-extension', version: '>= 3.27.90')
+libnautilus_extension_extensiondir = libnautilus_extension_dep.get_pkgconfig_variable('extensiondir',
define_variable: ['libdir', user_share_prefix / user_share_libdir])
+message('installing nautilus plugin in: ' + libnautilus_extension_extensiondir)
+
+subdir('data')
+subdir('po')
+subdir('src')
+
+configure_file(
+ output: 'config.h',
+ configuration: config_h,
+)
+
+meson.add_install_script(
+ 'meson_post_install.py',
+ gio_schemasdir,
+)
+
+output = user_share_name + ' was configured with the following options:\n'
+output += '** httpd location: ' + httpd_path + '\n'
+output += '** httpd modules_path: ' + modules_path + '\n'
+output += '** nautilus extension path: ' + libnautilus_extension_extensiondir + '\n\n'
+output += 'Do note Apache 2.2 and mod_dnssd 0.6 are required to use ' + user_share_name + '.'
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..8e4cbaf
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,6 @@
+option('systemduserunitdir', type: 'string', value: '', description: 'custom directory for systemd user
units')
+
+option('nautilus_extension', type: 'boolean', value: false, description: 'Enable nautilus extension')
+
+option('httpd', type: 'array', value: ['httpd', '/usr/sbin/httpd', 'apache2', '/usr/sbin/apache2', 'httpd2',
'/usr/sbin/httpd2'], description: 'Specify the binary used for the Apache httpd binary (default: httpd)')
+option('modules_path', type: 'string', value: '/etc/httpd/modules/', description: 'Path where the httpd
modules are located (default: /etc/httpd/modules/')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..780ad3d
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+import sys
+
+if not os.environ.get('DESTDIR'):
+ print('Compiling gsettings schemas...')
+ subprocess.call(['glib-compile-schemas', sys.argv[1]])
\ No newline at end of file
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..4253621
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(user_share_name, preset: 'glib')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..4f4a725
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,70 @@
+common_c_flags = ['-DGNOMELOCALEDIR="@0@"'.format(user_share_prefix / user_share_localedir)]
+
+deps = [
+ gio_dep,
+ glib_dep,
+]
+
+libuser_share_common = static_library(
+ 'user-share-common',
+ sources: 'user_share-common.c',
+ dependencies: deps,
+)
+
+libuser_share_common_dep = declare_dependency(
+ include_directories: '.',
+ dependencies: deps,
+ link_with: libuser_share_common,
+)
+
+sources = files(
+ 'http.c',
+ 'user_share-private.c',
+ 'user_share-webdav.c',
+)
+
+deps = sockets_deps + [
+ gio_unix_dep,
+ libuser_share_common_dep,
+]
+
+c_flags = common_c_flags + [
+ '-DHTTPD_CONFIG_TEMPLATE="@0@"'.format(user_share_prefix / user_share_pkgdatadir / 'dav_user_%s.conf'),
+ '-DHTTPD_PROGRAM="@0@"'.format(httpd_path),
+ '-DHTTPD_MODULES_PATH="@0@"'.format(modules_path),
+]
+
+if have_selinux
+ deps += libselinux_dep
+endif
+
+executable(
+ 'gnome-user-share-webdav',
+ sources: sources,
+ include_directories: top_inc,
+ dependencies: deps,
+ c_args: c_flags,
+ install: true,
+ install_dir: user_share_libexecdir,
+)
+
+sources = files(
+ 'nautilus-share-bar.c',
+ 'share-extension.c',
+)
+
+deps = [
+ gtk_dep,
+ libnautilus_extension_dep,
+ libuser_share_common_dep,
+]
+
+shared_module(
+ 'nautilus-share-extension',
+ sources: sources,
+ include_directories: top_inc,
+ dependencies: deps,
+ c_args: common_c_flags,
+ install: true,
+ install_dir: libnautilus_extension_extensiondir,
+)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]