Skip to content

Commit 021ecc2

Browse files
QuLogicjtojnarSalamandar
committed
Add Meson build system
Co-authored-by: Jan Tojnar <[email protected]> Co-authored-by: Félix Piédallu <[email protected]>
1 parent a442b86 commit 021ecc2

File tree

10 files changed

+804
-3
lines changed

10 files changed

+804
-3
lines changed

.github/workflows/test.yaml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
- pull_request
66

77
jobs:
8-
linux:
9-
name: Linux
8+
linux-autotools:
9+
name: Linux Autotools
1010
runs-on: ubuntu-22.04
1111
strategy:
1212
matrix:
@@ -35,3 +35,35 @@ jobs:
3535
make
3636
- name: "Run tests"
3737
run: make distcheck
38+
39+
linux-meson:
40+
name: Linux Meson
41+
runs-on: ubuntu-22.04
42+
strategy:
43+
matrix:
44+
configureFlags:
45+
- ""
46+
- "-Dglib=enabled -Dintrospection=enabled"
47+
- "-Dgegl=enabled"
48+
include:
49+
- configureFlags: "-Dglib=enabled -Dintrospection=enabled"
50+
extraDeps: "libgirepository1.0-dev"
51+
- configureFlags: "-Dgegl=enabled"
52+
extraDeps: "libgegl-dev"
53+
steps:
54+
- uses: actions/checkout@v4
55+
- name: "Install dependencies"
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y \
59+
libjson-c-dev \
60+
meson \
61+
ninja-build \
62+
gettext \
63+
${{ matrix.extraDeps }}
64+
- name: "Build"
65+
run: |
66+
meson setup _build --buildtype=release -Dauto_features=disabled
67+
meson compile -C _build
68+
- name: "Run tests"
69+
run: meson dist -C _build

appveyor_build.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ pacman --noconfirm -S --needed \
1111
base-devel \
1212
${PKG_PREFIX}-json-c \
1313
${PKG_PREFIX}-glib2 \
14-
${PKG_PREFIX}-gobject-introspection
14+
${PKG_PREFIX}-gobject-introspection \
15+
${PKG_PREFIX}-meson \
16+
git
1517

1618

1719
# Add m4 directories to the ACLOCAL_PATH
@@ -30,6 +32,11 @@ done
3032
export ACLOCAL_PATH
3133
export PWD="$APPVEYOR_BULD_FOLDER"
3234

35+
# Check that Meson build works.
36+
meson setup _build --buildtype=release -Dgegl=false -Ddocs=false
37+
meson dist -C _build
38+
rm -rf _build
39+
3340
./autogen.sh
3441
./configure
3542
make distcheck

build-aux/fix-po-location.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
The `generate.py` script will pass location info as a translator note.
5+
This script converts it to a proper location comment.
6+
"""
7+
8+
import re
9+
import sys
10+
11+
LOCATION_PATTERN = re.compile(r"^#\. (: \.\./brushsettings.json:.*)", re.MULTILINE)
12+
13+
match sys.argv:
14+
case [_, input_path, output_path]:
15+
pass
16+
case _:
17+
print("usage: fix-po-location.py <input> <output>", file=sys.stderr)
18+
sys.exit(1)
19+
20+
with open(input_path) as po_in, open(output_path, "w") as po_out:
21+
po_out.write(LOCATION_PATTERN.sub(r"#\1", po_in.read()))

doc/meson.build

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
doc_conf = configuration_data()
2+
doc_conf.merge_from(conf)
3+
4+
doc_conf.set('DOXYGEN_SOURCE_ROOT', meson.project_source_root())
5+
doc_conf.set('DOXYXML_BUILD_PATH', meson.current_build_dir())
6+
doc_conf.set('DOXYGEN_EXCLUDED', '')
7+
8+
doxyfile = configure_file(
9+
input: 'Doxyfile.in',
10+
output: 'Doxyfile',
11+
configuration: doc_conf,
12+
)
13+
14+
doxygen_index = custom_target(
15+
'doxygen',
16+
input: doxyfile,
17+
output: 'index.xml',
18+
command: [
19+
doxygen,
20+
'@INPUT@',
21+
],
22+
)
23+
24+
subdir('source')
25+
26+
run_target(
27+
'sphinx',
28+
depends: [
29+
doxygen_index,
30+
],
31+
command: [
32+
sphinx_build,
33+
'-c', meson.current_build_dir() / 'source',
34+
meson.current_source_dir() / 'source',
35+
meson.current_build_dir() / 'build',
36+
],
37+
)

doc/source/meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sphinx_conf_file = configure_file(
2+
input: 'conf.py.in',
3+
output: 'conf.py',
4+
configuration: doc_conf,
5+
)

gegl/meson.build

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
libmypaint_gegl_inc = include_directories('.')
2+
3+
libmypaint_gegl_sources = [
4+
'../glib/mypaint-gegl-glib.c',
5+
'mypaint-gegl-surface.c',
6+
]
7+
8+
libmypaint_gegl_headers = [
9+
'../glib/mypaint-gegl-glib.h',
10+
'mypaint-gegl-surface.h',
11+
]
12+
13+
libmypaint_gegl = library(
14+
f'mypaint-gegl-@api_platform_version@',
15+
libmypaint_gegl_sources,
16+
include_directories: toplevel_inc,
17+
link_with: libmypaint,
18+
dependencies: [
19+
json,
20+
gobject,
21+
gegl,
22+
],
23+
version: abi_version_info,
24+
install: true,
25+
)
26+
27+
install_headers(
28+
libmypaint_gegl_headers,
29+
subdir: 'libmypaint-gegl',
30+
)
31+
32+
33+
if use_introspection
34+
gnome = import('gnome')
35+
36+
libmypaint_gegl_gir = gnome.generate_gir(
37+
libmypaint_gegl,
38+
namespace: 'MyPaintGegl',
39+
nsversion: api_platform_version,
40+
41+
sources: libmypaint_gegl_sources + libmypaint_gegl_headers,
42+
symbol_prefix: 'mypaint_gegl',
43+
identifier_prefix: 'MyPaintGegl',
44+
45+
includes: [
46+
'GObject-2.0',
47+
gegl_gir,
48+
libmypaint_gir[0],
49+
],
50+
install: true,
51+
)
52+
endif
53+
54+
55+
pkgconfig.generate(
56+
libmypaint_gegl,
57+
name: meson.project_name() + '-gegl-' + api_platform_version,
58+
version: version_full,
59+
description: 'MyPaint brush engine library, with GEGL integration',
60+
requires: [
61+
libmypaint,
62+
gegl,
63+
],
64+
url: project_url,
65+
subdirs: 'libmypaint-gegl',
66+
)

0 commit comments

Comments
 (0)