an9wer

Porting Rsstail to OpenBSD

Posted:

2023-11-27

Rsstail is a command-line tool that monitors RSS feeds and detects new entries. I found it useful as I wanted to read Slashdot on Telegram, by periodically checking Slashdot's RSS feed for any new posts. I also preferred to run it on one of my OpenBSD servers. However, at the time of writing, there is no pre-built package for rsstail, which means I will have to port it to OpenBSD by myself.

Building Libmrss

Since rsstail depends on libmrss, the first step is to build libmrss.

Building libmrss relies on the automake and autoconf tool chains, which can be installed through the pkg_add command on OpenBSD, as follows:

$ doas pkg_add automake autoconf

Then, retrieve the source code of libmrss:

$ git clone --depth 1 https://github.com/bakulf/libmrss

There is a file named "autogen.sh" in the source code, which can be used to generate the "configure" file. Note that the version of installed automake and autoconf should be specified:

$ AUTOMAKE_VERSION=1.16 AUTOCONF_VERSION=2.71 sh autogen.sh

After that, use the "configure" script to check dependent libraries and generate a Makefile. Note that OpenBSD places all files of any installed package, including its library files if any, into the "/usr/local" directory (e.g. "/usr/local/lib/libcurl.so"). To let the "configure" script find the location of library files that is under the "usr/local" directory, use CPPFLAGS and LDFLAGS to specify the location expicitly :

$ CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure --prefix=/usr/local

Upon successful execution without any issues, a Makefile will be automatically generated, and now we can compile the source code and install output files into the system:

$ make && make install

Build Rsstail

The next step is to build rsstail, which simpler than doing libmrss.

Retrieve the source code of rsstail:

$ git clone --depth 1 https://github.com/folkertvanheusden/rsstail

The source code already includes a Makefile, but several minor modifications are required:

# add the "/usr/local" directory for the library search path
$ sed -i -e '/^LDFLAGS=/ s/=/=-L\/usr\/local\/lib /' -e '/^CFLAGS=/ s/=/=-I\/usr\/local\/include /' Makefile

# replace the library name of iconv
$ sed -i '/^LDFLAGS=/ s/-liconv_hook/-liconv/' Makefile

# change optimization level to 1
$ sed -i '/^CFLAGS=/ s/-O3/-O1/' Makefile

Now that the Makefile has been modified, we can run the make command to compile and install it:

$ make && make install

Thanks for reading :)