Daniel Verkamp :: Building FreeBASIC on OpenBSD

Historical Note

This article was originally posted as a blog entry. These instructions are duplicated here for historical preservation purposes only; they have not been tested recently and are probably out of date.

Prerequisites

You'll need an i386 OpenBSD installation; I have only tested this on the latest release at this time, OpenBSD 4.3, but it will probably work on older releases as well. You will also need an existing fbc executable for OpenBSD, unless you would like to cross-compile and assemble and link the files by hand.

Installing Dependencies

To build FreeBASIC on OpenBSD, you'll need to install some packages. This is how I installed the dependencies on OpenBSD 4.3:

export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/4.3/packages/i386/
pkg_add -i gmake
pkg_add -i autoconf # pick the latest version; currently, it is autoconf-2.61p1
pkg_add -i automake # pick the latest version; currently, it is automake-1.9.6p2
pkg_add -i subversion

Getting the FreeBASIC source

Using the Subversion client that you just installed, check out the FreeBASIC source in your home directory (substitute the path you'd like in FBC_SRC).

FBC_SRC=~/src/fbc/fbc-svn
mkdir -p ${FBC_SRC}
svn co https://fbc.svn.sourceforge.net/svnroot/fbc/trunk/FreeBASIC ${FBC_SRC}

Building FreeBASIC

This is much the same as building for Linux. Currently, I have not tested building with objinfo (bfd) enabled, because the bfd.h header shipped with OpenBSD seems to be broken, but it will probably work if you build and install your own copy of libbfd.

Runtime library:

cd ${FBC_SRC}/src/rtlib/obj/openbsd
../../configure
gmake
gmake MULTITHREADED=1
gmake install

To make things simpler, we will copy the runtime libraries to their proper location so we can link the compiler successfully later before running install.sh. Since the prebuilt fbc binary is configured with /usr as its prefix, we will copy the files to /usr/lib/freebasic/openbsd/.

su
mkdir /usr/lib/freebasic
mkdir /usr/lib/freebasic/openbsd
cp libfb*.a fbrt0.o /usr/lib/freebasic/openbsd/
exit

Graphics library (requires X):

cd ${FBC_SRC}/src/gfxlib2/obj/openbsd
../../configure
gmake
gmake MULTITHREADED=1
gmake install

Finally the compiler itself, using the existing OpenBSD compiler binary downloaded earlier:

cd ${FBC_SRC}/src/compiler/obj/openbsd
../../configure FBC=~/fbc --prefix=/usr --disable-objinfo
gmake
gmake install

Now we will do a full installation of FreeBASIC:

cd ${FBC_SRC}
su
./install.sh -i
exit
If all goes well, you should get a message stating that FreeBASIC has been successfully installed.

Note that this port has been very minimally tested; if you have any trouble, feel free to file a bug report or post questions on the FreeBASIC forums.