Fri Jul 21 11:02:22 2023 UTC

The Pkgfile

Packaging Helper Variables

PKG

Specifies the root folder when packaging.

SRC

Specifies the full path to the sources and compilation root folder.

PKGMK_SOURCE_DIR

Specifies the full path of the folder where sources are downloaded.

PKGMK_WORK_DIR

Specifies the full path to the working folder.

PKGMK_NO_STRIP

Switch to disable the removal of symbols in generated binaries.

Enabled:

PKGMK_NO_STRIP="yes"

Default: "no"

PKGMK_IGNORE_UNPACK

Switch to skip extracting files from a source archive.

Enabled:

PKGMK_IGNORE_UNPACK="yes"
Default: "no"

PKGMK_COMPRESS_PACKAGE

Switch to enable compression of binary package archives.

Default: "yes"

PKGMK_COMPRESS_MODE

Switch to choose the compression mode.

Default: "xz"

Possible values: gz, bz2 and xz

PKGMK_KEEP_SOURCES

Switch to keep sources:

Default: "yes"

PKGMK_KEEP_LA_LIBS

Switch to keep .la libraries.

Default: "no"

PKGMK_CLEAN

Switch to clean up product package archives.

Default: "no"

PKGMK_GROUPS

Table of possible groups.

Possible values: lib, devel, man, doc, service

Default: (devel man doc service)

PKGMK_LOCALES

Array of locales generated (if any) at packaging.

PKGMK_COLLECTIONS

Table allowing 'pkgmk' to find dependencies automatically in folders.

Possible values: (base cli cli-extra gui gui-extra )

PKGMK_IGNORE_REPO

PKGMK_IGNORE_COLLECTION

PKGMK_IGNORE_RUNTIMEDEPS

The variables for the package

description

The description describes the features of the package in a maximum of 112 characters.

Written in English.

url

The URL specifies the address where more information about the package can be found.

license

The license name is specified as:
"GPL2, LGPL3"

packager

The packager name is specified as:
<tnut tnut@nutyx.org>

contributors

The list of packagers who contributed to the build of this package:
"Tnut,Pierre,Spiky"

name

The name of the folder where the file(s) is the name of the package.

String of characters.

The name of a package must contain lowercase letters only.

The characters @ # / \ < > | are not allowed in the name

The maximum length of a name is determined by the maximum filename length. It is best to keep the size as small as possible. Minimum two characters.

version

String of characters.

Can contain any value representing the version of the sources used.

  • 20201201
  • 21.02
  • git-201
  • development

release

Integer value between 1 and 999.

Useful for telling mybld to recompile the package.

makedepends

Provides the list of package build dependencies.

run

Provides the list of working dependencies of the package.

categories

Normally detected automatically, if not, you can specify them here:
categories=(Office Graphics Education)

set

Add the package to the specified package set(s)
set=(gnome cinnamon)

alias

Specifies a synonymous name. The synonym must be unique, ie it cannot be called by the name of another package in the same collection.

source

The address of the sources, the name of the files necessary for the construction of the package.

Files whose names are specified in the sources array source() must be in the folder of the Pkgfile file.

Pre and post install files are not listed in this table.

build

The variable allows to predefine the way to build the package.

Currently there are several modes:

List of presets
meson
mkdir build
cd    build
meson --prefix=/usr \
      ../$name-$version
ninja
DESTDIR=$PKG ninja install
      
autogen
cd $name-$version
./autogen.sh
./configure --prefix=/usr \
            --disable-static
make
make DESTDIR=$PKG install
     
autoreconf
cd $name-$version
autoreconf -fiv
./configure --prefix=/usr \
            -disable-static
make
make DESTDIR=$PKG install
      
autotools
cd $name-$version
./configure --prefix=/usr \
            -disable-static
make
make DESTDIR=$PKG install
      
python2
cd $name-$version
python2 setup.py build
python2 setup.py install --prefix=/usr --root=$PKG
       
python3
cd $name-$version
python3 setup.py build
python3 setup.py install --prefix=/usr --root=$PKG
       
xorg
cd $name-$version
./configure --prefix=/usr        \
            --sysconfdir=/etc    \
            --localstatedir=/var \
            -disable-static
make
make DESTDIR=$PKG install
      
kde5, cmake
mkdir build
cd  build
cmake -DCMAKE_INSTALL_PREFIX=/usr  \
      -DCMAKE_BUILD_TYPE=Release   \
      -DCMAKE_INSTALL_LIBDIR=lib   \
      -DBUILD_TESTING=OFF          \
      -Wno-dev \
      ../$name-$version
make
make DESTDIR=$PKG install
      

Functions

All functions mentioned below are optional. It is entirely possible to build a package without any of them.

prepare

Often used to rename the source folder or to apply a patch needed for compilation.

The 'prepare' function is executed before the 'build' function below.

build

Main function for compiling the package. If present, it will always be executed before the functions below.

package

Optional function performed last. Can be used for package wrapping.

devel

Custom function if specific actions should be performed on the devel subpackage.

doc

Custom function if specific actions should be performed on the doc subpackage.

lib

Custom function if specific actions should be performed on the lib subpackage.

man

Custom function if specific actions should be performed on the man subpackage.

service

Custom function if specific actions need to be performed on the service subpackage.