Sat Sep 7 21:32:30 2019 UTC

Scenario C


You have ambitions to compile your own software and are convinced that this is the best way to manage a NuTyX system. You do not want to use the existing binaries.

Most packages that you wish to use are not present in the repository. Those that are, you prefer to compile yourself.

You want to get updates from available ports.

And of course, you want dependencies compiled automatically.

We at NuTyX warn you in advance, this Scenario is very time consuming. If you have already tinkered with similar distributions that use source builds, like CRUX, Gentoo, Exherbo, and Funtoo, then by all means, enjoy our method of installation.

[Important] To build your own packages, it is very important to start from a base system.

The /etc/cards.conf file

A folder containing my personal packages is added. This folder, as well as the standard collections, should never be updated by the command cards sync, so it does not specify any URL.

Only the base collection must remain active in order to install the development tools.

The folder containing the build logs is specified.

The folders defining the basic system, when returning to a base system are specified.

The typical contents of your /etc/cards.conf file for Scenario C:

dir /usr/ports/personal
dir /usr/ports/gui
dir /usr/ports/cli
dir /usr/ports/base
dir /var/lib/pkg/depotrepo/base|
logdir /var/log/pkgbuild
locale fr
locale it
base /usr/ports/base
base /usr/ports/tokeep

Development tools installation

We can now begin to install the development packages, such as a compiler, C and C ++ libraries, build tools (autoconf, automake, ...etc) ...etc. We start by creating the necessary folders:

sudo mkdir -p /usr/ports/{personal,tokeep}
sudo mkdir -p /srv/www/sources

And now we install the tools:

sudo cards sync
sudo cards install cards.devel
Retrieve info about the 66 packages: 100 %
661020 Bytes - 671821 Bytes/Sec - 100% - 0 Sec remain  remain

The /etc/pkgmk.conf file

For this scenario, it is essential to check all the variables necessary for the proper functioning of the two pkgmk / cards commands:

My processor has 4 cores but instead of using 64_bit, I prefer using a 32_bit NuTyX for its greater speed.

export MAKEFLAGS="-j4"

My sources are stored in a common folder, I do not want them to be deleted. I want the working folder to remain in the ports folder after the build. This will allow me to compile multiple ports without losing the work. This will be useful for subsequent checking.


In this scenario, I will manage dependencies automatically at compile time and so I need the file .PKGREPO to be generated in the ports file. I would like to use cards install or get to be able to reinstall my binaries when they are available. The pkgmk must generate the .PKGREPO of the relevant collection (parent folder). I use the duo cards / pkgmk


I do not want pkgmk to split the binary package into sub-packages (devel, doc, man, etc). I am happy with a single package since I compiled it myself. For locale, I will use French fr and Italian it.


I want pkgmk to compress my package as a (.gz) file (This algorithms is faster than .xz). Also, because I find that in the (.gz) format, my packages are easier to maintain and be re-installed later ...if hypothetically, I choose to return to a base system via the cards base -r command.


Here's is a posssible example of your /etc/pkgmk.conf for the Scenario C:

export CFLAGS="-O2 -pipe"
case ${PKGMK_ARCH} in
       export MAKEFLAGS="-j4"
       export CFLAGS="${CFLAGS} -m32"
       export CXXFLAGS="${CXXFLAGS} -m32"
       export LDFLAGS="${LDFLAGS} -m32"
       export MAKEFLAGS="-j4"
       echo "Unknown architecture selected! Exiting."
       exit 1

We can now retrieve the available ports from NuTyX:

sudo ports -u
Updating file list from
Updating collection base
 Checkout ./
 Checkout aaabasicfs/
 Checkout aaabasicfs/Pkgfile

Compile a package with a few dependencies

If you are reading this, make sure you have completed all the configuration steps for this exercise provided by the example using Scenario C.

Dependencies are often a headache for a package maintainer. It is never easy to know exactly what dependencies are essential for the package to compile without errors.

In addition to essential dependencies, there are also optional ones that allow for more functionality. In principle, under NuTyX we try to offer the maximum functionality.

The package we are going to build as an exercise will certainly not add much to your NuTyX system, but the method used to do it will teach you a great deal. That is why it is relevant for future builds. We are going to build the clipit package described as follows:

ClipIt is a lightweight GTK+ clipboard manager.

Project website:


* gtk+ >= 2.10.0

  1. Folder creation

    mkdir -p /usr/ports/personnal/clipit
  2. Package creation

    Complete the /usr/ports/personal/clipit/Pkgfile file with this:

    description="ClipIt is a lightweight GTK+ clipboard manager."
    maintainer="Gilberto Xyhthyx <xyhthyx at gmail dot com>"
    packager="Fran├žois Perrin"
    build() {
      cd $name-$version
      ./configure --prefix=/usr \
      make DESTDIR=$PKG install
  3. Package compilation

    cards depcreate clipit

    The very powerful cards depcreate command compiles and installs dependencies, then compiles the final package and installs it.

    yippee That's magical and intelligent programming for you! yippee


ports -u
ports -d
cards depends
cards depcreate
cards level

To know more details about thoses commands, I recommend you to read the man page for cards:

man cards