From 6e91a9b03c5d76cdd72af4446b07d8da67a44585 Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Sun, 22 Jul 2018 10:36:48 +0200 Subject: Allow building GDM with Meson. WIP WIP WIP WIP Solves #350. --- build-aux/autodetect-pam-config.py | 17 +++ build-aux/find-x-server.sh | 34 +++++ chooser/meson.build | 50 ++++++++ common/meson.build | 34 +++++ daemon/meson.build | 166 +++++++++++++++++++++++++ data/applications/meson.build | 16 +++ data/autostart/meson.build | 12 ++ data/dconf/meson.build | 11 ++ data/meson.build | 69 +++++++++++ data/pixmaps/meson.build | 24 ++++ libgdm/meson.build | 59 +++++++++ meson.build | 247 +++++++++++++++++++++++++++++++++++++ meson_options.txt | 44 +++++++ pam-extensions/meson.build | 17 +++ pam_gdm/meson.build | 16 +++ po/meson.build | 3 + tests/meson.build | 17 +++ utils/meson.build | 41 ++++++ 18 files changed, 877 insertions(+) create mode 100755 build-aux/autodetect-pam-config.py create mode 100755 build-aux/find-x-server.sh create mode 100644 chooser/meson.build create mode 100644 common/meson.build create mode 100644 daemon/meson.build create mode 100644 data/applications/meson.build create mode 100644 data/autostart/meson.build create mode 100644 data/dconf/meson.build create mode 100644 data/meson.build create mode 100644 data/pixmaps/meson.build create mode 100644 libgdm/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 pam-extensions/meson.build create mode 100644 pam_gdm/meson.build create mode 100644 po/meson.build create mode 100644 tests/meson.build create mode 100644 utils/meson.build diff --git a/build-aux/autodetect-pam-config.py b/build-aux/autodetect-pam-config.py new file mode 100755 index 00000000..549186ba --- /dev/null +++ b/build-aux/autodetect-pam-config.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +import os; + +pam_configs = [('redhat', 'redhat'), + ('fedora', 'redhat'), + ('exherbo', 'exherbo'), + ('arch', 'arch'), + ('lfs', 'lfs')] + +for distro, pam_config in pam_configs: + release_file = os.path.join('/', 'etc', '{}-release'.format(distro)) + if os.path.exists(release_file): + print(pam_config) + exit(0) + +print('none') diff --git a/build-aux/find-x-server.sh b/build-aux/find-x-server.sh new file mode 100755 index 00000000..b5a80750 --- /dev/null +++ b/build-aux/find-x-server.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# +# First check with "! -h" for /usr/X11R6 and /usr/X11 since they often +# symlink to each other, and configure should use the more stable +# location (the real directory) if possible. +# +# On Solaris, the /usr/bin/Xserver script is used to decide whether to +# use Xsun or Xorg, so this is used on Solaris. +# +# When testing for /usr/X11R6, first check with "! -h" for /usr/X11R6 +# and /usr/X11 since they often symlink to each other, and configure +# should use the more stable location (the real directory) if possible. +# +if test -x /usr/bin/X; then + echo "/usr/bin/X" +elif test -x /usr/X11/bin/Xserver; then + echo "/usr/X11/bin/Xserver" +elif test ! -h /usr/X11R6 -a -x /usr/X11R6/bin/X; then + echo "/usr/X11R6/bin/X" +elif test ! -h /usr/X11 -a -x /usr/X11/bin/X; then + echo "/usr/X11/bin/X" +elif test -x /usr/X11R6/bin/X; then + echo "/usr/X11R6/bin/X" +elif test -x /usr/bin/Xorg; then + echo "/usr/bin/Xorg" +elif test -x /usr/X11/bin/X; then + echo "/usr/X11/bin/X" +elif test -x /usr/openwin/bin/Xsun; then + echo "/usr/openwin/bin/Xsun" +elif test -x /opt/X11R6/bin/X; then + echo "/opt/X11R6/bin/X" +else + echo "" +fi diff --git a/chooser/meson.build b/chooser/meson.build new file mode 100644 index 00000000..b20f6009 --- /dev/null +++ b/chooser/meson.build @@ -0,0 +1,50 @@ +# Simple chooser +gdm_simple_chooser_src = [ + 'chooser-main.c', + 'gdm-chooser-host.c', + 'gdm-chooser-session.c', + 'gdm-host-chooser-dialog.c', + 'gdm-host-chooser-widget.c', +] + +gdm_simple_chooser_deps = [ + glib_dep, + gtk_dep, + libgdmcommon_dep, + libgdm_dep, + x_deps, + xdmcp_dep, +] + +gdm_simple_chooser = executable('gdm-simple-chooser', + gdm_simple_chooser_src, + dependencies: gdm_simple_chooser_deps, + include_directories: config_h_dir, + install: true, + install_dir: gdm_libexecdir, +) + +# Host chooser +gdm_host_chooser_src = [ + 'gdm-host-chooser.c', + 'gdm-chooser-host.c', + 'gdm-host-chooser-dialog.c', + 'gdm-host-chooser-widget.c', +] + +gdm_host_chooser_deps = [ + glib_dep, + gtk_dep, + libgdmcommon_dep, + libgdm_dep, + x_deps, + xdmcp_dep, +] + +gdm_host_chooser = executable('gdm-host-chooser', + gdm_host_chooser_src, + dependencies: gdm_host_chooser_deps, + include_directories: config_h_dir, + install: true, + install_dir: gdm_libexecdir, +) diff --git a/common/meson.build b/common/meson.build new file mode 100644 index 00000000..abbca2ff --- /dev/null +++ b/common/meson.build @@ -0,0 +1,34 @@ +libgdmcommon_src = files( + 'gdm-address.c', + 'gdm-common.c', + 'gdm-log.c', + 'gdm-profile.c', + 'gdm-settings-backend.c', + 'gdm-settings-desktop-backend.c', + 'gdm-settings-direct.c', + 'gdm-settings-utils.c', + 'gdm-settings.c', +) + +libgdmcommon_deps = [ + libsystemd_dep, + gobject_dep, + gio_dep, + gio_unix_dep, +] + +if selinux_enabled + libgdmcommon_deps += libselinux_dep +endif + +libgdmcommon_lib = static_library('gdmcommon', + libgdmcommon_src, + dependencies: libgdmcommon_deps, + include_directories: config_h_dir, +) + +libgdmcommon_dep = declare_dependency( + link_with: libgdmcommon_lib, + dependencies: libgdmcommon_deps, + include_directories: include_directories('.'), +) diff --git a/daemon/meson.build b/daemon/meson.build new file mode 100644 index 00000000..0bd35e1b --- /dev/null +++ b/daemon/meson.build @@ -0,0 +1,166 @@ +# D-Bus interfaces +display_dbus_gen = gnome.gdbus_codegen('gdm-display-glue', + 'gdm-display.xml', + namespace: 'GdmDBus', + interface_prefix: 'org.gnome.DisplayManager', +) +local_display_dbus_gen = gnome.gdbus_codegen('gdm-local-display-glue', + 'gdm-local-display.xml', + namespace: 'GdmDBus', + interface_prefix: 'org.gnome.DisplayManager', +) +local_display_factory_dbus_gen = gnome.gdbus_codegen('gdm-local-display-factory-glue', + 'gdm-local-display-factory.xml', + namespace: 'GdmDBus', + interface_prefix: 'org.gnome.DisplayManager', +) +manager_dbus_gen = gnome.gdbus_codegen('gdm-manager-glue', + 'gdm-manager.xml', + namespace: 'GdmDBus', + interface_prefix: 'org.gnome.DisplayManager', +) +session_dbus_gen = gnome.gdbus_codegen('gdm-session-glue', + 'gdm-session.xml', + namespace: 'GdmDBus', + interface_prefix: 'org.gnome.DisplayManager', +) +session_worker_dbus_gen = gnome.gdbus_codegen('gdm-session-worker-glue', + 'gdm-session-worker.xml', + namespace: 'GdmDBus', + interface_prefix: 'org.gnome.DisplayManager', +) + +gdm_session_enums = gnome.mkenums('gdm-session-enum-types', + h_template: 'gdm-session-enum-types.h.in', + c_template: 'gdm-session-enum-types.c.in', + sources: 'gdm-session.h', +) + +# Daemons deps +gdm_daemon_deps = [ + libgdmcommon_dep, + accountsservice_dep, + gobject_dep, + gio_dep, + gio_unix_dep, + libpam_dep, + x_deps, + xcb_dep, +] + +# test-session-client +test_session_client_src = [ + 'test-session-client.c', + session_dbus_gen, + manager_dbus_gen, +] + +test_session_client = executable('test-session-client', + test_session_client_src, + dependencies: gdm_daemon_deps, + include_directories: config_h_dir, +) + +# Session worker +gdm_session_worker_src = [ + 'session-worker-main.c', + 'gdm-session.c', + 'gdm-session-settings.c', + 'gdm-session-auditor.c', + 'gdm-session-record.c', + 'gdm-session-worker.c', + 'gdm-session-worker-job.c', + 'gdm-session-worker-common.c', + 'gdm-dbus-util.c', + session_dbus_gen, + session_worker_dbus_gen, + gdm_session_enums, +] + +gdm_session_worker_includes = [ + config_h_dir, +] + +if pam_extensions_supported + gdm_session_worker_src += '../pam-extensions/gdm-pam-extensions.h' + gdm_session_worker_includes += pam_extensions_includedir +endif + +# TODO +# if libaudit +# endif + +# TODO +# if ADT +# endif + +gdm_session_worker = executable('gdm-session-worker', + gdm_session_worker_src, + dependencies: gdm_daemon_deps, + include_directories: gdm_session_worker_includes, + install: true, + install_dir: gdm_libexecdir, +) + +# Wayland session +gdm_wayland_session_src = [ + 'gdm-wayland-session.c', + manager_dbus_gen, +] + +gdm_wayland_session = executable('gdm-wayland-session', + gdm_wayland_session_src, + dependencies: gdm_daemon_deps, + include_directories: gdm_session_worker_includes, + install: true, + install_dir: gdm_libexecdir, +) + +# X session +# gdm_x_session_src = [ +# 'gdm-x-session.c', +# manager_dbus_gen, +# ] +# +# gdm_x_session = executable('gdm-x-session', +# gdm_x_session_src, +# dependencies: gdm_daemon_deps, +# include_directories: gdm_session_worker_includes, +# install: true, +# install_dir: gdm_libexecdir, +# ) + +# GDM daemon +gdm_daemon_src = [ + 'gdm-dbus-util.c', + 'gdm-display-access-file.c', + 'gdm-display-factory.c', + 'gdm-display-store.c', + 'gdm-display.c', + 'gdm-launch-environment.c', + 'gdm-legacy-display.c', + 'gdm-local-display-factory.c', + 'gdm-local-display.c', + 'gdm-manager.c', + 'gdm-server.c', + 'gdm-session-record.c', + 'gdm-session-worker-common.c', + 'gdm-session-worker-job.c', + 'gdm-session.c', + 'main.c', + display_dbus_gen, + local_display_factory_dbus_gen, + manager_dbus_gen, + local_display_dbus_gen, + session_dbus_gen, + session_worker_dbus_gen, + gdm_session_enums, +] + +gdm_daemon = executable('gdm', + gdm_daemon_src, + dependencies: gdm_daemon_deps, + include_directories: config_h_dir, + install: true, + # install_dir: sbindir +) diff --git a/data/applications/meson.build b/data/applications/meson.build new file mode 100644 index 00000000..5b6ceead --- /dev/null +++ b/data/applications/meson.build @@ -0,0 +1,16 @@ +desktop_conf = configuration_data() +# desktop_conf.set('SBINDIR', gdm_sbindir) XXX +desktop_conf.set('SYSCONFDIR', gdm_sysconfdir) +desktop_conf.set('LIBDIR', gdm_libdir) +desktop_conf.set('LIBEXECDIR', gdm_libexecdir) +desktop_conf.set('LOCALSTATEDIR', gdm_localstatedir) + +foreach desktop_file : [ 'mime-dummy-handler.desktop', 'mimeapps.list' ] + configure_file( + input: desktop_file, + output: desktop_file, + configuration: desktop_conf, + install: true, + install_dir: join_paths(gdm_datadir, 'gdm', 'greeter', 'applications'), + ) +endforeach diff --git a/data/autostart/meson.build b/data/autostart/meson.build new file mode 100644 index 00000000..9abd5675 --- /dev/null +++ b/data/autostart/meson.build @@ -0,0 +1,12 @@ +autostart_files_conf = configuration_data() +autostart_files_conf.set('LIBEXECDIR', gdm_libexecdir) + +foreach autostart_file : [ 'orca-autostart.desktop' ] + configure_file( + input: autostart_file, + output: autostart_file, + configuration: autostart_files_conf, + install: true, + install_dir: join_paths(gdm_datadir, 'gdm', 'greeter', 'autostart'), + ) +endforeach diff --git a/data/dconf/meson.build b/data/dconf/meson.build new file mode 100644 index 00000000..46f32cfb --- /dev/null +++ b/data/dconf/meson.build @@ -0,0 +1,11 @@ + +gdm_dconf_conf = configuration_data() +gdm_dconf_conf.set('DATADIR', gdm_datadir) # XXX correct? +gdm_dconf_conf.set('PACKAGE', meson.project_name()) # XXX correct? +configure_file( + input: 'gdm.in', + output: 'gdm', + configuration: gdm_dconf_conf, + install: true, + install_dir: join_paths(gdm_datadir, 'dconf', 'profile'), +) diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 00000000..d09e0d07 --- /dev/null +++ b/data/meson.build @@ -0,0 +1,69 @@ +subdir('applications') +subdir('autostart') +subdir('pixmaps') + +# XPath configs +x_path_conf = configuration_data() +x_path_conf.set('X_PATH', x_path) #XXX quoted? +foreach file : [ 'Init', 'PreSession', 'PostSession' ] + configure_file( + input: '@0@.in'.format(file), + output: file, + configuration: x_path_conf, + ) +endforeach + +subdir('dconf') + +compiled_gschema = gnome.compile_schemas() +install_data('org.gnome.login-screen.gschema.xml', + install_dir: join_paths(gdm_datadir, 'glib-2.0', 'schemas'), +) + +install_data('locale.alias', + install_dir: join_paths(gdm_datadir, 'gdm'), +) +configure_file( + input: 'gnome-login.session.in', + output: 'gnome-login.session', + configuration: configuration_data(), + install_dir: join_paths(gdm_datadir, 'gnome-session', 'sessions'), +) + +rules_conf = configuration_data() +rules_conf.set('libexecdir', gdm_libexecdir) +configure_file( + input: '61-gdm.rules.in', + output: '61-gdm.rules', + install: true, + configuration: rules_conf, + install_dir: join_paths(gdm_prefix, 'lib', 'udev', 'rules.d'), +) + +# DBus service files +service_config = configuration_data() +# service_config.set('sbindir', join_paths(sbindir)) # XXX +service_config.set('GDM_INITIAL_VT', gdm_initial_vt) # XXX +service_config.set('LANG_CONFIG_FILE', lang_config_file) +service_config.set('PLYMOUTH_QUIT_SERVICE', lang_config_file) # XXX +# XXX more + +configure_file( + input: 'gdm.service.in', + output: 'gdm.service', + configuration: service_config, + install: true, + # install_dir: join_paths(datadir, 'dbus-1', 'services'), XXX systemd unit +) + +# XSession +if install_gdm_xsession + xsession_config = configuration_data() +# xsession_config.set('XSESSION_SHELL', xsession_shell) # XXX + configure_file( + input: 'XSession.in', + output: 'XSession', + install: true, + install_dir: gdmconfdir, + ) +endif diff --git a/data/pixmaps/meson.build b/data/pixmaps/meson.build new file mode 100644 index 00000000..95324a92 --- /dev/null +++ b/data/pixmaps/meson.build @@ -0,0 +1,24 @@ +gdm_icons = [ + [ 16, [ 'gdm-xnest.png' ] ], + [ 32, [ 'gdm-setup.png', 'gdm-xnest.png' ] ], + [ 48, [ 'gdm.png', 'gdm-setup.png', 'gdm-xnest.png' ] ], +] + +foreach size : gdm_icons + size_str = '@0@x@0@'.format(size[0]) + icons_install_dir = join_paths(gdm_datadir, 'icons', 'hicolor', size_str, 'apps') + + foreach png : size[1] + install_data(join_paths(size_str, png), + install_dir: icons_install_dir, + ) + endforeach +endforeach + + +install_data( + 'gdm-foot-logo.png', + 'nobody.png', + 'nohost.png', + install_dir: join_paths(gdm_datadir, 'pixmaps'), +) diff --git a/libgdm/meson.build b/libgdm/meson.build new file mode 100644 index 00000000..80a0114e --- /dev/null +++ b/libgdm/meson.build @@ -0,0 +1,59 @@ +# FIXME: We can't use gnome.gdbus_codegen(autocleanup: 'all') here since it's a bit too new +libgdm_manager_dbus_gen = custom_target('gdm-manager-glue', + input: '../daemon/gdm-manager.xml', + output: [ 'gdm-manager-glue.c', 'gdm-manager-glue.h' ], + command: [ 'gdbus-codegen', + '--c-namespace', 'Gdm', + '--interface-prefix=org.gnome.DisplayManager', + '--generate-c-code=gdm-manager-glue', + '--c-generate-autocleanup=all', + '--annotate', 'org.gnome.DisplayManager.Manager', 'org.gtk.GDBus.C.Name', 'Manager', + '--output-directory', '@OUTDIR@', + '@INPUT@' + ], + build_by_default: true, +) +libgdm_client_dbus_gen = custom_target('gdm-client-glue', + input: '../daemon/gdm-session.xml', + output: [ 'gdm-client-glue.c', 'gdm-client-glue.h' ], + command: [ 'gdbus-codegen', + '--c-namespace', 'Gdm', + '--interface-prefix=org.gnome.DisplayManager', + '--generate-c-code=gdm-client-glue', + '--c-generate-autocleanup=all', + '--annotate', 'org.gnome.DisplayManager.UserVerifier', 'org.gtk.GDBus.C.Name', 'UserVerifier', + '--annotate', 'org.gnome.DisplayManager.Greeter', 'org.gtk.GDBus.C.Name', 'Greeter', + '--annotate', 'org.gnome.DisplayManager.RemoteGreeter', 'org.gtk.GDBus.C.Name', 'RemoteGreeter', + '--annotate', 'org.gnome.DisplayManager.Chooser', 'org.gtk.GDBus.C.Name', 'Chooser', + '--output-directory', '@OUTDIR@', + '@INPUT@' + ], + build_by_default: true, +) + +libgdm_src = [ + 'gdm-client.c', + 'gdm-sessions.c', + 'gdm-user-switching.c', + libgdm_manager_dbus_gen, + libgdm_client_dbus_gen, +] + +libgdm_deps = [ + glib_dep, + gio_dep, + gio_unix_dep, + libsystemd_dep, +] + +libgdm = library('gdm', + libgdm_src, + dependencies: libgdm_deps, + include_directories: config_h_dir, +) + +libgdm_dep = declare_dependency( + link_with: libgdm, + dependencies: libgdm_deps, + include_directories: include_directories('.'), +) diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..beba39d3 --- /dev/null +++ b/meson.build @@ -0,0 +1,247 @@ +project('gdm', 'c', + version: '3.29.1', + license: 'GPL2+', + meson_version: '>= 0.43', +) + +# Modules +gnome = import('gnome') +i18n = import('i18n') + +# Compiler +cc = meson.get_compiler('c') + +# Common options +gdm_prefix = get_option('prefix') +gdm_datadir = join_paths(gdm_prefix, get_option('datadir')) +gdm_includedir = join_paths(gdm_prefix, get_option('includedir')) +gdm_libdir = join_paths(gdm_prefix, get_option('libdir')) +gdm_libexecdir = join_paths(gdm_prefix, get_option('libexecdir')) +gdm_bindir = join_paths(gdm_prefix, get_option('bindir')) +gdm_sysconfdir = join_paths(gdm_prefix, get_option('sysconfdir')) +gdm_localstatedir = join_paths(gdm_prefix, get_option('localstatedir')) +gnome_localedir = join_paths(gdm_datadir, 'localedir') + +# GDM-specifc Options +selinux_enabled = get_option('selinux') +gdmconfdir = (get_option('sysconfsubdir') == '')? gdm_sysconfdir : join_paths(gdm_sysconfdir, get_option('sysconfsubdir')) +dmconfdir = (get_option('dmconfdir') != '')? get_option('dmconfdir') : join_paths(gdm_sysconfdir, 'dm') +install_gdm_xsession = get_option('gdm-xsession') +user_display_server_enabled = get_option('user-display-server') +default_pam_config = get_option('default-pam-config') +console_helper_enabled = get_option('console-helper') +authentication_scheme_enabled = get_option('authentication-scheme') +xinerama_enabled = get_option('xinerama') +xdmcp_enabled = get_option('xdmcp') +tcp_wrappers_enabled = get_option('tcp-wrappers') +systemd_systemunitdir = get_option('systemdsystemunitdir') +systemd_journal_enabled = get_option('systemd-journal') +wayland_support_enabled = get_option('wayland-support') +plymouth_enabled = get_option('plymouth') +at_spi_registryd_dir = (get_option('at-spi-registryd-dir') != '')? get_option('at-spi-registryd-dir') : gdm_libexecdir +gdm_session_default_path = get_option('default-path') +lang_config_file = (get_option('lang-file') != '')? get_option('lang-file') : join_paths(gdm_sysconfdir, 'locale.conf') +ipv6_enabled = get_option('ipv6') +gdm_username = get_option('user') +gdm_groupname = get_option('group') +pam_prefix = (get_option('pam-prefix') != '')? get_option('pam-prefix') : gdm_sysconfdir +pam_mod_dir = (get_option('pam-mod-dir') != '')? get_option('pam-mod-dir') : join_paths(gdm_libdir, 'security') +dbus_sys = get_option('dbus-sys') +dbus_services = get_option('dbus-services') +rbac_shutdown_enabled = get_option('rbac-shutdown') +gdm_log_dir = get_option('log-dir') +at_bindir = (get_option('at-bindir') != '')? get_option('at-bindir') : gdm_bindir +gdm_defaults_conf = (get_option('defaults-conf') != '')? get_option('defaults-conf') : join_paths(gdm_datadir, 'gdm', 'defaults.conf') +gdm_custom_conf = (get_option('custom-conf') != '')? get_option('custom-conf') : join_paths(gdmconfdir, 'custom.conf') +gdm_runtime_conf = (get_option('runtime-conf') != '')? get_option('runtime-conf') : gdm_custom_conf +gnome_settings_daemon_dir = (get_option('gnome-settings-daemon-dir') != '')? get_option('gnome-settings-daemon-dir') : gdm_libexecdir +check_accelerated_dir = (get_option('check-accelerated-dir') != '')? get_option('check-accelerated-dir') : gdm_libexecdir +xevie_enabled = get_option('xevie') +libaudit_enabled = get_option('libaudit') +gdm_run_dir = (get_option('run-dir') != '')? get_option('run-dir') : join_paths(gdm_localstatedir, 'run', 'gdm') +gdm_pid_file = (get_option('pid-file') != '')? get_option('pid-file') : join_paths(gdm_run_dir, 'gdm.pid') +ran_once_marker_dir = (get_option('ran-once-marker-dir') != '')? get_option('ran-once-marker-dir') : gdm_run_dir +working_dir = (get_option('working-dir') != '')? get_option('working-dir') : join_paths(gdm_localstatedir, 'lib', 'gdm') +gdm_xauth_dir = (get_option('xauth-dir') != '')? get_option('xauth-dir') : gdm_run_dir +gdm_screenshot_dir = (get_option('screenshot-dir') != '')? get_option('screenshot-dir') : join_paths(gdm_run_dir, 'greeter') +profiling_enabled = get_option('profiling') +gdm_initial_vt = get_option('initial-vt') + +# Common variables +config_h_dir = include_directories('.') + +# Dependencies +glib_min_version = '2.44.0' + +glib_dep = dependency('glib-2.0', version: '>=' + glib_min_version) +gobject_dep = dependency('gobject-2.0', version: '>=' + glib_min_version) +gio_dep = dependency('gio-2.0', version: '>=' + glib_min_version) +gio_unix_dep = dependency('gio-unix-2.0', version: '>=' + glib_min_version) +gtk_dep = dependency('gtk+-3.0', version: '>= 2.91.1') +libcanberra_gtk_dep = dependency('libcanberra-gtk3', version: '>= 0.4') +accountsservice_dep = dependency('accountsservice', version: '>= 0.6.35') +xcb_dep = dependency('xcb') +keyutils_dep = cc.find_library('keyutils', required: false) +if selinux_enabled + libselinux_dep = dependency('libselinux') +endif +# if xdmcp_enabled XXX + xdmcp_dep = cc.find_library('Xdmcp') +# endif +# X11 +x_deps = declare_dependency( + dependencies: [ + dependency('x11'), + dependency('xau'), + ], +) +find_x_server_script = find_program('build-aux/find-x-server.sh', native: true) +find_x_server_out = run_command(find_x_server_script).stdout().strip() +if find_x_server_out != '' + x_bin = find_x_server_out + x_bin_path_split = x_bin.split('/') + i = 0 + x_path = '/' + foreach dir : x_bin_path_split + if i < x_bin_path_split.length() - 1 + x_path = join_paths(x_path, dir) + endif + i = i + 1 + endforeach +else + # what to do, what to do, this is wrong, but this just sets the + # defaults, perhaps this user is cross compiling or some such + x_path = '/usr/bin/X11:/usr/X11R6/bin:/opt/X11R6/bin' + x_bin = '/usr/bin/X' +endif +# systemd +libsystemd_dep = dependency('libsystemd') +journald_dep = dependency('journald', required: false) +systemd_multiseat_x = find_program('systemd-multi-seat-x', required: false) +systemd_x_server = systemd_multiseat_x.found()? systemd_multiseat_x.path() : '/lib/systemd/systemd-multi-seat-x' +# unit tests +libcheck_dep = dependency('check', version: '>= 0.9.4') + +cc.has_header('security/pam_modutil.h') +cc.has_header('security/pam_ext.h') +have_pam_syslog = cc.has_function('pam_syslog', args: 'pam') + +# UTMP +have_utmpx_header = cc.has_header('utmpx.h') +have_utmp_header = cc.has_header('utmp.h') +utmp_struct = have_utmpx_header? 'struct utmpx' : 'struct utmp' +utmp_include = have_utmpx_header? '#include ' : '#include ' +utmp_has_host_field = cc.has_member(utmp_struct, 'ut_host', prefix: utmp_include) +utmp_has_pid_field = cc.has_member(utmp_struct, 'ut_pid', prefix: utmp_include) +utmp_has_id_field = cc.has_member(utmp_struct, 'ut_id', prefix: utmp_include) +utmp_has_name_field = cc.has_member(utmp_struct, 'ut_name', prefix: utmp_include) +utmp_has_type_field = cc.has_member(utmp_struct, 'ut_type', prefix: utmp_include) +utmp_has_exit_e_termination_field = cc.has_member(utmp_struct, 'ut_exit.e_termination', prefix: utmp_include) +utmp_has_user_field = cc.has_member(utmp_struct, 'ut_user', prefix: utmp_include) +utmp_has_time_field = cc.has_member(utmp_struct, 'ut_time', prefix: utmp_include) +utmp_has_tv_field = cc.has_member(utmp_struct, 'ut_tv', prefix: utmp_include) +utmp_has_syslen_field = cc.has_member(utmp_struct, 'ut_syslen', prefix: utmp_include) + +# Check for POSIX getpwnam_r +have_posix_getpwnam_r = cc.compiles(''' +#define _POSIX_PTHREAD_SEMANTICS +#include +#include + +int main(int argc, char **argv) { + char buffer[10000]; + struct passwd pwd, *pwptr = &pwd; + int error; + errno = 0; + error = getpwnam_r ("", &pwd, buffer, + sizeof (buffer), &pwptr); + return (error < 0 && errno == ENOSYS) + || error == ENOSYS; +} +''') + +# PAM +libpam_dep = cc.find_library('pam') +pam_extensions_supported = cc.has_header_symbol('security/pam_appl.h', 'PAM_BINARY_PROMPT') + +# Configuration +conf = configuration_data() +conf.set_quoted('G_LOG_DOMAIN', 'Gdm') +conf.set_quoted('VERSION', meson.project_version()) +conf.set_quoted('PACKAGE_VERSION', meson.project_version()) +conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) +conf.set_quoted('DATADIR', gdm_datadir) +conf.set_quoted('BINDIR', gdm_bindir) +conf.set_quoted('LIBDIR', gdm_libdir) +conf.set_quoted('LIBEXECDIR', gdm_libexecdir) +conf.set_quoted('LOGDIR', gdm_log_dir) +conf.set_quoted('DMCONFDIR', dmconfdir) +conf.set_quoted('GDMCONFDIR', gdmconfdir) +conf.set_quoted('GDM_SCREENSHOT_DIR', gdm_screenshot_dir) +conf.set_quoted('GDM_CACHE_DIR', join_paths(gdm_localstatedir, 'cache', 'gdm')) +conf.set_quoted('GDM_XAUTH_DIR', gdm_xauth_dir) +conf.set_quoted('GDM_RAN_ONCE_MARKER_DIR', ran_once_marker_dir) +conf.set_quoted('GDM_RUN_DIR', gdm_run_dir) +conf.set_quoted('GNOMELOCALEDIR', gnome_localedir) +conf.set_quoted('AT_SPI_REGISTRYD_DIR', at_spi_registryd_dir) +conf.set_quoted('GDM_PID_FILE', gdm_pid_file) +conf.set_quoted('GNOME_SETTINGS_DAEMON_DIR', gnome_settings_daemon_dir) +conf.set_quoted('CHECK_ACCELRATED_DIR', check_accelerated_dir) +conf.set_quoted('LANG_CONFIG_FILE', lang_config_file) +conf.set('HAVE_UTMP_H', have_utmp_header) +conf.set('HAVE_UTMPX_H', have_utmpx_header) +conf.set('HAVE_POSIX_GETPWNAM_R', have_posix_getpwnam_r) +conf.set('UTMP', utmp_struct) +conf.set('HAVE_GETUTXENT', cc.has_function('getutxent')) +conf.set('HAVE_UPDWTMP', cc.has_function('updwtmp')) +conf.set('HAVE_UPDWTMPX', cc.has_function('updwtmpx')) +conf.set('HAVE_LOGIN', cc.has_function('login', args: 'util')) +conf.set('HAVE_LOGOUT', cc.has_function('logout', args: 'util')) +conf.set('HAVE_LOGWTMP', cc.has_function('logwtmp', args: 'util')) +conf.set('HAVE_PAM_SYSLOG', have_pam_syslog) +conf.set('HAVE_KEYUTILS', keyutils_dep.found()) +conf.set('SUPPORTS_PAM_EXTENSIONS', pam_extensions_supported) +conf.set('HAVE_SELINUX', selinux_enabled) +conf.set('ENABLE_USER_DISPLAY_SERVER', user_display_server_enabled) +conf.set('ENABLE_WAYLAND_SUPPORT', wayland_support_enabled) +conf.set_quoted('GDM_INITIAL_VT', '@0@'.format(gdm_initial_vt)) +conf.set_quoted('GDM_DEFAULTS_CONF', gdm_custom_conf) +conf.set_quoted('GDM_CUSTOM_CONF', gdm_custom_conf) +conf.set_quoted('GDM_RUNTIME_CONF', gdm_runtime_conf) +conf.set_quoted('GDM_SESSION_DEFAULT_PATH', gdm_session_default_path) +conf.set_quoted('GDM_USERNAME', gdm_username) +conf.set_quoted('GDM_GROUPNAME', gdm_groupname) +conf.set('HAVE_LIBXDMCP', xdmcp_enabled) +conf.set_quoted('SYSTEMD_X_SERVER', systemd_x_server) +conf.set_quoted('X_SERVER', x_bin) +conf.set_quoted('X_PATH', x_path) +conf.set('HAVE_UT_UT_HOST', utmp_has_host_field) +conf.set('HAVE_UT_UT_PID', utmp_has_pid_field) +conf.set('HAVE_UT_UT_ID', utmp_has_id_field) +conf.set('HAVE_UT_UT_NAME', utmp_has_name_field) +conf.set('HAVE_UT_UT_TYPE', utmp_has_type_field) +conf.set('HAVE_UT_UT_EXIT_E_TERMINATION', utmp_has_exit_e_termination_field) +conf.set('HAVE_UT_UT_USER', utmp_has_user_field) +conf.set('HAVE_UT_UT_TIME', utmp_has_time_field) +conf.set('HAVE_UT_UT_TV', utmp_has_tv_field) +conf.set('HAVE_UT_UT_SYSLEN', utmp_has_syslen_field) +configure_file(output: 'config.h', configuration: conf) + +# Subdirs +subdir('data') +subdir('common') +if pam_extensions_supported + subdir('pam-extensions') +endif +subdir('daemon') +subdir('libgdm') +subdir('utils') +subdir('pam_gdm') +subdir('po') +subdir('tests') +# if xdmcp_enabled + subdir('chooser') +# endif +# if docs_enabled +# subdir('docs') +# endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..8506ee35 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,44 @@ +option('selinux', type: 'boolean', value: true, description: 'Add SELinux support.') +option('sysconfsubdir', type: 'string', value: 'gdm', description: 'Directory name used under sysconfdir.') +option('dmconfdir', type: 'string', value: '', description: 'Directory where sessions are stored.') +option('gdm-xsession', type: 'boolean', value: false, description: 'Enable installing the gdm Xsession file.') +option('split-authentication', type: 'boolean', value: true, description: 'Enable multiple simultaneous PAM conversations during login.') +option('user-display-server', type: 'boolean', value: true, description: 'Enable running X server as user.') +option('default-pam-config', type: 'combo', choices: [ 'autodetect', 'redhat', 'openembedded', 'exherbo', 'lfs', 'arch', 'none'], value: 'autodetect', description: '') +option('console-helper', type: 'boolean', value: false, description: 'Enable PAM console helper.') +option('authentication-scheme', type: 'boolean', value: false, description: 'Choose a specific authentication scheme.') +option('xinerama', type: 'boolean', value: false, description: 'Add Xinerama support.') +option('xdmcp', type: 'boolean', value: false, description: 'Add XDMCP (remote login).') +option('tcp-wrappers', type: 'boolean', value: false, description: 'Use TCP wrappers.') +option('systemdsystemunitdir', type: 'boolean', value: false, description: 'Directory for systemd service files.') +option('systemd-journal', type: 'boolean', value: false, description: 'Add journald support.') +option('wayland-support', type: 'boolean', value: false, description: 'Enable support for wayland sessions.') +option('plymouth', type: 'boolean', value: false, description: 'Add plymouth support.') +option('at-spi-registryd-dir', type: 'string', value: '', description: 'Specify the directory of at-spi-registryd.') +option('default-path', type: 'string', value: '/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin', description: 'Path GDM will use as the user\'s default PATH.') +option('lang-file', type: 'string', value: '', description: 'File containing default language settings.') +option('ipv6', type: 'boolean', value: false, description: 'Enables compilation of IPv6 code.') +option('user', type: 'string', value: 'gdm', description: 'GDM\'s username.') +option('group', type: 'string', value: 'gdm', description: 'GDM\'s group.') +option('pam-prefix', type: 'string', value: '', description: 'Specify where PAM files go.') +option('pam-mod-dir', type: 'string', value: '', description: 'Directory to install PAM modules in.') +option('dbus-sys', type: 'string', value: '', description: 'Where D-Bus systemd directory is.') +option('dbus-services', type: 'string', value: '', description: 'Where D-Bus services directory is.') +option('rbac-shutdown', type: 'boolean', value: false, description: 'Build with RBAC support specifying shutdown/reboot RBAC authentication key.') +option('log-dir', type: 'string', value: '/var/log/gdm', description: 'Log directory.') +option('at-bindir', type: 'string', value: '', description: 'PATH to Accessible Technology programs.') +option('defaults-conf', type: 'string', value: '', description: 'Filename to give to defaults file.') +option('custom-conf', type: 'string', value: '', description: 'Filename to give to custom configuration file.') +option('gnome-settings-daemon-dir', type: 'string', value: '', description: 'Specify the directory of gnome-settings-daemon used by the chooser.') +option('check-accelerated-dir', type: 'string', value: '', description: 'Specify the directory of gnome-session-check-accelerated.') +option('xevie', type: 'boolean', value: false, description: 'Add XEvIE Xserver extension support.') +option('libaudit', type: 'boolean', value: false, description: 'Add Linux audit support.') +option('run-dir', type: 'string', value: '', description: 'Runtime directory.') +option('pid-file', type: 'string', value: '', description: 'Pid file.') +option('ran-once-marker-dir', type: 'string', value: '', description: 'Ran once marker directory.') +option('working-dir', type: 'string', value: '', description: 'Working directory.') +option('xauth-dir', type: 'string', value: '', description: 'XAuth cookie directory.') +option('screenshot-dir', type: 'string', value: '', description: 'Directory to store greeter screenshot.') +option('runtime-conf', type: 'string', value: '', description: 'Filename to give to runtime configuration file.') +option('profiling', type: 'boolean', value: false, description: 'Enable profiling.') +option('initial-vt', type: 'integer', value: 1, description: 'Initial virtual terminal to use.') diff --git a/pam-extensions/meson.build b/pam-extensions/meson.build new file mode 100644 index 00000000..2027c832 --- /dev/null +++ b/pam-extensions/meson.build @@ -0,0 +1,17 @@ +if pam_extensions_supported + pkgconf_config = configuration_data() + pkgconf_config.set_quoted('prefix', gdm_prefix) + pkgconf_config.set_quoted('libdir', gdm_libdir) + pkgconf_config.set_quoted('includedir', gdm_includedir) + pkgconf_config.set_quoted('VERSION', meson.project_version()) + + configure_file( + output: 'gdm-pam-extensions.pc', + input: 'gdm-pam-extensions.pc.in', + configuration: pkgconf_config, + install: true, + install_dir: join_paths(gdm_libdir, 'pkgconfig'), + ) + + pam_extensions_includedir = include_directories('.') +endif diff --git a/pam_gdm/meson.build b/pam_gdm/meson.build new file mode 100644 index 00000000..f47d8e6a --- /dev/null +++ b/pam_gdm/meson.build @@ -0,0 +1,16 @@ +pam_gdm_deps = [ + libpam_dep, +] + +if keyutils_dep.found() + pam_gdm_deps += keyutils_dep +endif + +pam_gdm = library('pam_gdm', + 'pam_gdm.c', + dependencies: pam_gdm_deps, + include_directories: config_h_dir, + name_prefix: '', + install: true, + install_dir: pam_mod_dir, +) diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 00000000..f904cde4 --- /dev/null +++ b/po/meson.build @@ -0,0 +1,3 @@ +i18n.gettext(meson.project_name(), + preset: 'glib' +) diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 00000000..128b5d2e --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,17 @@ +m_common_test_src = [ + 'm-common.c', + 's-common-address.c', + 's-common.c', +] + +m_common_test_deps = [ + libgdmcommon_dep, + libcheck_dep, +] + +m_common_test = executable('m-common', + m_common_test_src, + dependencies: m_common_test_deps, +) + +test('m-common', m_common_test) diff --git a/utils/meson.build b/utils/meson.build new file mode 100644 index 00000000..3fa176c8 --- /dev/null +++ b/utils/meson.build @@ -0,0 +1,41 @@ +# gdm-flexiserver +gdm_flexiserver_deps = [ + glib_dep, + libgdmcommon_dep, +] + +gdm_flexiserver = executable('gdm-flexiserver', + 'gdmflexiserver.c', + dependencies: gdm_flexiserver_deps, + include_directories: config_h_dir, + install: true, +) + +# gdm-screenshot +gdm_screenshot_deps = [ + glib_dep, + gtk_dep, + x_deps, + libcanberra_gtk_dep, +] + +gdm_screenshot = executable('gdm-screenshot', + 'gdm-screenshot.c', + dependencies: gdm_screenshot_deps, + include_directories: config_h_dir, + install: true, +) + +# gdm-disable-wayland +gdm_disable_wayland_deps = [ + glib_dep, +] + +gdm_disable_wayland = executable('gdm-disable-wayland', + 'gdm-disable-wayland.c', + dependencies: gdm_disable_wayland_deps, + include_directories: config_h_dir, + install: true, + install_dir: gdm_libexecdir, +) + -- cgit v1.2.1