SUMMARY="Code formatter for Haiku coding style"
DESCRIPTION="Format C++ code following the Haiku Coding Guidelines.

This is a fork of clang-format with customizations to implement the coding style followed by Haiku \
and several applications running on Haiku."
HOMEPAGE="https://github.com/owenca/haiku-format"
COPYRIGHT="2003-2019 University of Illinois at Urbana-Champaign
	2019-2021 Owen Pan, Saloni Goyal, Adrien Destugues"
LICENSE="Apache v2 with LLVM Exception"
REVISION="1"
srcGitRev="bcc5a44f23e6663ade208840fe5509c6da5f2459"
SOURCE_URI="https://github.com/owenca/llvm-project/archive/$srcGitRev.tar.gz"
SOURCE_DIR="llvm-project-$srcGitRev"
CHECKSUM_SHA256="b9b923099224a238187560fdf5bd2181d9df73a624040cc83c6db26f6aae3f77"

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

PROVIDES="
	haiku_format$secondaryArchSuffix = $portVersion
	cmd:haiku_format = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ninja
	cmd:python3
	"

BUILD()
{
	mkdir -p build
	cd build
	cmake  -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -Wno-dev -DLLVM_ENABLE_PROJECTS=clang ../llvm
	ninja clang-format && strip -s bin/clang-format
}

INSTALL()
{
	mkdir -p $prefix/bin
	cp build/bin/clang-format $prefix/bin/haiku-format
}
