# Template file for 'libcxxabi'
pkgname=libcxxabi
version=10.0.0
revision=1
wrksrc="${pkgname}-${version}.src"
build_style=cmake
configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../libcxx/include
 -DLIBCXXABI_USE_LLVM_UNWINDER=1
 -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
make_build_args="VERBOSE=1"
hostmakedepends="clang-tools-extra llvm10"
makedepends="llvm10 llvm-libunwind-devel"
short_desc="Low-level support for libc++ standard library"
maintainer="Orphaned <orphan@voidlinux.org>"
license="NCSA, MIT"
homepage="https://libcxxabi.llvm.org"
distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz
 https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz"
checksum="e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
 270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7"

case "$XBPS_TARGET_MACHINE" in
	armv[67]l)
		broken="invalid operands of types 'char [8]' and 'const uint64_t' to binary 'operator&'"
	;;
esac

post_extract() {
	# Break dependency cycle, we just need the headers here
	mv ../libcxx-${version}.src libcxx

	# For musl
	sed -i 's/!defined(_GCC_MAX_ALIGN_T)/& \&\& !defined(__DEFINED_max_align_t)/' libcxx/include/stddef.h
}

post_install() {
	vmkdir usr/include
	vcopy include/* usr/include
	vlicense LICENSE.TXT
}

libcxxabi-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
	}
}
