Sun Feb 18 13:59:59 2018 UTC

How to build a package


We have provided the required Know-how, the available base commands, the minimum syntax of instructions and a list of available packages for you to choose from.

Come and join the many participants of all ages and gender, from all over the world, and venture along this exciting road we call NuTyX. We can promise you a rewarding experience as you build your very first NuTyX system, following our (NuTyX) rules Laughing.

Build your first package

We will show you how to build and install a first package in a very straightforward way.

This tutorial explains to you in a very simple way the construction of your first binary package.

They are no prerequisites. This exercise can be done regardless of the state of your NuTyX.

The chosen package is a little text editor which doesn't need any dependencies.

[Important] For this package, we won't use an isolated environment named chroot. We will see in the next article how to build in isolated environments: that's the only working method if we need to build a package having dependencies.

Make the build recipe

sudo mkdir -p /usr/ports/perso/nano
echo '
description="Text Editor"
maintainer="Nano team"
packager="Fran├žois Perrin francois dot perrin at myworld dot com"



build() {
cd $name-$version
./configure --prefix=/usr \
--sysconfdir=/etc \
--enable-utf8 \
--enable-color \
--enable-multibuffer \
--enable-nanorc \
make DESTDIR=$PKG install
rm $PKG/usr/share/info/dir
}' > /usr/ports/perso/nano/Pkgfile

Install the development packages

get cards.devel

Compile the package

cd /usr/ports/perso/nano
sudo pkgmk -d

Install the package

sudo pkgadd nano1*

The configuration files

The /etc/cards.conf file

This file is always present on a NuTyX installation.

It's a bit like "the spine" of your NuTyX.

The /etc/cards.conf file will reflect the way you use NuTyX.

All the collections that you want to use in your NuTyX can be specified in two ways:

  1. configuration example of cli collection in binaries from a remote server
    dir /var/lib/pkg/depot/cli|
  2. configuration example of cli in local ports
    dir /usr/ports/cli

This file is also responsible for the list of packages you want to keep when you execute the command:

cards base -r
And finally, it specifies which location should be installed.

You can find more information by reading the cards.conf manual

man cards.conf

The /etc/pkgmk.conf file

This file is used when compiling news ports. It specifies all the variables used by the pkgmk command.

Please take the time to read the main page of pkgmk.conf

man pkgmk.conf

Example of /etc/pkgmk.conf file

export CFLAGS="-O2 -pipe"

case ${PKGMK_ARCH} in
		export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
                export CFLAGS="${CFLAGS} -m32"
                export CXXFLAGS="${CXXFLAGS} -m32"
                export LDFLAGS="${LDFLAGS} -m32"
                echo "Unknown architecture selected! Exiting."
                exit 1
# Those settings are typically set for packaging
# without sub packages and only French locations
# They are also the default ones


We are now ready to build our packages in a chroot.