Commit 3753ca58 authored by Iñigo Martínez's avatar Iñigo Martínez
Browse files

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.
parent 076c374a
Pipeline #248938 passed with stage
in 5 minutes and 13 seconds
install_data(
'GooCanvas.py',
install_dir: py_installation.get_path('purelib') / 'gi/overrides',
)
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
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,
)
<!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@">
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,
)
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)
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,
)
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')
i18n.gettext(goocanvas_api_name, preset: 'glib')
/*** 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 ***/
/*** 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 ***/
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),
install: true,
)
endif
Supports Markdown
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