# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Autogenerated by pycargoebuild 0.13.2

EAPI=8

CRATES="
	aho-corasick@0.7.19
	ansi_term@0.12.1
	async-attributes@1.1.2
	async-channel@1.7.1
	async-executor@1.4.1
	async-global-executor@2.3.0
	async-io@1.9.0
	async-lock@2.5.0
	async-process@1.5.0
	async-std@1.12.0
	async-stream-impl@0.2.1
	async-stream@0.2.1
	async-task@4.3.0
	atomic-waker@1.0.0
	atty@0.2.14
	autocfg@1.1.0
	autotools@0.2.5
	avahi-sys@0.10.0
	bindgen@0.55.1
	bindgen@0.59.2
	bitflags@1.3.2
	blocking@1.2.0
	bonjour-sys@0.1.0
	bumpalo@3.11.0
	byteorder@1.4.3
	bytes@1.2.1
	cache-padded@1.2.0
	cc@1.0.73
	cexpr@0.4.0
	cexpr@0.6.0
	cfg-if@0.1.10
	cfg-if@1.0.0
	clang-sys@1.3.3
	clap@2.34.0
	cmake@0.1.48
	colored@2.0.0
	concurrent-queue@1.2.4
	crossbeam-utils@0.8.11
	ctor@0.1.23
	darling@0.10.2
	darling_core@0.10.2
	darling_macro@0.10.2
	derive-getters@0.2.0
	derive-new@0.5.9
	derive_builder@0.9.0
	derive_builder_core@0.9.0
	dns-parser@0.8.0
	either@1.8.0
	env_logger@0.7.1
	env_logger@0.9.0
	err-derive@0.2.4
	event-listener@2.5.3
	fastrand@1.8.0
	fnv@1.0.7
	foreign-types-shared@0.1.1
	foreign-types@0.3.2
	futures-channel@0.3.24
	futures-core@0.3.24
	futures-io@0.3.24
	futures-lite@1.12.0
	futures-macro@0.3.24
	futures-task@0.3.24
	futures-util@0.3.24
	getrandom@0.2.7
	glob@0.3.0
	gloo-timers@0.2.4
	hermit-abi@0.1.19
	humantime@1.3.0
	humantime@2.1.0
	ident_case@1.0.1
	instant@0.1.12
	js-sys@0.3.60
	kv-log-macro@1.0.7
	lazy_static@1.4.0
	lazycell@1.3.0
	libc@0.2.132
	libloading@0.7.3
	libusb1-sys@0.6.4
	lock_api@0.4.8
	log@0.4.17
	mdns@3.0.0
	memchr@2.5.0
	minimal-lexical@0.2.1
	mio@0.8.4
	net2@0.2.37
	nom@5.1.2
	nom@7.1.1
	num_cpus@1.13.1
	once_cell@1.14.0
	openssl-macros@0.1.0
	openssl-src@111.22.0+1.1.1q
	openssl-sys@0.9.75
	openssl@0.10.41
	parking@2.0.0
	parking_lot@0.12.1
	parking_lot_core@0.9.3
	peeking_take_while@0.1.2
	pin-project-lite@0.2.9
	pin-utils@0.1.0
	pkg-config@0.3.25
	plist_plus@0.2.1
	polling@2.3.0
	ppv-lite86@0.2.16
	proc-macro-error-attr@1.0.4
	proc-macro-error@1.0.4
	proc-macro2@1.0.43
	quick-error@1.2.3
	quote@1.0.21
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	redox_syscall@0.2.16
	regex-syntax@0.6.27
	regex@1.6.0
	rusb@0.9.1
	rustc-hash@1.1.0
	rustversion@1.0.9
	rusty_libimobiledevice@0.1.6
	scopeguard@1.1.0
	serde@1.0.144
	serde_derive@1.0.144
	shlex@0.1.1
	shlex@1.1.0
	signal-hook-registry@1.4.0
	signal-hook@0.3.14
	slab@0.4.7
	smallvec@1.9.0
	socket2@0.4.7
	strsim@0.8.0
	strsim@0.9.3
	syn@1.0.99
	synstructure@0.12.6
	termcolor@1.1.3
	textwrap@0.11.0
	tokio-macros@1.8.0
	tokio@1.21.1
	unicode-ident@1.0.4
	unicode-width@0.1.10
	unicode-xid@0.2.4
	value-bag@1.0.0-alpha.9
	vcpkg@0.2.15
	vec_map@0.8.2
	version_check@0.9.4
	waker-fn@1.1.0
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.83
	wasm-bindgen-futures@0.4.33
	wasm-bindgen-macro-support@0.2.83
	wasm-bindgen-macro@0.2.83
	wasm-bindgen-shared@0.2.83
	wasm-bindgen@0.2.83
	web-sys@0.3.60
	wepoll-ffi@0.1.2
	which@3.1.1
	which@4.3.0
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.5
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-sys@0.36.1
	windows_aarch64_msvc@0.36.1
	windows_i686_gnu@0.36.1
	windows_i686_msvc@0.36.1
	windows_x86_64_gnu@0.36.1
	windows_x86_64_msvc@0.36.1
"

declare -A GIT_CRATES=(
	[zeroconf-macros]='https://github.com/zeyugao/zeroconf-rs;860b030064308d4318e2c6936886674d955c6472;zeroconf-rs-%commit%/zeroconf-macros'
	[zeroconf]='https://github.com/zeyugao/zeroconf-rs;860b030064308d4318e2c6936886674d955c6472;zeroconf-rs-%commit%/zeroconf'
)

inherit cargo

DESCRIPTION="A replacement/addition to usbmuxd."
HOMEPAGE="https://github.com/jkcoxson/netmuxd"
ZEROCONF_RS_SHA="860b030064308d4318e2c6936886674d955c6472"
SRC_URI="https://github.com/jkcoxson/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}
	https://github.com/zeyugao/zeroconf-rs/archive/${ZEROCONF_RS_SHA}.tar.gz -> ${PN}-zeroconf-rs-${ZEROCONF_RS_SHA:0:7}.tar.gz"

LICENSE="MIT"
# Dependent crate licenses
LICENSE+=" Apache-2.0 BSD ISC LGPL-2.1+ MIT MPL-2.0 Unicode-DFS-2016"
SLOT="0"
KEYWORDS="~amd64"

DEPEND="app-pda/libimobiledevice[static-libs]
	>=app-pda/libplist-2.6.0[static-libs]"
BDEPEND="dev-libs/openssl[static-libs]
	app-pda/libimobiledevice-glue[static-libs]
	app-pda/libusbmuxd[static-libs]"

src_prepare() {
	default
	ln -s "${WORKDIR}/zeroconf-rs-${ZEROCONF_RS_SHA}" "${WORKDIR}/zeroconf-rs" || die
	ln -s "${WORKDIR}/cargo_home/gentoo/mdns-3.0.0" "${WORKDIR}/mdns" || die
	sed -re 's/, "vendored" //g' -i Cargo.toml || die
}

src_configure() {
	local myfeatures=( usb )
	cargo_src_configure --bin "${PN}"
}

src_compile() {
	RUSTFLAGS="-L /usr/$(get_libdir) -l dylib=imobiledevice-1.0 -l dylib=plist"
	export RUSTFLAGS
	cargo_src_compile
}

src_install() {
	cargo_src_install
	einstalldocs
}