Build with HaikuPorts

Build with HaikuPorts

  • mdo  DigitalBox
  •   Dev
  •   December 3, 2024

HaikuPorts is a repository of recipes which is used to compile and make software's packages for the Haiku operating system.

It can be used by developers to retrieve libraries needed for porting software, or by end users to get their favorite software on the system.

Many of the applications available through HaikuDepot come from packages built with recipes referenced on HaikuPorts repo, making this repo an essential part of the Haiku ecosystem.

In this article, we will make a quick overview on how HaikuPorts can be used to build a software from an existing recipe.

Prerequisites

The installation of the tools to build the HaikuPorts' recipe is well described in details on the Haiku Port wiki page :

First go into a Terminal and clone both HaikuPorter - the tool used to interpret the recipes - and HaikuPorts - the repository containing the recipes :

git clone https://github.com/haikuports/haikuporter.git --depth=50
git clone https://github.com/haikuports/haikuports.git --depth=50

You should have both the "haikuporter" and "haikuports " folders visible as below :

In order to indicate to haikuporter tool where to look for the recipes, paste the commands below :

cd haikuporter
cp haikuports-sample.conf /boot/home/config/settings/haikuports.conf
lpe ~/config/settings/haikuports.conf

Indicate after "TREE_PATH", the folder where haikuports is located and your packager's name and email if needed :

In order to have haikuporter tool recognized on your system, make the below symbolic link in the "non-packaged/bin" folder :

ln -s /boot/home/haikuporter/haikuporter /boot/home/config/non-packaged/bin/

Finally, open in Pe editor the file named "/boot/home/config/settings/profile" and add the below line at the end :

alias hp="haikuporter -S -j8 --no-source-packages --get-dependencies"

It will create an alias where "hp" will be recognized to call haikuporter tool with some options in any Terminal opened.

If you are curious, you will notice that haikuporter tools is a set of python scripts :

HaikuPorts recipes

HaikuPorts is a repository organized by applications or libraries categories as below :

Each folder will contain a list of folders, where each folder will correspond to an application's recipe or a library's recipe.

Let's have a look at vim's recipe.

Vim - which stands for "Vi Improved" - is an improved version of the vi editor distributed with most UNIX systems.

Let's locate where "vim" folder is located : Go into "haikuports" folder and search for "vim" :

find . -name vim

Ok now that vim's folder has been identified, let's open its recipe:

cd app-editors/vim
lpe vim-9.1.0.recipe &

As you can see, the recipe gives some general information on the application : its description, summary, license, and most important the source URI.

The source URI is important because HaikuPorter will use it to download the sources of the software and after that start the compilation.

If you go forward in the recipe, you can see that the instructions on how to compile the sources are detailed:

Finally, there's also some information on how the application must be installed on Haiku :

In the example above, an application shortcut will be created on the DeskBar, but also a symbolic link in the bin directory.

First build

Ok, now let's build our first package : vim !

To start the build from the recipe, just type the below command:

hp vim

It will call the haikuporter tool to build vim.

Once completed, the HPKG package named "vim-9.1.0.1-x86_64.hpkg" will be available in the "packages" folder :

Open the folder and inside it double click on the package. Proceed with the install :

If you check the "Contents" tab, you will see that "vim" is installed in the system "bin" folder :

If you type "vim --version", you should see the version of the software displayed as below :

And now you can use vim and edit any file you want :

vim /boot/home/config/settings/profile

Great !

If you're not familiar with vim, type ":" and "q" then hit return:

You should know how to build software with existing recipes from HaikutPorts now :)


Powered by Bludit - Hosted by Planet Hoster
© 2025 Haiku Insider