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

build: Support the meson build system

Yay, one more module off the list!

!7
parent 72c88a0d
/* The gettext translation domain */
#mesondefine GETTEXT_PACKAGE
/* Path to library install prefix */
#mesondefine INSTALL_PREFIX
/* Define if using seccomp */
#mesondefine ENABLE_SECCOMP
/* Define to 1 if Bubblewrap support is available */
#mesondefine HAVE_BWRAP
/* we have the timerfd_create(2) system call */
#mesondefine HAVE_TIMERFD
#
/* Define to 1 if you have the `openat' function. */
#mesondefine HAVE_OPENAT
/* define if udev is available */
#mesondefine HAVE_UDEV
/* Define to include GNU extensions */
#mesondefine _GNU_SOURCE
gnome.yelp('fdl', sources: 'index.docbook')
gnome.yelp('gpl', sources: 'index.docbook')
gnome.yelp('lgpl', sources: 'index.docbook')
ignored_headers = [
'gnome-rr-private.h',
'libgsystem',
'meta-dbus-idle-monitor.h',
'meta-dbus-xrandr.h',
'meta-xrandr-shared.h'
]
gnome.gtkdoc('gnome-desktop3',
main_sgml: 'gnome-desktop3-docs.sgml',
ignore_headers: ignored_headers,
scan_args: '--deprecated-guards="GNOME_DISABLE_DEPRECATED"',
mkdb_args: ['--sgml-mode', '--output-format=xml'],
src_dir: join_paths(meson.source_root(), 'libgnome-desktop'),
install: true
)
libargs = [
'-DG_LOG_DOMAIN="GnomeDesktop"',
'-DGDK_DISABLE_DEPRECATION_WARNINGS',
'-DGTK_DISABLE_DEPRECATION_WARNINGS',
'-DGNOMELOCALEDIR="@0@"'.format(localedir),
'-DLIBLOCALEDIR="@0@"'.format(liblocaledir),
'-DISO_CODES_PREFIX="@0@"'.format(iso_codes_prefix),
'-DXKB_BASE="@0@"'.format(xkb_base)
]
introspection_sources = [
'gnome-desktop-thumbnail.c',
'gnome-bg.c',
'gnome-bg-slide-show.c',
'gnome-bg-crossfade.c',
'gnome-rr.c',
'gnome-rr-config.c',
'gnome-rr-output-info.c',
'gnome-pnp-ids.c',
'gnome-wall-clock.c',
'gnome-xkb-info.c',
'gnome-idle-monitor.c',
'gnome-languages.c'
]
dbus_xrandr_built_sources = gnome.gdbus_codegen('meta-dbus-xrandr',
'xrandr.xml',
namespace: 'MetaDBus',
interface_prefix: 'org.gnome.Mutter'
)
dbus_idle_built_sources = gnome.gdbus_codegen('meta-dbus-idle-monitor',
'idle-monitor.xml',
namespace: 'MetaDBus',
interface_prefix: 'org.gnome.Mutter',
object_manager: true
)
libgnome_desktop_sources = [
introspection_sources,
dbus_xrandr_built_sources,
dbus_idle_built_sources,
'gnome-datetime-source.h',
'gnome-datetime-source.c',
'gnome-rr-private.h',
'default-input-sources.h',
'meta-xrandr-shared.h',
'gnome-desktop-thumbnail-script.c',
'gnome-desktop-thumbnail-script.h'
]
libgnome_desktop_headers = [
'gnome-bg.h',
'gnome-bg-crossfade.h',
'gnome-bg-slide-show.h',
'gnome-desktop-thumbnail.h',
'gnome-rr.h',
'gnome-rr-config.h',
'gnome-pnp-ids.h',
'gnome-wall-clock.h',
'gnome-xkb-info.h',
'gnome-idle-monitor.h',
'gnome-languages.h'
]
install_headers(libgnome_desktop_headers,
subdir: 'gnome-desktop-3.0/libgnome-desktop'
)
gnome_desktop_deps = [
config_h,
gdk_pixbuf_dep,
gtk_dep,
glib_dep,
gio_dep,
gio_unix_dep,
schemas_dep,
xkb_config_dep,
iso_codes_dep,
udev_dep,
seccomp_dep
]
libgnome_desktop = library('gnome-desktop-3',
libgnome_desktop_sources,
dependencies: [gnome_desktop_deps, m_dep, rt_dep, x_dep],
soversion: soversion,
c_args: libargs,
install: true
)
libgnome_desktop_dep = declare_dependency(
dependencies: gnome_desktop_deps,
link_with: libgnome_desktop
)
gnome.generate_gir(libgnome_desktop,
sources: introspection_sources + libgnome_desktop_headers,
export_packages: 'gnome-desktop-3.0',
namespace: 'GnomeDesktop',
nsversion: '3.0',
includes: ['GObject-2.0', 'Gtk-3.0', 'GDesktopEnums-3.0'],
extra_args: '-DGNOME_DESKTOP_USE_UNSTABLE_API',
identifier_prefix: 'Gnome',
symbol_prefix: 'gnome',
install: true
)
desktop_pc = pkg.generate(
libraries: libgnome_desktop,
requires: ['gtk+-3.0', 'gsettings-desktop-schemas'],
version: meson.project_version(),
name: 'gnome-desktop-3.0',
filebase: 'gnome-desktop-3.0',
description: 'Utility library for loading .desktop files',
subdirs: 'gnome-desktop-3.0'
)
if get_option('debug_tools')
executable('gnome-rr-debug',
sources: 'gnome-rr-debug.c',
dependencies: libgnome_desktop_dep,
install_dir: libexecdir,
install: true
)
endif
test_programs = [
'test-xkb-info',
'test-pnp-ids',
'test-wall-clock',
'test-desktop-thumbnail',
'test-idle-monitor',
'test-languages'
]
foreach program : test_programs
executable(program, program + '.c',
dependencies: libgnome_desktop_dep
)
endforeach
project('gnome-desktop', 'c',
meson_version: '>= 0.47.0',
version: '3.30.0',
license: ['GPL2+', 'LGPL2+']
)
# Before making a release, the soversion string should be modified.
# The string is of the form C.A.R.
# - If interfaces have been changed or added, but binary compatibility has
# been preserved, change to C+1.A+1.0
# - If binary compatibility has been broken (eg removed or changed interfaces)
# change to C+1.0.0
# - If the interface is the same as the previous version, change to C.A.R+1
soversion = '17.0.2'
gdk_pixbuf_req = '>= 2.36.5'
gtk_req = '>= 3.3.6'
glib_req = '>= 2.53.0'
xrandr_req = '>= 1.3'
schemas_req = '>= 3.27.0'
xext_req = '>= 1.1'
gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')
prefix = get_option('prefix')
datadir = join_paths(prefix, get_option('datadir'))
libexecdir = join_paths(prefix, get_option('libexecdir'))
liblocaledir = join_paths(get_option('prefix'), 'lib', 'locale')
localedir = join_paths(datadir, 'locale')
test_metadir = join_paths(datadir, 'installed-tests', meson.project_name())
test_execdir = join_paths(libexecdir, 'installed-tests', meson.project_name())
versiondir = join_paths(datadir, 'gnome')
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req)
gtk_dep = dependency('gtk+-3.0', version: gtk_req)
glib_dep = dependency('glib-2.0', version: glib_req)
gio_dep = dependency('gio-2.0', version: glib_req)
gio_unix_dep = dependency('gio-unix-2.0', version: glib_req)
schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)
xkb_config_dep = dependency('xkeyboard-config')
iso_codes_dep = dependency('iso-codes')
x_dep = dependency('x11')
udev_dep = dependency('libudev', required: get_option('udev'))
# Check for bubblewrap compatible platform
host_os = host_machine.system()
host_cpu = host_machine.cpu()
supported_os = ['linux']
unsupported_cpus = ['alpha', 'ia64', 'm68k', 'sh4', 'sparc64']
if supported_os.contains(host_os) and not unsupported_cpus.contains(host_cpu)
seccomp_dep = dependency('libseccomp')
else
seccomp_dep = dependency('', required: false)
endif
xkb_base = xkb_config_dep.get_pkgconfig_variable('xkb_base')
iso_codes_prefix = iso_codes_dep.get_pkgconfig_variable('prefix')
cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required: false)
rt_dep = cc.find_library('rt', required: false)
if not cc.has_function('clock_gettime', dependencies: rt_dep)
rt_dep = dependency('', required: false)
endif
conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', '@0@-3.0'.format(meson.project_name()))
conf.set_quoted('INSTALL_PREFIX', prefix)
conf.set10('ENABLE_SECCOMP', seccomp_dep.found())
conf.set10('HAVE_BWRAP', seccomp_dep.found())
conf.set10('_GNU_SOURCE', seccomp_dep.found())
conf.set10('HAVE_UDEV', udev_dep.found())
conf.set10('HAVE_TIMERFD', cc.has_function('timerfd_create'))
conf.set10('HAVE_OPENAT', cc.has_function('openat'))
config_h = declare_dependency(
sources: configure_file(
configuration: conf,
input: 'config.h.meson',
output: 'config.h'
),
include_directories: include_directories('.')
)
version_array = meson.project_version().split('.')
version_conf = configuration_data()
version_conf.set('GNOME_PLATFORM', version_array[0])
version_conf.set('GNOME_MINOR', version_array[1])
version_conf.set('GNOME_MICRO', version_array[2])
version_conf.set('GNOME_DISTRIBUTOR', get_option('gnome_distributor'))
if get_option('date_in_gnome_version')
date = run_command(['date', '+%Y-%m-%d'])
version_conf.set('GNOME_DATE', date.stdout().strip())
version_conf.set('GNOME_DATE_COMMENT_START', '')
version_conf.set('GNOME_DATE_COMMENT_END', '')
else
version_conf.set('GNOME_DATE', '')
version_conf.set('GNOME_DATE_COMMENT_START', '<!--')
version_conf.set('GNOME_DATE_COMMENT_END', '-->')
endif
version_xml = configure_file(
configuration: version_conf,
input: 'gnome-version.xml.in',
output: 'gnome-version.xml'
)
install_data(version_xml, install_dir: versiondir)
subdir('libgnome-desktop')
subdir('po')
subdir('tests')
if get_option('desktop_docs')
subdir('desktop-docs/fdl')
subdir('desktop-docs/gpl')
subdir('desktop-docs/lgpl')
endif
if get_option('gtk_doc')
subdir('docs/reference/gnome-desktop3')
endif
option('gnome_distributor',
type: 'string', value: 'GNOME.Org',
description: 'Specify name of GNOME distributor'
)
option('date_in_gnome_version',
type: 'boolean', value: true,
description: 'Include the buid date in gnome-version.xml'
)
option('desktop_docs',
type: 'boolean', value: true,
description: 'Build desktop-wide help documents'
)
option('debug_tools',
type: 'boolean', value: true, description: 'Build debug tools'
)
option('udev',
type: 'feature', description: 'Udev support'
)
option('gtk_doc',
type: 'boolean', value: false, description: 'Build API reference'
)
option('installed_tests',
type: 'boolean', value: false, description: 'Enable installed tests'
)
i18n.gettext('gnome-desktop-3.0', preset: 'glib')
test_args = [
'-DG_LOG_DOMAIN="GnomeDesktop"',
'-DGDK_DISABLE_DEPRECATED_WARNINGS',
'-DGTK_DISABLE_DEPRECATED_WARNINGS',
'-DINSTALLED_TEST_DIR="@0@"'.format(test_execdir)
]
test_programs = [
'wall-clock',
'wallclock-reftest'
]
test_metas = []
foreach program: test_programs
exe = executable(program, program + '.c',
dependencies: libgnome_desktop_dep,
c_args: test_args,
install_dir: test_execdir,
install: get_option('installed_tests')
)
if get_option('installed_tests')
meta_data = configuration_data()
meta_data.set('TEST_EXEC', join_paths(test_execdir, program))
test_metas += configure_file(
configuration: meta_data,
input: 'meta.test.in',
output: program + '.test',
)
endif
endforeach
if get_option('installed_tests')
test_data = files(
'C.ref.ui',
'C.ui',
'en_US.utf-8.ref.ui',
'en_US.utf-8.ui',
'he_IL.utf8.ref.ui',
'he_IL.utf8.ui'
)
install_data(test_data + test_metas, install_dir: test_metadir)
endif
[Test]
Type=session
Exec=@TEST_EXEC@ --tap
Output=TAP
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment