# Template file for 'med'
pkgname=med
version=4.1.1
revision=2
build_style=cmake
configure_args="-DMEDFILE_BUILD_PYTHON=OFF -DMEDFILE_BUILD_TESTS=OFF"
hostmakedepends="gcc-fortran"
makedepends="hdf5-devel tk-devel"
depends="tk" # xmdump* are wish scripts
short_desc="Data Modelization and Exchanges"
maintainer="Piraty <mail@piraty.dev>"
license="GPL-3.0-only, LGPL-3.0-only"
homepage="https://www.salome-platform.org"
distfiles="https://github.com/chennes/med/archive/v${version}.tar.gz"
checksum=ee8b3b6d46bfee25c1d289308b16c7f248d1339161fd5448339382125e6119ad

# uses hdf5 old api
CFLAGS+=" -DH5_USE_110_API=1"

post_extract() {
	# The py-compile helper uses the imp module, removed in Python 3.12;
	# besides, we don't want the module pre-compiled anyway, so just drop it
	: > config/py-compile
	cat > config/py-compile <<-'EOF'
		#!/bin/sh
		: "$@"
		EOF
}

libmed-devel_package() {
	short_desc+=" library - development files"
	depends="libmed>=${version}_${revision}"
	pkg_install() {
		vmove "usr/include"
		vmove "usr/share/cmake"
		vmove "usr/lib/libmed*.so"
	}
}

libmed_package() {
	short_desc+=" library"
	pkg_install() {
		vmove "usr/lib/libmed*"
	}
}

med-doc_package() {
	short_desc+=" - Documentation"
	pkg_install() {
		vmove usr/share/doc
	}
}
