SUMMARY="A C/C++ implementation of a Sass compiler"
DESCRIPTION="Sass is a CSS pre-processor language to add on exciting, \
new, awesome features to CSS. Sass was the first language of its kind \
and by far the most mature and up to date codebase. LibSass is a C++ port of \
the original Ruby Sass CSS compiler with a C API."
HOMEPAGE="https://sass-lang.com/libsass"
COPYRIGHT="2012-2018 the Sass Open Source Foundation"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://github.com/sass/libsass/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="5f61cbcddaf8e6ef7a725fcfa5d05297becd7843960f245197ebb655ff868770"
SOURCE_FILENAME="libsass-$portVersion.tar.gz"

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

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

PROVIDES="
	libsass$secondaryArchSuffix = $portVersion
	lib:libsass$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

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

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

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

BUILD()
{
	autoreconf -vfi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install
	install -m 755 -d "$developDocDir"
	install -m 644 -t "$developDocDir" Readme.md

	#remove libtool file
	rm -f "$libDir"/libsass.la

	prepareInstalledDevelLib libsass
	fixPkgconfig

	# devel package
	packageEntries devel \
		"$developDir"
}
