# Template file for 'cargo-c'
pkgname=cargo-c
version=0.9.22
revision=2
build_style=cargo
hostmakedepends="pkg-config zlib-devel"
makedepends="openssl-devel libssh2-devel zlib-devel libcurl-devel"
short_desc="Build and install C-compatible rust libraries"
maintainer="oreo639 <oreo6391@gmail.com>"
license="MIT"
homepage="https://crates.io/crates/cargo-c"
distfiles="https://github.com/lu-zero/cargo-c/archive/v${version}.tar.gz
 https://github.com/lu-zero/cargo-c/releases/download/v${version}/Cargo.lock"
checksum="6af542e3d76e4341693b2e9a9f50abf15b04d82c5f9d1b350110cfac7e914e73
 0c59e6fa12196cb57733d889ace5acbbe26ec32a6124324d0e6aa0bae2d2a4c3"
skip_extraction="Cargo.lock"

post_extract() {
	local old_lg=b2a5e68b318f28fd7d8f9158bbdab0033f47e1ddd1beb2effe70d9c1c5d1cb31
	local new_lg=98ad678aeacd9467f15af1f03bbfa762a8ec9b5b89f9bb61220430d077ff6519
	cd ${wrksrc}
	cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/Cargo.lock .
	cargo vendor
	mkdir -p .cargo
	cat <<-EOF >>.cargo/config.toml
	[source.crates-io]
	replace-with = "vendored-sources"

	[source.vendored-sources]
	directory = "vendor"
	EOF

	vsed -i "s/$old_lg/$new_lg/" vendor/libgit2-sys/.cargo-checksum.json
}

post_install() {
	vlicense LICENSE
}
