SUMMARY="Portable uuid C library"
DESCRIPTION="A universally unique identifier (UUID) is an identifier standard \
used in software construction, standardized by the Open Software Foundation \
(OSF) as part of the Distributed Computing Environment (DCE).

The intent of UUIDs is to enable distributed systems to uniquely identify \
information without significant central coordination. In this context the word \
unique should be taken to mean \"practically unique\" rather than \"guaranteed \
unique\"."
HOMEPAGE="https://gitlab.com/kallisti5/libuuid"
COPYRIGHT="2013-2014 Ralph Böhme"
LICENSE="BSD (3-clause)"
REVISION="4"
SOURCE_URI="https://gitlab.com/kallisti5/libuuid/-/archive/v${portVersion}/libuuid-v${portVersion}.tar.gz"
SOURCE_DIR="libuuid-v${portVersion}"
CHECKSUM_SHA256="5c4985534b5a8a4c3100e298a6cbb30b6bbf1800a6bab39e214a3bcdb0cd5aed"
PATCHES="libuuid-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	libuuid$secondaryArchSuffix = $portVersion
	lib:libuuid$secondaryArchSuffix = $portVersion compat >= 1.3
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"
CONFLICTS="
	util_linux$secondaryArchSuffix
	"

PROVIDES_devel="
	libuuid${secondaryArchSuffix}_devel = $portVersion
	devel:libuuid$secondaryArchSuffix = $portVersion compat >= 1.3
	"
REQUIRES_devel="
	libuuid$secondaryArchSuffix == $portVersion base
	"
CONFLICTS_devel="
	util_linux${secondaryArchSuffix}_devel
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:scons
	"

BUILD()
{
	export HAIKU_SECONDARY_ARCH="$effectiveTargetArchitecture"
	scons --prefix=$prefix --lib-dir=$libDir --exec-prefix=$libExecDir \
		--inc-dir=$includeDir --man-dir=$manDir
}

INSTALL()
{
	export HAIKU_SECONDARY_ARCH="$effectiveTargetArchitecture"
	scons --prefix=$prefix --lib-dir=$libDir --exec-prefix=$libExecDir \
		--inc-dir=$includeDir --man-dir=$manDir install

	fixPkgconfig

	prepareInstalledDevelLib libuuid
	packageEntries devel $developDir
}

TEST()
{
	scons
	./src/test_uuid
}
