# Template file for 'cmark'
pkgname=cmark
version=0.31.1
revision=2
build_style=cmake
configure_args="-DBUILD_SHARED_LIBS=ON"
short_desc="CommonMark parsing and rendering library and program in C"
maintainer="pancake <pancake@nopcode.org>"
license="MIT"
homepage="https://github.com/commonmark/cmark"
distfiles="https://github.com/commonmark/cmark/archive/${version}.tar.gz"
checksum=3da93db5469c30588cfeb283d9d62edfc6ded9eb0edc10a4f5bbfb7d722ea802
replaces="python3-commonmark>=0"

pre_configure() {
	# Fix the SONAME version to use just the major number
	vsed -i src/CMakeLists.txt \
		-e 's/SOVERSION ${PROJECT_VERSION}/SOVERSION ${PROJECT_VERSION_MAJOR}/'
}

post_install() {
	vlicense COPYING
}

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