Commit c987d3d2 authored by Florian Müllner's avatar Florian Müllner

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
parent 26e7962d
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
)
/* 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 <sys/resource.h> 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
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)
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
#!/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
version_conf = configuration_data()
version_conf.set('VERSION', meson.project_version())
subdir('shell')
subdir('st')
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
)
......@@ -52,10 +52,15 @@
<xi:include href="xml/shell-mount-operation.xml"/>
<xi:include href="xml/shell-polkit-authentication-agent.xml"/>
</chapter>
<!-- FIXME:
Not generated at the moment, find out whether to blame gtk-doc or meson
-->
<!--
<chapter id="object-tree">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>
</chapter>
-->
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
......
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
)
......@@ -47,10 +47,15 @@
<xi:include href="xml/st-texture-cache.xml"/>
</chapter>
</part>
<!-- FIXME:
Not generated at the moment, find out whether to blame gtk-doc or meson
-->
<!--
<chapter id="object-tree">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>
</chapter>
-->
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
......
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]
)
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
)
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
)
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
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'
)
i18n.gettext(meson.project_name(), preset: 'glib')
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'
)
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
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
)
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'