[gnome-session] build: Port to meson build system
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] build: Port to meson build system
- Date: Thu, 16 Nov 2017 14:35:53 +0000 (UTC)
commit eeefdc8e1a436d0c58cea756e8a3ea63e59145b5
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Sun Sep 17 22:19:10 2017 +0200
build: Port to meson build system
meson is a build system focused on speed an ease of use, which
helps speeding up the software development. This patch adds meson
support along autotools.
https://bugzilla.gnome.org/show_bug.cgi?id=787806
Makefile.am | 10 +-
data/Makefile.am | 3 +-
data/meson.build | 94 +++++++++
doc/Makefile.am | 2 +
doc/dbus/Makefile.am | 3 +-
doc/dbus/meson.build | 46 +++++
doc/man/Makefile.am | 1 +
doc/man/meson.build | 43 ++++
doc/meson.build | 9 +
gnome-session/Makefile.am | 1 +
gnome-session/meson.build | 111 +++++++++++
meson.build | 369 ++++++++++++++++++++++++++++++++++++
meson_options.txt | 9 +
meson_post_install.py | 21 ++
po/meson.build | 1 +
tools/Makefile.am | 2 +
tools/meson.build | 67 +++++++
17 files changed, 787 insertions(+), 5 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6560a4e..cc904a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,9 +7,13 @@ SUBDIRS = \
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-EXTRA_DIST = \
- HACKING \
- MAINTAINERS
+EXTRA_DIST = \
+ HACKING \
+ MAINTAINERS \
+ meson.build \
+ meson_options.txt \
+ meson_post_install.py \
+ po/meson.build
MAINTAINERCLEANFILES = \
$(srcdir)/INSTALL \
diff --git a/data/Makefile.am b/data/Makefile.am
index d8c4557..8e8fd91 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -50,7 +50,8 @@ EXTRA_DIST = \
session-selector.ui \
gnome-custom-session.desktop.in \
$(ui_DATA) \
- $(hwcompat_DATA)
+ $(hwcompat_DATA) \
+ meson.build
CLEANFILES = \
$(gsettings_SCHEMAS) \
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..bf7ecfa
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,94 @@
+desktop = 'gnome.desktop'
+
+# FIXME: The same target can not be copied into two directories.
+# There is a workaround in meson_post_install.py until proper solution arises:
+# https://groups.google.com/forum/#!topic/mesonbuild/3iIoYPrN4P0
+custom_target(
+ desktop,
+ input: desktop + '.in',
+ output: desktop,
+ command: intltool_desktop_cmd,
+ install: true,
+ #install_dir: [
+ # join_paths(session_datadir, 'xsessions'),
+ # join_paths(session_datadir, 'wayland-sessions')
+ #]
+ install_dir: join_paths(session_datadir, 'xsessions')
+)
+
+desktop = 'gnome-xorg.desktop'
+
+custom_target(
+ desktop,
+ input: desktop + '.in',
+ output: desktop,
+ command: intltool_desktop_cmd,
+ install: true,
+ install_dir: join_paths(session_datadir, 'xsessions')
+)
+
+sessions = [
+ 'gnome.session',
+ 'gnome-dummy.session'
+]
+
+foreach session: sessions
+ desktop_conf = configuration_data()
+ desktop_conf.set('libexecdir', session_libexecdir)
+
+ desktop = session + '.desktop'
+
+ desktop_in = configure_file(
+ input: desktop + '.in.in',
+ output: desktop + '.in',
+ configuration: desktop_conf
+ )
+
+ custom_target(
+ session,
+ input: desktop_in,
+ output: session,
+ command: intltool_desktop_cmd,
+ install: true,
+ install_dir: join_paths(session_pkgdatadir, 'sessions')
+ )
+endforeach
+
+schema_conf = configuration_data()
+
+schema = 'org.gnome.SessionManager.gschema.xml'
+
+configure_file(
+ input: schema + '.in',
+ output: schema,
+ install: true,
+ install_dir: join_paths(session_datadir, 'glib-2.0', 'schemas'),
+ configuration: schema_conf
+)
+
+install_data(
+ 'gnome-session.convert',
+ install_dir: join_paths(session_datadir, 'GConf', 'gsettings')
+)
+
+data = files('hardware-compatibility')
+
+if enable_session_selector
+ data += files('session-selector.ui')
+
+ desktop = 'gnome-custom-session.desktop'
+
+ custom_target(
+ desktop,
+ input: desktop + '.in',
+ output: desktop,
+ command: intltool_desktop_cmd,
+ install: true,
+ install_dir: join_paths(session_datadir, 'xsessions')
+ )
+endif
+
+install_data(
+ data,
+ install_dir: session_pkgdatadir
+)
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 1129c41..1880e7c 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -4,4 +4,6 @@ if ENABLE_MAN
SUBDIRS += man
endif
+EXTRA_DIST = meson.build
+
-include $(top_srcdir)/git.mk
diff --git a/doc/dbus/Makefile.am b/doc/dbus/Makefile.am
index aedb24c..8c86429 100644
--- a/doc/dbus/Makefile.am
+++ b/doc/dbus/Makefile.am
@@ -43,6 +43,7 @@ EXTRA_DIST = \
config.xsl \
docbook.css \
dbus-introspect-docs.dtd \
- spec-to-docbook.xsl
+ spec-to-docbook.xsl \
+ meson.build
-include $(top_srcdir)/git.mk
diff --git a/doc/dbus/meson.build b/doc/dbus/meson.build
new file mode 100644
index 0000000..12ebce6
--- /dev/null
+++ b/doc/dbus/meson.build
@@ -0,0 +1,46 @@
+ifaces_refs = []
+
+ifaces = [
+ 'org.gnome.SessionManager',
+ 'org.gnome.SessionManager.Client',
+ 'org.gnome.SessionManager.ClientPrivate',
+ 'org.gnome.SessionManager.Inhibitor',
+ 'org.gnome.SessionManager.Presence'
+]
+
+gnome_session_dir = join_paths(meson.source_root(), 'gnome-session')
+spec_to_docbook = files('spec-to-docbook.xsl')
+
+foreach iface: ifaces
+ iface_ref = iface + '.ref.xml'
+
+ ifaces_refs += custom_target(
+ iface_ref,
+ input: files(join_paths(gnome_session_dir, iface + '.xml')),
+ output: iface_ref,
+ command: [xsltproc, '--output', '@OUTPUT@', spec_to_docbook, '@INPUT@']
+ )
+endforeach
+
+session_conf = configuration_data()
+session_conf.set('VERSION', session_version)
+
+session = meson.project_name()
+
+xml_in = configure_file(
+ input: session + '.xml.in',
+ output: session + '.xml',
+ configuration: session_conf
+)
+
+config_xsl = files('config.xsl')
+
+custom_target(
+ session,
+ input: xml_in,
+ output: session + '.html',
+ command: [find_program('xmlto'), 'xhtml-nochunks', '-o', meson.current_build_dir(), '-m', config_xsl,
'@INPUT@'],
+ depends: ifaces_refs,
+ install: true,
+ install_dir: join_paths(session_datadir, 'doc', meson.project_name(), 'dbus')
+)
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index 02e5c62..8c1c22a 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -19,6 +19,7 @@ man_MANS += gnome-session-selector.1
endif
EXTRA_DIST = \
+ meson.build \
gnome-session-inhibit.xml \
gnome-session-selector.xml \
$(man_MANS)
diff --git a/doc/man/meson.build b/doc/man/meson.build
new file mode 100644
index 0000000..4a389bc
--- /dev/null
+++ b/doc/man/meson.build
@@ -0,0 +1,43 @@
+man1_dir = join_paths(session_mandir, 'man1')
+
+xsltproc_cmd = [
+ xsltproc,
+ '--output', '@OUTPUT@',
+ '--nonet',
+ '--stringparam', 'man.output.quietly', '1',
+ '--stringparam', 'funcsynopsis.style', 'ansi',
+ '--stringparam', 'man.th.extra1.suppress', '1',
+ '--stringparam', 'man.authors.section.enabled', '0',
+ '--stringparam', 'man.copyright.section.enabled', '0',
+ 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+ '@INPUT@'
+]
+
+mans = ['gnome-session-inhibit']
+
+if enable_session_selector
+ mans += 'gnome-session-selector'
+endif
+
+foreach man: mans
+ output = man + '.1'
+
+ custom_target(
+ output,
+ input: man + '.xml',
+ output: output,
+ command: xsltproc_cmd,
+ install: true,
+ install_dir: man1_dir
+ )
+endforeach
+
+man_data = files(
+ 'gnome-session.1',
+ 'gnome-session-quit.1'
+)
+
+install_data(
+ man_data,
+ install_dir: man1_dir
+)
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..6d323bb
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,9 @@
+xsltproc = find_program('xsltproc')
+
+if enable_docbook
+ subdir('dbus')
+endif
+
+if enable_man
+ subdir('man')
+endif
diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am
index 86c2842..3aef7b5 100644
--- a/gnome-session/Makefile.am
+++ b/gnome-session/Makefile.am
@@ -205,6 +205,7 @@ BUILT_SOURCES = \
org.gnome.SessionManager.Presence.c
EXTRA_DIST += \
+ meson.build \
README \
org.gnome.SessionManager.xml \
org.gnome.SessionManager.App.xml \
diff --git a/gnome-session/gnome-session.in b/gnome-session/gnome-session.in
old mode 100644
new mode 100755
diff --git a/gnome-session/meson.build b/gnome-session/meson.build
new file mode 100644
index 0000000..7d2f3c0
--- /dev/null
+++ b/gnome-session/meson.build
@@ -0,0 +1,111 @@
+script_conf = configuration_data()
+script_conf.set('libexecdir', session_libexecdir)
+
+script = 'gnome-session'
+
+configure_file(
+ input: script + '.in',
+ output: script,
+ install: true,
+ install_dir: session_bindir,
+ configuration: script_conf
+)
+
+libgsmutil = static_library(
+ 'gsmutil',
+ sources: 'gsm-util.c',
+ include_directories: top_inc,
+ dependencies: session_deps
+)
+
+sources = files(
+ 'gsm-app.c',
+ 'gsm-autostart-app.c',
+ 'gsm-client.c',
+ 'gsm-dbus-client.c',
+ 'gsm-fail-whale.c',
+ 'gsm-inhibitor.c',
+ 'gdm-log.c',
+ 'gsm-manager.c',
+ 'gsm-presence.c',
+ 'gsm-process-helper.c',
+ 'gsm-session-fill.c',
+ 'gsm-session-save.c',
+ 'gsm-shell-extensions.c',
+ 'gsm-shell.c',
+ 'gsm-store.c',
+ 'gsm-system.c',
+ 'gsm-systemd.c',
+ 'gsm-xsmp-client.c',
+ 'gsm-xsmp-server.c',
+ 'main.c'
+)
+
+dbus_ifaces = [
+ ['org.gnome.SessionManager', 'ExportedManager'],
+ ['org.gnome.SessionManager.Client', 'ExportedClient'],
+ ['org.gnome.SessionManager.ClientPrivate', 'ExportedClientPrivate'],
+ ['org.gnome.SessionManager.App', 'ExportedApp'],
+ ['org.gnome.SessionManager.Inhibitor', 'ExportedInhibitor'],
+ ['org.gnome.SessionManager.Presence', 'ExportedPresence']
+]
+
+foreach iface: dbus_ifaces
+ sources += gnome.gdbus_codegen(
+ iface[0],
+ iface[0] + '.xml',
+ interface_prefix: iface[0] + '.',
+ namespace: 'Gsm',
+ annotations: [iface[0], 'org.gtk.GDBus.C.Name', iface[1]]
+ )
+endforeach
+
+if enable_consolekit
+ sources += files('gsm-consolekit.c')
+endif
+
+cflags = [
+ '-DLOCALE_DIR="@0@"'.format(session_localedir),
+ '-DDATA_DIR="@0@"'.format(session_pkgdatadir),
+ '-DLIBEXECDIR="@0@"'.format(session_libexecdir)
+]
+
+executable(
+ meson.project_name() + '-binary',
+ sources,
+ include_directories: top_inc,
+ dependencies: session_bin_deps,
+ c_args: cflags,
+ link_with: libgsmutil,
+ install: true,
+ install_dir: session_libexecdir
+)
+
+sources = files('gsm-fail-whale-dialog.c')
+
+cflags = '-DLOCALE_DIR="@0@"'.format(session_localedir)
+
+executable(
+ meson.project_name() + '-failed',
+ sources,
+ include_directories: top_inc,
+ dependencies: gtk_dep,
+ c_args: cflags,
+ install: true,
+ install_dir: session_libexecdir
+)
+
+units = [
+ ['test-inhibit', [], session_deps + [gtk_dep]],
+ ['test-client-dbus', [], [gio_dep]],
+ ['test-process-helper', files('gsm-process-helper.c'), [gio_dep]]
+]
+
+foreach unit: units
+ executable(
+ unit[0],
+ [unit[0] + '.c'] + unit[1],
+ include_directories: top_inc,
+ dependencies: unit[2]
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..b8659c9
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,369 @@
+project(
+ 'gnome-session', 'c',
+ version: '3.26.0',
+ license: 'GPL2+',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'warning_level=1'
+ ],
+ meson_version: '>= 0.43.0'
+)
+
+session_version = meson.project_version()
+version_array = session_version.split('.')
+session_major_version = version_array[0].to_int()
+session_minor_version = version_array[1].to_int()
+session_micro_version = version_array[2].to_int()
+
+session_api_version = '@0@.0'.format(session_major_version)
+session_api_name = '@0@-@1@'.format(meson.project_name(), session_api_version)
+
+session_prefix = get_option('prefix')
+session_bindir = join_paths(session_prefix, get_option('bindir'))
+session_datadir = join_paths(session_prefix, get_option('datadir'))
+session_libdir = join_paths(session_prefix, get_option('libdir'))
+session_libexecdir = join_paths(session_prefix, get_option('libexecdir'))
+session_localedir = join_paths(session_prefix, get_option('localedir'))
+session_localstatedir = join_paths(session_prefix, get_option('localstatedir'))
+session_mandir = join_paths(session_prefix, get_option('mandir'))
+session_sbindir = join_paths(session_prefix, get_option('sbindir'))
+session_sysconfdir = join_paths(session_prefix, get_option('sysconfdir'))
+
+session_pkgdatadir = join_paths(session_datadir, meson.project_name())
+
+session_debug = get_option('buildtype').contains('debug')
+
+cc = meson.get_compiler('c')
+
+config_h = configuration_data()
+
+# defines
+set_defines = [
+ # package
+ ['PACKAGE', meson.project_name()],
+ ['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=' + meson.project_name()],
+ ['PACKAGE_NAME', meson.project_name()],
+ ['PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), session_version)],
+ ['PACKAGE_TARNAME', meson.project_name()],
+ ['PACKAGE_URL', ''],
+ ['PACKAGE_VERSION', session_version],
+ ['VERSION', session_version],
+ # i18n
+ ['GETTEXT_PACKAGE', session_api_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_LOCALE_H', 'locale.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_PARAM_H', 'sys/param.h'],
+ ['HAVE_SYS_STAT_H', 'sys/stat.h'],
+ ['HAVE_SYS_TYPES_H', 'sys/types.h'],
+ ['HAVE_SYSLOG_H', 'syslog.h'],
+ ['HAVE_UNISTD_H', 'unistd.h']
+]
+
+foreach header: check_headers
+ config_h.set(header[0], cc.has_header(header[1]))
+endforeach
+
+# functions
+check_functions = [
+ # i18n
+ ['HAVE_DCGETTEXT', 'dcgettext'],
+ ['HAVE_GETTEXT', 'gettext'],
+ ['HAVE_ICONV', 'iconv']
+]
+
+if host_machine.system().contains('darwin')
+ check_functions += [
+ ['HAVE_CFLOCALECOPYCURRENT', 'CFLocaleCopyCurrent'],
+ ['HAVE_CFPREFERENCESCOPYAPPVALUE', 'CFPreferencesCopyAppValue']
+ ]
+endif
+
+foreach func: check_functions
+ config_h.set(func[0], cc.has_function(func[1]))
+endforeach
+
+# symbols
+check_symbols = [
+ # i18n
+ ['HAVE_LC_MESSAGES', 'locale.h', 'LC_MESSAGES'],
+ ['HAVE_BIND_TEXTDOMAIN_CODESET', 'libintl.h', 'bind_textdomain_codeset']
+]
+
+# compiler flags
+common_flags = ['-DHAVE_CONFIG_H']
+
+enable_deprecation_flags = get_option('enable-deprecation-flags')
+if enable_deprecation_flags
+ common_flags += [
+ '-DGCONF_DISABLE_DEPRECATED',
+ '-DGCONF_DISABLE_SINGLE_INCLUDES',
+ '-DBONOBO_DISABLE_DEPRECATED',
+ '-DBONOBO_DISABLE_SINGLE_INCLUDES',
+ '-DBONOBO_UI_DISABLE_DEPRECATED',
+ '-DBONOBO_UI_DISABLE_SINGLE_INCLUDES',
+ '-DGNOME_DISABLE_DEPRECATED',
+ '-DGNOME_DISABLE_SINGLE_INCLUDES',
+ '-DLIBGLADE_DISABLE_DEPRECATED',
+ '-DLIBGLADE_DISABLE_SINGLE_INCLUDES',
+ '-DGNOME_VFS_DISABLE_DEPRECATED',
+ '-DGNOME_VFS_DISABLE_SINGLE_INCLUDES',
+ '-DWNCK_DISABLE_DEPRECATED',
+ '-DWNCK_DISABLE_SINGLE_INCLUDES',
+ '-DLIBSOUP_DISABLE_DEPRECATED',
+ '-DLIBSOUP_DISABLE_SINGLE_INCLUDES'
+ ]
+endif
+
+compiler_flags = []
+if session_debug
+ test_cflags = [
+ '-Werror=format=2',
+ '-Werror=implicit-function-declaration',
+ '-Werror=init-self',
+ '-Werror=missing-include-dirs',
+ '-Werror=missing-prototypes',
+ '-Werror=pointer-arith',
+ '-Werror=return-type',
+ '-Wnested-externs',
+ '-Wstrict-prototypes'
+ ]
+
+ foreach cflag: test_cflags
+ if cc.has_argument(cflag)
+ compiler_flags += [cflag]
+ endif
+ endforeach
+endif
+
+add_project_arguments(common_flags + compiler_flags, language: 'c')
+
+glib_req_version = '>= 2.46.0'
+
+gio_dep = dependency('gio-2.0', version: glib_req_version)
+glib_dep = dependency('glib-2.0', version: glib_req_version)
+gtk_dep = dependency('gtk+-3.0', version: '>= 3.18.0')
+ice_dep = dependency('ice')
+sm_dep = dependency('sm')
+x11_dep = dependency('x11')
+
+session_deps = [
+ gio_dep,
+ glib_dep,
+ dependency('gnome-desktop-3.0', version: '>= 3.18.0'),
+ dependency('json-glib-1.0', version: '>= 0.10')
+]
+
+session_bin_deps = session_deps + [
+ ice_dep,
+ sm_dep,
+ x11_dep,
+ dependency('gio-unix-2.0', version: glib_req_version),
+ dependency('xau'),
+ dependency('xext')
+]
+
+enable_session_selector = get_option('enable-session-selector')
+
+# FIXME: We can only support old upower
+# https://bugzilla.gnome.org/show_bug.cgi?id=710383
+upower_glib_dep = dependency('upower-glib', version: '< 0.99.0', required: false)
+session_bin_deps += upower_glib_dep
+
+have_old_power = upower_glib_dep.found()
+config_h.set('HAVE_OLD_UPOWER', have_old_power)
+
+# Check for gconf
+enable_gconf = get_option('enable-gconf')
+if enable_gconf
+ gconf_dep = dependency('gconf-2.0', required: false)
+ assert(gconf_dep.found(), 'GConf support explicitly required, but gconf not found')
+
+ session_bin_deps += gconf_dep
+endif
+config_h.set('HAVE_GCONF', enable_gconf)
+
+# Check for systemd
+session_tracking = 'null backend'
+
+enable_systemd = get_option('enable-systemd')
+if enable_systemd
+ libsystemd_dep = dependency('libsystemd', version: '>= 209', required: false)
+ session_bin_deps += libsystemd_dep
+
+ if not libsystemd_dep.found()
+ libsystemd_login_dep = dependency('libsystemd-login', version: '>= 183', required: false)
+ libsystemd_daemon_dep = dependency('libsystemd-daemon', required: false)
+ libsystemd_journal_dep = dependency('libsystemd-journal', required: false)
+ assert(libsystemd_login_dep.found() and libsystemd_daemon_dep.found() and libsystemd_journal_dep.found(),
+ 'Systemd support explicitly required, but systemd not found')
+
+ session_bin_deps += [
+ libsystemd_login_dep,
+ libsystemd_daemon_dep,
+ libsystemd_journal_dep
+ ]
+ endif
+
+ session_tracking = 'systemd'
+endif
+config_h.set('HAVE_SYSTEMD', enable_systemd)
+
+# Check for ConsoleKit
+enable_consolekit = get_option('enable-consolekit')
+if enable_consolekit
+ dbus_glib_dep = dependency('dbus-glib-1', version: '>= 0.76')
+ assert(dbus_glib_dep.found(), 'ConsoleKit support explicitly required, but dbus-glib not found')
+
+ session_bin_deps += dbus_glib_dep
+
+ if enable_systemd
+ session_tracking += ' (with fallback to ConsoleKit)'
+ else
+ session_tracking = 'ConsoleKit'
+ endif
+endif
+config_h.set('HAVE_CONSOLEKIT', enable_consolekit)
+
+# Check for XSync extension
+have_xsync = cc.has_header('X11/extensions/sync.h')
+config_h.set('HAVE_XSYNC', have_xsync,
+ description: 'Have the SYNC extension library')
+
+# Check for XTest extension
+xtest_dep = dependency('xtst', required: false)
+session_bin_deps += xtest_dep
+
+have_xtest = xtest_dep.found()
+config_h.set('HAVE_XTEST', have_xtest,
+ description: 'Have the XTest extension library')
+
+# XRender checks
+xrender_dep = dependency('xrender', required: false)
+session_bin_deps += xrender_dep
+
+have_xrender = xrender_dep.found()
+config_h.set('HAVE_XRENDER', have_xrender,
+ description: 'Have the Render X extension')
+
+# Check for X transport interface - allows to disable ICE Transports
+# See also https://bugzilla.gnome.org/show_bug.cgi?id=725100
+enable_xtrans = get_option('enable-xtrans')
+have_xtrans = false
+
+if enable_xtrans
+ xtrans_dep = dependency('xtrans')
+ have_xtrans = xtrans_dep.found()
+endif
+config_h.set10('HAVE_XTRANS', have_xtrans,
+ description: 'Have the X Transport library')
+
+# Code for checking whether IPv6 is enabled on the system....
+enable_ipv6 = get_option('enable-ipv6')
+have_ipv6 = false
+
+if enable_ipv6
+ # Code for checking presence of AF_INET6 on the system....
+ ipv6_src = '''
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ int main () {
+ socket(AF_INET6, SOCK_STREAM, 0);
+ };
+ '''
+ have_ipv6 = cc.compiles(ipv6_src)
+
+ # Now we would check for specific function like getaddrinfo.
+ if cc.compiles(ipv6_src)
+ have_ipv6 = cc.has_function('getaddrinfo')
+
+ if not have_ipv6
+ foreach lib: ['bsd', 'socket', 'inet']
+ # FIXME: this condition is due to not able to break the loop
+ if not have_ipv6
+ dep = dependency(lib, required: false)
+ have_ipv6 = dep.found() and cc.has_function('getaddrinfo', dependencies: dep)
+
+ if have_ipv6
+ session_bin_deps += dep
+ endif
+ endif
+ endforeach
+ endif
+ endif
+endif
+config_h.set('ENABLE_IPV6', have_ipv6,
+ description: 'Define IPV6 is supported')
+
+configure_file(
+ output: 'config.h',
+ configuration: config_h
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+intltool_merge = find_program('intltool-merge')
+intltool_cache = join_paths(po_dir, '.intltool-merge-cache')
+intltool_desktop_cmd = [intltool_merge, '-d', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
+
+top_inc = include_directories('.')
+
+subdir('gnome-session')
+subdir('tools')
+subdir('data')
+
+enable_docbook = get_option('enable-docbook')
+enable_man = get_option('enable-man')
+if enable_docbook or enable_man
+ subdir('doc')
+endif
+
+subdir('po')
+
+meson.add_install_script(
+ 'meson_post_install.py',
+ session_datadir
+)
+
+output = '\n gnome-session ' + session_version + '\n'
+output += ' ====================\n\n'
+output += ' prefix: ' + session_prefix + '\n'
+output += ' exec_prefix: ' + session_libexecdir + '\n'
+output += ' libdir: ' + session_libdir + '\n'
+output += ' bindir: ' + session_bindir + '\n'
+output += ' sbindir: ' + session_sbindir + '\n'
+output += ' sysconfdir: ' + session_sysconfdir + '\n'
+output += ' localstatedir: ' + session_localstatedir + '\n'
+output += ' datadir: ' + session_datadir + '\n'
+output += ' source code location: ' + meson.source_root() + '\n'
+output += ' compiler: ' + cc.get_id() + '\n'
+output += ' cflags: ' + ' '.join(compiler_flags) + '\n'
+output += ' Debug mode: ' + session_debug.to_string() + '\n'
+output += ' Use *_DISABLE_DEPRECATED: ' + enable_deprecation_flags.to_string() + '\n\n'
+output += ' GConf support: ' + enable_gconf.to_string() + '\n'
+output += ' Session tracking: ' + session_tracking + ' \n'
+output += ' IPv6 support: ' + have_ipv6.to_string() + '\n'
+output += ' XRender support: ' + have_xrender.to_string() + '\n'
+output += ' XSync support: ' + have_xsync.to_string() + '\n'
+output += ' XTest support: ' + have_xtest.to_string() + '\n'
+output += ' Legacy UPower backend: ' + have_old_power.to_string() + '\n'
+output += ' Build Docbook: ' + enable_docbook.to_string() + '\n'
+output += ' Build manpages: ' + enable_man.to_string()
+message(output)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..7cadb91
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,9 @@
+option('enable-deprecation-flags', type: 'boolean', value: false, description: 'use *_DISABLE_DEPRECATED
flags')
+option('enable-session-selector', type: 'boolean', value: false, description: 'enable building a custom
session selector dialog')
+option('enable-gconf', type: 'boolean', value: false, description: 'Support gconf-based autostart')
+option('enable-systemd', type: 'boolean', value: false, description: 'Use systemd')
+option('enable-consolekit', type: 'boolean', value: false, description: 'Use consolekit')
+option('enable-docbook', type: 'boolean', value: false, description: 'build documentation')
+option('enable-man', type: 'boolean', value: false, description: 'build documentation (requires xmlto)')
+option('enable-ipv6', type: 'boolean', value: false, description: 'enable IPv6 extensions')
+option('enable-xtrans', type: 'boolean', value: true, description: 'Build without xtrans support (results in
ICE listening on remote TCP ports)')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..54361bf
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+import subprocess
+import sys
+
+if not os.environ.get('DESTDIR'):
+ schemadir = os.path.join(sys.argv[1], 'glib-2.0', 'schemas')
+ print('Compile gsettings schemas...')
+ subprocess.call(['glib-compile-schemas', schemadir])
+
+ # FIXME: this is due to unable to copy a generated target file:
+ # https://groups.google.com/forum/#!topic/mesonbuild/3iIoYPrN4P0
+ dst_dir = os.path.join(sys.argv[1], 'wayland-sessions')
+ if not os.path.exists(dst_dir):
+ os.makedirs(dst_dir)
+
+ src = os.path.join(sys.argv[1], 'xsessions', 'gnome.desktop')
+ dst = os.path.join(dst_dir, 'gnome.desktop')
+ shutil.copyfile(src, dst)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..77bf1ff
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(session_api_name, preset: 'glib')
diff --git a/tools/Makefile.am b/tools/Makefile.am
index d3b8bf3..4b04796 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -101,4 +101,6 @@ gnome_session_selector_SOURCES = \
gnome-session-selector.c
endif
+EXTRA_DIST = meson.build
+
-include $(top_srcdir)/git.mk
diff --git a/tools/gnome-session-custom-session b/tools/gnome-session-custom-session
old mode 100644
new mode 100755
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..10ee918
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,67 @@
+install_data(
+ 'gnome-session-custom-session',
+ install_dir: session_bindir
+)
+
+deps = session_deps + [
+ sm_dep,
+ ice_dep
+]
+
+cflags = ['-DLOCALE_DIR="@0@"'.format(session_localedir)]
+
+programs = [
+ # name, deps, cflags, install_dir
+ ['gnome-session-quit', deps, cflags, session_bindir],
+ ['gnome-session-inhibit', session_deps, cflags, session_bindir]
+]
+
+if enable_session_selector
+ deps = [
+ glib_dep,
+ gtk_dep
+ ]
+
+ cflags += '-DGTKBUILDER_DIR="@0@"'.format(session_pkgdatadir)
+
+ programs += [['gnome-session-selector', deps, cflags, session_bindir]]
+endif
+
+deps = [
+ gtk_dep,
+ x11_dep,
+ dependency('egl'),
+ dependency('glesv2')
+]
+
+cflags = '-DPKGDATADIR="@0@"'.format(session_pkgdatadir)
+
+programs += [['gnome-session-check-accelerated-gles-helper', deps, cflags, session_libexecdir]]
+
+deps = [
+ glib_dep,
+ x11_dep,
+ dependency('gl'),
+ dependency('epoxy'),
+ dependency('xcomposite')
+]
+
+programs += [['gnome-session-check-accelerated-gl-helper', deps, cflags, session_libexecdir]]
+
+deps += [gtk_dep]
+
+cflags = '-DLIBEXECDIR="@0@"'.format(session_libexecdir)
+
+programs += [['gnome-session-check-accelerated', deps, cflags, session_libexecdir]]
+
+foreach program: programs
+ executable(
+ program[0],
+ program[0] + '.c',
+ include_directories: top_inc,
+ dependencies: program[1],
+ c_args: program[2],
+ install: true,
+ install_dir: program[3]
+ )
+endforeach
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]