[goocanvas/goocanvas-3.0-meson] build: Port to meson build system
- From: Iñigo Martínez <inigomartinez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goocanvas/goocanvas-3.0-meson] build: Port to meson build system
- Date: Thu, 21 Jan 2021 07:59:46 +0000 (UTC)
commit 922ff44d5764f32ae76eb4bcfee32be42685888b
Author: Iñigo Martínez <inigomartinez gmail com>
Date: Mon Jan 18 11:41:53 2021 +0100
build: Port to meson build system
meson is a build system focused on speed an ease of use, which
helps speeding up the software development.
bindings/python/meson.build | 4 ++
demo/meson.build | 67 +++++++++++++++++++++
docs/meson.build | 38 ++++++++++++
docs/xml/gtkdocentities.ent.in | 7 +++
docs/xml/meson.build | 15 +++++
meson.build | 83 +++++++++++++++++++++++++
meson_options.txt | 4 ++
po/meson.build | 1 +
src/goocanvasenumtypes.c.template | 41 +++++++++++++
src/goocanvasenumtypes.h.template | 24 ++++++++
src/meson.build | 123 ++++++++++++++++++++++++++++++++++++++
11 files changed, 407 insertions(+)
---
diff --git a/bindings/python/meson.build b/bindings/python/meson.build
new file mode 100644
index 0000000..a1b1c07
--- /dev/null
+++ b/bindings/python/meson.build
@@ -0,0 +1,4 @@
+install_data(
+ 'GooCanvas.py',
+ install_dir: py_installation.get_path('purelib') / 'gi/overrides',
+)
diff --git a/demo/meson.build b/demo/meson.build
new file mode 100644
index 0000000..d379901
--- /dev/null
+++ b/demo/meson.build
@@ -0,0 +1,67 @@
+tests = [
+ ['generic-position-demo', {'sources': files('generic-position-demo.c')}],
+ ['mv-generic-position-demo', {'sources': files('mv-generic-position-demo.c')}],
+ ['mv-radii-demo', {'sources': files('mv-radii-demo.c')}],
+ ['mv-rotate-skew-demo', {'sources': files('mv-rotate-skew-demo.c')}],
+ ['mv-scalability-demo', {'sources': files('mv-scalability-demo.c')}],
+ ['mv-simple-demo', {'sources': files('mv-simple-demo.c')}],
+ ['mv-table-demo', {'sources': files('mv-table-demo.c')}],
+ ['radii-demo', {'sources': files('radii-demo.c')}],
+ ['scalability-demo', {'sources': files('scalability-demo.c')}],
+ ['simple-demo', {'sources': files('simple-demo.c')}],
+ ['table-demo', {'sources': files('table-demo.c')}],
+ ['units-demo', {'sources': files('units-demo.c')}],
+ ['widgets-demo', {'sources': files('widgets-demo.c')}],
+]
+
+sources = files(
+ 'demo-animation.c',
+ 'demo-arrowhead.c',
+ 'demo.c',
+ 'demo-clipping.c',
+ 'demo-events.c',
+ 'demo-features.c',
+ 'demo-fifteen.c',
+ 'demo-focus.c',
+ 'demo-grabs.c',
+ 'demo-item.c',
+ 'demo-large-items.c',
+ 'demo-large-line.c',
+ 'demo-large-rect.c',
+ 'demo-paths.c',
+ 'demo-scalability.c',
+ 'demo-table.c',
+)
+
+tests += [['demo', {'sources': sources}]]
+
+sources = files(
+ 'mv-demo-animation.c',
+ 'mv-demo-arrowhead.c',
+ 'mv-demo.c',
+ 'mv-demo-clipping.c',
+ 'mv-demo-events.c',
+ 'mv-demo-features.c',
+ 'mv-demo-fifteen.c',
+ 'mv-demo-focus.c',
+ 'mv-demo-grabs.c',
+ 'mv-demo-paths.c',
+ 'mv-demo-scalability.c',
+ 'mv-demo-table.c',
+)
+
+tests += [['mv-demo', {'sources': sources}]]
+
+deps = [
+ libgoocanvas_dep,
+ m_dep,
+]
+
+foreach test: tests
+ executable(
+ test[0],
+ include_directories: top_inc,
+ dependencies: deps,
+ kwargs: test[1],
+ )
+endforeach
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..ffbbf80
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,38 @@
+subdir('xml')
+
+# FIXME: the file name has not been updated
+doc_module_basename = meson.project_name() + (goocanvas_major_version - 1).to_string()
+
+doc_module_dir = gnome.gtkdoc_html_dir(goocanvas_api_name)
+
+private_headers = [
+ 'goocanvasmarshal.h',
+ 'goocanvasprivate.h',
+]
+
+expand_content_files = [
+ 'architecture.xml',
+ 'coordinates.xml',
+ 'creating-items.xml',
+ 'model-view-canvas.xml',
+ 'overview.xml',
+ 'simple-canvas.xml',
+ 'wysiwyg.xml',
+]
+
+gnome.gtkdoc(
+ goocanvas_api_name,
+ main_xml: doc_module_basename + '-docs.sgml',
+ module_version: goocanvas_major_version.to_string(),
+ src_dir: src_inc,
+ ignore_headers: private_headers,
+ include_directories: top_inc,
+ dependencies: libgoocanvas_dep,
+ gobject_typesfile: files(doc_module_basename + '.types'),
+ fixxref_args: '--html-dir=' + (goocanvas_prefix / doc_module_dir),
+ scan_args: '--rebuild-types',
+ scanobjs_args: '--query-child-properties=goo_canvas_query_child_properties',
+ expand_content_files: expand_content_files,
+ install: true,
+ install_dir: doc_module_dir,
+)
diff --git a/docs/xml/gtkdocentities.ent.in b/docs/xml/gtkdocentities.ent.in
new file mode 100644
index 0000000..fd86c16
--- /dev/null
+++ b/docs/xml/gtkdocentities.ent.in
@@ -0,0 +1,7 @@
+<!ENTITY package "@PACKAGE@">
+<!ENTITY package_bugreport "@PACKAGE_BUGREPORT@">
+<!ENTITY package_name "@PACKAGE_NAME@">
+<!ENTITY package_string "@PACKAGE_STRING@">
+<!ENTITY package_tarname "@PACKAGE_TARNAME@">
+<!ENTITY package_url "@PACKAGE_URL@">
+<!ENTITY package_version "@PACKAGE_VERSION@">
diff --git a/docs/xml/meson.build b/docs/xml/meson.build
new file mode 100644
index 0000000..973e721
--- /dev/null
+++ b/docs/xml/meson.build
@@ -0,0 +1,15 @@
+ent_conf = {
+ 'PACKAGE': goocanvas_name,
+ 'PACKAGE_BUGREPORT': '',
+ 'PACKAGE_NAME': goocanvas_name,
+ 'PACKAGE_STRING': '@0@ @1@'.format(goocanvas_name, goocanvas_version),
+ 'PACKAGE_TARNAME': goocanvas_name,
+ 'PACKAGE_URL': '',
+ 'PACKAGE_VERSION': goocanvas_version,
+}
+
+configure_file(
+ input: 'gtkdocentities.ent.in',
+ output: '@BASENAME@',
+ configuration: ent_conf,
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..f84cd35
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,83 @@
+project(
+ 'goocanvas', 'c',
+ version: '3.0.0',
+ license: 'LGPL',
+ default_options: 'buildtype=debugoptimized',
+ meson_version: '>= 0.49.0',
+)
+
+goocanvas_name = meson.project_name()
+
+goocanvas_version = meson.project_version()
+version_array = goocanvas_version.split('.')
+goocanvas_major_version = version_array[0].to_int()
+goocanvas_minor_version = version_array[1].to_int()
+goocanvas_micro_version = version_array[2].to_int()
+
+# If the source code has changed at all, increment goocanvasui_revision
+# If any interfaces have been added, removed, or changed, increment goocanvasui_current, and set
goocanvasui_revision to 0.
+# If any interfaces have been added since the last public release, then increment goocanvasui_age.
+# If any interfaces have been removed since the last public release, then set goocanvasui_age to 0.
+# Reference: http://www.gnu.org/software/libtool/manual/libtool.html#Versioning
+
+goocanvas_revision = 2
+goocanvas_current = 12
+goocanvas_age = 3
+goocanvas_current_minus_age = goocanvas_current - goocanvas_age
+goocanvas_libversion = '@0@.@1@.@2@'.format(goocanvas_current_minus_age, goocanvas_age, goocanvas_revision)
+
+goocanvas_api_name = meson.project_name() + goocanvas_major_version.to_string()
+goocanvas_api_version = '@0@.@1@'.format(goocanvas_major_version, goocanvas_minor_version)
+goocanvas_api_prefix = 'Goo'
+
+goocanvas_api_ns = 'GooCanvas'
+
+goocanvas_prefix = get_option('prefix')
+goocanvas_includedir = get_option('includedir')
+goocanvas_libdir = get_option('libdir')
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+pymod = import('python')
+
+source_root = meson.current_source_dir()
+build_root = meson.current_build_dir()
+
+its_dir = source_root / 'data/gettext'
+po_dir = source_root / 'po'
+
+top_inc = include_directories('.')
+
+cc = meson.get_compiler('c')
+
+config_h = configuration_data()
+config_h.set_quoted('GETTEXT_PACKAGE', goocanvas_api_name)
+
+# Check required libraries
+cairo_dep = dependency('cairo', version: '>= 1.10.0')
+glib_dep = dependency('glib-2.0', version: '>= 2.28.0')
+gtk_dep = dependency('gtk+-3.0', version: '>= 3.0.0')
+
+m_dep = cc.find_library('m')
+
+enable_introspection = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required:
get_option('introspection')).found()
+
+subdir('po')
+subdir('src')
+subdir('demo')
+
+py_installation = pymod.find_installation('python3', required: get_option('python'))
+if py_installation.found()
+ subdir('bindings/python')
+endif
+
+enable_gtk_doc = get_option('gtk_doc')
+if enable_gtk_doc
+ subdir('docs')
+endif
+
+configure_file(
+ output: 'config.h',
+ configuration: config_h,
+)
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..d274c64
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,4 @@
+option('python', type: 'feature', value: 'auto', description: 'build python support')
+option('introspection', type: 'feature', value: 'auto', description: 'build introspection support')
+
+option('gtk_doc', type: 'boolean', value: false, description: 'build GTK Doc reference')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..df18f14
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(goocanvas_api_name, preset: 'glib')
diff --git a/src/goocanvasenumtypes.c.template b/src/goocanvasenumtypes.c.template
new file mode 100644
index 0000000..e3feb03
--- /dev/null
+++ b/src/goocanvasenumtypes.c.template
@@ -0,0 +1,41 @@
+/*** BEGIN file-header ***/
+#include "goocanvas.h"
+#include <glib-object.h>
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@basename@" */
+
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type (void)
+{
+ static volatile gsize g_define_type_id__volatile = 0;
+
+ if (g_once_init_enter (&g_define_type_id__volatile)) {
+ static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ GType g_define_type_id = \
+ g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
+
+ g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+ }
+
+ return g_define_type_id__volatile;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+/*** END file-tail ***/
diff --git a/src/goocanvasenumtypes.h.template b/src/goocanvasenumtypes.h.template
new file mode 100644
index 0000000..13d9bde
--- /dev/null
+++ b/src/goocanvasenumtypes.h.template
@@ -0,0 +1,24 @@
+/*** BEGIN file-header ***/
+#pragma once
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@basename@" */
+
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+#define GOO_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+GType @enum_name@_get_type (void) G_GNUC_CONST;
+
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+/*** END file-tail ***/
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..2574b99
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,123 @@
+src_inc = include_directories('.')
+
+libname = '@0@-@1@'.format(goocanvas_name, goocanvas_api_version)
+
+headers = files(
+ 'goocanvasellipse.h',
+ 'goocanvasgrid.h',
+ 'goocanvasgroup.h',
+ 'goocanvas.h',
+ 'goocanvasimage.h',
+ 'goocanvasitem.h',
+ 'goocanvasitemmodel.h',
+ 'goocanvasitemsimple.h',
+ 'goocanvaspath.h',
+ 'goocanvaspolyline.h',
+ 'goocanvasrect.h',
+ 'goocanvasstyle.h',
+ 'goocanvastable.h',
+ 'goocanvastext.h',
+ 'goocanvasutils.h',
+ 'goocanvaswidget.h',
+)
+
+install_headers(
+ headers,
+ install_dir: goocanvas_includedir / libname,
+)
+
+sources = files(
+ 'goocanvasatk.c',
+ 'goocanvas.c',
+ 'goocanvasellipse.c',
+ 'goocanvasgrid.c',
+ 'goocanvasgroup.c',
+ 'goocanvasimage.c',
+ 'goocanvasitem.c',
+ 'goocanvasitemmodel.c',
+ 'goocanvasitemsimple.c',
+ 'goocanvaspath.c',
+ 'goocanvaspolyline.c',
+ 'goocanvasrect.c',
+ 'goocanvasstyle.c',
+ 'goocanvastable.c',
+ 'goocanvastext.c',
+ 'goocanvasutils.c',
+ 'goocanvaswidget.c',
+)
+
+
+marshal = 'goocanvasmarshal'
+
+sources += gnome.genmarshal(
+ marshal,
+ sources: marshal + '.list',
+ prefix: 'goo_canvas_marshal',
+ install_header: true,
+ install_dir: goocanvas_includedir / libname,
+)
+
+enum_types = 'goocanvasenumtypes'
+
+enum_sources = gnome.mkenums(
+ enum_types,
+ sources: headers,
+ h_template: enum_types + '.h.template',
+ c_template: enum_types + '.c.template',
+ install_header: true,
+ install_dir: goocanvas_includedir / libname,
+)
+
+private_deps = [
+ glib_dep,
+ m_dep,
+]
+
+deps = [
+ cairo_dep,
+ gtk_dep,
+]
+
+libgoocanvas = shared_library(
+ libname,
+ version: goocanvas_libversion,
+ sources: sources + enum_sources,
+ include_directories: top_inc,
+ dependencies: deps + private_deps,
+ c_args: '-DG_LOG_DOMAIN="GooCanvas"',
+ install: true,
+ install_rpath: goocanvas_libdir,
+)
+
+libgoocanvas_dep = declare_dependency(
+ sources: enum_sources[1],
+ include_directories: src_inc,
+ dependencies: gtk_dep,
+ link_with: libgoocanvas,
+)
+
+pkg.generate(
+ libraries: libgoocanvas,
+ name: goocanvas_api_ns,
+ description: 'A GTK+ canvas widget using cairo',
+ filebase: libname,
+ subdirs: libname,
+ requires: deps,
+ variables: 'exec_prefix=${prefix}',
+)
+
+if enable_introspection
+ libgoocanvas_gir = gnome.generate_gir(
+ libgoocanvas,
+ sources: sources + enum_sources + headers,
+ includes: 'Gtk-3.0',
+ nsversion: goocanvas_api_version,
+ namespace: goocanvas_api_ns,
+ identifier_prefix: goocanvas_api_prefix,
+ symbol_prefix: goocanvas_api_prefix.to_lower(),
+ export_packages: '@0@-@1@'.format(goocanvas_api_ns, goocanvas_api_version),
+ # extra_args: c_flags,
+ # header: 'polkit/polkit.h',
+ install: true,
+ )
+endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]