Skip to content

Commit

Permalink
Add Meson build system
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Tojnar <[email protected]>
Co-authored-by: Félix Piédallu <[email protected]>
  • Loading branch information
3 people committed Aug 4, 2024
1 parent a442b86 commit bdde78f
Show file tree
Hide file tree
Showing 10 changed files with 795 additions and 3 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
- pull_request

jobs:
linux:
name: Linux
linux-autotools:
name: Linux Autotools
runs-on: ubuntu-22.04
strategy:
matrix:
Expand Down Expand Up @@ -35,3 +35,35 @@ jobs:
make
- name: "Run tests"
run: make distcheck

linux-meson:
name: Linux Meson
runs-on: ubuntu-22.04
strategy:
matrix:
configureFlags:
- ""
- "-Dglib=enabled -Dintrospection=enabled"
- "-Dgegl=enabled"
include:
- configureFlags: "-Dglib=enabled -Dintrospection=enabled"
extraDeps: "libgirepository1.0-dev"
- configureFlags: "-Dgegl=enabled"
extraDeps: "libgegl-dev"
steps:
- uses: actions/checkout@v4
- name: "Install dependencies"
run: |
sudo apt-get update
sudo apt-get install -y \
libjson-c-dev \
meson \
ninja-build \
gettext \
${{ matrix.extraDeps }}
- name: "Build"
run: |
meson setup _build --buildtype=release -Dauto_features=disabled
meson compile -C _build
- name: "Run tests"
run: meson dist -C _build
9 changes: 8 additions & 1 deletion appveyor_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ pacman --noconfirm -S --needed \
base-devel \
${PKG_PREFIX}-json-c \
${PKG_PREFIX}-glib2 \
${PKG_PREFIX}-gobject-introspection
${PKG_PREFIX}-gobject-introspection \
${PKG_PREFIX}-meson \
git


# Add m4 directories to the ACLOCAL_PATH
Expand All @@ -30,6 +32,11 @@ done
export ACLOCAL_PATH
export PWD="$APPVEYOR_BULD_FOLDER"

# Check that Meson build works.
meson setup _build --buildtype=release -Dgegl=false -Ddocs=false
meson dist -C _build
rm -rf _build

./autogen.sh
./configure
make distcheck
21 changes: 21 additions & 0 deletions build-aux/fix-po-location.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3

"""
The `generate.py` script will pass location info as a translator note.
This script converts it to a proper location comment.
"""

import re
import sys

LOCATION_PATTERN = re.compile(r"^#\. (: \.\./brushsettings.json:.*)", re.MULTILINE)

match sys.argv:
case [_, input_path, output_path]:
pass
case _:
print("usage: fix-po-location.py <input> <output>", file=sys.stderr)
sys.exit(1)

with open(input_path) as po_in, open(output_path, "w") as po_out:
po_out.write(LOCATION_PATTERN.sub(r"#\1", po_in.read()))
37 changes: 37 additions & 0 deletions doc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
doc_conf = configuration_data()
doc_conf.merge_from(conf)

doc_conf.set('DOXYGEN_SOURCE_ROOT', meson.project_source_root())
doc_conf.set('DOXYXML_BUILD_PATH', meson.current_build_dir())
doc_conf.set('DOXYGEN_EXCLUDED', '')

doxyfile = configure_file(
input: 'Doxyfile.in',
output: 'Doxyfile',
configuration: doc_conf,
)

doxygen_index = custom_target(
'doxygen',
input: doxyfile,
output: 'index.xml',
command: [
doxygen,
'@INPUT@',
],
)

subdir('source')

run_target(
'sphinx',
depends: [
doxygen_index,
],
command: [
sphinx_build,
'-c', meson.current_build_dir() / 'source',
meson.current_source_dir() / 'source',
meson.current_build_dir() / 'build',
],
)
5 changes: 5 additions & 0 deletions doc/source/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sphinx_conf_file = configure_file(
input: 'conf.py.in',
output: 'conf.py',
configuration: doc_conf,
)
66 changes: 66 additions & 0 deletions gegl/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
libmypaint_gegl_inc = include_directories('.')

libmypaint_gegl_sources = [
'../glib/mypaint-gegl-glib.c',
'mypaint-gegl-surface.c',
]

libmypaint_gegl_headers = [
'../glib/mypaint-gegl-glib.h',
'mypaint-gegl-surface.h',
]

libmypaint_gegl = library(
f'mypaint-gegl-@api_platform_version@',
libmypaint_gegl_sources,
include_directories: toplevel_inc,
link_with: libmypaint,
dependencies: [
json,
gobject,
gegl,
],
version: abi_version_info,
install: true,
)

install_headers(
libmypaint_gegl_headers,
subdir: 'libmypaint-gegl',
)


if use_introspection
gnome = import('gnome')

libmypaint_gegl_gir = gnome.generate_gir(
libmypaint_gegl,
namespace: 'MyPaintGegl',
nsversion: api_platform_version,

sources: libmypaint_gegl_sources + libmypaint_gegl_headers,
symbol_prefix: 'mypaint_gegl',
identifier_prefix: 'MyPaintGegl',

includes: [
'GObject-2.0',
gegl_gir,
libmypaint_gir[0],
],
install: true,
)
endif


pkgconfig.generate(
libmypaint_gegl,
name: meson.project_name() + '-gegl-' + api_platform_version,
version: version_full,
description: 'MyPaint brush engine library, with GEGL integration',
requires: [
libmypaint,
gegl,
],
url: project_url,
subdirs: 'libmypaint-gegl',
)
Loading

0 comments on commit bdde78f

Please sign in to comment.