SUMMARY="A cross-platform C++ class library"
DESCRIPTION="smooth is an object oriented C++ class library for Windows, \
macOS, Linux and most Unix-like operating systems. It provides basic \
functionality and platform support for applications and libraries.

Features provided by smooth include:

- user interface API with various widgets
- simple to use multithreading API
- file and network IO interface
- completely transparent Unicode and software internationalization support
- a libxml2 based XML parser"
HOMEPAGE="http://www.smooth-project.org/"
COPYRIGHT="1998-2026 Robert Kausch"
LICENSE="Artistic v2.0"
REVISION="1"
SOURCE_URI="https://github.com/enzo1982/smooth/releases/download/v${portVersion/\~/-}/smooth-${portVersion/\~/-}.tar.gz"
CHECKSUM_SHA256="<checksum>"
SOURCE_DIR="smooth-${portVersion/\~/-}"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

libVersion="${portVersion%~*}"
libVersionCompat="${libVersion##*.} compat >= 0"

PROVIDES="
	smooth$secondaryArchSuffix = $portVersion
	lib:libsmooth_${libVersion%.*}$secondaryArchSuffix = $libVersionCompat
	"
if [ -z "$commandSuffix" ]; then
PROVIDES+="
	cmd:smooth_translator = $portVersion
	"
fi
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libcpuid$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libfribidi$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libwebp$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	smooth${secondaryArchSuffix}_devel = $portVersion
	devel:libsmooth_${libVersion%.*}$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	smooth$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libbz2$secondaryArchSuffix
	devel:libcpuid$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libwebp$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	make $jobArgs
}

INSTALL()
{
	make prefix="$prefix" bindir="$commandBinDir" libdir="$libDir" \
		includedir="$includeDir" install

	if [ -n "$commandSuffix" ]; then
		rm -rf "$commandBinDir"
	fi

	prepareInstalledDevelLib libsmooth-${libVersion%.*}

	packageEntries devel \
		"$developDir"
}
