# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=gc
pkgver=8.2.4
pkgrel=0
pkgdesc="A garbage collector for C and C++"
url="https://hboehm.info/gc/"
arch="all"
license="MIT"
depends=""
makedepends="libatomic_ops-dev linux-headers"
subpackages="$pkgname-dev $pkgname-doc libgc++:libgccpp"
source="https://github.com/ivmai/bdwgc/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--datadir=/usr/share/doc/gc \
		--enable-cplusplus
	make
}

check() {
	if [ "$CARCH" = "ppc" ]; then
		make check || true
	else
		make check
	fi
}

package() {
	make DESTDIR="$pkgdir" install
}

libgccpp() {
	install -d "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libgccpp.* "$pkgdir"/usr/lib/libgctba.* "$subpkgdir"/usr/lib/
}

sha512sums="27d014378000f25fb2f5598904be85604822d5ed4553f8b3d1c279122300d3958b4432ec08f951cfd842d92121ea8a030dda34bf2475ec53d4fded551fdd3a98  gc-8.2.4.tar.gz"