# Template file for 'libimobiledevice'
pkgname=libimobiledevice
version=1.3.0
revision=8
build_style=gnu-configure
hostmakedepends="automake libtool pkgconf python3-Cython"
makedepends="python3-devel libglib-devel openssl-devel
 libusb-devel libplist-devel libusbmuxd-devel"
short_desc="Library to communicate with Apple devices"
maintainer="Orphaned <orphan@voidlinux.org>"
license="LGPL-2.1-only"
homepage="https://libimobiledevice.org"
changelog="https://raw.githubusercontent.com/libimobiledevice/libimobiledevice/master/NEWS"
distfiles="https://github.com/libimobiledevice/libimobiledevice/archive/${version}.tar.gz"
checksum=acbfb73eabee162e64c0d9de207d71c0a5f47c40cd5ad32a5097f734328ce10a

if [ "$CROSS_BUILD" ]; then
	configure_args="ac_cv_sys_file_offset_bits=yes ac_cv_sys_large_file=yes"
fi

post_patch() {
	# LibreSSL does not provide this function
	vsed -e '/SSL_CTX_set_security_level/d' -i src/idevice.c
	vsed -e 's,-L$(libdir),,g' -i cython/Makefile.am
}

pre_configure() {
	export PYTHON_CPPFLAGS="-I${XBPS_CROSS_BASE}/${py3_inc}"
	export PYTHON_LDFLAGS="-L${XBPS_CROSS_BASE}/usr/lib -lpython${py3_ver}"
	autoreconf -fi
}

libimobiledevice-devel_package() {
	short_desc+=" - development files"
	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/*.a
		vmove usr/lib/*.so
		vmove usr/lib/pkgconfig
	}
}
