Skip to content

Commit 13a0214

Browse files
authored
Merge pull request #2086 from profanity-im/meson-build
Fix #1002. Was already started in 2021 in #1619 but then abandoned it. I want to take this opportunity to change a couple of other things regarding building: * The `--plugins` switch is gone. Use `--python-plugins` and `--c-plugins` instead. * We don't autoenable depending on dependencies being present. Every feature needs to be enabled explicitly. This helps with having deterministic builds. * Instead of setting `PACKAGE_STATUS="development/release"` in the configure.ac file we will use the default meson `buildtype`. Autotools will probably stay a while. The next release will contain both with a note for packagers to try to use meson and give us feedback. Meson/Ninja is significantly faster and the syntax is much easier to read. The faster build times eventually will also help when waiting for CI results. There are some things missing still like our `make dist`, `make doublecheck` and such. Usage example: ``` meson setup build --buildtype=release -Domemo=enabled -Dpgp=enabled meson compile -C build ``` The changes described above are only on meson. Autotools still behaves the same. The plan is to keep it as is and remove it once we know everything works in meson.
2 parents f5eccea + 4223105 commit 13a0214

File tree

7 files changed

+865
-2
lines changed

7 files changed

+865
-2
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ jobs:
2626
docker build -f Dockerfile.${{ matrix.flavor }} -t profanity .
2727
docker run profanity ./ci-build.sh
2828
29+
linux-meson:
30+
runs-on: ubuntu-latest
31+
32+
strategy:
33+
matrix:
34+
flavor: [debian]
35+
36+
name: Linux-meson
37+
steps:
38+
- uses: actions/checkout@v2
39+
- name: Run tests
40+
run: |
41+
docker build -f Dockerfile.${{ matrix.flavor }} -t profanity .
42+
docker run profanity ./ci-meson-build.sh
43+
2944
code-style:
3045
runs-on: ubuntu-22.04
3146
name: Check coding style

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ src/config.h
4040
src/config.h.in
4141
src/config.h.in~
4242
src/gitversion.h
43-
src/gitversion.h.in
4443
src/stamp-h1
4544
src/plugins/profapi.lo
4645

Dockerfile.debian

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
55
autoconf \
66
autoconf-archive \
77
automake \
8+
cmake \
89
expect \
910
gcc \
1011
git \
@@ -13,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1314
libgcrypt-dev \
1415
libglib2.0-dev \
1516
libgpgme11-dev \
16-
libgtk2.0-dev \
17+
libgtk-3-dev \
1718
libmicrohttpd-dev \
1819
libncursesw5-dev \
1920
libnotify-dev \
@@ -24,6 +25,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2425
libtool \
2526
libxss-dev \
2627
make \
28+
meson \
29+
ninja-build \
2730
pkg-config \
2831
python3-dev \
2932
python-dev-is-python3 \

ci-meson-build.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
3+
# Exit on error
4+
set -e
5+
6+
error_handler()
7+
{
8+
ERR_CODE=$?
9+
echo
10+
echo "Error ${ERR_CODE} with command '${BASH_COMMAND}' on line ${BASH_LINENO[0]}. Exiting."
11+
# Meson logs are stored in the build directory
12+
if [ -f "build/meson-logs/testlog.txt" ]; then
13+
echo "--- Meson Test Log ---"
14+
cat build/meson-logs/testlog.txt
15+
fi
16+
exit ${ERR_CODE}
17+
}
18+
19+
trap error_handler ERR
20+
21+
tests=(
22+
"-Dnotifications=enabled -Dicons-and-clipboard=enabled -Dotr=enabled -Dpgp=enabled -Domemo=enabled -Dc-plugins=enabled -Dpython-plugins=enabled -Dxscreensaver=enabled -Domemo-qrcode=enabled -Dgdk-pixbuf=enabled"
23+
""
24+
"-Dnotifications=disabled"
25+
"-Dicons-and-clipboard=disabled"
26+
"-Dotr=disabled"
27+
"-Dpgp=disabled"
28+
"-Domemo=disabled -Domemo-qrcode=disabled"
29+
"-Dpgp=disabled -Dotr=disabled"
30+
"-Dpgp=disabled -Dotr=disabled -Domemo=disabled"
31+
"-Dpython-plugins=disabled"
32+
"-Dc-plugins=disabled"
33+
"-Dc-plugins=disabled -Dpython-plugins=disabled"
34+
"-Dxscreensaver=disabled"
35+
"-Dgdk-pixbuf=disabled"
36+
)
37+
38+
# Run Valgrind check (Only on Linux, on first/full feature set)
39+
if [[ "$(uname | tr '[:upper:]' '[:lower:]')" == linux* ]]; then
40+
echo "--> Running Valgrind check with full features"
41+
42+
meson setup build_valgrind ${tests[0]} -Dtests=true
43+
meson compile -C build_valgrind
44+
45+
meson test -C build_valgrind --print-errorlogs --wrap=valgrind || echo "Valgrind issues detected"
46+
47+
rm -rf build_valgrind
48+
fi
49+
50+
# Iterate through all feature combinations
51+
for features in "${tests[@]}"
52+
do
53+
echo "----------------------------------------------------"
54+
echo "--> Building with: ${features}"
55+
echo "----------------------------------------------------"
56+
57+
rm -rf build_run
58+
59+
meson setup build_run ${features} -Dtests=true
60+
meson compile -C build_run
61+
62+
meson test -C build_run --print-errorlogs
63+
64+
./build_run/profanity -v
65+
done

0 commit comments

Comments
 (0)