Skip to content

Checking a new port

Schrijvers Luc edited this page Mar 26, 2023 · 5 revisions

If you want to start on a new port there are several ways to go, first check haikuports for existing recipes if the port you are looking into doesn't already exists.

There are multiple build systems around like, configure, cmake, meson, python, rust ... I'll try to add some information as I go along

Most of these build system have similar ways to check on dependencies.

Preperations

First thing I do is try a build in Terminal before I start writing a recipe.

Pull the sources archive from the net and extract to where you want them to go (I got a wip directory which I use for this).

Make sure you are working from the extracted directory in Terminal.

For this I also create a destdir directory in my home directory (used later on install time)

  • mkdir -p /boot/home/destdir

If you are using 32bit you have a chance to use the older gcc2 compiler (default) or the newer (currently) gcc11 compiler.

You can switch in Terminal with:

  • setarch x86 (gcc11)

To switch back to gcc2 just exit:

  • exit

To check your gcc version:

  • gcc -v

Missing depencies:

In case you get an error on missing dependencies (for instance missing libmad), most of them can be installed in Terminal with pkgman install libmad_devel (32bit and 64bit primary architecture) or pkgman install libmad_x86_devel (32bit secondary architecture)

Installing the devel package installs both the base and the develop package if not installed, and in case libmad needs extra packages those will be installed also)

Configure steps

Check in the source if there is a configure script, if not and a configure.ac or configure.in script is included first run:

  • autoreconf -vfi (this will create the configure script)

If there is a configure script (or has just been created with the previous command) then run:

  • configure --prefix=/boot/home/destdir (will run the checks on dependencies - headers, libraries ...)

  • configure --help (shows you optional settings to pass to configure)

  • Sometimes a dependency won't be found although that is installed, if configure doesn't seem to find it, read the config.log for eventual missing dependencies listed in there. For instance I had proj recipe bumped earlier, checking up on libgeotiff config.log showed me it didn't find curl and sqlite3 (both dependencies for proj)

Once all dependencies have been fulfilled:

  • make

You could run into parse errors or even missing dependencies for gcc2, in that case switch in Terminal to gcc11.

Not all libraries are ported to both primary and secondary architecture on 32bit.

Once make finishes run:

  • make install (if the --prefix is given things will be installed in /boot/home/destdir)

Cmake steps

  • cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/boot/home/destdir (creates a build directory and will run cmake from current directory, this will also run the checks on dependencies - headers, libraries ...)
  • cmake -L (list all options available to use for cmake)

You can also encounter that cmake needs ninja to build the project instead of make, for that you use:

  • cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/boot/home/destdir -G Ninja For that you need to switch make with ninja in the next commands.

Once all dependencies have been fulfilled:

  • make -C build (tells make to run in the created build directory)

Once make finishes run:

  • make -C build install

Meson

  • meson build --prefix=/boot/home/destdir (check meson_options.txt/meson.build for options to enable/disable/set, for instance if you want to disable introspection in a build you mostly can add -Dintrospection=false)

  • meson configure (list all options available to use for meson)

Once all dependencies have been fulfilled:

  • ninja -C build

Once ninja finishes run:

  • ninja -D build install

Useful information:

One of my most visited sites I use when checking up on new ports or updating existing ones is Repology, a lot of work has been done by others on several Operating Systems, sometimes patches can be found there too to fix the ones we sometimes encounter.