Sunday, January 25, 2015

My first OpenBSD port

has just landed in the ports tree. It's been a fun ride, this post is a summary of the whole process from the perspective of a first time contributor. Note that this is not a tutorial, just my personal experiences of getting my first port accepted to the tree.



I first installed OpenBSD on Dec 7 2014. I dedicated the first few weeks of usage to learning the OS with great help from an amazing book by Michael W. Lucas - Absolute OpenBSD, 2nd edition. I also followed the mailing lists in order to stay up to date with recent developments with the OS. When I felt comfortable enough I took the step and started following -CURRENT (well mostly by installing snapshots).

I was determined to port Otter to OpenBSD from my first days. I like that browser and I think it has a promising future. The development is very active and I was pretty much following it since inception over an year ago. The only thing holding me back was lack of Qt5 on OpenBSD. I kept checking for qt with pkg_add -Q qt5 from time to time and suddenly on one day a list of packages was returned. That's when I started my porting work.

I started off by talking to the upstream developers of the Otter browser. Mostly to ask if anyone else contacted them about porting to OpenBSD - I didn't want to duplicate my effort with someone else that might have been further along.

After confirming that I'm clear I took the first step with porting, an out of ports build. Looking at it now that was a small mistake as the OpenBSD ports infrastructure takes care of many pitfalls that I at first manually side-stepped. Some of the issues felt related to the Qt port itself so on December 25th I compiled a list of problems I hit and went off to the ports@ mailing list. I had a working (but crashing) executable at that point in time.

The compiler warnings I reported resulted in a review of the Qt5 port for insecure API usage - which is nice. Though the biggest win at that point was detecting a bug in Qt5 that failed to load GTK due to hard coded library versions. Later down in the thread another user pointed out a bug he reported upstream to Qt developers - that bug was responsible for the two biggest crashes I hit with Otter (crash on modal dialog/window resize).

Since I'm working on a pretty weak i386 machine compiling Qt5 from source was out of the question. So I waited for the snapshot packages catching up to the patches and started working on the actual port infrastructure.

OpenBSD has great resources for people new to porting. The porters handbook covers pretty much anything one will ever need in order to prepare a port. I took some time to read through it and followed the steps to set-up my installation for porting work.

The feedback I got from my first email greatly eased out the initial work. People already suggested pre-built infrastructure modules for gcc4, CMake & Qt. This saved a lot of initial effort I would have to go through in order to have a package at all.

All of this wasn't a 'sprint' effort. I was mostly working on the port once per week and mostly during evenings. On Jan 13 I had a working initial port and submitted it to the ports@ mailing list for a review. From then on it was a back and forward exchange between experienced ported, developers and me. I received a ton of great feedback and yesterday on Jan 24th the port was imported to the OpenBSD ports tree.

I am still worried about the crashes that zhuk@ is hitting with his set-up. I would really like to hit them on my box in order to attempt debugging them. Still I'm really happy that the port has been imported.

# cvs -q up -Pd
P Makefile
U otter-browser/Makefile
U otter-browser/distinfo
U otter-browser/patches/patch-CMakeLists_txt
U otter-browser/pkg/DESCR
U otter-browser/pkg/PLIST
What's next? The obvious. Maintaining the port of course and trying to debug issues reported by people on the OpenBSD mailing lists. I also started testing ports submitted by others.

Why am I doing all of this? First of all, I wanted to use Otter and it's really nice to finally have it. Secondly, ports are in my humble opinion an extremely important part of the system. Having many, up to date ports greatly improves the experience first-timers have with the system. Testing ports doesn't take a lot of time, but if no one is doing it then perfectly fine ports might never end up in the tree.

I might even attempt doing some more porting work :) Being a huge Fallout fan I keep eyeing falltergeist. I even did an initial query on the ports@ mailing list about it.

Porting. Porting never changes...