# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=systemc
pkgver=2.3.4
pkgrel=0
pkgdesc="C++ library for modeling and describing complex hardware systems"
url="https://www.accellera.org/downloads/standards/systemc"
arch="x86_64 x86 armhf armv7 aarch64"
license="Apache-2.0"
makedepends="cmake samurai"
subpackages="$pkgname-doc $pkgname-static $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/accellera-official/systemc/archive/refs/tags/$pkgver.tar.gz
	musl-endian.patch"

build() {
	local cmake_opts="
		-DCMAKE_INSTALL_PREFIX=/usr
		-DCMAKE_INSTALL_LIBDIR=lib
		-DCMAKE_BUILD_TYPE=None
		-DCMAKE_CXX_STANDARD=17
	"

	cmake -B build -G Ninja \
		$cmake_opts \
		-DBUILD_SHARED_LIBS=ON
	cmake --build build

	cmake -B build-static -G Ninja \
		$cmake_opts \
		-DBUILD_SHARED_LIBS=OFF
	cmake --build build-static
}

check() {
	cmake --build build --target check
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	DESTDIR="$pkgdir" cmake --install build-static --component lib
}

sha512sums="
3ef4b5e9c05b8d03e856598ddc27ad50a0a39a7f9334cd00faefeacdf954b6527104d3238c4e8bfa88c00dc382f4da5a50efbd845fe0b6cc2f5a025c993deefd  systemc-2.3.4.tar.gz
f0fa14df0b22c524bedac6ddf35ea4b88c1946167c0d0fb428f8ed59e362c503204f862fdd65dfb16987468ba17d62ce49c66f3e0af359f58bc4045a7ce01238  musl-endian.patch
"
