Fix https://github.com/profanity-im/profanity/issues/1002.
Was already started in 2021 in https://github.com/profanity-im/profanity/pull/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.
Use disabler() for optional dependencies.
Extract repeated build type checks into is_debug/is_release variables.
Consolidate compiler flags into single add_project_arguments() calls.
Simplify dependency list building (Meson auto-ignores disabled deps).
Streamline platform checks using 'in' operator.
Remove redundant variables (xscrnsaver_found, gtk_version, config_h_inc).
Simplify ncurses and header detection with clearer fallback chains.
Consolidate install_data() calls for files in same directory.
For meson we dont just check for the presence of a dependency and
then auto enable it.
Users must enable features explicit. This helps with having
deterministic results.
Also remove the general `plugins` switch which was used to
enable/disable both python and c plugins. Users can just use
those switches.
In out autotools build we check for all kinds of curses and their
support for wide character.
Let's focus on more modern systems until someone complains.
For autotools this was added in:
75bb00368f
Regarding:
https://github.com/profanity-im/profanity/issues/1334
I think libstrophe is rather common now and should be treated
like all the other dependencies anyways.
So I'll remove this from the meson files at least. Since my
goal is to have a cleaner build system.
In autotools we had `package_status` which we set to either
`release` or `development`.
When converting from autotools to meson we used that mechanism
as well. But actually meson has a default way of handling this
with the option `buildtype`.
The following values are possible:
debug, debugoptimized, release, plain
So our `package_status = development` will now be
`if get_option('buildtype') == 'debug' or get_option('buildtype') ==
'debugoptimized'`. Probably we could also use
`if get_option('buildtype') == 'release'. But like this the
`plain` will be really plain.
Usage:
```
meson setup build --buildtype=debug
meson compile -C build
```
Add a GitHub Actions workflow to build with Cygwin on Windows.
Fixes issues by forcing Cygwin bash for all steps, handling temporary script paths,
stripping CRLF line endings, and enabling igncr.
Make profanity exit gracefully when it receives either SIGTERM or
SIGHUP. This means that various cleanups will happen as if the user
issued the /quit command, whereas before these signals would terminate
profanity immediately leaving for instance the connection to the server
unterminated.
The main motivation for this change is so that profanity will exit
gracefully when the user closes the terminal that it's running in, which
is a handy shortcut (but can also happen on accident) and won't now lead
to the connection slowly timing out on the server instead. Similarly for
SIGTERM: profanity now for instance needs not be manually closed before
shutting down the computer to avoid the above as it will instead receive
this signal from the init process.
* No need to call `g_key_file_has_key()` before calling a getter.
* Add helper to convert `gcharv` to `glist`.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
If one is running multiple instances of profanity, the behavior of the
accounts module was to constantly overwrite the accounts file with the
version that was on-disk of the first instance of profanity started.
This is changed now in order to only write what we modified, we keep a
copy of the accounts file and when "saving" we re-read accounts from disk
and only update the values of the modified account.
This is not 100% fool proof if one modifies the same account from two
different instances, but still better than before.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
* Less `GString`.
* Don't `g_free()` a `strdup()`'ed string.
* Don't lookup the `console` window X times, but only once.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
* Add new TLS policy `direct` as a replacement for `legacy`.
* Document that `/[command]?` prints the help of a command.
* Add option to get help via `/command help`.
* Fix `my-prof.supp` generation and tests for out-of-source builds.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
* use `gchar` instead of `char`.
* improve situations when strings must be duplicated or can pass ownership.
* encapsulate the X.509 name details into a struct.
* prevent memory leaks if a name detail is contained multiple times.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
* add can simply do a `memcpy()`.
* in remove we don't have to put the array in a list in order to put it
back into an array again. Also we don't have to `strdup()` each entry,
which leads to even less allocations.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>