Sat Sep 7 21:27:31 2019 UTC

What's a port?


A port is a directory containing the files needed for building a package. The command pkgmk will be used to "build" the package, which can be installed afterwards.

This means that this directory must contain as a minimum a file named Pkgfile. The building of the package will be controlled by the contents of this file. It contains all the information necessary to compile and install the package from source.

The name port comes from the BSD world where a port refers to software "ported" to another operating system or platform. In our case, the port is simply the definitions for building a package.

Minimal syntax of a port

The minimum information required for producing a binary are:

  • name: the name of the build package.
  • version: the version of the sources of the package.
  • release: the nth attempt at building the package. Its value will always start at 1
  • source: the address of the sources of the package we want to build.
  • build(): the function which contains the recipe.

A little example with comments:

# Name of the package

# Version of the package

# Release of the package

# Location of the sources of the package to be built

# Recipe for building the package (often uses three standard commands)
build() {
cd $name-$version
./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
make DESTDIR=$PKG install

If you compare this example with an official NuTyX port, you can see that the official one contains more information. We will see this in the next paragraph. One line could catch you:$name/${version%.*}/

The syntax ${version%.*} allows us to substitute a variable of N digits for a variable of N-1 digits. It's often necessary for the sources of gnome packages. In our example, the line:$name/${version%.*}/

is identical to$name/2.6/

since the variable version=2.6.4

Practical example of a port

The xfce4-libutil/Pkgfile file

description="libxfce4util, base library for Xfce"

packager="tnut "

makedepends=(glib intltool)



build() {

  cd ${_name}-$version

  ./configure --prefix=/usr \


  make DESTDIR=$PKG install

If you want to make sure that the build bot is able to compile the package without any problems, it's important to specify all the dependencies needed for the compilation of the package. Dependencies starting from the NuTyX base are always included. Indeed the bot will always build the package by starting from the NuTyX base.

The line makedepends=(...) is used for this purpose. It defines all the needed dependencies for the compilation of the package. Dependencies are separated a spaceLaughing.


You could now try to build your first package.