# Template file for 'fractal'
pkgname=fractal
version=4.4.0
revision=1
build_style=meson
build_helper="rust"
hostmakedepends="cargo pkg-config glib-devel gettext"
makedepends="gtk+3-devel libglib-devel openssl-devel gstreamer1-devel
 cairo-devel gettext-devel gst-plugins-base1-devel gst-plugins-bad1-devel
 gst1-editing-services-devel gtksourceview4-devel pango-devel gspell-devel
 gmp-devel libsecret-devel libhandy-devel rust-std"
short_desc="Matrix Messaging Client for GNOME"
maintainer="Cameron Nemo <cam@nohom.org>"
license="GPL-3.0-or-later"
homepage="https://wiki.gnome.org/Apps/Fractal"
distfiles="https://gitlab.gnome.org/GNOME/fractal/-/archive/${version}/fractal-${version}.tar.gz"
checksum=33d8b5303f9309bc4a29bdcabe263f316cfb8805b50d7f4b6b2f0a0a7dd9efaf

post_patch() {
	[ -z "$CROSS_BUILD" ] && return 0

	vsed -i scripts/cargo.sh \
		-e 's;"$CARGO_TARGET_DIR";&/${RUST_TARGET};' \
		-e '/CARGO_HOME/d'
}

pre_build() {
	# fixes an indexmap error when cross compiling
	cargo update --package autocfg:1.0.0 --precise 1.1.0
	cargo update --package autocfg:0.1.7 --precise 0.1.8
	cargo update --package socket2 --precise 0.3.19
}
