8.101. Npth-1.8

The NPth package contains a very portable POSIX/ANSI-C based library for Unix platforms which provides non-preemptive priority-based scheduling for multiple threads of execution (multithreading) inside event-driven applications. All threads run in the same address space of the server application, but each thread has its own individual program-counter, run-time stack, signal mask and errno variable.

Approximate build time: 0.1 SBU
Required disk space: 2.9 MB

8.101.1. Installation of NPth

Create the PKGBUILD for the NPth package with the following commands:

mkdir /sources/npth
cd /sources/npth
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>

pkgname="npth"
pkgver="1.8"
pkgrel="1"
pkgdesc="${pkgname} ${pkgver}"
arch=('x86'
      'x86_64')
url="https://www.gnupg.org/gcrypt/"
license=('LGPLv2.1')
groups=('core')
depends=('glibc'
         'rootfs')
makedepends=('bash'
             'binutils'
             'coreutils'
             'gcc'
             'grep'
             'make'
             'sed')
source=('https://www.gnupg.org/ftp/gcrypt/npth/npth-1.8.tar.bz2')
md5sums=('cb4fc0402be5ba67544e499cb2c1a74d')

build(){
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr
  make
}

check(){
  cd "${pkgname}-${pkgver}"
  make check
}

package(){
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}
REALEOF

Prepare the build directory for the pacman user and build the package:

chown -R root:pacman .
chmod 2775 .
chmod 664 PKGBUILD
su pacman -c 'makepkg -L --nodeps'

Add the newly created package to the central package repository:

cp npth-1.8-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/npth-1.8-1-$(uname -m).pkg.tar.xz

Update the local cache and install the NPth package:

pacman -Syu
pacman -S npth --overwrite \* -dd --noconfirm

Finally, copy the source files into the source repository and clean up the build directory:

mkdir /srv/pacman/source/LFS/npth
cp PKGBUILD /srv/pacman/source/LFS/npth
cd /sources
rm -rf npth

8.101.2. Contents

Installed Program: npth-config
Installed Library: libnpth.so
Installed Directory: None

Short Descriptions

npth-config

is a utility used to configure and build applications based on the npth library. It can be used to query the C compiler and linker flags which are required to correctly compile and link the application against the npth library.

libnpth.so

contains the API functions used by the New Portable Threads Library.