8.69. Check-0.15.2

Check is a unit testing framework for C.

Approximate build time: 0.1 SBU (about 2.1 SBU with tests)
Required disk space: 11 MB

8.69.1. Installation of Check

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

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

pkgname="check"
pkgver="0.15.2"
pkgrel="1"
pkgdesc="Check is a unit testing framework for C."
arch=('x86'
      'x86_64')
url="https://libcheck.github.io/check"
license=('LGPLv2.1')
groups=('core')
depends=('bash'
         'gawk'
         'rootfs')
makedepends=('gcc'
             'grep'
             'make'
             'sed'
             'texinfo')
source=('https://github.com/libcheck/check/releases/download/0.15.2/check-0.15.2.tar.gz')
md5sums=('50fcafcecde5a380415b12e9c574e0b2')
    
build(){
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr --disable-static
  make
}

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

package(){
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" docdir="/usr/share/doc/check-${pkgver}" 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 check-0.15.2-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/check-0.15.2-1-$(uname -m).pkg.tar.xz

Update the local cache and install the Check package:

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

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

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

8.69.2. Contents of Check

Installed program: checkmk
Installed library: libcheck.so

Short Descriptions

checkmk

Awk script for generating C unit tests for use with the Check unit testing framework

libcheck.so

Contains functions that allow Check to be called from a test program