Sign inSign up

artworks/weechat

By artworks

Updated almost 2 years ago

Image
0

305

artworks/weechat repository overview

WeeChat

An implementation of WeeChat enviroment in Docker.

Build WeeChat Docker Image

One of the most convenient options to build an appropriate WeeChat version is to match Docker container OS with the host.

As of 2024-11 WeeChat uses CMake which links shared libraries and hard-codes directories used by WeeChat like WeeChat plugins which are shared libraries, too.

Weechat finds the libraries with PkgConfig. It should be possible to PKG_CONFIG_PATH, as it does work for Python. If the required Ruby version installation has PkgConfig file (e.g. *.pc), we can try to set that variable to the directory containing it for WeeChat to build expecting it.

In order to build the latest WeeChat of the branch main of the official repository, you should check the Dockerfile and match the host with the WeeChat Docker Image base image. This is required to match the shared libraries between environments (e.g. libruby.so for WeeChat plugin ruby.so), or else linking may mismatch.

A plugin is a C program which can call WeeChat functions defined in an interface. This C program does not need WeeChat sources to compile and can be dynamically loaded into WeeChat with command /plugin. The plugin has to be a dynamic library, for dynamic loading by operating system. Under GNU/Linux, the file has ".so" extension, ".dll" under Windows. The plugin has to include "weechat-plugin.h" file (available in WeeChat source code). This file defines structures and types used to communicate with WeeChat.

Source

Let's suppose, in our case the host OS is Ubuntu 22.04.

$ lsb_release -a;
# Description: Ubuntu 22.04.5 LTS

$ grep -m 1 -- FROM './src/weechat/Dockerfile';
# FROM ubuntu:22.04 AS base
cd -- './src/weechat';
docker build -t weechat:local -- .;

Create WeeChat Build Archive

mkdir -- './build' &&
cd -- './build' &&
docker run --rm -itv "$( pwd -P )/:/opt/build/" -e 'A_WEECHAT_ARCHIVE_DIRPATH=/opt/build' -- 'weechat:local' &&
ls;
# weechat-2024-11-29_12-48-29_Z.tar.gz

Copy built files to the host

tar -xvzf './weechat-2024-11-29_12-48-29_Z.tar.gz' -C /;

Check WeeChat

$ ldd -- '/usr/local/lib/weechat/plugins/ruby.so';
# linux-vdso.so.1 (0x00007fff52ffb000)
# libruby-3.0.so.3.0 => /lib/x86_64-linux-gnu/libruby-3.0.so.3.0 (0x00007f3484d6e000)
# libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3484b45000)
# libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f3484b29000)
# libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f3484aa7000)
# libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f3484a6d000)
# libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3484984000)
# /lib64/ld-linux-x86-64.so.2 (0x00007f3485136000)
weechat --version;
weechat -i;
weechat -r '/debug dirs;';

WeeChat Plugin Dependencies

In case the Docker container mismatches with the host, some plugins may require dependencies installed of specific versions on the final environment to support all the WeeChat plugins.

Execute /debug dirs in WeeChat to find the directory with plugins (e.g. lib -> /usr/local/lib/weechat/).

Ruby

ldd -- '/usr/local/lib/weechat/plugins/ruby.so';
# linux-vdso.so.1 (0x00007ffff64b4000)
# libruby-3.1.so.3.1 => not found
# libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb75368a000)
# /lib64/ld-linux-x86-64.so.2 (0x00007fb753901000)
$ mkdir -- './ruby' &&
cd -- './ruby' &&
wget -- 'https://github.com/postmodern/ruby-install/releases/download/v0.9.3/ruby-install-0.9.3.tar.gz' &&
tar -xvzf './ruby-install-'*'.tar.gz' &&
cd -- './ruby-install-'* &&
sudo make install &&
ruby-install --version;
$ sudo ruby-install --system ruby 3.1 -- --enable-shared &&
$ sh -c 'ruby --version;';
$ find '/usr/local/lib/' -iname '*libruby*';
/usr/local/lib/libruby.so.3.1.6
/usr/local/lib/libruby-static.a
/usr/local/lib/libruby.so
/usr/local/lib/libruby.so.3.1

It is possible to install Ruby User-scoped (i.e. in ~/.rubies/bin/):

ruby-install ruby 3.1 -- --enable-shared &&
sh -c 'ruby --version;';

See: https://github.com/postmodern/ruby-install

TLS

Generate TLS self-signed certificates in directory ./tls/:

docker run --rm \
    -itv './tls/:/certs/' \
    -e SSL_SUBJECT='example.com' \
    -e CA_EXPIRE=365 \
    -e SSL_SIZE=4096 -- \
    'stakater/ssl-certs-generator';

Tag summary

Content type

Image

Digest

sha256:6ecd122d8

Size

396.2 MB

Last updated

almost 2 years ago

docker pull artworks/weechat