feat: Remove autotools and adapt docu and scripts

We will only use Meson from now on.

Signed-off-by: Michael Vetter <jubalh@iodoru.org>
This commit is contained in:
Michael Vetter
2026-03-27 21:23:49 +01:00
parent 5e8987274f
commit bc777c56b2
17 changed files with 120 additions and 1344 deletions

View File

@@ -38,6 +38,8 @@ jobs:
uses: egor-tensin/setup-cygwin@v4
with:
packages: >-
meson
ninja
autoconf
automake
libtool
@@ -65,28 +67,14 @@ jobs:
./configure --prefix=$PWD/install
make -j2 install
- name: Autotools bootstrap
run: |
cd "$GITHUB_WORKSPACE"
# On Windows checkouts the executable bit may be lost and CRLF line endings
# can break shell scripts, so normalize bootstrap.sh if it exists.
if [ -f ./bootstrap.sh ]; then
sed -i 's/\r$//' ./bootstrap.sh
chmod +x ./bootstrap.sh
./bootstrap.sh
else
autoreconf -fi
fi
- name: Configure
- name: Meson setup
env:
PKG_CONFIG_PATH: ${{ github.workspace }}/deps/libstrophe/install/lib/pkgconfig:$PKG_CONFIG_PATH
run: |
cd "$GITHUB_WORKSPACE"
./configure
meson setup build_run
- name: Build
run: |
cd "$GITHUB_WORKSPACE"
make -j2
meson compile -C build_run

View File

@@ -17,32 +17,29 @@ jobs:
fail-fast: false
matrix:
include:
- flavor: debian
buildsystem: autotools
tests: unit
omemo: signal
script: ./scripts/build-configuration-matrix.sh
- flavor: fedora
buildsystem: autotools
tests: unit
omemo: signal
script: ./scripts/build-configuration-matrix.sh
- flavor: ubuntu
buildsystem: autotools
tests: unit
omemo: signal
script: ./scripts/build-configuration-matrix.sh
- flavor: debian
buildsystem: meson
tests: unit
omemo: signal
script: ./scripts/build-configuration-matrix.sh meson
script: ./scripts/build-configuration-matrix.sh
omemo_env: libsignal
- flavor: fedora
buildsystem: meson
tests: unit
omemo: signal
script: ./scripts/build-configuration-matrix.sh
omemo_env: libsignal
- flavor: ubuntu
buildsystem: meson
tests: unit
omemo: signal
script: ./scripts/build-configuration-matrix.sh
omemo_env: libsignal
- flavor: debian
buildsystem: meson
tests: unit
omemo: libomemo
script: ./scripts/build-configuration-matrix.sh meson
script: ./scripts/build-configuration-matrix.sh
omemo_env: libomemo-c
name: ${{ matrix.flavor }} | ${{ matrix.buildsystem }} | ${{ matrix.tests }} | ${{ matrix.omemo }}

View File

@@ -1,33 +1,28 @@
# Contributing to Profanity
## Build
Profanity can be built using either **Autotools** or **Meson**.
### Build Options
Both build systems support several features that can be enabled or disabled.
Meson requires features to be **explicitly enabled**. Nothing is auto-enabled; if you want a feature, you must pass the corresponding `-Doption=enabled` flag.
**Important Difference:**
- **Autotools**: Features are **auto-enabled** if the required dependencies are found on your system during the `./configure` step.
- **Meson**: Features must be **explicitly enabled**. Nothing is auto-enabled; if you want a feature, you must pass the corresponding `-Doption=enabled` flag.
| Feature | Description | Autotools flag | Meson option |
| :--- | :--- | :--- | :--- |
| **Notifications** | Desktop notifications support | `--enable-notifications` | `-Dnotifications=enabled` |
| **Python Plugins** | Support for Python plugins | `--enable-python-plugins` | `-Dpython-plugins=enabled` |
| **C Plugins** | Support for C plugins | `--enable-c-plugins` | `-Dc-plugins=enabled` |
| **OTR** | Off-the-Record encryption | `--enable-otr` | `-Dotr=enabled` |
| **PGP** | PGP encryption support | `--enable-pgp` | `-Dpgp=enabled` |
| **OMEMO** | OMEMO encryption support | `--enable-omemo` | `-Domemo=enabled` |
| **OMEMO Backend** | Select OMEMO backend library | *N/A* | `-Domemo-backend=libsignal\|libomemo-c` |
| **QR Code** | OMEMO QR code display | `--enable-omemo-qrcode` | `-Domemo-qrcode=enabled` |
| **Icons/Clipboard** | GTK tray icons & clipboard | `--enable-icons-and-clipboard` | `-Dicons-and-clipboard=enabled` |
| **GDK Pixbuf** | Avatar scaling support | `--enable-gdk-pixbuf` | `-Dgdk-pixbuf=enabled` |
| **XScreenSaver** | Idle time detection | `--with-xscreensaver` | `-Dxscreensaver=enabled` |
| **Tests** | Build unit tests | *Built by default* | `-Dtests=true` |
| **Sanitizers** | Run-time error detection | *Via CFLAGS* | `-Db_sanitize=address,undefined` |
| Feature | Description | Meson option |
| :--- | :--- | :--- |
| **Notifications** | Desktop notifications support | `-Dnotifications=enabled` |
| **Python Plugins** | Support for Python plugins | `-Dpython-plugins=enabled` |
| **C Plugins** | Support for C plugins | `-Dc-plugins=enabled` |
| **OTR** | Off-the-Record encryption | `-Dotr=enabled` |
| **PGP** | PGP encryption support | `-Dpgp=enabled` |
| **OMEMO** | OMEMO encryption support | `-Domemo=enabled` |
| **OMEMO Backend** | Select OMEMO backend library | `-Domemo-backend=libsignal\|libomemo-c` |
| **QR Code** | OMEMO QR code display | `-Domemo-qrcode=enabled` |
| **Icons/Clipboard** | GTK tray icons & clipboard | `-Dicons-and-clipboard=enabled` |
| **GDK Pixbuf** | Avatar scaling support | `-Dgdk-pixbuf=enabled` |
| **XScreenSaver** | Idle time detection | `-Dxscreensaver=enabled` |
| **Tests** | Build unit tests | `-Dtests=true` |
| **Sanitizers** | Run-time error detection | `-Db_sanitize=address,undefined` |
### Selecting OMEMO Backend
When building with OMEMO support enabled in Meson, you can choose between two backend libraries:
When building with OMEMO support enabled, you can choose between two backend libraries:
- `libsignal`: The default backend using `libsignal-protocol-c`.
- `libomemo-c`: An alternative backend using `libomemo-c`.
@@ -36,13 +31,7 @@ Example of choosing the `libomemo-c` backend:
meson setup build_run -Domemo=enabled -Domemo-backend=libomemo-c
```
### Using Autotools
1. Generate configuration files: `./bootstrap.sh`
2. Configure: `./configure --enable-otr --enable-omemo`
3. Build: `make`
4. Run: `./profanity`
### Using Meson
### Build Instructions
1. Setup build directory: `meson setup build_run -Domemo=enabled -Dotr=enabled`
2. Build: `meson compile -C build_run`
3. Run: `./build_run/profanity`
@@ -171,8 +160,6 @@ Follow the style already present ;-)
To make this easier for you we created a `.clang-format` file.
You'll need to have `clang-format` installed. We currently use **version 21**, which is also the version enforced by our CI in `.github/workflows/main.yml`.
Then just run `make format` before you do any commit.
It might be a good idea to add a git pre-commit hook.
So git automatically runs clang-format before doing a commit.
@@ -214,7 +201,7 @@ In cases where you want to disable automatic formatting for a specific block of
## Verification & Testing
### Running unit tests
Run `make check` to run the unit tests with your current configuration or `./scripts/build-configuration-matrix.sh [autotools|meson]` to check with different switches passed to configure.
Run `meson test -C build_run` to run the unit tests with your current configuration or `./scripts/build-configuration-matrix.sh` to check with different switches passed to configure.
### Writing unit tests
We use the [cmocka](https://cmocka.org/) testing framework for unit tests.
@@ -240,7 +227,7 @@ Examples:
When adding a new test file:
1. Create the `.c` and `.h` files in the appropriate subdirectory of `tests/unittests`.
2. Register the test functions in `tests/unittests/unittests.c` within the `all_tests` array.
3. Add the new source file to `unittest_sources` in both `meson.build` and `Makefile.am`.
3. Add the new source file to `unittest_sources` in `meson.build`.
### Running functional tests
Functional tests use [stabber](https://github.com/profanity-im/stabber) to simulate an XMPP server.
@@ -261,12 +248,6 @@ Using Meson:
4. To run manually: `./build_run/functionaltests`
5. To run a specific test manually: `CMOCKA_TEST_FILTER=test_name ./build_run/functionaltests` (use `./build_run/functionaltests --list` to see all available tests)
Using Autotools:
1. Configure: `./configure` (check the summary to ensure `cmocka`, `stabber` and `libutil` were found)
2. Build and run all tests: `make check`
3. To run manually: `./tests/functionaltests/functionaltests`
4. To run a specific test manually: `CMOCKA_TEST_FILTER=test_name ./tests/functionaltests/functionaltests`
### Writing functional tests
Functional tests simulate real world usage by running Profanity and interacting with it. They verify Profanitys responses to an XMPP server.
@@ -287,43 +268,32 @@ To see the complete list check `proftest.h`.
1. Create a new test file (`test_new_feature.c` and `test_new_feature.h`) in `tests/functionaltests/`.
2. Define your test functions using the `void test_name(void** state)` signature.
3. Use the `PROF_FUNC_TEST(test_name)` macro to register your test in `tests/functionaltests/functionaltests.c`. This macro automatically handles the setup (`init_prof_test`) and teardown (`close_prof_test`) for each test.
4. Add the new source file to `functionaltest_sources` in both `meson.build` and `Makefile.am`.
4. Add the new source file to `functionaltest_sources` in `meson.build`.
### Valgrind
We provide a suppressions file `prof.supp`. It is a combination of the suppressions for shipped with glib2, python and custom rules.
`G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --track-origins=yes --leak-check=full --leak-resolution=high --num-callers=30 --show-leak-kinds=definite --log-file=profval --suppressions=prof.supp ./profanity`
`G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --track-origins=yes --leak-check=full --leak-resolution=high --num-callers=30 --show-leak-kinds=definite --log-file=profval --suppressions=prof.supp ./build_run/profanity`
There's also the option to create a "personalized" suppression file with the up-to-date glib2 and python suppressions.
`make my-prof.supp`
After executing this, you can replace the `--suppressions=prof.supp` argument in the above call, by `--suppressions=my-prof.supp`.
### Clang Static Analyzer
Running the clang static code analyzer helps improving the quality too.
```
make clean
scan-build make
scan-view ...
rm -rf build_run
scan-build meson setup build_run
scan-build meson compile -C build_run
```
### Finding typos
We include a `.codespellrc` configuration file for `codespell` in the root directory.
Before committing it might make sense to run `codespell` to see if you made any typos.
You can run the `make spell` command for this.
### Full check
Run the central quality check script before submitting a patch. This runs the spell checker, code formatter, and unit tests.
If using Autotools:
```
make doublecheck
```
If using Meson:
Using Meson:
```
meson compile doublecheck
```
@@ -331,7 +301,7 @@ meson compile doublecheck
Alternatively, you can run the script directly:
```
./scripts/lint-and-test.sh --fix-formatting --meson # or --autotools
./scripts/lint-and-test.sh --fix-formatting --tests
```
### Pre-commit hook

View File

@@ -1,379 +0,0 @@
core_sources = \
src/xmpp/contact.c src/xmpp/contact.h \
src/log.c src/common.c \
src/chatlog.c src/chatlog.h \
src/database.h src/database.c \
src/log.h src/profanity.c src/common.h \
src/profanity.h src/xmpp/chat_session.c \
src/xmpp/chat_session.h src/xmpp/muc.c src/xmpp/muc.h src/xmpp/jid.h src/xmpp/jid.c \
src/xmpp/chat_state.h src/xmpp/chat_state.c \
src/xmpp/resource.c src/xmpp/resource.h \
src/xmpp/roster_list.c src/xmpp/roster_list.h \
src/xmpp/xmpp.h src/xmpp/capabilities.c src/xmpp/session.c \
src/xmpp/connection.h src/xmpp/connection.c \
src/xmpp/iq.c src/xmpp/message.c src/xmpp/presence.c src/xmpp/stanza.c \
src/xmpp/stanza.h src/xmpp/message.h src/xmpp/iq.h src/xmpp/presence.h \
src/xmpp/capabilities.h src/xmpp/session.h \
src/xmpp/roster.c src/xmpp/roster.h \
src/xmpp/bookmark.c src/xmpp/bookmark.h \
src/xmpp/blocking.c src/xmpp/blocking.h \
src/xmpp/form.c src/xmpp/form.h \
src/xmpp/avatar.c src/xmpp/avatar.h \
src/xmpp/ox.c src/xmpp/ox.h \
src/xmpp/vcard.c src/xmpp/vcard.h src/xmpp/vcard_funcs.h \
src/event/common.c src/event/common.h \
src/event/server_events.c src/event/server_events.h \
src/event/client_events.c src/event/client_events.h \
src/ui/ui.h src/ui/window.c src/ui/window.h src/ui/core.c \
src/ui/titlebar.c src/ui/statusbar.c src/ui/inputwin.c \
src/ui/titlebar.h src/ui/statusbar.h src/ui/inputwin.h \
src/ui/screen.h src/ui/screen.c \
src/ui/console.c src/ui/notifier.c \
src/ui/win_types.h \
src/ui/window_list.c src/ui/window_list.h \
src/ui/rosterwin.c src/ui/occupantswin.c \
src/ui/buffer.c src/ui/buffer.h \
src/ui/chatwin.c \
src/ui/mucwin.c \
src/ui/privwin.c \
src/ui/confwin.c \
src/ui/xmlwin.c \
src/ui/vcardwin.c \
src/command/cmd_defs.h src/command/cmd_defs.c \
src/command/cmd_funcs.h src/command/cmd_funcs.c \
src/command/cmd_ac.h src/command/cmd_ac.c \
src/tools/parser.c \
src/tools/parser.h \
src/tools/http_common.c \
src/tools/http_common.h \
src/tools/http_upload.c \
src/tools/http_upload.h \
src/tools/http_download.c \
src/tools/http_download.h \
src/tools/plugin_download.c \
src/tools/plugin_download.h \
src/tools/bookmark_ignore.c \
src/tools/bookmark_ignore.h \
src/tools/autocomplete.c src/tools/autocomplete.h \
src/tools/clipboard.c src/tools/clipboard.h \
src/tools/editor.c src/tools/editor.h \
src/config/files.c src/config/files.h \
src/config/conflists.c src/config/conflists.h \
src/config/accounts.c src/config/accounts.h \
src/config/tlscerts.c src/config/tlscerts.h \
src/config/account.c src/config/account.h \
src/config/preferences.c src/config/preferences.h \
src/config/theme.c src/config/theme.h \
src/config/color.c src/config/color.h \
src/config/scripts.c src/config/scripts.h \
src/config/cafile.c src/config/cafile.h \
src/plugins/plugins.h src/plugins/plugins.c \
src/plugins/api.h src/plugins/api.c \
src/plugins/callbacks.h src/plugins/callbacks.c \
src/plugins/autocompleters.c src/plugins/autocompleters.h \
src/plugins/themes.c src/plugins/themes.h \
src/plugins/settings.c src/plugins/settings.h \
src/plugins/disco.c src/plugins/disco.h \
src/ui/tray.h src/ui/tray.c
unittest_sources = \
src/xmpp/contact.c src/xmpp/contact.h src/common.c \
src/log.h src/profanity.c src/common.h \
src/profanity.h src/xmpp/chat_session.c \
src/xmpp/chat_session.h src/xmpp/muc.c src/xmpp/muc.h src/xmpp/jid.h src/xmpp/jid.c \
src/xmpp/resource.c src/xmpp/resource.h \
src/xmpp/chat_state.h src/xmpp/chat_state.c \
src/xmpp/roster_list.c src/xmpp/roster_list.h \
src/xmpp/xmpp.h src/xmpp/form.c \
src/ui/ui.h \
src/otr/otr.h \
src/pgp/gpg.h \
src/pgp/ox.h \
src/omemo/omemo.h \
src/omemo/crypto.h \
src/omemo/store.h \
src/xmpp/vcard.h src/xmpp/vcard_funcs.h \
src/command/cmd_defs.h src/command/cmd_defs.c \
src/command/cmd_funcs.h src/command/cmd_funcs.c \
src/command/cmd_ac.h src/command/cmd_ac.c \
src/tools/parser.c \
src/tools/parser.h \
src/tools/autocomplete.c src/tools/autocomplete.h \
src/tools/clipboard.c src/tools/clipboard.h \
src/tools/editor.c src/tools/editor.h \
src/tools/bookmark_ignore.c \
src/tools/bookmark_ignore.h \
src/config/accounts.h \
src/config/account.c src/config/account.h \
src/config/files.c src/config/files.h \
src/config/tlscerts.c src/config/tlscerts.h \
src/config/preferences.c src/config/preferences.h \
src/config/theme.c src/config/theme.h \
src/config/color.c src/config/color.h \
src/config/scripts.c src/config/scripts.h \
src/config/conflists.c src/config/conflists.h \
src/plugins/plugins.h src/plugins/plugins.c \
src/plugins/api.h src/plugins/api.c \
src/plugins/callbacks.h src/plugins/callbacks.c \
src/plugins/autocompleters.c src/plugins/autocompleters.h \
src/plugins/themes.c src/plugins/themes.h \
src/plugins/settings.c src/plugins/settings.h \
src/plugins/disco.c src/plugins/disco.h \
src/ui/window_list.c src/ui/window_list.h \
src/event/common.c src/event/common.h \
src/event/server_events.c src/event/server_events.h \
src/event/client_events.c src/event/client_events.h \
src/ui/tray.h src/ui/tray.c \
tests/prof_cmocka.h \
tests/unittests/xmpp/stub_vcard.c \
tests/unittests/xmpp/stub_avatar.c \
tests/unittests/xmpp/stub_ox.c \
tests/unittests/xmpp/stub_xmpp.c \
tests/unittests/xmpp/stub_message.c \
tests/unittests/ui/stub_ui.c tests/unittests/ui/stub_ui.h \
tests/unittests/ui/stub_vcardwin.c \
tests/unittests/log/stub_log.c \
tests/unittests/chatlog/stub_chatlog.c \
tests/unittests/database/stub_database.c \
tests/unittests/config/stub_accounts.c \
tests/unittests/config/stub_cafile.c \
tests/unittests/tools/stub_http_upload.c \
tests/unittests/tools/stub_http_download.c \
tests/unittests/tools/stub_aesgcm_download.c \
tests/unittests/tools/stub_plugin_download.c \
tests/unittests/helpers.c tests/unittests/helpers.h \
tests/unittests/xmpp/test_form.c tests/unittests/xmpp/test_form.h \
tests/unittests/test_common.c tests/unittests/test_common.h \
tests/unittests/tools/test_autocomplete.c tests/unittests/tools/test_autocomplete.h \
tests/unittests/xmpp/test_jid.c tests/unittests/xmpp/test_jid.h \
tests/unittests/tools/test_parser.c tests/unittests/tools/test_parser.h \
tests/unittests/xmpp/test_roster_list.c tests/unittests/xmpp/test_roster_list.h \
tests/unittests/xmpp/test_chat_session.c tests/unittests/xmpp/test_chat_session.h \
tests/unittests/xmpp/test_contact.c tests/unittests/xmpp/test_contact.h \
tests/unittests/config/test_preferences.c tests/unittests/config/test_preferences.h \
tests/unittests/event/test_server_events.c tests/unittests/event/test_server_events.h \
tests/unittests/xmpp/test_muc.c tests/unittests/xmpp/test_muc.h \
tests/unittests/command/test_cmd_presence.c tests/unittests/command/test_cmd_presence.h \
tests/unittests/command/test_cmd_alias.c tests/unittests/command/test_cmd_alias.h \
tests/unittests/command/test_cmd_connect.c tests/unittests/command/test_cmd_connect.h \
tests/unittests/command/test_cmd_rooms.c tests/unittests/command/test_cmd_rooms.h \
tests/unittests/command/test_cmd_account.c tests/unittests/command/test_cmd_account.h \
tests/unittests/command/test_cmd_sub.c tests/unittests/command/test_cmd_sub.h \
tests/unittests/command/test_cmd_bookmark.c tests/unittests/command/test_cmd_bookmark.h \
tests/unittests/command/test_cmd_otr.c tests/unittests/command/test_cmd_otr.h \
tests/unittests/command/test_cmd_pgp.c tests/unittests/command/test_cmd_pgp.h \
tests/unittests/command/test_cmd_join.c tests/unittests/command/test_cmd_join.h \
tests/unittests/command/test_cmd_roster.c tests/unittests/command/test_cmd_roster.h \
tests/unittests/command/test_cmd_ac.c tests/unittests/command/test_cmd_ac.h \
tests/unittests/command/test_cmd_disconnect.c tests/unittests/command/test_cmd_disconnect.h \
tests/unittests/plugins/test_callbacks.c tests/unittests/plugins/test_callbacks.h \
tests/unittests/plugins/test_plugins_disco.c tests/unittests/plugins/test_plugins_disco.h \
tests/unittests/unittests.c
functionaltest_sources = \
tests/prof_cmocka.h \
tests/functionaltests/proftest.c tests/functionaltests/proftest.h \
tests/functionaltests/test_connect.c tests/functionaltests/test_connect.h \
tests/functionaltests/test_ping.c tests/functionaltests/test_ping.h \
tests/functionaltests/test_rooms.c tests/functionaltests/test_rooms.h \
tests/functionaltests/test_presence.c tests/functionaltests/test_presence.h \
tests/functionaltests/test_message.c tests/functionaltests/test_message.h \
tests/functionaltests/test_chat_session.c tests/functionaltests/test_chat_session.h \
tests/functionaltests/test_carbons.c tests/functionaltests/test_carbons.h \
tests/functionaltests/test_receipts.c tests/functionaltests/test_receipts.h \
tests/functionaltests/test_roster.c tests/functionaltests/test_roster.h \
tests/functionaltests/test_software.c tests/functionaltests/test_software.h \
tests/functionaltests/test_muc.c tests/functionaltests/test_muc.h \
tests/functionaltests/test_disconnect.c tests/functionaltests/test_disconnect.h \
tests/functionaltests/functionaltests.c
main_source = src/main.c
python_sources = \
src/plugins/python_plugins.h src/plugins/python_plugins.c \
src/plugins/python_api.h src/plugins/python_api.c
c_sources = \
src/plugins/c_plugins.h src/plugins/c_plugins.c \
src/plugins/c_api.h src/plugins/c_api.c
git_include = src/gitversion.h
pgp_sources = \
src/pgp/gpg.h src/pgp/gpg.c \
src/pgp/ox.h src/pgp/ox.c
pgp_unittest_sources = \
tests/unittests/pgp/stub_gpg.c \
tests/unittests/pgp/stub_ox.c
otr4_sources = \
src/otr/otrlib.h src/otr/otrlibv4.c src/otr/otr.h src/otr/otr.c
omemo_sources = \
src/omemo/omemo.h src/omemo/omemo.c src/omemo/crypto.h src/omemo/crypto.c \
src/omemo/store.h src/omemo/store.c src/xmpp/omemo.h src/xmpp/omemo.c \
src/tools/aesgcm_download.h src/tools/aesgcm_download.c
omemo_unittest_sources = \
tests/unittests/omemo/stub_omemo.c
if BUILD_PYTHON_API
core_sources += $(python_sources)
unittest_sources += $(python_sources)
endif
if BUILD_C_API
core_sources += $(c_sources)
unittest_sources += $(c_sources)
endif
otr_unittest_sources = \
tests/unittests/otr/stub_otr.c
themes_sources = $(top_srcdir)/themes/*
icons_sources = $(top_srcdir)/icons/*
script_sources = bootstrap.sh
man1_sources = $(wildcard $(top_srcdir)/docs/profanity*.1)
if BUILD_PGP
core_sources += $(pgp_sources)
unittest_sources += $(pgp_unittest_sources)
endif
if BUILD_OTR
unittest_sources += $(otr_unittest_sources)
core_sources += $(otr4_sources)
endif
if BUILD_OMEMO
core_sources += $(omemo_sources)
unittest_sources += $(omemo_unittest_sources)
endif
all_c_sources = $(core_sources) $(unittest_sources) \
$(pgp_sources) $(pgp_unittest_sources) \
$(otr4_sources) $(otr_unittest_sources) \
$(omemo_sources) $(omemo_unittest_sources) \
$(c_sources) $(python_sources) \
$(main_source)
AM_CFLAGS = @AM_CFLAGS@ -I$(srcdir)/src
bin_PROGRAMS = profanity
profanity_SOURCES = $(core_sources) $(main_source)
if THEMES_INSTALL
profanity_themesdir = @THEMES_PATH@
profanity_themes_DATA = $(themes_sources)
endif
if INCLUDE_GIT_VERSION
BUILT_SOURCES = $(git_include)
endif
profanity_iconsdir = @ICONS_PATH@
profanity_icons_DATA = $(icons_sources)
if BUILD_C_API
lib_LTLIBRARIES = libprofanity.la
libprofanity_la_LDFLAGS = -version-info 0:0:0 -shared -no-undefined
libprofanity_la_SOURCES = src/plugins/profapi.c
library_includedir=$(includedir)
library_include_HEADERS = src/plugins/profapi.h
endif
TESTS = tests/unittests/unittests
check_PROGRAMS = tests/unittests/unittests
tests_unittests_unittests_CPPFLAGS = -I$(srcdir)/tests/ -I$(srcdir)/tests/unittests
tests_unittests_unittests_SOURCES = $(unittest_sources)
tests_unittests_unittests_LDADD = -lcmocka
# Functional test were commented out because of:
# https://github.com/profanity-im/profanity/pull/1010
# An issue was raised for stabber:
# https://github.com/profanity-im/stabber/issues/5
# Once this issue is resolved functional tests should be enabled again
#
if HAVE_STABBER
if HAVE_UTIL
TESTS += tests/functionaltests/functionaltests
check_PROGRAMS += tests/functionaltests/functionaltests
tests_functionaltests_functionaltests_SOURCES = $(functionaltest_sources)
tests_functionaltests_functionaltests_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/tests
tests_functionaltests_functionaltests_LDADD = -lcmocka -lstabber -lutil
endif
endif
man1_MANS = $(man1_sources)
EXTRA_DIST = $(man1_sources) $(icons_sources) $(themes_sources) $(script_sources) profrc.example theme_template LICENSE.txt README.md CHANGELOG
# Ship API documentation with `make dist`
EXTRA_DIST += \
apidocs/c/c-prof.conf \
apidocs/c/gen.sh \
apidocs/c/profapi.h \
apidocs/c/profhooks.h \
apidocs/python/conf.py \
apidocs/python/gen.sh \
apidocs/python/index.rst \
apidocs/python/Makefile \
apidocs/python/src/plugin.py \
apidocs/python/src/prof.py
if INCLUDE_GIT_VERSION
GIT_FILES = $(top_srcdir)/.git/HEAD $(top_srcdir)/.git/index
EXTRA_DIST += $(GIT_FILES)
$(git_include).in: $(GIT_FILES)
rm -f $@
echo "#ifndef PROF_GIT_BRANCH" >> $@
echo "#define PROF_GIT_BRANCH \"$(shell git -C $(top_srcdir) rev-parse --symbolic-full-name --abbrev-ref HEAD)\"" >> $@
echo "#endif" >> $@
echo "#ifndef PROF_GIT_REVISION" >> $@
echo "#define PROF_GIT_REVISION \"$(shell git -C $(top_srcdir) log --pretty=format:'%h' -n 1)\"" >> $@
echo "#endif" >> $@
#
# Create $(git_include) atomically to catch possible race. The race can occur
# when $(git_include) is generated in parallel with building of src/profanity.c.
# So this hack allows to find and fix the problem earlier.
#
$(git_include): $(git_include).in
cp $< $@
clean-local:
rm -f $(git_include) $(git_include).in
endif
.PHONY: my-prof.supp
my-prof.supp:
@sed '/^# AUTO-GENERATED START/q' $(srcdir)/prof.supp > $@
@printf "\n\n# glib\n" >> $@
@cat /usr/share/glib-2.0/valgrind/glib.supp >> $@
@printf "\n\n# Python\n" >> $@
@wget -O- https://raw.githubusercontent.com/python/cpython/refs/tags/v`python3 --version | cut -d' ' -f2`/Misc/valgrind-python.supp >> $@
@printf "\n\n# gtk\n" >> $@
@test -z "@GTK_VERSION@" || wget -O- https://raw.githubusercontent.com/GNOME/gtk/refs/tags/@GTK_VERSION@/gtk.supp >> $@
@printf "\n\n# more gtk\n" >> $@
@test -z "@GTK_VERSION@" || cat /usr/share/gtk-3.0/valgrind/gtk.supp >> $@
check-unit: tests/unittests/unittests
tests/unittests/unittests
@VALGRIND_CHECK_RULES@
VALGRIND_SUPPRESSIONS_FILES=prof.supp
format: $(all_c_sources)
clang-format -i $(all_c_sources)
format-sources: $(core_sources) $(main_source)
clang-format -i $^
spell:
codespell
doublecheck:
@./scripts/lint-and-test.sh --fix-formatting --autotools

View File

@@ -2,7 +2,7 @@
* Release libstrophe if required
* Set the correct release version in meson.build and configure.ac
* Set the correct release version in meson.build
* Run Unit tests: `meson setup build_test -Dtests=true && meson test -C build_test`
* Run Functional tests: same as above but needs stabber installed
@@ -27,10 +27,7 @@
* Update profanity.doap (new XEPs and latest version). Look for `DEV` which marks what is done on the development branch.
* Add new release to profanity.doap
* Set the package status to release: `meson setup build_rel --buildtype=release` and in configure.ac
```
PACKAGE_STATUS="release"
```
* Set the package status to release: `meson setup build_rel --buildtype=release`
* Update date and version in man pages (profanity.1, profanity-ox-setup.1)
* Add generated command manpages: `git add docs/profanity-*.1`
@@ -40,11 +37,6 @@ PACKAGE_STATUS="release"
* Generate tarballs: `meson dist -C build_rel --formats xztar,zip`
* Set the package status for autotools back to dev:
```
PACKAGE_STATUS="development"
```
* Remove generated command manpages:
`git rm docs/profanity-*.1`
`git checkout HEAD -- docs/profanity-ox-setup.1`

View File

@@ -1 +0,0 @@
bootstrap.sh

View File

@@ -1,4 +0,0 @@
#!/bin/sh
mkdir -p m4
autoreconf -i "$@"

View File

@@ -25,6 +25,8 @@ RUN dnf install -y \
libtool \
libuuid-devel \
make \
meson \
ninja-build \
ncurses-devel \
python3 \
python3-devel \

View File

@@ -24,6 +24,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libtool \
libxss-dev \
make \
meson \
ninja-build \
pkg-config \
python3-dev \
python-dev-is-python3 \

View File

@@ -1,4 +0,0 @@
#!/bin/sh
#./configure PYTHON_VERSION=3 CFLAGS='-g3 -O0' CXXFLAGS='-g3 -O0' $@
./configure CFLAGS='-g3 -O0' CXXFLAGS='-g3 -O0' $@

View File

@@ -1,448 +0,0 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([profanity],[0.17.0],[jubalh@iodoru.org],[profanity],[https://profanity-im.github.io/])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([src/config.h])
AC_PROG_CC
LT_INIT
AC_SYS_LARGEFILE
## Determine platform
AC_CANONICAL_TARGET
PLATFORM="unknown"
AS_CASE([$target_os],
[freebsd*], [PLATFORM="freebsd"],
[netbsd*], [PLATFORM="netbsd"],
[openbsd*], [PLATFORM="openbsd"],
[darwin*], [PLATFORM="osx"],
[cygwin], [PLATFORM="cygwin"],
[PLATFORM="nix"])
AM_INIT_AUTOMAKE([foreign subdir-objects])
PACKAGE_STATUS="development"
## Get git branch and revision if in development
if test "x$PACKAGE_STATUS" = xdevelopment; then
AM_CONDITIONAL([INCLUDE_GIT_VERSION], [true])
AC_DEFINE([HAVE_GIT_VERSION], [1], [Include git info])
else
AM_CONDITIONAL([INCLUDE_GIT_VERSION], [false])
fi
AC_DEFINE_UNQUOTED([PACKAGE_STATUS], ["$PACKAGE_STATUS"], [Status of this build])
AS_IF([test "x$PLATFORM" = xcygwin],
[AC_DEFINE([PLATFORM_CYGWIN], [1], [Cygwin])])
AS_IF([test "x$PLATFORM" = xosx],
[AC_DEFINE([PLATFORM_OSX], [1], [OSx])
# Apple silicon homebrew flags
AC_CHECK_FILE([/opt/homebrew/include],
[AM_CFLAGS="$AM_CFLAGS -I/opt/homebrew/include"
AM_LDFLAGS="$AM_LDFLAGS -L/opt/homebrew/lib"])])
## Environment variables
AC_ARG_VAR([PYTHON_FRAMEWORK], [Set base directory for Python Framework])
## Options
AC_ARG_ENABLE([notifications],
[AS_HELP_STRING([--enable-notifications], [enable desktop notifications])])
AC_ARG_ENABLE([python-plugins],
[AS_HELP_STRING([--enable-python-plugins], [enable Python plugins])])
AC_ARG_ENABLE([c-plugins],
[AS_HELP_STRING([--enable-c-plugins], [enable C plugins])])
AC_ARG_ENABLE([plugins],
[AS_HELP_STRING([--enable-plugins], [enable plugins])])
AC_ARG_ENABLE([otr],
[AS_HELP_STRING([--enable-otr], [enable otr encryption])])
AC_ARG_ENABLE([pgp],
[AS_HELP_STRING([--enable-pgp], [enable pgp])])
AC_ARG_ENABLE([omemo],
[AS_HELP_STRING([--enable-omemo], [enable OMEMO encryption])])
AC_ARG_WITH([xscreensaver],
[AS_HELP_STRING([--with-xscreensaver], [use libXScrnSaver to determine idle time])])
AC_ARG_WITH([themes],
[AS_HELP_STRING([--with-themes[[=PATH]]], [install themes (default yes)])])
AC_ARG_ENABLE([icons-and-clipboard],
[AS_HELP_STRING([--enable-icons-and-clipboard], [enable GTK tray icons and clipboard paste support])])
AC_ARG_ENABLE([gdk-pixbuf],
[AS_HELP_STRING([--enable-gdk-pixbuf], [enable GDK Pixbuf support to scale avatars before uploading])])
AC_ARG_ENABLE([omemo-qrcode],
[AS_HELP_STRING([--enable-omemo-qrcode], [enable ability to display omemo qr code])])
AC_ARG_ENABLE([functional-tests],
[AS_HELP_STRING([--enable-functional-tests], [enable functional tests (default auto)])])
m4_include([m4/ax_valgrind_check.m4])
AX_VALGRIND_DFLT([drd], [off])
AX_VALGRIND_DFLT([helgrind], [off])
AX_VALGRIND_DFLT([sgcheck], [off])
AX_VALGRIND_CHECK
# Required dependencies
AC_CHECK_FUNCS([atexit memset strdup strstr])
PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.62.0], [],
[AC_MSG_ERROR([glib 2.62.0 or higher is required])])
PKG_CHECK_MODULES([gio], [gio-2.0], [],
[AC_MSG_ERROR([libgio-2.0 from glib-2.0 is required])])
AC_SEARCH_LIBS([fmod], [m], [],
[AC_MSG_ERROR([math.h is required])], [])
PKG_CHECK_MODULES([curl], [libcurl >= 7.62.0], [],
[AC_CHECK_LIB([curl], [main], [],
[AC_MSG_ERROR([libcurl 7.62.0 or higher is required])])])
PKG_CHECK_MODULES([SQLITE], [sqlite3 >= 3.22.0], [],
[AC_MSG_ERROR([sqlite3 3.22.0 or higher is required])])
AX_PTHREAD
AS_IF([test "x$PTHREAD_CC" != x], [ CC="$PTHREAD_CC" ])
### plugins
## python
if test "x$enable_plugins" = xno; then
AM_CONDITIONAL([BUILD_PYTHON_API], [false])
elif test "x$enable_python_plugins" != xno; then
AS_IF([test "x$PLATFORM" = xosx], [
AS_IF([test "x$PYTHON_FRAMEWORK" = x], [ PYTHON_FRAMEWORK="/Library/Frameworks/Python.framework" ])
AC_MSG_NOTICE([Symlinking Python.framework to $PYTHON_FRAMEWORK])
rm -f Python.framework
ln -s $PYTHON_FRAMEWORK Python.framework ])
PKG_CHECK_MODULES([python], [python-embed], [PYTHON_CONFIG_EXISTS=yes], [PYTHON_CONFIG_EXISTS=no])
PKG_CHECK_MODULES([python], [python3-embed], [PYTHON3_CONFIG_EXISTS=yes; AC_DEFINE(PY_IS_PYTHON3, [1], [Is Python version 3])], [PYTHON3_CONFIG_EXISTS=no])
if test "$PYTHON_CONFIG_EXISTS" = "yes" || test "$PYTHON3_CONFIG_EXISTS" = "yes"; then
AM_CONDITIONAL([BUILD_PYTHON_API], [true])
AC_DEFINE([HAVE_PYTHON], [1], [Python support])
else
if test "x$enable_python_plugins" = xyes; then
AC_MSG_ERROR([Python not found, cannot enable Python plugins.])
else
AM_CONDITIONAL([BUILD_PYTHON_API], [false])
AC_MSG_NOTICE([Python development package not found, Python plugin support disabled.])
fi
fi
AS_IF([test "x$PLATFORM" = xosx], [rm -f Python.framework])
# set path to look for global python plugins
GLOBAL_PYTHON_PLUGINS_PATH='${pkgdatadir}/plugins'
AC_SUBST(GLOBAL_PYTHON_PLUGINS_PATH)
else
AM_CONDITIONAL([BUILD_PYTHON_API], [false])
fi
## C
if test "x$PLATFORM" = xcygwin; then
AM_CONDITIONAL([BUILD_C_API], [false])
else
LT_INIT
if test "x$enable_plugins" = xno; then
AM_CONDITIONAL([BUILD_C_API], [false])
elif test "x$enable_c_plugins" != xno; then
# libdl doesn't exist as a separate library in the BSDs and is
# provided in the standard libraries.
AS_IF([test "x$PLATFORM" = xopenbsd -o "x$PLATFORM" = xfreebsd -o "x$PLATFORM" = xnetbsd],
[AM_CONDITIONAL([BUILD_C_API], [true]) AC_DEFINE([HAVE_C], [1], [C support])],
[AC_CHECK_LIB([dl], [main],
[AM_CONDITIONAL([BUILD_C_API], [true]) LIBS="$LIBS -ldl" AC_DEFINE([HAVE_C], [1], [C support])],
[AS_IF(
[test "x$enable_c_plugins" = xyes],
[AC_MSG_ERROR([dl library needed to run C plugins])],
[AM_CONDITIONAL([BUILD_C_API], [false])])
])])
# set path to look for global c plugins
GLOBAL_C_PLUGINS_PATH='${pkglibdir}/plugins'
AC_SUBST(GLOBAL_C_PLUGINS_PATH)
else
AM_CONDITIONAL([BUILD_C_API], [false])
fi
fi
## Check for libstrophe
PKG_CHECK_MODULES([libstrophe], [libstrophe >= 0.12.3],
[LIBS="$libstrophe_LIBS $LIBS" CFLAGS="$CFLAGS $libstrophe_CFLAGS"])
AC_MSG_CHECKING([whether libstrophe works])
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <strophe.h>
int main() {
xmpp_initialize();
return 0;
}
]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([libstrophe is broken, check config.log for details])])
AC_MSG_CHECKING([whether libstrophe has XMPP_CERT_PUBKEY_FINGERPRINT_SHA256 support])
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <strophe.h>
int main() {
xmpp_tlscert_get_string(NULL, XMPP_CERT_PUBKEY_FINGERPRINT_SHA256);
return 1;
}
]])],
[AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_XMPP_CERT_PUBKEY_FINGERPRINT_SHA256], [1], [Have XMPP_CERT_PUBKEY_FINGERPRINT_SHA256])],
[AC_MSG_RESULT(no)])
## Check for curses library
PKG_CHECK_MODULES([ncursesw], [ncursesw],
[NCURSES_CFLAGS="$ncursesw_CFLAGS"; NCURSES_LIBS="$ncursesw_LIBS"; CURSES="ncursesw"],
[PKG_CHECK_MODULES([ncurses], [ncurses],
[NCURSES_CFLAGS="$ncurses_CFLAGS"; NCURSES_LIBS="$ncurses_LIBS"; CURSES="ncurses"],
[AC_CHECK_LIB([ncursesw], [main], [],
[AC_CHECK_LIB([ncurses], [main], [],
[AC_CHECK_LIB([curses], [main],
[LIBS="$LIBS -lcurses"; CURSES="curses"],
[AC_MSG_ERROR([ncurses or curses is required for profanity])])])])])])
AM_CFLAGS="$AM_CFLAGS $NCURSES_CFLAGS"
LIBS="$NCURSES_LIBS $LIBS"
## Check wide characters support in curses library
CFLAGS_RESTORE="$CFLAGS"
CFLAGS="$CFLAGS $NCURSES_CFLAGS"
AC_CACHE_CHECK([for wget_wch support in $CURSES], ncurses_cv_wget_wch,
[AC_LINK_IFELSE([AC_LANG_SOURCE([
void wget_wch(void);
int main() {
wget_wch();
return 0;
}
])],
[ncurses_cv_wget_wch=yes],
[ncurses_cv_wget_wch=no])
])
CFLAGS="$CFLAGS_RESTORE"
AS_IF([test "x$ncurses_cv_wget_wch" != xyes],
[AC_MSG_ERROR([ncurses does not support wide characters])])
## Check for ncursesw/ncurses.h first, Arch linux uses ncurses.h for ncursesw
AC_CHECK_HEADERS([ncursesw/ncurses.h], [], [])
AC_CHECK_HEADERS([ncurses.h], [], [])
AC_CHECK_HEADERS([curses.h], [], [])
# Check for readline
AS_IF([test "x$PLATFORM" = xosx],
[AC_PATH_PROG([BREW], [brew], ["failed"],
[$PATH:/opt/homebrew/bin:/usr/local/bin])
AS_IF([test "x$BREW" = xfailed],
[AC_CHECK_FILE([/opt/local/lib/libreadline.dylib],
[READLINE_PREFIX="/opt/local"],
[READLINE_PREFIX="/usr/local"])],
[READLINE_PREFIX="`$BREW --prefix readline`"])])
AS_IF([test "x$PLATFORM" = xosx],
[AC_CHECK_FILE([$READLINE_PREFIX/lib/libreadline.dylib],
[LIBS="-lreadline $LIBS"
AM_CPPFLAGS="-I$READLINE_PREFIX/include $AM_CPPFLAGS"
AM_LDFLAGS="-L$READLINE_PREFIX/lib $AM_LDFLAGS"
AC_SUBST(AM_LDFLAGS)],
[AC_MSG_ERROR([libreadline is required for profanity. Install it with Homebrew, MacPorts, or manually into /usr/local])])],
[test "x$PLATFORM" = xopenbsd],
[AC_CHECK_FILE([/usr/local/include/ereadline],
[LIBS="-lereadline $LIBS"
AM_CPPFLAGS="-I/usr/local/include/ereadline $AM_CFLAGS"
AM_LDFLAGS="-L/usr/local/lib $AM_LDFLAGS"
AC_SUBST(AM_LDFLAGS)])],
[AC_CHECK_LIB([readline], [main], [],
[AC_MSG_ERROR([libreadline is required for profanity])])])
## Check for optional dependencies depending on feature flags
dnl feature: icons-and-clipboard
AS_IF([test "x$enable_icons_and_clipboard" != xno],
[PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.24.0],
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])
GTK_VERSION=`pkg-config --modversion gtk+-3.0`],
[AS_IF([test "x$enable_icons_and_clipboard" = xyes],
[PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.24.10],
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])],
[AC_MSG_ERROR([gtk+-2.0 >= 2.24.10 or gtk+-3.0 >= 3.24.0 is required for icons and clipboard])],
[AC_MSG_NOTICE([gtk+-3.0/gtk+2.0 not found, icons and clipboard not enabled])])])])])
ICONS_PATH='${pkgdatadir}/icons'
AC_SUBST(ICONS_PATH)
dnl feature: notifications
## Check for desktop notification support
## Linux/FreeBSD require libnotify
## Windows uses native OS calls
## OSX requires terminal-notifier
AS_IF([test "x$PLATFORM" = xosx],
[AS_IF([test "x$enable_notifications" != xno],
[NOTIFIER_PATH="no"
AC_PATH_PROG(NOTIFIER_PATH, terminal-notifier, no)
AS_IF([test "x$NOTIFIER_PATH" = xno],
[AS_IF([test "x$enable_notifications" = xyes],
[AC_MSG_ERROR([terminal-notifier not found, required for desktop notifications.])],
[AC_MSG_NOTICE([Desktop notifications not supported.])])],
[AC_DEFINE([HAVE_OSXNOTIFY], [1], [terminal notifier])])])],
[test "x$PLATFORM" = xnix -o "x$PLATFORM" = xfreebsd],
[AS_IF([test "x$enable_notifications" != xno],
[PKG_CHECK_MODULES([libnotify], [libnotify],
[AC_DEFINE([HAVE_LIBNOTIFY], [1], [libnotify module])],
[AS_IF([test "x$enable_notifications" = xyes],
[AC_MSG_ERROR([libnotify is required but does not exist])],
[AC_MSG_NOTICE([libnotify support will be disabled])])])])])
dnl feature: xscreensaver
AS_IF([test "x$with_xscreensaver" != xno],
[PKG_CHECK_MODULES([xscrnsaver], [xscrnsaver x11],
[AC_MSG_NOTICE([xscreensaver support is enabled]);
LIBS="$xscrnsaver_LIBS $LIBS" CFLAGS="$CFLAGS $xscrnsaver_CFLAGS"
AC_DEFINE([HAVE_LIBXSS], [1], [xscreensaver support])],
[AS_IF([test "x$with_xscreensaver" = xyes],
[AC_MSG_ERROR([xscreensaver is required but does not exist])],
[AC_MSG_NOTICE([xscreensaver support is disabled])])])])
dnl feature: pgp
AM_CONDITIONAL([BUILD_PGP], [false])
if test "x$enable_pgp" != xno; then
AC_CHECK_LIB([gpgme], [main],
[AM_CONDITIONAL([BUILD_PGP], [true])
AC_DEFINE([HAVE_LIBGPGME], [1], [Have libgpgme])
AC_PATH_PROG([GPGME_CONFIG], [gpgme-config], ["failed"])
AS_IF([test "x$GPGME_CONFIG" = xfailed],
[LIBS="-lgpgme $LIBS"],
[LIBS="`$GPGME_CONFIG --libs` $LIBS" AM_CFLAGS="`$GPGME_CONFIG --cflags` $AM_CFLAGS"])],
[AS_IF([test "x$enable_pgp" = xyes],
[AC_MSG_ERROR([libgpgme is required for pgp support])],
[AC_MSG_NOTICE([libgpgme not found, pgp support not enabled])])])
fi
dnl feature: otr
AM_CONDITIONAL([BUILD_OTR], [false])
if test "x$enable_otr" != xno; then
AM_CONDITIONAL([BUILD_OTR], [true])
PKG_CHECK_MODULES([libotr], [libotr >= 4.0],
[LIBS="$libotr_LIBS $LIBS" CFLAGS="$libotr_CFLAGS $CFLAGS"],
[AM_CONDITIONAL([BUILD_OTR], [false])
AS_IF([test "x$enable_otr" = xyes],
[AC_MSG_ERROR([libotr >= 4.0 is required for OTR support])],
[AC_MSG_NOTICE([libotr >= 4.0 not found, OTR support not enabled])])])
AM_COND_IF([BUILD_OTR], [AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])])
fi
dnl feature: pixbuf / used for scaling avatars before uploading via `/avatar set`
AS_IF([test "x$enable_gdk_pixbuf" != xno],
[PKG_CHECK_MODULES([gdk_pixbuf], [gdk-pixbuf-2.0 >= 2.4],
[AC_DEFINE([HAVE_PIXBUF], [1], [gdk-pixbuf module])
LIBS="$gdk_pixbuf_LIBS $LIBS" CFLAGS="$gdk_pixbuf_CFLAGS $CFLAGS"],
[AS_IF([test "x$enable_gdk_pixbuf" = xyes],
[AC_MSG_ERROR([gdk-pixbuf-2.0 >= 2.4 is required to scale avatars before uploading])],
[AC_MSG_NOTICE([gdk-pixbuf-2.0 >= 2.4 not found, GDK Pixbuf support not enabled])])])])
dnl feature: omemo
AM_CONDITIONAL([BUILD_OMEMO], [false])
if test "x$enable_omemo" != xno; then
OMEMO_LIBS=""
PKG_CHECK_MODULES([libsignal], [libsignal-protocol-c >= 2.3.2],
[OMEMO_LIBS="$libsignal_LIBS"
PKG_CHECK_MODULES([gcrypt], [libgcrypt >= 1.7.0],
[OMEMO_LIBS="$gcrypt_LIBS $OMEMO_LIBS"
AM_CONDITIONAL([BUILD_OMEMO], [true])],
[AC_MSG_NOTICE([gcrypt >= 1.7.0 not found, OMEMO support not enabled])])],
[AC_MSG_NOTICE([libsignal-protocol-c >= 2.3.2 not found, OMEMO support not enabled])])
AM_COND_IF([BUILD_OMEMO],
[AC_DEFINE([HAVE_OMEMO], [1], [Have OMEMO])
LIBS="$OMEMO_LIBS $LIBS"],
[AS_IF([test "x$enable_omemo" = xyes],
[AC_MSG_ERROR([OMEMO support requires a library which is missed])])])
fi
dnl feature: themes
AS_IF([test "x$with_themes" = xno],
[THEMES_INSTALL="false"],
[THEMES_INSTALL="true"])
AS_IF([test "x$with_themes" = xno -o "x$with_themes" = xyes -o "x$with_themes" = x],
[THEMES_PATH='${pkgdatadir}/themes'],
[THEMES_PATH="$with_themes"])
AC_SUBST(THEMES_PATH)
AM_CONDITIONAL([THEMES_INSTALL], "$THEMES_INSTALL")
if test "x$enable_omemo_qrcode" != xno; then
PKG_CHECK_MODULES([libqrencode], [libqrencode],
[AC_DEFINE([HAVE_QRENCODE], [1], [Have QRencode]) LIBS="$libqrencode_LIBS $LIBS" CFLAGS="$libqrencode_CFLAGS $CFLAGS"],
[AS_IF([test "x$enable_qrcode" = xyes],
[AC_MSG_ERROR([libqrencode not found])],
[AC_MSG_NOTICE([librencode not found])])])
fi
## Tests
# cmocka is required only for tests, profanity shouldn't be linked with it
# TODO: pass cmocka_CFLAGS and cmocka_LIBS to Makefile.am
PKG_CHECK_MODULES([cmocka], [cmocka], [],
[AC_MSG_NOTICE([cmocka is not found, will not be able to run tests])])
AM_CONDITIONAL([HAVE_STABBER], [false])
AM_CONDITIONAL([HAVE_UTIL], [false])
if test "x$enable_functional_tests" != xno; then
AC_CHECK_LIB([stabber], [stbbr_start], [AM_CONDITIONAL([HAVE_STABBER], [true])],
[AS_IF([test "x$enable_functional_tests" = xyes],
[AC_MSG_ERROR([libstabber not found, but functional tests were explicitly enabled])],
[AC_MSG_NOTICE([libstabber not found, will not be able to run functional tests])])])
AC_CHECK_LIB([util], [forkpty], [AM_CONDITIONAL([HAVE_UTIL], [true])],
[AS_IF([test "x$enable_functional_tests" = xyes],
[AC_MSG_ERROR([libutil not found, but functional tests were explicitly enabled])],
[AC_MSG_NOTICE([libutil not found, will not be able to run functional tests])])])
fi
## Default parameters
AM_CFLAGS="$AM_CFLAGS -Wall -Wno-deprecated-declarations -std=gnu99 -ggdb3"
AM_LDFLAGS="$AM_LDFLAGS -export-dynamic"
AS_IF([test "x$PACKAGE_STATUS" = xdevelopment],
[AM_CFLAGS="$AM_CFLAGS -Wunused -Werror"])
AS_IF([test "x$PLATFORM" = xosx],
[AM_CFLAGS="$AM_CFLAGS -Qunused-arguments"])
AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS $glib_CFLAGS $gio_CFLAGS $curl_CFLAGS ${SQLITE_CFLAGS}"
AM_CFLAGS="$AM_CFLAGS $libnotify_CFLAGS ${GTK_CFLAGS} $python_CFLAGS"
AM_CFLAGS="$AM_CFLAGS -DTHEMES_PATH=\"\\\"$THEMES_PATH\\\"\" -DICONS_PATH=\"\\\"$ICONS_PATH\\\"\" -DGLOBAL_PYTHON_PLUGINS_PATH=\"\\\"$GLOBAL_PYTHON_PLUGINS_PATH\\\"\" -DGLOBAL_C_PLUGINS_PATH=\"\\\"$GLOBAL_C_PLUGINS_PATH\\\"\""
AM_CFLAGS="$AM_CFLAGS $CFLAGS"
LIBS="$glib_LIBS $gio_LIBS $PTHREAD_LIBS $curl_LIBS $libnotify_LIBS $python_LIBS ${GTK_LIBS} ${SQLITE_LIBS} $LIBS"
AC_SUBST(AM_LDFLAGS)
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(GTK_VERSION)
## Output
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
AC_MSG_NOTICE([Summary of build options:
PLATFORM : $target_os
PACKAGE_STATUS : $PACKAGE_STATUS
GTK_VERSION : $GTK_VERSION
LIBS : $LIBS
Install themes : $THEMES_INSTALL
Themes path : $THEMES_PATH
Icons path : $ICONS_PATH
Global Python plugins path : $GLOBAL_PYTHON_PLUGINS_PATH
Global C plugins path : $GLOBAL_C_PLUGINS_PATH
CFLAGS : $AM_CFLAGS
CPPFLAGS : $AM_CPPFLAGS
LDFLAGS : $AM_LDFLAGS
LIBS : $LIBS
Run `make' to build profanity])
dnl vim: expandtab:ts=4:sts=4:sw=4

View File

@@ -1,239 +0,0 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_valgrind_check.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_VALGRIND_DFLT(memcheck|helgrind|drd|sgcheck, on|off)
# AX_VALGRIND_CHECK()
#
# DESCRIPTION
#
# AX_VALGRIND_CHECK checks whether Valgrind is present and, if so, allows
# running `make check` under a variety of Valgrind tools to check for
# memory and threading errors.
#
# Defines VALGRIND_CHECK_RULES which should be substituted in your
# Makefile; and $enable_valgrind which can be used in subsequent configure
# output. VALGRIND_ENABLED is defined and substituted, and corresponds to
# the value of the --enable-valgrind option, which defaults to being
# enabled if Valgrind is installed and disabled otherwise. Individual
# Valgrind tools can be disabled via --disable-valgrind-<tool>, the
# default is configurable via the AX_VALGRIND_DFLT command or is to use
# all commands not disabled via AX_VALGRIND_DFLT. All AX_VALGRIND_DFLT
# calls must be made before the call to AX_VALGRIND_CHECK.
#
# If unit tests are written using a shell script and automake's
# LOG_COMPILER system, the $(VALGRIND) variable can be used within the
# shell scripts to enable Valgrind, as described here:
#
# https://www.gnu.org/software/gnulib/manual/html_node/Running-self_002dtests-under-valgrind.html
#
# Usage example:
#
# configure.ac:
#
# AX_VALGRIND_DFLT([sgcheck], [off])
# AX_VALGRIND_CHECK
#
# in each Makefile.am with tests:
#
# @VALGRIND_CHECK_RULES@
# VALGRIND_SUPPRESSIONS_FILES = my-project.supp
# EXTRA_DIST = my-project.supp
#
# This results in a "check-valgrind" rule being added. Running `make
# check-valgrind` in that directory will recursively run the module's test
# suite (`make check`) once for each of the available Valgrind tools (out
# of memcheck, helgrind and drd) while the sgcheck will be skipped unless
# enabled again on the commandline with --enable-valgrind-sgcheck. The
# results for each check will be output to test-suite-$toolname.log. The
# target will succeed if there are zero errors and fail otherwise.
#
# Alternatively, a "check-valgrind-$TOOL" rule will be added, for $TOOL in
# memcheck, helgrind, drd and sgcheck. These are useful because often only
# some of those tools can be ran cleanly on a codebase.
#
# The macro supports running with and without libtool.
#
# LICENSE
#
# Copyright (c) 2014, 2015, 2016 Philip Withnall <philip.withnall@collabora.co.uk>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 23
dnl Configured tools
m4_define([valgrind_tool_list], [[memcheck], [helgrind], [drd], [sgcheck]])
m4_set_add_all([valgrind_exp_tool_set], [sgcheck])
m4_foreach([vgtool], [valgrind_tool_list],
[m4_define([en_dflt_valgrind_]vgtool, [on])])
AC_DEFUN([AX_VALGRIND_DFLT],[
m4_define([en_dflt_valgrind_$1], [$2])
])dnl
AC_DEFUN([AX_VALGRIND_CHECK],[
AM_EXTRA_RECURSIVE_TARGETS([check-valgrind])
m4_foreach([vgtool], [valgrind_tool_list],
[AM_EXTRA_RECURSIVE_TARGETS([check-valgrind-]vgtool)])
dnl Check for --enable-valgrind
AC_ARG_ENABLE([valgrind],
[AS_HELP_STRING([--enable-valgrind], [Whether to enable Valgrind on the unit tests])],
[enable_valgrind=$enableval],[enable_valgrind=])
AS_IF([test "$enable_valgrind" != "no"],[
# Check for Valgrind.
AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind])
AS_IF([test "$VALGRIND" = ""],[
AS_IF([test "$enable_valgrind" = "yes"],[
AC_MSG_ERROR([Could not find valgrind; either install it or reconfigure with --disable-valgrind])
],[
enable_valgrind=no
])
],[
enable_valgrind=yes
])
])
AM_CONDITIONAL([VALGRIND_ENABLED],[test "$enable_valgrind" = "yes"])
AC_SUBST([VALGRIND_ENABLED],[$enable_valgrind])
# Check for Valgrind tools we care about.
[valgrind_enabled_tools=]
m4_foreach([vgtool],[valgrind_tool_list],[
AC_ARG_ENABLE([valgrind-]vgtool,
m4_if(m4_defn([en_dflt_valgrind_]vgtool),[off],dnl
[AS_HELP_STRING([--enable-valgrind-]vgtool, [Whether to use ]vgtool[ during the Valgrind tests])],dnl
[AS_HELP_STRING([--disable-valgrind-]vgtool, [Whether to skip ]vgtool[ during the Valgrind tests])]),
[enable_valgrind_]vgtool[=$enableval],
[enable_valgrind_]vgtool[=])
AS_IF([test "$enable_valgrind" = "no"],[
enable_valgrind_]vgtool[=no],
[test "$enable_valgrind_]vgtool[" ]dnl
m4_if(m4_defn([en_dflt_valgrind_]vgtool), [off], [= "yes"], [!= "no"]),[
AC_CACHE_CHECK([for Valgrind tool ]vgtool,
[ax_cv_valgrind_tool_]vgtool,[
ax_cv_valgrind_tool_]vgtool[=no
m4_set_contains([valgrind_exp_tool_set],vgtool,
[m4_define([vgtoolx],[exp-]vgtool)],
[m4_define([vgtoolx],vgtool)])
AS_IF([`$VALGRIND --tool=]vgtoolx[ --help >/dev/null 2>&1`],[
ax_cv_valgrind_tool_]vgtool[=yes
])
])
AS_IF([test "$ax_cv_valgrind_tool_]vgtool[" = "no"],[
AS_IF([test "$enable_valgrind_]vgtool[" = "yes"],[
AC_MSG_ERROR([Valgrind does not support ]vgtool[; reconfigure with --disable-valgrind-]vgtool)
],[
enable_valgrind_]vgtool[=no
])
],[
enable_valgrind_]vgtool[=yes
])
])
AS_IF([test "$enable_valgrind_]vgtool[" = "yes"],[
valgrind_enabled_tools="$valgrind_enabled_tools ]m4_bpatsubst(vgtool,[^exp-])["
])
AC_SUBST([ENABLE_VALGRIND_]vgtool,[$enable_valgrind_]vgtool)
])
AC_SUBST([valgrind_tools],["]m4_join([ ], valgrind_tool_list)["])
AC_SUBST([valgrind_enabled_tools],[$valgrind_enabled_tools])
[VALGRIND_CHECK_RULES='
# Valgrind check
#
# Optional:
# - VALGRIND_SUPPRESSIONS_FILES: Space-separated list of Valgrind suppressions
# files to load. (Default: empty)
# - VALGRIND_FLAGS: General flags to pass to all Valgrind tools.
# (Default: --num-callers=30)
# - VALGRIND_$toolname_FLAGS: Flags to pass to Valgrind $toolname (one of:
# memcheck, helgrind, drd, sgcheck). (Default: various)
# Optional variables
VALGRIND_SUPPRESSIONS ?= $(addprefix --suppressions=,$(VALGRIND_SUPPRESSIONS_FILES))
VALGRIND_FLAGS ?= --num-callers=30
VALGRIND_memcheck_FLAGS ?= --leak-check=full --show-reachable=no
VALGRIND_helgrind_FLAGS ?= --history-level=approx
VALGRIND_drd_FLAGS ?=
VALGRIND_sgcheck_FLAGS ?=
# Internal use
valgrind_log_files = $(addprefix test-suite-,$(addsuffix .log,$(valgrind_tools)))
valgrind_memcheck_flags = --tool=memcheck $(VALGRIND_memcheck_FLAGS)
valgrind_helgrind_flags = --tool=helgrind $(VALGRIND_helgrind_FLAGS)
valgrind_drd_flags = --tool=drd $(VALGRIND_drd_FLAGS)
valgrind_sgcheck_flags = --tool=exp-sgcheck $(VALGRIND_sgcheck_FLAGS)
valgrind_quiet = $(valgrind_quiet_$(V))
valgrind_quiet_ = $(valgrind_quiet_$(AM_DEFAULT_VERBOSITY))
valgrind_quiet_0 = --quiet
valgrind_v_use = $(valgrind_v_use_$(V))
valgrind_v_use_ = $(valgrind_v_use_$(AM_DEFAULT_VERBOSITY))
valgrind_v_use_0 = @echo " USE " $(patsubst check-valgrind-%-local,%,$''@):;
# Support running with and without libtool.
ifneq ($(LIBTOOL),)
valgrind_lt = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=execute
else
valgrind_lt =
endif
# Use recursive makes in order to ignore errors during check
check-valgrind-local:
ifeq ($(VALGRIND_ENABLED),yes)
$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k \
$(foreach tool, $(valgrind_enabled_tools), check-valgrind-$(tool))
else
@echo "Need to reconfigure with --enable-valgrind"
endif
# Valgrind running
VALGRIND_TESTS_ENVIRONMENT = \
$(TESTS_ENVIRONMENT) \
env VALGRIND=$(VALGRIND) \
G_SLICE=always-malloc,debug-blocks \
G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly
VALGRIND_LOG_COMPILER = \
$(valgrind_lt) \
$(VALGRIND) $(VALGRIND_SUPPRESSIONS) --error-exitcode=1 $(VALGRIND_FLAGS)
define valgrind_tool_rule
check-valgrind-$(1)-local:
ifeq ($$(VALGRIND_ENABLED)-$$(ENABLE_VALGRIND_$(1)),yes-yes)
ifneq ($$(TESTS),)
$$(valgrind_v_use)$$(MAKE) check-TESTS \
TESTS_ENVIRONMENT="$$(VALGRIND_TESTS_ENVIRONMENT)" \
LOG_COMPILER="$$(VALGRIND_LOG_COMPILER)" \
LOG_FLAGS="$$(valgrind_$(1)_flags)" \
TEST_SUITE_LOG=test-suite-$(1).log
endif
else ifeq ($$(VALGRIND_ENABLED),yes)
@echo "Need to reconfigure with --enable-valgrind-$(1)"
else
@echo "Need to reconfigure with --enable-valgrind"
endif
endef
$(foreach tool,$(valgrind_tools),$(eval $(call valgrind_tool_rule,$(tool))))
A''M_DISTCHECK_CONFIGURE_FLAGS ?=
A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-valgrind
MOSTLYCLEANFILES ?=
MOSTLYCLEANFILES += $(valgrind_log_files)
.PHONY: check-valgrind $(addprefix check-valgrind-,$(valgrind_tools))
']
AC_SUBST([VALGRIND_CHECK_RULES])
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([VALGRIND_CHECK_RULES])])
])

View File

@@ -729,7 +729,7 @@ endif
lint_and_test = find_program('scripts/lint-and-test.sh', required: false)
if lint_and_test.found()
run_target('doublecheck',
command: [lint_and_test, '--fix-formatting', '--meson']
command: [lint_and_test, '--fix-formatting', '--tests']
)
endif

View File

@@ -9,16 +9,16 @@ Central validation script mainly for local development.
- **Usage:** `./scripts/lint-and-test.sh [options]`
- **Options:**
- `--fix-formatting`: Automatically apply `clang-format` fixes.
- `--autotools` / `--meson`: Run unit tests using the specified build system.
- `--tests`: Run unit tests using Meson.
- `--hook`: Run in "hook mode" (checks only staged files).
- `--install`: Install the script as a git `pre-commit` hook.
## `build-configuration-matrix.sh`
Exhaustive build configuration matrix testing. It ensures that Profanity compiles and passes unit tests across a variety of feature configurations for both Autotools and Meson.
Exhaustive build configuration matrix testing. It ensures that Profanity compiles and passes unit tests across a variety of feature configurations for Meson.
- **Purpose:** Verifies architectural compatibility by testing many combinations of build flags.
- **Usage:** `./scripts/build-configuration-matrix.sh [autotools|meson] [extra-args]`
- **Extra Arguments:** Any arguments passed after the build system are forwarded directly to the configuration command (`./configure` or `meson setup`).
- **Usage:** `./scripts/build-configuration-matrix.sh [extra-args]`
- **Extra Arguments:** Any arguments are forwarded directly to the configuration command (`meson setup`).
- **Environment:** Primarily used in CI (GitHub Actions), but can be run locally to verify all configurations.
## `changelog-helper.py`

View File

@@ -1,7 +1,6 @@
#!/usr/bin/env bash
# Exhaustive build configuration matrix testing for Profanity
# Supports both Autotools and Meson
set -e
@@ -24,18 +23,12 @@ error_handler() {
ERR_CODE=$?
echo -e "${RED}Error ${ERR_CODE} with command '${BASH_COMMAND}' on line ${BASH_LINENO[0]}. Exiting.${NC}"
if [ "$BUILD_SYSTEM" == "autotools" ]; then
log_content ./config.log
log_content ./test-suite.log
log_content ./test-suite-memcheck.log
else
for log in build_run/meson-logs/testlog.txt build_valgrind/meson-logs/testlog.txt; do
if [ -f "$log" ]; then
echo "--- Meson Test Log ($log) ---"
cat "$log"
fi
done
fi
for log in build_run/meson-logs/testlog.txt build_valgrind/meson-logs/testlog.txt; do
if [ -f "$log" ]; then
echo "--- Meson Test Log ($log) ---"
cat "$log"
fi
done
exit ${ERR_CODE}
}
@@ -49,155 +42,72 @@ num_cores() {
}
usage() {
echo "Usage: $0 [autotools|meson] [extra-args]"
echo "Usage: $0 [extra-args]"
echo ""
echo "Run exhaustive build matrix tests for the specified build system."
echo "Default build system is 'autotools'."
echo "Run exhaustive build matrix tests."
echo ""
echo "Extra arguments are passed directly to the configuration command:"
echo " - Autotools: ./configure [extra-args]"
echo " - Meson: meson setup [extra-args]"
echo "Extra arguments are passed directly to: meson setup [extra-args]"
exit 0
}
# Determine build system
BUILD_SYSTEM="autotools"
if [[ "$1" == "autotools" || "$1" == "meson" ]]; then
BUILD_SYSTEM="$1"
shift
fi
if [[ "$1" == "--help" || "$1" == "-h" ]]; then
usage
fi
# Compatibility with old script that took autotools|meson as first arg
if [[ "$1" == "meson" ]]; then
shift
elif [[ "$1" == "autotools" ]]; then
echo -e "${RED}Error: Autotools is no longer supported.${NC}"
exit 1
fi
ARCH="$(uname | tr '[:upper:]' '[:lower:]')"
EXTRA_ARGS="$*"
if [ "$BUILD_SYSTEM" == "autotools" ]; then
echo -e "${YELLOW}---> Starting Autotools build matrix...${NC}"
./bootstrap.sh
# Build Matrix
echo -e "${YELLOW}---> Starting build matrix...${NC}"
MAKE="make --quiet -j$(num_cores)"
CC="gcc"
tests=(
"-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"
""
"-Dnotifications=disabled"
"-Dicons-and-clipboard=disabled"
"-Dotr=disabled"
"-Dpgp=disabled"
"-Domemo=disabled -Domemo-qrcode=disabled"
"-Dpgp=disabled -Dotr=disabled"
"-Dpgp=disabled -Dotr=disabled -Domemo=disabled"
"-Dpython-plugins=disabled"
"-Dc-plugins=disabled"
"-Dc-plugins=disabled -Dpython-plugins=disabled"
"-Dxscreensaver=disabled"
"-Dgdk-pixbuf=disabled"
)
case "$ARCH" in
linux*)
tests=(
"--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp
--enable-omemo --enable-plugins --enable-c-plugins
--enable-python-plugins --with-xscreensaver --enable-omemo-qrcode --enable-gdk-pixbuf"
"--disable-notifications --disable-icons-and-clipboard --disable-otr --disable-pgp
--disable-omemo --disable-plugins --disable-c-plugins
--disable-python-plugins --without-xscreensaver"
"--disable-notifications"
"--disable-icons-and-clipboard"
"--disable-otr"
"--disable-pgp"
"--disable-omemo --disable-omemo-qrcode"
"--disable-pgp --disable-otr"
"--disable-pgp --disable-otr --disable-omemo"
"--disable-plugins"
"--disable-python-plugins"
"--disable-c-plugins"
"--disable-c-plugins --disable-python-plugins"
"--without-xscreensaver"
"--disable-gdk-pixbuf"
"")
source /etc/profile.d/debuginfod.sh 2>/dev/null || true
;;
*)
# Darwin, OpenBSD, etc.
if [ "$ARCH" == "openbsd*" ]; then
MAKE="gmake"
CC="egcc -std=gnu99 -fexec-charset=UTF-8"
fi
tests=(
"--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp
--enable-omemo --enable-plugins --enable-c-plugins
--enable-python-plugins"
"--disable-notifications --disable-icons-and-clipboard --disable-otr --disable-pgp
--disable-omemo --disable-plugins --disable-c-plugins
--disable-python-plugins"
"--disable-notifications"
"--disable-icons-and-clipboard"
"--disable-otr"
"--disable-pgp"
"--disable-omemo"
"--disable-pgp --disable-otr"
"--disable-pgp --disable-otr --disable-omemo"
"--disable-plugins"
"--disable-python-plugins"
"--disable-c-plugins"
"--disable-c-plugins --disable-python-plugins"
"")
;;
esac
# Valgrind check (Linux only)
if [[ "$ARCH" == linux* ]]; then
echo -e "${YELLOW}--> Building with ./configure ${tests[0]} --enable-valgrind --disable-functional-tests ${EXTRA_ARGS}${NC}"
./configure ${tests[0]} --enable-valgrind --disable-functional-tests ${EXTRA_ARGS}
$MAKE CC="${CC}"
$MAKE check-valgrind
$MAKE distclean
fi
for features in "${tests[@]}"
do
echo -e "${YELLOW}--> Building with ./configure ${features} --disable-functional-tests ${EXTRA_ARGS}${NC}"
./configure $features --disable-functional-tests ${EXTRA_ARGS}
$MAKE CC="${CC}"
$MAKE check-unit
./profanity -v
$MAKE clean
done
else
# Meson Build Matrix
echo -e "${YELLOW}---> Starting Meson build matrix...${NC}"
tests=(
"-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"
""
"-Dnotifications=disabled"
"-Dicons-and-clipboard=disabled"
"-Dotr=disabled"
"-Dpgp=disabled"
"-Domemo=disabled -Domemo-qrcode=disabled"
"-Dpgp=disabled -Dotr=disabled"
"-Dpgp=disabled -Dotr=disabled -Domemo=disabled"
"-Dpython-plugins=disabled"
"-Dc-plugins=disabled"
"-Dc-plugins=disabled -Dpython-plugins=disabled"
"-Dxscreensaver=disabled"
"-Dgdk-pixbuf=disabled"
)
BACKEND_OPT=""
if [ -n "${OMEMO_BACKEND}" ]; then
BACKEND_OPT="-Domemo-backend=${OMEMO_BACKEND}"
fi
# Valgrind check (Linux only)
if [[ "$ARCH" == linux* ]]; then
echo -e "${YELLOW}--> Running Valgrind check with full features ${BACKEND_OPT} ${EXTRA_ARGS}${NC}"
rm -rf build_valgrind
meson setup build_valgrind ${tests[0]} ${BACKEND_OPT} -Dtests=true -Db_sanitize=address,undefined ${EXTRA_ARGS}
meson compile -C build_valgrind
meson test -C build_valgrind "unit tests" --print-errorlogs --wrap=valgrind || echo "Valgrind issues detected"
rm -rf build_valgrind
fi
for features in "${tests[@]}"
do
echo -e "${YELLOW}--> Building with: ${features} ${BACKEND_OPT} ${EXTRA_ARGS}${NC}"
rm -rf build_run
meson setup build_run ${features} ${BACKEND_OPT} -Dtests=true ${EXTRA_ARGS}
meson compile -C build_run
meson test -C build_run "unit tests" --print-errorlogs
./build_run/profanity -v
done
BACKEND_OPT=""
if [ -n "${OMEMO_BACKEND}" ]; then
BACKEND_OPT="-Domemo-backend=${OMEMO_BACKEND}"
fi
# Valgrind check (Linux only)
if [[ "$ARCH" == linux* ]]; then
echo -e "${YELLOW}--> Running Valgrind check with full features ${BACKEND_OPT} ${EXTRA_ARGS}${NC}"
rm -rf build_valgrind
meson setup build_valgrind ${tests[0]} ${BACKEND_OPT} -Dtests=true -Db_sanitize=address,undefined ${EXTRA_ARGS}
meson compile -C build_valgrind
meson test -C build_valgrind "unit tests" --print-errorlogs --wrap=valgrind || echo "Valgrind issues detected"
rm -rf build_valgrind
fi
for features in "${tests[@]}"
do
echo -e "${YELLOW}--> Building with: ${features} ${BACKEND_OPT} ${EXTRA_ARGS}${NC}"
rm -rf build_run
meson setup build_run ${features} ${BACKEND_OPT} -Dtests=true ${EXTRA_ARGS}
meson compile -C build_run
meson test -C build_run "unit tests" --print-errorlogs
./build_run/profanity -v
done
echo -e "${GREEN}Build configuration matrix testing successful!${NC}"

View File

@@ -17,7 +17,7 @@ usage() {
echo ""
echo "Description:"
echo " Code quality checks (spelling, formatting, and unit tests)."
echo " Works with autotools and meson and can be used as a git"
echo " Works with meson and can be used as a git"
echo " pre-commit hook."
echo ""
echo "Options:"
@@ -25,8 +25,7 @@ usage() {
echo " --no-format Skip the formatting check/fix entirely. Use this if your local"
echo " clang-format version produces different results than the CI."
echo " Can also be set via SKIP_FORMAT=1 environment variable."
echo " --autotools Run unit tests using Autotools (make check-unit)"
echo " --meson Run unit tests using Meson (meson test)"
echo " --tests Run unit tests using Meson (meson test)"
echo " --hook Git hook mode: Checks only staged files for spelling and"
echo " formatting. Does not run tests to ensure fast commits."
echo " --install Install this script as a git pre-commit hook"
@@ -37,10 +36,7 @@ run_tests() {
local system=$1
echo -e "${YELLOW}---> Running unit tests...${NC}"
if [ "$system" == "autotools" ]; then
echo "Using Autotools..."
make check-unit
elif [ "$system" == "meson" ]; then
if [ "$system" == "meson" ]; then
echo "Using Meson..."
# Uses build_run
meson test -C build_run "unit tests"
@@ -111,8 +107,7 @@ while [[ "$#" -gt 0 ]]; do
case $1 in
--fix-formatting) MODE="fix" ;;
--no-format) INTERNAL_SKIP_FORMAT=true ;;
--autotools) BUILD_SYSTEM="autotools" ;;
--meson) BUILD_SYSTEM="meson" ;;
--tests) BUILD_SYSTEM="meson" ;;
--hook) HOOK=true ;;
--install)
echo "Installing pre-commit hook..."

View File

@@ -1,7 +1,2 @@
export COLUMNS=300
if [ -f "./build_run/profanity" ]; then
./build_run/profanity -l DEBUG
else
# Fallback for autotools
./profanity -l DEBUG
fi
./build_run/profanity -l DEBUG