Meson port - integrating merge request !35

This commit contains the meson build system changes from is a combination
of commits from that branch, with most of the meson port done by
Félix Piédallu - with some adaptations to sources and build by Øyvind Kolås.

We need a transition phase where meson works on top of autotools to
switch many of the CI systems gegl is involved in over to meson.

Among the commits squashed into this one are:

Author: Félix Piédallu <felix@piedallu.me>
    Remove check for py2
    post-merge
    build: add gegl-npd-lib to pkgconfig
    Added meson files
    [src] move libnsgif to subdir
    [src] Compatibility with Meson: libs/ -> subprojects/

Author: Øyvind Kolås <pippin@gimp.org>
    tools: exp_combine fix signedness warning
    gegl: fix Babl gir name
    meson: do not builds docs and workshop by default
    bin/meson: link binary with gio
    operations/meson: add missing operations
    meson: skip opencl tests, opt all other tests out of parallel running
    put all genrated webcontent in one folder
    docs/meson: build of ops examples/html
    tools: skip searching for source path for ops, adapt for meson
    docs: make asciidoc part of build work with meson, using bits from nielsdg's meson branch
    bin:meson add lua deps
    meson: check for luajit instead of lua
    meson: generate gtk-doc
    meson: drop graphviz checking
    gegl: add back GEGL_MAJOR_VERSION etc in gegl-version.h
    build: add check for malloc_trim
parent f92aabcd
Pipeline #104206 passed with stages
in 14 minutes and 25 seconds
lua_files = files(
'cairo_h.lua',
'cairo.lua',
'gegl_box-blur.lua',
'gegl_c2g.lua',
'gegl_crop.lua',
'gegl_edge-neon.lua',
'gegl_fill-path.lua',
'gegl_gaussian-blur.lua',
'gegl_linear-gradient.lua',
'gegl_median-blur.lua',
'gegl_radial-gradient.lua',
'gegl_rectangle.lua',
'gegl_rotate.lua',
'gegl_snn-mean.lua',
'gegl_stress.lua',
'gegl_translate.lua',
'gegl_unsharp-mask.lua',
'gegl_vector-stroke.lua',
'init.lua',
'mime.lua',
'mrg.lua',
'mrl.lua',
'preferences.lua',
'viewer.lua',
)
if lua.found()
install_data(
lua_files,
install_dir: get_option('datadir') / api_name / 'lua'
)
endif
subdir('lua')
gegl_sources = files(
'gegl-options.c',
'gegl-path-smooth.c',
'gegl.c',
)
gegl_deps = [
babl,
glib,
gobject,
math,
]
if libpng.found()
gegl_deps += [ libpng, ]
endif
if mrg.found() and gexiv2.found() and lua.found()
gegl_sources += files(
'argvs.c',
'mrg-gegl.c',
'ui-collection.c',
'ui-core.c',
'ui-viewer.c',
)
gegl_sources += custom_target('argvs-commands.inc',
input : gegl_sources,
output: 'argvs-commands.inc',
command: [ argvs_extract, '@INPUT@' ],
capture: true,
)
gegl_deps += [ mrg, gexiv2, sdl1, lua, gio ]
endif
if libspiro.found()
gegl_sources += files('gegl-path-spiro.c')
gegl_deps += [ libspiro, ]
endif
gegl_bin = executable('gegl',
gegl_sources,
include_directories: [ rootInclude, geglInclude, ],
dependencies: gegl_deps,
link_with: gegl_lib,
install: true,
)
......@@ -5665,7 +5665,7 @@ static void gegl_ui (Mrg *mrg, void *data)
if (g_str_has_suffix (o->path, ".lui"))
{
#if HAVE_LUA
#ifdef HAVE_LUA
gsize length = 0;
int result;
......@@ -5714,7 +5714,7 @@ static void gegl_ui (Mrg *mrg, void *data)
if (g_str_has_suffix (o->path, ".lui"))
{
#if HAVE_LUA
#ifdef HAVE_LUA
int result;
int status;
if (lui_contents)
......@@ -5737,7 +5737,7 @@ static void gegl_ui (Mrg *mrg, void *data)
#endif
}
#if HAVE_LUA
#ifdef HAVE_LUA
if (run_lua_file ("viewer.lua"))
{
}
......@@ -5752,7 +5752,7 @@ static void gegl_ui (Mrg *mrg, void *data)
}
else if (S_ISDIR (stat_buf.st_mode))
{
#if HAVE_LUA
#ifdef HAVE_LUA
if (run_lua_file ("collection.lua"))
{
}
......@@ -5769,7 +5769,7 @@ static void gegl_ui (Mrg *mrg, void *data)
if (o->show_preferences)
{
#if HAVE_LUA
#ifdef HAVE_LUA
if (run_lua_file ("preferences.lua"))
{
}
......@@ -7038,7 +7038,7 @@ int cmd_save (COMMAND_ARGS) /* "save", 0, "", ""*/
if (o->src_path)
{
char *prepended = g_strdup_printf ("gegl:load path=%s\n%s", basename(o->src_path), serialized);
char *prepended = g_strdup_printf ("gegl:load path=%s\n%s", g_basename(o->src_path), serialized);
g_file_set_contents (o->chain_path, prepended, -1, NULL);
g_free (prepended);
}
......
graphic_files = [
'babl-16x16.svg',
'babl-48x48.svg',
'babl-a4poster.svg',
]
graphic_files_install = []
# Dummy config to copy index.html to build
graphic_files_install += configure_file(
input: 'index.html',
output: '@PLAINNAME@',
configuration: configuration_data()
)
foreach file : graphic_files
# Dummy config to copy svg files to build
graphic_files_install += configure_file(
input: file,
output: '@PLAINNAME@',
configuration: configuration_data()
)
endforeach
if rsvg_convert_bin.found()
foreach file : graphic_files
sizeinfo = (
file.contains('a4poster')
? [ '-w', '256', ]
: []
)
graphic_files_install += custom_target(
file,
input: file,
output: '@BASENAME@.png',
command: [
rsvg_convert_bin,
sizeinfo,
'-o', '@OUTPUT@',
'@INPUT@',
],
install: false,
build_by_default: true,
)
endforeach
endif
subdir('graphics')
host = 'pippin.gimp.org'
location= 'public_html/babl'
scptarget = host + ':' + location + '/'
xml_insert = find_program(join_paths('tools', 'xml_insert.sh'))
index_static_html = configure_file(
input : 'index-static.html.in',
output: 'index-static.html',
configuration: conf,
)
babl_css = configure_file(
input : 'babl.css',
output : 'babl.css',
copy: true
)
index_html_tmp_env = [
'BABL_PATH='+ join_paths(meson.build_root(), 'extensions'),
]
index_html_tmp = custom_target('index.html.tmp',
input : [ babl_html_dump, ],
output: [ 'index.html.tmp', ],
command: [
env_bin,
index_html_tmp_env,
babl_html_dump
],
capture: true,
)
index_html = custom_target('index.html',
input : [
index_static_html,
index_html_tmp,
join_paths(meson.source_root(), 'AUTHORS'),
join_paths(meson.source_root(), 'TODO'),
join_paths(meson.source_root(), 'NEWS'),
],
output: [ 'index.html', ],
command: [
env_bin,
'cp', '@INPUT0@', '@OUTPUT@',
'&&', xml_insert, '@OUTPUT@', 'BablBase', '@INPUT1@',
'&&', xml_insert, '@OUTPUT@', 'AUTHORS', '@INPUT2@',
'&&', xml_insert, '@OUTPUT@', 'TODO', '@INPUT3@',
'&&', xml_insert, '@OUTPUT@', 'NEWS', '@INPUT4@',
],
build_by_default: true,
)
run_target('push_web',
command: [
'scp', index_html, index_static_html, babl_css, scptarget,
'&&',
'scp', graphic_files_install, scptarget + 'graphics/'
],
)
#!/bin/sh
echo "installing docs $MESON_BUILD_ROOT"
doc_config = configuration_data()
doc_config.set('top_srcdir', meson.source_root())
html_files = []
gtkdoc_files = []
#######################################
# HTML files
html_files += custom_target('class-hierarchy.html',
input : [ ],
output: [ 'class-hierarchy.html' ],
command: [ find_program('env'),
'GEGL_SWAP=RAM',
'GEGL_PATH='+ meson.build_root() / 'operations',
introspect,
],
build_by_default : true,
capture: true,
)
if asciidoc.found()
asciidoc_files = files(
'abyss_policy.txt',
'build.txt',
'commandline.txt',
'contribute.txt',
'development.txt',
'editor.txt',
'environment.txt',
'features.txt',
'gegl-chain.txt',
'glossary.txt',
'journal.txt',
'NEWS.txt',
'operation-api.txt',
'source-overview.txt',
)
asciidoc_files += [
configure_file(
input : 'copyright.txt.in',
output: 'copyright.txt',
configuration: doc_config,
),
configure_file(
input : 'hello-world.txt.in',
output: 'hello-world.txt',
configuration: doc_config,
),
configure_file(
input : 'index.txt.in',
output: 'index.txt',
configuration: doc_config,
),
]
foreach file: asciidoc_files
rendered_file = custom_target('@0@.html'.format(file).underscorify(),
output: '@BASENAME@.html',
input: file,
build_by_default : true,
command: [ asciidoc,
'--unsafe',
'-o', '@OUTPUT@',
'-a', 'stylesheet="@0@"'.format(join_paths(meson.source_root(), 'gegl.css')),
'-a', 'quirks!',
'@INPUT@',
],
)
endforeach
endif
#######################################
# GTK Doc files
gtkdoc_files += files(
'gegl.css',
)
gtkdoc_images = files(
'images/standard-input.png',
'images/standard-panorama.png',
'images/standard-aux.png',
'images/GEGL.png',
)
install_data(gtkdoc_files,
install_dir: gnome.gtkdoc_html_dir('gegl')
)
install_data(gtkdoc_images,
install_dir: join_paths (gnome.gtkdoc_html_dir('gegl') , 'images')
)
configure_file(input: 'images/GEGL.png',
output: 'GEGL.png',
copy: true,
)
docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
gnome.gtkdoc('gegl',
dependencies : gegl_lib,
main_xml : meson.project_name() + '-docs.xml',
src_dir: [
join_paths(meson.source_root(), 'gegl'),
join_paths(meson.build_root(), 'gegl'),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(glib_docpath),
],
install : true,
)
doc_operations_examples_dir = join_paths(
meson.current_build_dir(), 'ophtml',
)
exclusion_pattern = '|'.join([
'alpha-inpaint',
'box-blur', 'box-percentile', 'buffer-cache', 'buffer-source',
'clone', 'convert-format',
'disc-percentile', 'dropshadow',
'exp-combine', 'exr-load',
'hstack',
'image-compare', 'integral-image', 'introspect',
'jpg-load',
'kuwahara',
'layer', 'line-profile', 'load',
'magick-load', 'mandelbrot', 'matting-global',
'nop',
'open-buffer',
'pixbuf', 'png-load',
'remap',
'snn-percentile', 'stretch-contrast', 'svg-load',
'v4l2',
'warp',
])
doc_operations_examples = custom_target('gallery-stamp',
install:true,
install_dir: gnome.gtkdoc_html_dir('gegl'),
output: ['gallery-stamp'],
command: [ bash, '-c',
' '.join([
'mkdir', '-p', doc_operations_examples_dir,
'&&',
'cd', join_paths(meson.current_build_dir(), 'ophtml'),
'&&',
'GEGL_PATH=' + join_paths(meson.build_root(), 'operations'),
operations_html.full_path(),
'&&',
'echo', 'Generating example images',
'&&',
'BABL_TOLERANCE=0.0',
'GEGL_SWAP=RAM',
'GEGL_PATH=' + join_paths(meson.build_root(), 'operations'),
gegl_tester.full_path(),
'--all', '-o', doc_operations_examples_dir,
'-d', join_paths(meson.current_source_dir(), 'images'),
'-e', '"' + exclusion_pattern + '"', '||', 'true', '&&', 'touch', '../gallery-stamp'
])
],
)
meson.add_install_script('install-docs.sh')
examples = [
{ 'name': '2geglbuffer', },
{ 'name': 'frame-counter', },
{ 'name': 'gegl-convert', },
{ 'name': 'gegl-slicer', },
{ 'name': 'geglbuffer-add-image', },
{ 'name': 'geglbuffer-clock', },
{ 'name': 'hello-world', },
{ 'name': 'video-invert', },
]
if sdl2.found()
examples += {
'name': 'sdl-draw',
'deps': [ sdl2, math, ]
}
endif
if gexiv2.found()
examples += {
'name': 'gegl-video',
'deps': [ gexiv2, ]
}
endif
foreach example : examples
example_name = example.get('name')
example_srcs = example.get('srcs', example_name + '.c')
example_deps = example.get('deps', [])
exe = executable(example_name,
example_srcs,
include_directories: [ geglInclude, ],
dependencies: [
babl,
glib,
gobject,
example_deps,
],
link_with: [ gegl_lib, ],
install: false,
)
# Fore use as tests for ff-load-save
if example_name == 'gegl-video'
gegl_video_example = exe
endif
if example_name == 'frame-counter'
frame_counter_example = exe
endif
endforeach
gegl_sources += files(
'gegl-algorithms.c',
'gegl-buffer-access.c',
'gegl-buffer-config.c',
'gegl-buffer-enums.c',
'gegl-buffer-iterator.c',
'gegl-buffer-iterator2.c',
'gegl-buffer-linear.c',
'gegl-buffer-load.c',
'gegl-buffer-matrix2.c',
'gegl-buffer-save.c',
'gegl-buffer-swap.c',
'gegl-buffer.c',
'gegl-compression-nop.c',
'gegl-compression-rle.c',
'gegl-compression-zlib.c',
'gegl-compression.c',
'gegl-memory.c',
'gegl-rectangle.c',
'gegl-sampler-cubic.c',
'gegl-sampler-linear.c',
'gegl-sampler-lohalo.c',
'gegl-sampler-nearest.c',
'gegl-sampler-nohalo.c',
'gegl-sampler.c',
'gegl-scratch.c',
'gegl-tile-alloc.c',
'gegl-tile-backend-buffer.c',
'gegl-tile-backend-file-async.c',
'gegl-tile-backend-ram.c',
'gegl-tile-backend-swap.c',
'gegl-tile-backend.c',
'gegl-tile-handler-cache.c',
'gegl-tile-handler-chain.c',
'gegl-tile-handler-empty.c',
'gegl-tile-handler-log.c',
'gegl-tile-handler-zoom.c',
'gegl-tile-handler.c',
'gegl-tile-source.c',
'gegl-tile-storage.c',
'gegl-tile.c',
)
gegl_introspectable_headers += files(
'gegl-buffer-backend.h',
'gegl-buffer-enums.h',
'gegl-buffer-iterator.h',
'gegl-buffer-matrix2.h',
'gegl-buffer-swap.h',
'gegl-buffer.h',
'gegl-memory.h',
'gegl-rectangle.h',
'gegl-scratch.h',
'gegl-tile-backend.h',
'gegl-tile-handler.h',
'gegl-tile-source.h',
)
gegl_headers += files(
'gegl-tile.h',
)
gegl_sources += files(
'gegl-cache.c',
'gegl-callback-visitor.c',
'gegl-connection.c',
'gegl-node-output-visitable.c',
'gegl-node.c',
'gegl-pad.c',
'gegl-region-generic.c',
'gegl-visitable.c',
'gegl-visitor.c',
)
gegl_introspectable_headers += files(
'gegl-node.h',
)
geglInclude = include_directories(
'.',
'buffer',
'graph',
'module',
'opencl',
'operation',
'process',
'property-types',
)
gegl_cflags = [
'-DLIBDIR="@0@"'.format(get_option('prefix') / get_option('libdir')),
'-DG_LOG_DOMAIN="@0@"'.format('GEGL'),
'-DGEGL_LOCALEDIR="@0@"'.format(get_option('localedir')),
]
gegl_version_h = configure_file(
input : 'gegl-version.h.in',
output: 'gegl-version.h',
configuration: config,
)
gegl_introspectable_headers = files(
'gegl.h',
'gegl-apply.h',
'gegl-enums.h',
'gegl-init.h',
'gegl-lookup.h',
'gegl-matrix.h',
'gegl-operations-util.h',
'gegl-parallel.h',
'gegl-random.h',
'gegl-types.h',
'gegl-utils.h',
) + [
gegl_version_h,
]
gegl_headers = files(
'gegl-cpuaccel.h',
'gegl-debug.h',
'gegl-op.h',
'gegl-plugin.h',
)
gegl_sources = files(
'gegl-apply.c',
'gegl-config.c',
'gegl-cpuaccel.c',
'gegl-dot-visitor.c',
'gegl-dot.c',
'gegl-enums.c',
'gegl-gio.c',
'gegl-init.c',
'gegl-instrument.c',
'gegl-introspection-support.c',
'gegl-lookup.c',
'gegl-matrix.c',
'gegl-parallel.c',
'gegl-random.c',
'gegl-serialize.c',
'gegl-stats.c',
'gegl-utils.c',
'gegl-xml.c',
)
subdir('buffer')
subdir('graph')
subdir('module')
subdir('opencl')
subdir('operation')
subdir('process')
subdir('property-types')
gegl_headers += gegl_introspectable_headers
install_headers(gegl_headers,
subdir: api_name
)
gegl_lib = library(api_name,
gegl_sources,
include_directories: [ rootInclude, geglInclude, ],
dependencies: [
babl,
glib,
gio,
math,
gmodule,
],
c_args: [ gegl_cflags, ],
install: true,
version: so_version,
)
introspection_sources = gegl_introspectable_headers + files(
'gegl-introspection-support.h',
'opencl' / 'gegl-cl-introspection-support.h',
)