SUMMARY="Implements functions designed to lock the standard mailboxes"
DESCRIPTION="This library implements a number of functions found in -lmail \
on SysV systems. These functions are designed to lock the standard mailboxes \
in /var/mail (or wherever the system puts them).

In additions, this library adds a number of functions to create, \
manage and remove generic lockfiles.

The lockfiles are created by this library in an NFS-safe manner, that \
is by using a tempfile and using link(2) to create the lockfile. It \
works around several defects in NFS servers to make sure the lockfile \
is created atomically.

The locking strategy is compatible with other well-written NFS-safe \
programs that create lockfiles - such as procmail, exim and mutt.

If you are trying to lock a mailbox in a directory writable for group \
mail, the locking functions will call a helper application which runs \
setgid to do the actual locking. The helper application \"dotlockfile\" \
can also be used directly, for example for use in shellscripts.

This means a program such as a MUA doesn't need to be setgid mail anymore \
to be able to lock the mailbox."
HOMEPAGE="https://github.com/miquels/liblockfile"
COPYRIGHT="1999-2016 Miquel van Smoorenburg"
LICENSE="GNU GPL v2
	GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/miquels/liblockfile/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="dfc552c72a93a28279017e81c9e1924b12cc97e4faca8faf5ddbba6b6f048e01"
PATCHES="liblockfile-$portVersion.patchset"

ARCHITECTURES="all ?x86_gcc2 ?x86 ?sparc"
SECONDARY_ARCHITECTURES="?x86_gcc2 ?x86"

libVersion="1.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	liblockfile$secondaryArchSuffix = $portVersion
	cmd:dotlockfile$secondaryArchSuffix = $portVersion
	lib:liblockfile$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	liblockfile${secondaryArchSuffix}_devel = $portVersion
	devel:liblockfile$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	liblockfile$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage liblockfile$secondaryArchSuffix \
	"$libDir"/liblockfile.so.$libVersion

BUILD()
{
	runConfigure ./configure \
		--enable-shared

	make $jobArgs
}

INSTALL()
{
	make install

	rm -f "$libDir"/liblockfile.a

	prepareInstalledDevelLib liblockfile
	fixPkgconfig

	packageEntries devel \
		"$developDir"
}

TEST()
{
	make check
}
