# Contributor: Aiden Grossman <agrossman154@yahoo.com>
# Maintainer: Aiden Grossman <agrossman154@yahoo.com>
pkgname=libmedc
pkgver=4.1.1
pkgrel=0
pkgdesc="Open source library for numerical simulation"
url="https://www.salome-platform.org/"
arch="all"
license="GPL-3.0-or-later"
makedepends="cmake hdf5-dev swig python3-dev samurai"
options="!check" #test suite is nonfunctional with python bindings
subpackages="$pkgname-dev $pkgname-doc $pkgname-python-pyc $pkgname-python:_py"
source="
	https://ftp.kaist.ac.kr/macports/distfiles/libmed/med-$pkgver.tar.gz
	hdf5.patch
	cmake-config-dir.patch
	"
builddir="$srcdir/med-${pkgver}_SRC"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DMEDFILE_BUILD_TESTS=OFF \
		-DMEDFILE_BUILD_PYTHON=ON
	cmake --build build
}

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

_py() {
	pkgdesc="Python bindings for libmedc"
	depends="python3"
	amove usr/lib/python3*
}

sha512sums="
8917e7ecfe30e1259b0927c8e1c3d6efd86ed2386813f6d90217bd95589199478e587f0815031ab65cacf7901a30b77a6307414f9073caffe6e7f013e710d768  med-4.1.1.tar.gz
68d9291e73a68d674081314028c0fce7bbd4a7b78b93b7e5078117ce62f2d07318bc33ec95091ce677148ec3926c1ce653d0760c34e74b29257a7be59210f040  hdf5.patch
8d0f58cd67d205fbacaff0e6da76e2ee5473457b478ede13a551ebe5853c0716c7406b74c3792e1ace33a34d352fccca8dd2940f063a7c060a12529d060a991a  cmake-config-dir.patch
"
