111.6. weechat-4.10.1
Extensible IRC client for the terminal, with a relay and scripting
| Version | 4.10.1, release 1 |
| Shelf | chat — Instant messaging, IRC, XMPP, Matrix, fediverse and voice clients, with their protocol and E2E libraries |
| Phase | 41_system (System), 269 of 1047 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://weechat.org/ |
| Build time | 0.9 SBU |
| Installed size | 7.1 MiB in 36 files |
| Recipe | ports/core/chat/weechat/kpkgbuild |
About
WeeChat is a chat client for the terminal, built around IRC and extended through plugins and scripts: the relay plugin lets a remote interface or another WeeChat attach to a running session, and scripts in Python, Perl, Ruby, Lua, Tcl and Scheme add the rest. The port builds the curses client weechat, the daemon-style weechat-headless, every plugin upstream ships except the PHP and JavaScript ones, the manual pages, and a desktop entry that opens it in a terminal as IRC. TLS and the ECDSA mechanism of IRC SASL come from gnutls; the encryption of secured data and the hashing behind the SCRAM mechanisms of IRC SASL come from libgcrypt.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/chat.txt:
IRC and the rest of the chat networks, in cells. The three scripting plugins are hard configure dependencies as well as runtime ones: dropping python3, perl or lua from the recipe's depends stops the build rather than narrowing it.
Sources
weechat-4.10.1.tar.xz(2.7 MiB)
sha256b8744c6f5dc5543062791f563e0516dbc96a36161e1a03c468b3b7dcc8be5aff
upstream: https://weechat.org/files/src/weechat-4.10.1.tar.xz
archive copy: sources-1/chat--weechat-4.10.1.tar.xz
Dependencies
Depends on: cmake, pkgconf, ncurses, gnutls, curl, zlib, zstd, libgcrypt, libgpg-error, cjson, python3, perl, lua, asciidoctor, ruby, tcl, guile, enchant.
Required by: no port names it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install weechat'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/chat/weechat.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/chat/weechat
echo 'b8744c6f5dc5543062791f563e0516dbc96a36161e1a03c468b3b7dcc8be5aff weechat-4.10.1.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/weechat
SRC=$SRC_ROOT/weechat-4.10.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf weechat-4.10.1.tar.xz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLIBDIR=/usr/lib \
-DENABLE_MAN=ON \
-DENABLE_DOC=OFF \
-DENABLE_TESTS=OFF \
-DENABLE_NLS=OFF \
-DENABLE_NCURSES=ON \
-DENABLE_HEADLESS=ON \
-DENABLE_ZSTD=ON \
-DENABLE_CJSON=ON \
-DENABLE_SCRIPT=ON \
-DENABLE_SCRIPTS=ON \
-DENABLE_PYTHON=ON \
-DENABLE_PERL=ON \
-DENABLE_LUA=ON \
-DENABLE_TCL=ON \
-DTCL_LIBRARY=/usr/lib/libtcl9.0.so \
-DTCL_INCLUDE_PATH=/usr/include \
-DENABLE_RUBY=ON \
-DENABLE_GUILE=ON \
-DENABLE_PHP=OFF \
-DENABLE_JAVASCRIPT=OFF \
-DENABLE_SPELL=ON \
-DENABLE_ENCHANT=ON
make
make DESTDIR=$PKG install
cd ..
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/weechat.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=IRC
GenericName=Chat
Comment=IRC client with scripting and a relay
Exec=weechat
Icon=weechat
Terminal=true
Categories=Network;InstantMessaging;
Keywords=irc;chat;im;message;weechat;
EOF
chmod 644 "$PKG/usr/share/applications/weechat.desktop"
The switches, and why each is set:
-DLIBDIR=/usr/lib— WeeChat’s own name for the library directory, given although it matches upstream’s default under the/usrprefix; the plugins go in$LIBDIR/weechat/plugins.-DENABLE_MAN=ON,-DENABLE_DOC=OFF— Build the manual pages, which are generated with asciidoctor, and not the HTML guides (the user’s guide, the plugin API reference, the scripting guide and the rest). Upstream’s default for both is off.-DENABLE_NLS=OFF— No message catalogues: the interface is in English, and the build needs no gettext. Upstream’s default is on; the tree’s language policy would remove the catalogues in any case.-DENABLE_HEADLESS=ON— Also buildweechat-headless, which runs a session with no interface for a relay client to attach to.-DENABLE_ZSTD=ON— Zstandard compression, for rotated log files and for relay messages.-DENABLE_CJSON=ON— The relay’sapiprotocol, an HTTP REST API, whose JSON is read and written with cjson.-DENABLE_SCRIPT=ON,-DENABLE_SCRIPTS=ON— The script manager (/script), and the scripting plugins as a group; each language below is switched on its own.-DENABLE_PYTHON=ON,-DENABLE_PERL=ON,-DENABLE_LUA=ON,-DENABLE_RUBY=ON,-DENABLE_GUILE=ON— The Python, Perl, Lua, Ruby and Scheme plugins, against python3, perl, lua, ruby and guile.-DENABLE_TCL=ON,-DTCL_LIBRARY=/usr/lib/libtcl9.0.so,-DTCL_INCLUDE_PATH=/usr/include— The Tcl plugin, with the library and the header directory of tcl named instead of left to CMake’sFindTCLto search for.-DENABLE_PHP=OFF— No PHP plugin. It is on by default upstream, and PHP is not in the tree.-DENABLE_JAVASCRIPT=OFF— No JavaScript plugin, which needs the V8 engine; upstream’s default is off as well.-DENABLE_SPELL=ON,-DENABLE_ENCHANT=ON— The spell checker, through enchant. Upstream’s default, withENABLE_ENCHANToff, links aspell directly.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/weechat, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf weechat-4.10.1-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/weechat, and runs the triggers its paths call for.
Contents
Installed programs: weechat, weechat-curses, weechat-headless.
Installed directories: /usr/include/weechat, /usr/lib/weechat, /usr/share/licenses/weechat.
Short descriptions
weechat |
the extensible chat client |
weechat-headless |
the extensible chat client (headless version) |
weechat.pc |
WeeChat plugins headers |
Notes
Each scripting plugin that is switched on finds its language with a REQUIRED CMake lookup, and the Tcl one stops on a missing library with an error. Taking one of those languages out of depends therefore makes the build fail, rather than leaving the plugin out; to drop a language, switch its plugin off as well.