From c987d3d2c97687a3656043f8e5dfffd9aa2e31e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 25 May 2017 02:16:27 +0200 Subject: [PATCH] build: Support the meson build system Meson is on track to replace autotools as the build system of choice, so support it in addition to autotools. If all goes well, we'll eventually be able to drop the latter ... https://bugzilla.gnome.org/show_bug.cgi?id=783229 --- browser-plugin/meson.build | 19 ++ config.h.meson | 26 +++ data/meson.build | 87 ++++++++ data/theme/meson.build | 21 ++ data/theme/parse-sass.sh | 5 +- docs/reference/meson.build | 5 + docs/reference/shell/meson.build | 57 +++++ docs/reference/shell/shell-docs.sgml | 5 + docs/reference/st/meson.build | 24 +++ docs/reference/st/st-docs.sgml | 5 + js/meson.build | 8 + js/misc/meson.build | 16 ++ man/meson.build | 19 ++ meson.build | 208 ++++++++++++++++++ meson_options.txt | 31 +++ po/meson.build | 1 + src/calendar-server/meson.build | 37 ++++ src/gnome-shell-extension-tool.in | 0 src/gnome-shell-perf-tool.in | 0 src/hotplug-sniffer/meson.build | 22 ++ src/meson.build | 301 +++++++++++++++++++++++++++ src/st/meson.build | 148 +++++++++++++ src/st/st.h.in | 3 + src/tray/meson.build | 12 ++ subprojects/gvc | 2 +- tests/meson.build | 8 + tests/run-test.sh.in | 2 +- 27 files changed, 1069 insertions(+), 3 deletions(-) create mode 100644 browser-plugin/meson.build create mode 100644 config.h.meson create mode 100644 data/meson.build create mode 100644 data/theme/meson.build create mode 100644 docs/reference/meson.build create mode 100644 docs/reference/shell/meson.build create mode 100644 docs/reference/st/meson.build create mode 100644 js/meson.build create mode 100644 js/misc/meson.build create mode 100644 man/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 po/meson.build create mode 100644 src/calendar-server/meson.build mode change 100644 => 100755 src/gnome-shell-extension-tool.in mode change 100644 => 100755 src/gnome-shell-perf-tool.in create mode 100644 src/hotplug-sniffer/meson.build create mode 100644 src/meson.build create mode 100644 src/st/meson.build create mode 100644 src/st/st.h.in create mode 100644 src/tray/meson.build create mode 100644 tests/meson.build diff --git a/browser-plugin/meson.build b/browser-plugin/meson.build new file mode 100644 index 000000000..d79188392 --- /dev/null +++ b/browser-plugin/meson.build @@ -0,0 +1,19 @@ +plugin_sources = [ + 'browser-plugin.c', + 'npapi/npapi.h', + 'npapi/npfunctions.h', + 'npapi/npruntime.h', + 'npapi/nptypes.h' +] + +shared_module('gnome-shell-browser-plugin', plugin_sources, + dependencies: [gio_dep, json_glib_dep], + c_args: ['-DG_LOG_DOMAIN="GnomeShellBrowserPlugin"'], + # Browsers can unload and reload the module while browsing, which is not + # supported by GObject. + # We pass -Wl,-z,nodelete to the linker to ensure the module is never + # unloaded. See https://bugzilla.gnome.org/show_bug.cgi?id=737932. + link_args: ['-Wl,-z,nodelete'], + install: true, + install_dir: plugindir +) diff --git a/config.h.meson b/config.h.meson new file mode 100644 index 000000000..10cadf98b --- /dev/null +++ b/config.h.meson @@ -0,0 +1,26 @@ +/* The prefix for our gettext translation domains. */ +#mesondefine GETTEXT_PACKAGE + +/* Version number of package */ +#mesondefine VERSION + +/* Version number of package */ +#mesondefine PACKAGE_VERSION + +/* Define to 1 if you have the `fdwalk' function. */ +#mesondefine HAVE_FDWALK + +/* Define to 1 if you have the `mallinfo' function. */ +#mesondefine HAVE_MALLINFO + +/* Define to 1 fi you have the header file. */ +#mesondefine HAVE_SYS_RESOURCE_H + +/* Define if we have NetworkManager */ +#mesondefine HAVE_NETWORKMANAGER + +/* Define if we have systemd */ +#mesondefine HAVE_SYSTEMD + +/* Define if _NL_TIME_FIRST_WEEKDATE is available */ +#mesondefine HAVE__NL_TIME_FIRST_WEEKDAY diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 000000000..0fa87fbfc --- /dev/null +++ b/data/meson.build @@ -0,0 +1,87 @@ +desktop_files = [ + 'org.gnome.Shell.desktop', + 'gnome-shell-extension-prefs.desktop' +] +service_files = [] + +if have_networkmanager + desktop_files += 'org.gnome.Shell.PortalHelper.desktop' + service_files += 'org.gnome.Shell.PortalHelper.service' +endif + +desktopconf = configuration_data() +# We substitute in bindir so it works as an autostart +# file when built in a non-system prefix +desktopconf.set('bindir', bindir) +desktopconf.set('VERSION', meson.project_version()) +foreach desktop_file : desktop_files + i18n.merge_file('desktop', + input: configure_file( + input: desktop_file + '.in.in', + output: desktop_file + '.in', + configuration: desktopconf + ), + output: desktop_file, + po_dir: '../po', + install: true, + install_dir: desktopdir, + type: 'desktop' + ) +endforeach + +serviceconf = configuration_data() +serviceconf.set('libexecdir', libexecdir) +foreach service_file : service_files + configure_file( + input: service_file + '.in', + output: service_file, + configuration: serviceconf, + install_dir: servicedir + ) +endforeach + + +dbus_interfaces = [ + 'org.gnome.Shell.PadOsd.xml', + 'org.gnome.Shell.Screencast.xml', + 'org.gnome.Shell.Screenshot.xml', + 'org.gnome.ShellSearchProvider.xml', + 'org.gnome.ShellSearchProvider2.xml' +] +install_data(dbus_interfaces, install_dir: ifacedir) + + +subdir('theme') + +theme_resources = gnome.compile_resources( + 'gnome-shell-theme', 'gnome-shell-theme.gresource.xml', + source_dir: 'theme', + dependencies: theme_deps, + gresource_bundle: true, + install: true, + install_dir: pkgdatadir +) + +perfconf = configuration_data() +perfconf.set('datadir', datadir) +configure_file( + input: 'perf-background.xml.in', + output: 'perf-background.xml', + configuration: perfconf, + install_dir: pkgdatadir +) + + +install_data('50-gnome-shell-system.xml', install_dir: keysdir) + + +schemaconf = configuration_data() +schemaconf.set('GETTEXT_PACKAGE', meson.project_name()) +configure_file( + input: 'org.gnome.shell.gschema.xml.in', + output: 'org.gnome.shell.gschema.xml', + configuration: schemaconf, + install_dir: schemadir +) + +install_data('gnome-shell-overrides.convert', install_dir: convertdir) diff --git a/data/theme/meson.build b/data/theme/meson.build new file mode 100644 index 000000000..ee64e7c42 --- /dev/null +++ b/data/theme/meson.build @@ -0,0 +1,21 @@ +theme_sources = files([ + 'gnome-shell-high-contrast.scss', + 'gnome-shell.scss', + 'gnome-shell-sass/_colors.scss', + 'gnome-shell-sass/_common.scss', + 'gnome-shell-sass/_drawing.scss', + 'gnome-shell-sass/_high-contrast-colors.scss' +]) + +theme_deps = [] + +if sassc.found() + parse_sass = files('parse-sass.sh') + + theme_deps += custom_target('update-theme', + output: 'theme-update.stamp', + depend_files: theme_sources, + command: [parse_sass, '@OUTPUT@'], + build_by_default: true + ) +endif diff --git a/data/theme/parse-sass.sh b/data/theme/parse-sass.sh index eca547eee..0858655ea 100755 --- a/data/theme/parse-sass.sh +++ b/data/theme/parse-sass.sh @@ -1,7 +1,10 @@ #!/usr/bin/sh srcdir=`dirname $0` +stamp=${1} for scss in $srcdir/*.scss do - sassc -a $scss ${scss%%.scss}.css + sassc -a $scss ${scss%%.scss}.css || exit 1 done + +[ "$stamp" ] && touch $stamp diff --git a/docs/reference/meson.build b/docs/reference/meson.build new file mode 100644 index 000000000..77d9fdee4 --- /dev/null +++ b/docs/reference/meson.build @@ -0,0 +1,5 @@ +version_conf = configuration_data() +version_conf.set('VERSION', meson.project_version()) + +subdir('shell') +subdir('st') diff --git a/docs/reference/shell/meson.build b/docs/reference/shell/meson.build new file mode 100644 index 000000000..1469ed422 --- /dev/null +++ b/docs/reference/shell/meson.build @@ -0,0 +1,57 @@ +private_headers = [ + 'gactionmuxer.h', + 'gactionobservable.h', + 'gactionobserver.h', + 'shell-network-agent.h', + 'shell-recorder-src.h' +] + +if not enable_recorder + private_headers += 'shell-recorder.h' +endif + +exclude_directories = [ + 'calendar-server', + 'hotplug-sniffer', + 'st', + 'tray' +] + +ifaces = [ + ['org.gnome.Shell.Screenshot', 'org.gnome.Shell.Screenshot.xml'], + ['org.gnome.ShellSearchProvider', 'org.gnome.Shell.SearchProvider.xml'], + ['org.gnome.ShellSearchProvider2', 'org.gnome.Shell.SearchProvider2.xml'] +] +foreach iface : ifaces + custom_target(iface[0] + ' docs', + input: '../../../data/@0@.xml'.format(iface[0]), + output: 'doc-gen-' + iface[1], + command: [ + 'gdbus-codegen', + '--interface-prefix=@0@.'.format(iface), + '--generate-docbook', 'doc-gen', + '--output-directory', '@OUTDIR@', + '@INPUT@' + ], + build_by_default: true + ) +endforeach + +configure_file( + input: 'version.xml.in', + output: 'version.xml', + configuration: version_conf +) + +gnome.gtkdoc('shell', + main_sgml: 'shell-docs.sgml', + src_dir: [ + join_paths(meson.source_root(), 'src'), + join_paths(meson.build_root(), 'src') + ], + scan_args: [ + '--ignore-headers=' + ' '.join(private_headers + exclude_directories), + '--rebuild-types' + ], + install: true +) diff --git a/docs/reference/shell/shell-docs.sgml b/docs/reference/shell/shell-docs.sgml index c349f84a5..9e6ae4e15 100644 --- a/docs/reference/shell/shell-docs.sgml +++ b/docs/reference/shell/shell-docs.sgml @@ -52,10 +52,15 @@ + + API Index diff --git a/docs/reference/st/meson.build b/docs/reference/st/meson.build new file mode 100644 index 000000000..fe89b53d4 --- /dev/null +++ b/docs/reference/st/meson.build @@ -0,0 +1,24 @@ +private_headers = [ + 'st-private.h', + 'st-theme-node-private.h' +] + +configure_file( + input: 'version.xml.in', + output: 'version.xml', + configuration: version_conf +) + +gnome.gtkdoc('st', + main_sgml: 'st-docs.sgml', + src_dir: [ + join_paths(meson.source_root(), 'src', 'st'), + join_paths(meson.build_root(), 'src', 'st') + ], + scan_args: [ + '--ignore-headers=' + ' '.join(private_headers), + '--rebuild-sections', + '--rebuild-types' + ], + install: true +) diff --git a/docs/reference/st/st-docs.sgml b/docs/reference/st/st-docs.sgml index 788c20460..be4cec249 100644 --- a/docs/reference/st/st-docs.sgml +++ b/docs/reference/st/st-docs.sgml @@ -47,10 +47,15 @@ + + API Index diff --git a/js/meson.build b/js/meson.build new file mode 100644 index 000000000..dd8ca3f66 --- /dev/null +++ b/js/meson.build @@ -0,0 +1,8 @@ +subdir('misc') + +js_resources = gnome.compile_resources( + 'js-resources', 'js-resources.gresource.xml', + source_dir: ['.', meson.current_build_dir()], + c_name: 'shell_js_resources', + dependencies: [config_js] +) diff --git a/js/misc/meson.build b/js/misc/meson.build new file mode 100644 index 000000000..20489496c --- /dev/null +++ b/js/misc/meson.build @@ -0,0 +1,16 @@ +jsconf = configuration_data() +jsconf.set('PACKAGE_NAME', meson.project_name()) +jsconf.set('PACKAGE_VERSION', meson.project_version()) +jsconf.set('GETTEXT_PACKAGE', meson.project_name()) +jsconf.set('LIBMUTTER_API_VERSION', mutter_api_version) +jsconf.set10('HAVE_BLUETOOTH', bt_dep.found()) +jsconf.set10('HAVE_NETWORKMANAGER', have_networkmanager) +jsconf.set('datadir', datadir) +jsconf.set('libexecdir', libexecdir) +jsconf.set('sysconfdir', sysconfdir) + +config_js = configure_file( + input: 'config.js.in', + output: 'config.js', + configuration: jsconf +) diff --git a/man/meson.build b/man/meson.build new file mode 100644 index 000000000..9d39a38b8 --- /dev/null +++ b/man/meson.build @@ -0,0 +1,19 @@ +custom_target('man page', + input: 'gnome-shell.xml', + output: 'gnome-shell.1', + command: [ + xsltproc, + '-o', '@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@' + ], + build_by_default: true, + install_dir: mandir + '/man1', + install: true +) diff --git a/meson.build b/meson.build new file mode 100644 index 000000000..b8844d7fc --- /dev/null +++ b/meson.build @@ -0,0 +1,208 @@ +project('gnome-shell', 'c', + version: '3.25.3', + meson_version: '>= 0.41.0', + license: 'GPLv2+' +) + +# We depend on a specific version of the libmutter API. The mutter variants of +# the Cogl and Clutter libraries also use this API version. +mutter_api_version = '0' + +clutter_pc = 'mutter-clutter-' + mutter_api_version +cogl_pc = 'mutter-cogl-' + mutter_api_version +cogl_pango_pc = 'mutter-cogl-pango-' + mutter_api_version +libmutter_pc = 'libmutter-' + mutter_api_version + +croco_req = '>= 0.6.8' +ecal_req = '>= 3.5.3' +eds_req = '>= 3.17.2' +gcr_req = '>= 3.7.5' +gdesktop_req = '>= 3.7.90' +gio_req = '>= 2.53.0' +gi_req = '>= 1.49.1' +gjs_req = '>= 1.47.0' +gtk_req = '>= 3.15.0' +json_glib_req = '>= 0.13.2' +mutter_req = '>= 3.25.2' +polkit_req = '>= 0.100' +schemas_req = '>= 3.21.3' +startup_req = '>= 0.11' + +bt_req = '>= 3.9.0' +gst_req = '>= 0.11.92' +nm_req = '>= 0.9.8' +secret_req = '>= 0.18' + +gnome = import('gnome') +i18n = import('i18n') + +prefix = get_option('prefix') + +bindir = join_paths(prefix, get_option('bindir')) +datadir = join_paths(prefix, get_option('datadir')) +libdir = join_paths(prefix, get_option('libdir')) +libexecdir = join_paths(prefix, get_option('libexecdir')) +mandir = join_paths(prefix, get_option('mandir')) +sysconfdir = join_paths(prefix, get_option('sysconfdir')) + +pkgdatadir = join_paths(datadir, meson.project_name()) +pkglibdir = join_paths(libdir, meson.project_name()) + +convertdir = join_paths(datadir, 'GConf', 'gsettings') +desktopdir = join_paths(datadir, 'applications') +ifacedir = join_paths(datadir, 'dbus-1', 'interfaces') +localedir = join_paths(datadir, 'locale') +mozplugindir = join_paths(libdir, 'mozilla', 'plugins') +schemadir = join_paths(datadir, 'glib-2.0', 'schemas') +servicedir = join_paths(datadir, 'dbus-1', 'services') + +plugindir = get_variable('BROWSER_PLUGIN_DIR', mozplugindir) + +keybindings_dep = dependency('gnome-keybindings', required: false) +if keybindings_dep.found() + keysdir = keybindings_dep.get_pkgconfig_variable('keysdir') +else + keysdir = join_paths(datadir, 'gnome-control-center', 'keybindings') +endif + +atk_bridge_dep = dependency('atk-bridge-2.0') +canberra_dep = dependency('libcanberra') +canberra_gtk_dep = dependency('libcanberra-gtk3') +ecal_dep = dependency('libecal-1.2', version: ecal_req) +eds_dep = dependency('libedataserver-1.2', version: eds_req) +gcr_dep = dependency('gcr-base-3', version: gcr_req) +gdk_x11_dep = dependency('gdk-x11-3.0') +gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0') +gi_dep = dependency('gobject-introspection-1.0', version: gi_req) +gio_dep = dependency('gio-2.0', version: gio_req) +gio_unix_dep = dependency('gio-unix-2.0', version: gio_req) +gjs_dep = dependency('gjs-1.0', version: gjs_req) +gtk_dep = dependency('gtk+-3.0', version: gtk_req) +libxml_dep = dependency('libxml-2.0') +croco_dep = dependency('libcroco-0.6', version: croco_req) +clutter_dep = dependency(clutter_pc, version: mutter_req) +cogl_dep = dependency(cogl_pc, version: mutter_req) +cogl_pango_dep = dependency(cogl_pango_pc, version: mutter_req) +mutter_dep = dependency(libmutter_pc, version: mutter_req) +polkit_dep = dependency('polkit-agent-1', version: polkit_req) +soup_dep = dependency('libsoup-2.4') +startup_dep = dependency('libstartup-notification-1.0', version: startup_req) +x11_dep = dependency('x11') +schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req) + +bt_dep = dependency('gnome-bluetooth-1.0', version: bt_req, required: false) +gst_dep = dependency('gstreamer-1.0', version: gst_req, required: false) +gst_base_dep = dependency('gstreamer-base-1.0', required: false) + +recorder_deps = [] +enable_recorder = gst_dep.found() and gst_base_dep.found() +if enable_recorder + recorder_deps += [gst_dep, gst_base_dep, gtk_dep, x11_dep] +endif + +nm_deps = [] +enable_networkmanager = get_option('enable-networkmanager') +if enable_networkmanager != 'no' + want_networkmanager = enable_networkmanager == 'yes' + + nm_deps += dependency('libnm-glib', + version: nm_req, required: want_networkmanager + ) + nm_deps += dependency('libnm-util', + version: nm_req, required: want_networkmanager + ) + nm_deps += dependency('libnm-gtk', + version: nm_req, required: want_networkmanager + ) + nm_deps += dependency('libsecret-1', + version: secret_req, required: want_networkmanager + ) + + have_networkmanager = true + foreach dep : nm_deps + have_networkmanager = have_networkmanager and dep.found() + endforeach + + if not have_networkmanager + nm_deps = [] + endif +else + have_networkmanager = false +endif + +enable_systemd = get_option('enable-systemd') +if enable_systemd != 'no' + want_systemd = enable_systemd == 'yes' + systemd_dep = dependency('libsystemd', required: want_systemd) + have_systemd = systemd_dep.found() +else + systemd_dep = [] + have_systemd = false +endif + +enable_plugin = get_option('enable-browser-plugin') +if enable_plugin + json_glib_dep = dependency('json-glib-1.0', version: json_glib_req) + + subdir('browser-plugin') +endif + +enable_man = get_option('enable-man') +if enable_man + xsltproc = find_program('xsltproc') + + subdir('man') +endif + +mutter_typelibdir = mutter_dep.get_pkgconfig_variable('typelibdir') +python = find_program('python3') +sassc = find_program('sassc', required: false) + +cc = meson.get_compiler('c') + +m_dep = cc.find_library('m', required: false) + +cdata = configuration_data() +cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name()) +cdata.set_quoted('VERSION', meson.project_version()) +cdata.set_quoted('PACKAGE_VERSION', meson.project_version()) + +cdata.set('HAVE_NETWORKMANAGER', have_networkmanager) +cdata.set('HAVE_SYSTEMD', have_systemd) + +cdata.set('HAVE_FDWALK', cc.has_function('fdwalk')) +cdata.set('HAVE_MALLINFO', cc.has_function('mallinfo')) +cdata.set('HAVE_SYS_RESOURCE_H', cc.has_header('sys/resource.h')) +cdata.set('HAVE__NL_TIME_FIRST_WEEKDAY', + cc.has_header_symbol('langinfo.h', '_NL_TIME_FIRST_WEEKDAY') +) + +config_h = configure_file( + input: 'config.h.meson', + output: 'config.h', + configuration: cdata +) + +conf_inc = include_directories('.') + +libgvc = subproject('gvc', + default_options: [ + 'package-name=' + meson.project_name(), + 'package-version=' + meson.project_version(), + 'pkgdatadir=' + pkgdatadir, + 'pkglibdir=' + pkglibdir, + 'static=false', + 'with-introspection=true' + ] +) +libgvc_gir = libgvc.get_variable('libgvc_gir') + +subdir('js') +subdir('src') +subdir('po') +subdir('data') +subdir('tests') + +if get_option('enable-documentation') + subdir('docs/reference') +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 000000000..18899ffdb --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,31 @@ +option('enable-browser-plugin', + type: 'boolean', + value: true, + description: 'Enable extensions.gnome.org browser plugin' +) + +option('enable-documentation', + type: 'boolean', + value: false, + description: 'Build API reference' +) + +option('enable-man', + type: 'boolean', + value: true, + description: 'Generate man pages' +) + +option('enable-networkmanager', + type: 'combo', + choices: ['yes', 'no', 'auto'], + value: 'auto', + description: 'Enable NetworkManager support' +) + +option('enable-systemd', + type: 'combo', + choices: ['yes', 'no', 'auto'], + value: 'auto', + description: 'Enable systemd integration' +) diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 000000000..e9b77d79b --- /dev/null +++ b/po/meson.build @@ -0,0 +1 @@ +i18n.gettext(meson.project_name(), preset: 'glib') diff --git a/src/calendar-server/meson.build b/src/calendar-server/meson.build new file mode 100644 index 000000000..a7393fce5 --- /dev/null +++ b/src/calendar-server/meson.build @@ -0,0 +1,37 @@ +calendar_sources = [ + 'gnome-shell-calendar-server.c', + 'calendar-debug.h', + 'calendar-sources.c', + 'calendar-sources.h' +] + +calendar_server = executable('gnome-shell-calendar-server', calendar_sources, + dependencies: [ecal_dep, eds_dep, gio_dep], + include_directories: include_directories('..', '../..'), + c_args: [ + '-DPREFIX="@0@"'.format(prefix), + '-DLIBDIR="@0@"'.format(libdir), + '-DDATADIR="@0@"'.format(datadir), + '-DG_LOG_DOMAIN="ShellCalendarServer"' + ], + install_dir: libexecdir, + install: true +) + +service_file = 'org.gnome.Shell.CalendarServer.service' + +configure_file( + input: service_file + '.in', + output: service_file, + configuration: service_data, + install_dir: servicedir +) + +i18n.merge_file('evolution-calendar.desktop', + input: 'evolution-calendar.desktop.in', + output: 'evolution-calendar.desktop', + po_dir: '../../po', + install: true, + install_dir: desktopdir, + type: 'desktop' +) diff --git a/src/gnome-shell-extension-tool.in b/src/gnome-shell-extension-tool.in old mode 100644 new mode 100755 diff --git a/src/gnome-shell-perf-tool.in b/src/gnome-shell-perf-tool.in old mode 100644 new mode 100755 diff --git a/src/hotplug-sniffer/meson.build b/src/hotplug-sniffer/meson.build new file mode 100644 index 000000000..4a777e5d9 --- /dev/null +++ b/src/hotplug-sniffer/meson.build @@ -0,0 +1,22 @@ +hotplug_sources = [ + 'hotplug-mimetypes.h', + 'shell-mime-sniffer.h', + 'shell-mime-sniffer.c', + 'hotplug-sniffer.c' +] + +executable('gnome-shell-hotplug-sniffer', hotplug_sources, + dependencies: [gio_dep, gdk_pixbuf_dep], + include_directories: include_directories('../..'), + install_dir: libexecdir, + install: true +) + +service_file = 'org.gnome.Shell.HotplugSniffer.service' + +configure_file( + input: service_file + '.in', + output: service_file, + configuration: service_data, + install_dir: servicedir +) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 000000000..6957a948e --- /dev/null +++ b/src/meson.build @@ -0,0 +1,301 @@ +service_data = configuration_data() +service_data.set('libexecdir', libexecdir) + +subdir('calendar-server') +subdir('hotplug-sniffer') +subdir('st') +subdir('tray') + +script_data = configuration_data() +script_data.set('bindir', bindir) +script_data.set('datadir', datadir) +script_data.set('libdir', libdir) +script_data.set('libexecdir', libexecdir) +script_data.set('pkgdatadir', pkgdatadir) +script_data.set('pkglibdir', pkglibdir) +script_data.set('sysconfdir', sysconfdir) +script_data.set('PYTHON', python.path()) +script_data.set('VERSION', meson.project_version()) + +foreach tool : ['gnome-shell-extension-tool', 'gnome-shell-perf-tool'] + configure_file( + input: tool + '.in', + output: tool, + configuration: script_data, + install_dir: bindir + ) +endforeach + +gnome_shell_cflags = [ + '-DCLUTTER_ENABLE_EXPERIMENTAL_API', + '-DCOGL_ENABLE_EXPERIMENTAL_API', + '-DVERSION="@0@"'.format(meson.project_version()), + '-DLOCALEDIR="@0@"'.format(localedir), + '-DDATADIR="@0@"'.format(datadir), + '-DGNOME_SHELL_LIBEXECDIR="@0@"'.format(libexecdir), + '-DGNOME_SHELL_DATADIR="@0@"'.format(pkgdatadir), + '-DGNOME_SHELL_PKGLIBDIR="@0@"'.format(pkglibdir) +] + +rpath_link_args = ['-Wl,-rpath', mutter_typelibdir] +install_rpath = ':'.join([mutter_typelibdir, pkglibdir]) + +gnome_shell_deps = [ + gio_unix_dep, + libxml_dep, + gtk_dep, + atk_bridge_dep, + gjs_dep, + gdk_x11_dep, + soup_dep, + clutter_dep, + cogl_pango_dep, + startup_dep, + gi_dep, + canberra_dep, canberra_gtk_dep, + polkit_dep, + gcr_dep, + systemd_dep +] + +gnome_shell_deps += nm_deps +gnome_shell_deps += recorder_deps + +libshell_menu_gir_sources = [ + 'gtkactionmuxer.h', + 'gtkactionmuxer.c', + 'gtkactionobservable.h', + 'gtkactionobservable.c', + 'gtkactionobserver.h', + 'gtkactionobserver.c', + 'gtkmenutrackeritem.c', + 'gtkmenutrackeritem.h' +] + +libshell_menu_no_gir_sources= [ + 'gtkmenutracker.c', + 'gtkmenutracker.h' +] + +libshell_menu = library('gnome-shell-menu', + sources: libshell_menu_gir_sources + libshell_menu_no_gir_sources, + dependencies: [gio_dep, clutter_dep], + include_directories: conf_inc, + link_args: rpath_link_args, + install_rpath: mutter_typelibdir, + install_dir: pkglibdir, + install: true +) + +libshell_menu_gir = gnome.generate_gir(libshell_menu, + sources: libshell_menu_gir_sources, + nsversion: '0.1', + namespace: 'ShellMenu', + identifier_prefix: 'Gtk', + symbol_prefix: 'gtk', + includes: ['Gio-2.0', libst_gir[0]], + dependencies: [mutter_dep], + extra_args: ['--quiet'], + install_dir_gir: pkgdatadir, + install_dir_typelib: pkglibdir, + install: true +) + + +libshell_public_headers = [ + 'shell-app.h', + 'shell-app-system.h', + 'shell-app-usage.h', + 'shell-embedded-window.h', + 'shell-generic-container.h', + 'shell-glsl-quad.h', + 'shell-gtk-embed.h', + 'shell-global.h', + 'shell-invert-lightness-effect.h', + 'shell-action-modes.h', + 'shell-mount-operation.h', + 'shell-perf-log.h', + 'shell-screenshot.h', + 'shell-stack.h', + 'shell-tray-icon.h', + 'shell-tray-manager.h', + 'shell-util.h', + 'shell-window-tracker.h', + 'shell-wm.h' +] + +if have_networkmanager + libshell_public_headers += 'shell-network-agent.h' +endif + +libshell_private_headers = [ + 'shell-app-private.h', + 'shell-app-system-private.h', + 'shell-global-private.h', + 'shell-window-tracker-private.h', + 'shell-wm-private.h' +] + +libshell_sources = [ + 'gnome-shell-plugin.c', + 'shell-app.c', + 'shell-app-system.c', + 'shell-app-usage.c', + 'shell-embedded-window.c', + 'shell-embedded-window-private.h', + 'shell-generic-container.c', + 'shell-global.c', + 'shell-glsl-quad.c', + 'shell-gtk-embed.c', + 'shell-invert-lightness-effect.c', + 'shell-keyring-prompt.c', + 'shell-keyring-prompt.h', + 'shell-menu-tracker.c', + 'shell-menu-tracker.h', + 'shell-mount-operation.c', + 'shell-perf-log.c', + 'shell-polkit-authentication-agent.c', + 'shell-polkit-authentication-agent.h', + 'shell-screenshot.c', + 'shell-secure-text-buffer.c', + 'shell-secure-text-buffer.h', + 'shell-stack.c', + 'shell-tray-icon.c', + 'shell-tray-manager.c', + 'shell-util.c', + 'shell-window-tracker.c', + 'shell-wm.c' +] + +if have_networkmanager + libshell_sources += 'shell-network-agent.c' +endif + +libshell_private_sources = [] + +if enable_recorder + libshell_sources += ['shell-recorder.c'] + libshell_public_headers += ['shell-recorder.h'] + + libshell_private_sources += ['shell-recorder-src.c'] + libshell_private_headers += ['shell-recorder-src.h'] +endif + + +libshell_enums = gnome.mkenums('shell-enum-types', + sources: libshell_public_headers, + c_template: 'shell-enum-types.c.in', + h_template: 'shell-enum-types.h.in' +) + +libshell_gir_sources = [ + libshell_enums, + libshell_public_headers, + libshell_sources +] + +libshell_no_gir_sources = [ + js_resources, + libshell_private_headers, + libshell_private_sources +] + +dbus_generated = gnome.gdbus_codegen('org-gtk-application', + 'org.gtk.Application.xml', + namespace: 'Shell' +) + +libshell_no_gir_sources += dbus_generated + +libshell = library('gnome-shell', + sources: libshell_gir_sources + libshell_no_gir_sources, + dependencies: gnome_shell_deps + [mutter_dep, m_dep], + include_directories: [conf_inc, st_inc, include_directories('tray')], + c_args: gnome_shell_cflags, + link_with: [libshell_menu, libst, libtray], + link_args: rpath_link_args, + install_rpath: install_rpath, + install_dir: pkglibdir, + install: true +) + +libshell_gir_includes = [ + 'Clutter-@0@'.format(mutter_api_version), + 'ClutterX11-@0@'.format(mutter_api_version), + 'Meta-@0@'.format(mutter_api_version), + 'Soup-2.4' +] + +if have_networkmanager + libshell_gir_includes += ['NetworkManager-1.0', 'NMClient-1.0'] +endif + +libshell_gir_includes += [ + libgvc_gir[0], + libshell_menu_gir[0], + libst_gir[0] +] + +gnome.generate_gir(libshell, + sources: libshell_gir_sources, + nsversion: '0.1', + namespace: 'Shell', + includes: libshell_gir_includes, + link_with: [libshell_menu, libst], + extra_args: ['--quiet'], + install_dir_gir: pkgdatadir, + install_dir_typelib: pkglibdir, + install: true +) + +executable('gnome-shell', 'main.c', + c_args: gnome_shell_cflags + [ + '-DMUTTER_TYPELIB_DIR="@0@"'.format(mutter_typelibdir) + ], + dependencies: gnome_shell_deps + [mutter_dep], + link_with: libshell, + include_directories: [conf_inc, st_inc, include_directories('tray')], + link_args: rpath_link_args, + install_rpath: install_rpath, + install: true +) + +executable('gnome-shell-extension-prefs', + 'gnome-shell-extension-prefs.c', js_resources, + c_args: gnome_shell_cflags, + dependencies: gnome_shell_deps, + include_directories: [conf_inc], + link_args: rpath_link_args, + install_rpath: install_rpath, + install: true +) + + +if have_networkmanager + executable('gnome-shell-portal-helper', + 'gnome-shell-portal-helper.c', js_resources, + c_args: gnome_shell_cflags, + dependencies: gnome_shell_deps, + include_directories: [conf_inc], + link_args: rpath_link_args, + install_rpath: install_rpath, + install_dir: libexecdir, + install: true + ) +endif + +executable('gnome-shell-perf-helper', 'shell-perf-helper.c', + dependencies: [gtk_dep, gio_dep, m_dep], + include_directories: [conf_inc], + link_args: rpath_link_args, + install_rpath: install_rpath, + install_dir: libexecdir, + install: true +) + +executable('run-js-test', 'run-js-test.c', + dependencies: [mutter_dep, gio_dep, gjs_dep], + include_directories: [conf_inc], + link_with: libshell, + link_args: rpath_link_args +) diff --git a/src/st/meson.build b/src/st/meson.build new file mode 100644 index 000000000..02064bd9e --- /dev/null +++ b/src/st/meson.build @@ -0,0 +1,148 @@ +st_headers = [ + 'st-adjustment.h', + 'st-bin.h', + 'st-border-image.h', + 'st-box-layout.h', + 'st-box-layout-child.h', + 'st-button.h', + 'st-clipboard.h', + 'st-drawing-area.h', + 'st-entry.h', + 'st-focus-manager.h', + 'st-generic-accessible.h', + 'st-icon.h', + 'st-icon-colors.h', + 'st-im-text.h', + 'st-label.h', + 'st-private.h', + 'st-scrollable.h', + 'st-scroll-bar.h', + 'st-scroll-view.h', + 'st-shadow.h', + 'st-texture-cache.h', + 'st-theme.h', + 'st-theme-context.h', + 'st-theme-node.h', + 'st-types.h', + 'st-widget.h', + 'st-widget-accessible.h' +] + +st_includes = [] +foreach include : st_headers + st_includes += '#include <@0@>'.format(include) +endforeach + +st_h_data = configuration_data() +st_h_data.set('includes', '\n'.join(st_includes)) + +st_h = configure_file( + input: 'st.h.in', + output: 'st.h', + configuration: st_h_data +) + +st_inc = include_directories('.', '..') + +st_private_headers = [ + 'st-private.h', + 'st-theme-private.h', + 'st-theme-node-private.h', + 'st-theme-node-transition.h' +] + +# please, keep this sorted alphabetically +st_sources = [ + 'st-adjustment.c', + 'st-bin.c', + 'st-border-image.c', + 'st-box-layout.c', + 'st-box-layout-child.c', + 'st-button.c', + 'st-clipboard.c', + 'st-drawing-area.c', + 'st-entry.c', + 'st-focus-manager.c', + 'st-generic-accessible.c', + 'st-icon.c', + 'st-icon-colors.c', + 'st-im-text.c', + 'st-label.c', + 'st-private.c', + 'st-scrollable.c', + 'st-scroll-bar.c', + 'st-scroll-view.c', + 'st-shadow.c', + 'st-texture-cache.c', + 'st-theme.c', + 'st-theme-context.c', + 'st-theme-node.c', + 'st-theme-node-drawing.c', + 'st-theme-node-transition.c', + 'st-widget.c' +] + +st_built_sources = gnome.mkenums('st-enum-types', + sources: st_headers, + c_template: 'st-enum-types.c.in', + h_template: 'st-enum-types.h.in' +) + +st_gir_sources = st_sources + st_private_headers + st_headers + st_built_sources + +st_non_gir_sources = [ + 'st-scroll-view-fade.c', + 'st-scroll-view-fade.h' +] + +data_to_c = find_program(meson.source_root() + '/src/data-to-c.pl') + +custom_target('scroll-view-fade-glsl', + input: ['st-scroll-view-fade.glsl'], + output: ['st-scroll-view-fade-generated.c'], + build_by_default: true, + capture: true, + command: [data_to_c, '@INPUT@', 'st_scroll_view_fade_glsl'] +) + +st_cflags = [ + '-I@0@/src'.format(meson.source_root()), + '-I@0@'.format(meson.build_root()), + '-DPREFIX="@0@"'.format(prefix), + '-DLIBDIR="@0@"'.format(libdir), + '-DG_LOG_DOMAIN="St"', + '-DST_COMPILATION', + '-DCLUTTER_ENABLE_EXPERIMENTAL_API', + '-DCOGL_ENABLE_EXPERIMENTAL_API', + '-DPACKAGE_DATA_DIR="@0@"'.format(pkgdatadir) +] + +# Currently meson requires a shared library for building girs +libst = shared_library('st-1.0', + sources: st_gir_sources + st_non_gir_sources, + c_args: st_cflags, + dependencies: [clutter_dep, gtk_dep, croco_dep, x11_dep, m_dep], + install_rpath: mutter_typelibdir, + install_dir: pkglibdir, + install: true +) + +test_theme = executable('test-theme', + sources: 'test-theme.c', + c_args: st_cflags, + dependencies: [clutter_dep, gtk_dep], + link_with: libst +) + +libst_gir = gnome.generate_gir(libst, + sources: st_gir_sources, + nsversion: '1.0', + namespace: 'St', + includes: ['Clutter-' + mutter_api_version, 'Gtk-3.0'], + dependencies: [mutter_dep], + include_directories: include_directories('..'), + extra_args: ['-DST_COMPILATION', '--quiet'], + install_dir_gir: pkgdatadir, + install_dir_typelib: pkglibdir, + install: true +) diff --git a/src/st/st.h.in b/src/st/st.h.in new file mode 100644 index 000000000..825c82097 --- /dev/null +++ b/src/st/st.h.in @@ -0,0 +1,3 @@ +#define ST_H_INSIDE 1 +@includes@ +#undef ST_H_INSIDE diff --git a/src/tray/meson.build b/src/tray/meson.build new file mode 100644 index 000000000..139e3b297 --- /dev/null +++ b/src/tray/meson.build @@ -0,0 +1,12 @@ +tray_sources = [ + 'na-tray-child.c', + 'na-tray-child.h', + 'na-tray-manager.c', + 'na-tray-manager.h' +] + +libtray = static_library('tray', tray_sources, + c_args: ['-DG_LOG_DOMAIN="notification_area"'], + dependencies: [clutter_dep, gtk_dep], + include_directories: conf_inc +) diff --git a/subprojects/gvc b/subprojects/gvc index ce8e4880c..01e1fde6e 160000 --- a/subprojects/gvc +++ b/subprojects/gvc @@ -1 +1 @@ -Subproject commit ce8e4880ce31e275c40825c4ed756c791107f810 +Subproject commit 01e1fde6e5cc416d4fe7b1d8a7afb97455210e3a diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 000000000..91f9cda15 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,8 @@ +testconf = configuration_data() +testconf.set('MUTTER_TYPELIB_DIR', mutter_typelibdir) +testconf.set('srcdir', meson.current_source_dir()) +configure_file( + input: 'run-test.sh.in', + output: 'run-test.sh', + configuration: testconf +) diff --git a/tests/run-test.sh.in b/tests/run-test.sh.in index 8113091c8..71b35aca0 100755 --- a/tests/run-test.sh.in +++ b/tests/run-test.sh.in @@ -30,7 +30,7 @@ builddir=`cd $builddir && pwd` srcdir=@srcdir@ srcdir=`cd $srcdir && pwd` -GI_TYPELIB_PATH="$GI_TYPELIB_PATH${GI_TYPELIB_PATH:+:}@MUTTER_TYPELIB_DIR@:$builddir/../src:$builddir/../subprojects/gvc" +GI_TYPELIB_PATH="$GI_TYPELIB_PATH${GI_TYPELIB_PATH:+:}@MUTTER_TYPELIB_DIR@:$builddir/../src:$builddir/../src/st:$builddir/../subprojects/gvc" GJS_PATH="$srcdir:$srcdir/../js:$builddir/../js" GJS_DEBUG_OUTPUT=stderr $verbose || GJS_DEBUG_TOPICS="JS ERROR;JS LOG"