[libwnck/wip/marco/meson-build: 1/4] meson: add support for building with the cool stuff
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libwnck/wip/marco/meson-build: 1/4] meson: add support for building with the cool stuff
- Date: Fri, 21 Sep 2018 09:38:14 +0000 (UTC)
commit 10d04012fbd12addff015b1ca22d1cca3fa2e658
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Thu Sep 20 15:22:56 2018 +0200
meson: add support for building with the cool stuff
config.h.meson | 100 ++++++++++++++++++++++++++++
doc/meson.build | 22 ++++++
libwnck/libwnck-3.map | 6 ++
libwnck/meson.build | 175 ++++++++++++++++++++++++++++++++++++++++++++++++
meson.build | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++
meson_options.txt | 20 ++++++
po/meson.build | 3 +
7 files changed, 506 insertions(+)
---
diff --git a/config.h.meson b/config.h.meson
new file mode 100644
index 0000000..8937326
--- /dev/null
+++ b/config.h.meson
@@ -0,0 +1,100 @@
+/* Define to 1 if translation of program messages to the user's native
+ language is requested. */
+#mesondefine ENABLE_NLS
+
+/* Package name */
+#mesondefine GETTEXT_PACKAGE
+
+/* Define if building against cairo-xlib-xrender */
+#mesondefine HAVE_CAIRO_XLIB_XRENDER
+
+/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
+ CoreFoundation framework. */
+#mesondefine HAVE_CFLOCALECOPYCURRENT
+
+/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
+ the CoreFoundation framework. */
+#mesondefine HAVE_CFPREFERENCESCOPYAPPVALUE
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+ */
+#mesondefine HAVE_DCGETTEXT
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#mesondefine HAVE_DLFCN_H
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#mesondefine HAVE_GETTEXT
+
+/* Define if you have the iconv() function and it works. */
+#mesondefine HAVE_ICONV
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#mesondefine HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#mesondefine HAVE_MEMORY_H
+
+/* Define if you have libstartup-notification */
+#mesondefine HAVE_LIBSTARTUP_NOTIFICATION_1_0
+
+#ifdef HAVE_LIBSTARTUP_NOTIFICATION_1_0
+#define HAVE_STARTUP_NOTIFICATION 1
+#endif
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#mesondefine HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#mesondefine HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#mesondefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#mesondefine HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#mesondefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#mesondefine HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#mesondefine HAVE_UNISTD_H
+
+/* Define if you have the XRes library */
+#mesondefine HAVE_XRES
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#mesondefine LT_OBJDIR
+
+/* Define if debugging is disabled */
+#mesondefine NDEBUG
+
+/* Name of package */
+#mesondefine PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#mesondefine PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#mesondefine PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#mesondefine PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#mesondefine PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#mesondefine PACKAGE_URL
+
+/* Define to the version of this package. */
+#mesondefine PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#mesondefine STDC_HEADERS
+
+/* Version number of package */
+#mesondefine VERSION
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..2112049
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,22 @@
+gnome.gtkdoc(meson.project_name(),
+ namespace: PACKAGE_NAME,
+ main_sgml: meson.project_name() + '-docs.sgml',
+ src_dir: join_paths(meson.source_root(), meson.project_name()),
+ dependencies: declare_dependency(
+ include_directories: default_includes,
+ dependencies: LIBWNCK_DEPS,
+ compile_args: libwnck_cflags,
+ link_with: libwnck_lib
+ ),
+ gobject_typesfile: meson.project_name() + '.types',
+ scan_args: [
+ '--rebuild-types',
+ '--ignore-headers=' + ' '.join(['wnck-enum-types.h', 'version.h']),
+ '--deprecated-guards="WNCK_DISABLE_DEPRECATED"'
+ ],
+ mkdb_args: [
+ '--sgml-mode', '--output-format=xml'
+ ],
+ install: true,
+ module_version: MODULE_VERSION,
+)
diff --git a/libwnck/libwnck-3.map b/libwnck/libwnck-3.map
new file mode 100644
index 0000000..7b17479
--- /dev/null
+++ b/libwnck/libwnck-3.map
@@ -0,0 +1,6 @@
+{
+global:
+ wnck_*;
+local:
+ *;
+};
diff --git a/libwnck/meson.build b/libwnck/meson.build
new file mode 100644
index 0000000..2e6878e
--- /dev/null
+++ b/libwnck/meson.build
@@ -0,0 +1,175 @@
+gnome = import('gnome')
+
+libwnck_includepath = join_paths(includedir, PACKAGE_NAME)
+libwnck_includedir = join_paths(libwnck_includepath, meson.project_name())
+
+version_data = configuration_data()
+version_array = meson.project_version().split('.')
+version_data.set('WNCK_MAJOR_VERSION', version_array[0])
+version_data.set('WNCK_MINOR_VERSION', version_array[1])
+version_data.set('WNCK_MICRO_VERSION', version_array[2])
+
+headers = [
+ 'libwnck.h',
+ 'pager.h',
+ 'application.h',
+ 'class-group.h',
+ 'screen.h',
+ 'selector.h',
+ 'tasklist.h',
+ 'util.h',
+ 'window.h',
+ 'window-action-menu.h',
+ 'workspace.h',
+]
+
+headers += configure_file(
+ input: 'version.h.in',
+ output: 'version.h',
+ configuration: version_data)
+
+sources = [
+ 'application.c',
+ 'class-group.c',
+ 'pager.c',
+ 'screen.c',
+ 'selector.c',
+ 'tasklist.c',
+ 'util.c',
+ 'window-action-menu.c',
+ 'window.c',
+ 'wnck-image-menu-item-private.h',
+ 'wnck-image-menu-item.c',
+ 'workspace.c',
+ 'xutils.c',
+]
+
+a11y_sources = [
+ 'pager-accessible.c',
+ 'pager-accessible.h',
+ 'pager-accessible-factory.c',
+ 'pager-accessible-factory.h',
+ 'workspace-accessible.c',
+ 'workspace-accessible.h',
+ 'workspace-accessible-factory.c',
+ 'workspace-accessible-factory.h',
+]
+
+enum_types = []
+enum_types += gnome.mkenums(
+ 'wnck-enum-types.h',
+ sources: headers,
+ fhead: '''#if !defined (__LIBWNCK_H_INSIDE__) && !defined (WNCK_COMPILATION)
+#error "Only <libwnck/libwnck.h> can be included directly."
+#endif
+#ifndef __WNCK_ENUM_TYPES_H__
+#define __WNCK_ENUM_TYPES_H__
+G_BEGIN_DECLS''',
+ ftail: '''G_END_DECLS
+#endif /* __WNCK_ENUM_TYPES_H__ */''',
+ eprod: '''#define WNCK_TYPE_@ENUMSHORT@ @enum_name@_get_type()
+GType @enum_name@_get_type (void);''',
+ install_header: true,
+ install_dir: libwnck_includedir
+)
+
+enum_types += gnome.mkenums(
+ 'wnck-enum-types.c',
+ sources: headers,
+ fhead: '#include <libwnck/libwnck.h>',
+ fprod: '/* enumerations from "@filename@" */',
+ vhead: 'static const G@Type@Value _@enum_name@_values[] = {',
+ vprod: '{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },',
+ vtail: '''{ 0, NULL, NULL }
+};
+
+GType
+@enum_name@_get_type (void)
+{
+ static GType type = 0;
+ if (!type)
+ type = g_@type@_register_static ("@EnumName@", _@enum_name@_values);
+ return type;
+}'''
+)
+
+resources = gnome.compile_resources(
+ '@0@-resources'.format(meson.project_name()),
+ 'wnck.gresource.xml',
+ source_dir: '.',
+ c_name: meson.project_name()
+)
+
+libwnck_cflags = [
+ '-DG_LOG_DOMAIN="Wnck"',
+ '-DWNCK_I_KNOW_THIS_IS_UNSTABLE',
+ '-DWNCK_LOCALEDIR="@0@"'.format(localedir),
+ '-DWNCK_COMPILATION',
+ '-DSN_API_NOT_YET_FROZEN=1'
+]
+
+mapfile = MODULE_NAME + '.map'
+libwnck_ldflags = [
+ '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile),
+]
+
+if get_option('enable-deprecation-flags')
+ foreach domain: ['G', 'ATK', 'GDK', 'GDK_PIXBUF', 'GTK', 'WNCK']
+ libwnck_cflags += '-D@0@_DISABLE_DEPRECATED'.format(domain)
+ endforeach
+endif
+
+libwnck_lib = shared_library(LIBNAME,
+ include_directories: default_includes,
+ sources: sources + a11y_sources + enum_types + resources,
+ dependencies: LIBWNCK_DEPS,
+ version: '@0@.@1@.@2@'.format(LIBWNCK_SOVERSION, LIBWNCK_CURRENT, LIBWNCK_REVISION),
+ soversion: LIBWNCK_SOVERSION,
+ install: true,
+ c_args: libwnck_cflags,
+ link_args: libwnck_ldflags,
+)
+
+introspection = get_option('introspection')
+if not introspection.disabled()
+ find_program('g-ir-scanner', required: introspection.enabled())
+ gnome.generate_gir(libwnck_lib,
+ sources : headers + sources + enum_types,
+ namespace : 'Wnck',
+ nsversion : MODULE_VERSION,
+ export_packages : PACKAGE_NAME,
+ includes : ['GObject-2.0', 'GdkPixbuf-2.0', 'Gtk-3.0'],
+ extra_args: ['--c-include=@0@/@0@.h'.format(meson.project_name()),
+ '--cflags-begin'] + libwnck_cflags + ['--cflags-end'],
+ install : true
+ )
+endif
+
+install_headers(headers, subdir: libwnck_includedir)
+
+progs = [
+ 'wnckprop',
+]
+
+if not get_option('enable-deprecation-flags')
+ progs += 'wnck-urgency-monitor'
+endif
+
+test_progs = [
+ 'test-wnck',
+ 'test-tasklist',
+ 'test-selector',
+ 'test-pager',
+ 'test-urgent',
+ 'test-shutdown',
+]
+
+foreach prog: progs + test_progs
+ executable(prog, [prog + '.c'] + enum_types,
+ include_directories: default_includes,
+ dependencies: LIBWNCK_DEPS,
+ c_args: libwnck_cflags,
+ link_with: libwnck_lib,
+ install: progs.contains(prog) and get_option('install-tools'),
+ install_dir: bindir)
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..e3eb6a1
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,180 @@
+project('libwnck',
+ 'c',
+ version: '3.30.0',
+ meson_version: '>= 0.47.999')
+
+LIBWNCK_SOVERSION = 0
+
+# libtool versioning for libwnck
+# increment if the interface has additions, changes, removals.
+LIBWNCK_CURRENT = 3
+
+# increment any time the source changes; set to
+# 0 if you increment CURRENT
+LIBWNCK_REVISION = 0
+
+# increment if any interfaces have been added; set to 0
+# if any interfaces have been changed or removed. removal has
+# precedence over adding, so set to 0 if both happened.
+LIBWNCK_AGE = 3
+
+MODULE_NAME = meson.project_name() + '-@0@'.format(LIBWNCK_CURRENT)
+MODULE_VERSION = '@0@.@1@'.format(LIBWNCK_CURRENT, LIBWNCK_REVISION)
+PACKAGE_NAME = MODULE_NAME + '.@0@'.format(LIBWNCK_REVISION)
+LIBNAME = MODULE_NAME.split('lib')[1]
+
+prefix = get_option('prefix')
+bindir = join_paths(prefix, get_option('bindir'))
+libdir = join_paths(prefix, get_option('libdir'))
+includedir = join_paths(prefix, get_option('includedir'))
+localedir = join_paths(prefix, get_option('localedir'))
+
+cc = meson.get_compiler('c')
+default_includes = include_directories('.')
+
+#####
+# CFLAGS
+# The same as the AX_COMPILER_FLAGS Autotools macro.
+
+warning_cflags = [
+ '-fno-strict-aliasing',
+ '-Wall',
+ '-Wextra',
+ '-Wundef',
+ '-Wnested-externs',
+ '-Wwrite-strings',
+ '-Wpointer-arith',
+ '-Wmissing-declarations',
+ '-Wmissing-prototypes',
+ '-Wstrict-prototypes',
+ '-Wredundant-decls',
+ '-Wno-unused-parameter',
+ '-Wno-missing-field-initializers',
+ '-Wdeclaration-after-statement',
+ '-Wformat=2',
+ '-Wold-style-definition',
+ '-Wcast-align',
+ '-Wformat-nonliteral',
+ '-Wformat-security',
+ '-Wsign-compare',
+ '-Wstrict-aliasing',
+ '-Wshadow',
+ '-Winline',
+ '-Wpacked',
+ '-Wmissing-format-attribute',
+ '-Wmissing-noreturn',
+ '-Winit-self',
+ '-Wredundant-decls',
+ '-Wmissing-include-dirs',
+ '-Wunused-but-set-variable',
+ '-Warray-bounds',
+ '-Wimplicit-function-declaration',
+ '-Wreturn-type',
+ '-Wswitch-enum',
+ '-Wswitch-default',
+ '-Wduplicated-cond',
+ '-Wduplicated-branches',
+ '-Wlogical-op',
+ '-Wrestrict',
+ '-Wnull-dereference',
+ '-Wjump-misses-init',
+ '-Wdouble-promotion'
+]
+
+supported_warning_cflags = cc.get_supported_arguments(warning_cflags)
+add_global_arguments(supported_warning_cflags, language : 'c')
+##### end CFLAGS
+
+conf = configuration_data()
+check_headers = [
+ ['HAVE_DLFCN_H', 'dlfcn.h'],
+ ['HAVE_INTTYPES_H', 'inttypes.h'],
+ ['HAVE_MEMORY_H', 'memory.h'],
+ ['HAVE_STDINT_H', 'stdint.h'],
+ ['HAVE_STDLIB_H', 'stdlib.h'],
+ ['HAVE_STRINGS_H', 'strings.h'],
+ ['HAVE_STRING_H', 'string.h'],
+ ['HAVE_SYS_STAT_H', 'sys/stat.h'],
+ ['HAVE_SYS_TYPES_H', 'sys/types.h'],
+ ['HAVE_UNISTD_H', 'unistd.h'],
+]
+
+foreach h: check_headers
+ if cc.has_header(h.get(1))
+ conf.set(h.get(0), 1)
+ endif
+endforeach
+
+check_functions = [
+ ['HAVE_DCGETTEXT', 'dcgettext', '#include<libintl.h>'],
+]
+
+foreach f: check_functions
+ if cc.has_function(f.get(1), prefix : f.get(2))
+ conf.set(f.get(0), 1)
+ endif
+endforeach
+
+LIBWNCK_DEPS = [cc.find_library('m', required: true)]
+STARTUP_NOTIFICATION_PACKAGE = 'libstartup-notification-1.0'
+X11_PACKAGE = 'x11'
+XRES_PACKAGE = 'xres'
+
+pkg_deps = [
+ ['cairo-xlib-xrender', [], false],
+ ['glib-2.0', '>= 2.32', true],
+ ['gobject-2.0', '>= 2.13.0', true],
+ ['gtk+-3.0', '>= 3.22.0', true],
+ [STARTUP_NOTIFICATION_PACKAGE, '>= 0.4', get_option('startup-notification').enabled()],
+ [X11_PACKAGE, [], true],
+ [XRES_PACKAGE, [], false],
+]
+
+foreach p: pkg_deps
+ pkg = p.get(0)
+ required = p.get(2)
+ dep = dependency(pkg, version: p.get(1), required: required)
+ LIBWNCK_DEPS += dep
+
+ if not required and dep.found()
+ conf.set('HAVE_' + pkg.to_upper().underscorify(), 1)
+ endif
+endforeach
+
+conf.set_quoted('PACKAGE_NAME', meson.project_name())
+conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
+conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('GETTEXT_PACKAGE', PACKAGE_NAME)
+
+configure_file(input: 'config.h.meson',
+ output : 'config.h',
+ configuration : conf)
+
+pc_conf = configuration_data()
+pc_conf.set('prefix', get_option('prefix'))
+pc_conf.set('exec_prefix', '${prefix}')
+pc_conf.set('libdir', '${exec_prefix}/' + get_option('libdir'))
+pc_conf.set('includedir', '${prefix}/' + get_option('includedir'))
+pc_conf.set('STARTUP_NOTIFICATION_PACKAGE', STARTUP_NOTIFICATION_PACKAGE)
+pc_conf.set('X11_PACKAGE', X11_PACKAGE)
+pc_conf.set('XRES_PACKAGE', XRES_PACKAGE)
+pc_conf.set('VERSION', meson.project_version())
+
+foreach pc: [PACKAGE_NAME, PACKAGE_NAME + '-uninstalled']
+ install_path = []
+ if not pc.contains('-uninstalled')
+ install_path = join_paths(libdir, 'pkgconfig')
+ endif
+ configure_file(input: pc + '.pc.in',
+ output: pc + '.pc',
+ configuration: pc_conf,
+ install_dir: install_path)
+endforeach
+
+subdir('libwnck')
+subdir('po')
+
+if get_option('enable-gtk-doc')
+ subdir('doc')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..59eeb7d
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,20 @@
+option('enable-deprecation-flags',
+ type: 'boolean',
+ value: false,
+ description: 'Use *_DISABLE_DEPRECATED flags')
+option('install-tools',
+ type: 'boolean',
+ value: true,
+ description: 'Install wnck-based tools')
+option('startup-notification',
+ type: 'feature',
+ value: 'auto',
+ description: 'Use Startup notification')
+option('introspection',
+ type: 'feature',
+ value: 'enabled',
+ description: 'Enable GObject introspection')
+option('enable-gtk-doc',
+ type: 'boolean',
+ value: false,
+ description: 'Enable generating the API reference (depends on GTK-Doc)')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..2a69160
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+i18n = import('i18n')
+
+i18n.gettext(PACKAGE_NAME, preset: 'glib')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]