# Copyright 2023 Kirixetamine <revelation@krxt.dev>
# Distributed under the terms of the ISC License

# Crates autogenerated by pycargoebuild 0.13.2

EAPI=8

CRATES="
	ab_glyph@0.2.15
	ab_glyph_rasterizer@0.1.5
	adler@1.0.2
	ahash@0.7.6
	aho-corasick@0.7.18
	android_glue@0.2.3
	android_system_properties@0.1.2
	approx@0.5.1
	arrayvec@0.7.2
	ash@0.37.0+1.3.209
	atty@0.2.14
	autocfg@1.1.0
	base64@0.13.0
	bit-set@0.5.2
	bit-vec@0.6.3
	bitflags@1.3.2
	block@0.1.6
	bumpalo@3.10.0
	bytemuck@1.10.0
	bytemuck_derive@1.1.0
	byteorder@1.4.3
	calloop@0.9.3
	cc@1.0.73
	cfg-if@0.1.10
	cfg-if@1.0.0
	cfg_aliases@0.1.1
	cgl@0.3.2
	chrono@0.4.19
	chunked_transfer@1.4.0
	clipboard-win@4.4.1
	clipboard_macos@0.1.0
	clipboard_wayland@0.2.0
	clipboard_x11@0.4.0
	cocoa-foundation@0.1.0
	cocoa@0.24.0
	codespan-reporting@0.11.1
	colored@1.9.3
	copyless@0.1.5
	core-foundation-sys@0.7.0
	core-foundation-sys@0.8.3
	core-foundation@0.7.0
	core-foundation@0.9.3
	core-graphics-types@0.1.1
	core-graphics@0.19.2
	core-graphics@0.22.3
	core-video-sys@0.1.4
	crc32fast@1.3.2
	crossbeam-channel@0.5.5
	crossbeam-deque@0.8.1
	crossbeam-epoch@0.9.9
	crossbeam-utils@0.8.10
	cty@0.2.2
	d3d12@0.5.0
	darling@0.13.4
	darling_core@0.13.4
	darling_macro@0.13.4
	dirs-sys@0.3.7
	dirs@4.0.0
	dispatch@0.2.0
	dlib@0.5.0
	downcast-rs@1.2.0
	either@1.7.0
	error-code@2.3.1
	euclid@0.22.7
	fern@0.6.1
	filetime@0.2.17
	flate2@1.0.24
	fnv@1.0.7
	foreign-types-shared@0.1.1
	foreign-types@0.3.2
	form_urlencoded@1.0.1
	futures-channel@0.3.21
	futures-core@0.3.21
	futures-executor@0.3.21
	futures-io@0.3.21
	futures-macro@0.3.21
	futures-sink@0.3.21
	futures-task@0.3.21
	futures-util@0.3.21
	futures@0.3.21
	fxhash@0.2.1
	gethostname@0.2.3
	getrandom@0.2.7
	gl_generator@0.14.0
	glam@0.10.2
	glow@0.11.2
	glow_glyph@0.5.1
	glyph_brush@0.7.4
	glyph_brush_draw_cache@0.1.5
	glyph_brush_layout@0.2.3
	gpu-alloc-types@0.2.0
	gpu-alloc@0.5.3
	gpu-descriptor-types@0.1.1
	gpu-descriptor@0.2.2
	guillotiere@0.6.2
	hashbrown@0.11.2
	hashbrown@0.12.1
	hermit-abi@0.1.19
	hexf-parse@0.2.1
	ident_case@1.0.1
	idna@0.2.3
	indexmap@1.9.1
	inplace_it@0.3.3
	instant@0.1.12
	itoa@1.0.2
	jni-sys@0.3.0
	js-sys@0.3.58
	kamadak-exif@0.5.4
	khronos-egl@4.1.0
	khronos_api@3.1.0
	lazy_static@1.4.0
	libc@0.2.126
	libloading@0.7.3
	linked-hash-map@0.5.6
	lock_api@0.4.7
	log@0.4.17
	malloc_buf@0.0.6
	matches@0.1.9
	memchr@2.5.0
	memmap2@0.3.1
	memmap2@0.5.4
	memoffset@0.6.5
	metal@0.24.0
	minimal-lexical@0.2.1
	miniz_oxide@0.5.3
	mio@0.8.4
	mutate_once@0.1.1
	naga@0.9.0
	ndk-context@0.1.1
	ndk-glue@0.5.2
	ndk-macro@0.3.0
	ndk-sys@0.2.2
	ndk@0.5.0
	nix@0.22.3
	nix@0.24.1
	nom@7.1.1
	num-integer@0.1.45
	num-traits@0.2.15
	num_cpus@1.13.1
	num_enum@0.5.7
	num_enum_derive@0.5.7
	objc-foundation@0.1.1
	objc@0.2.7
	objc_exception@0.1.2
	objc_id@0.1.1
	once_cell@1.12.0
	ordered-float@3.0.0
	osmesa-sys@0.1.2
	owned_ttf_parser@0.15.0
	parking_lot@0.11.2
	parking_lot@0.12.1
	parking_lot_core@0.8.5
	parking_lot_core@0.9.3
	percent-encoding@2.1.0
	pin-project-lite@0.2.9
	pin-utils@0.1.0
	pkg-config@0.3.25
	ppv-lite86@0.2.16
	proc-macro-crate@1.1.3
	proc-macro2@1.0.40
	profiling@1.0.6
	quote@1.0.20
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.3
	range-alloc@0.1.2
	raw-window-handle@0.3.4
	raw-window-handle@0.4.3
	rayon-core@1.9.3
	rayon@1.5.3
	redox_syscall@0.2.13
	redox_users@0.4.3
	regex-syntax@0.6.26
	regex@1.5.6
	renderdoc-sys@0.7.1
	retry@1.3.1
	ring@0.16.20
	rustc-hash@1.1.0
	rustls@0.20.6
	ryu@1.0.10
	scoped-tls@1.0.0
	scopeguard@1.1.0
	sct@0.7.0
	serde@1.0.138
	serde_derive@1.0.138
	serde_json@1.0.82
	shared_library@0.1.9
	slab@0.4.6
	slotmap@1.0.6
	smallvec@1.9.0
	smithay-client-toolkit@0.15.4
	smithay-client-toolkit@0.16.0
	smithay-clipboard@0.6.6
	spin@0.5.2
	spirv@0.2.0+1.5.4
	static_assertions@1.1.0
	static_init@1.0.2
	static_init_macro@1.0.2
	str-buf@1.0.6
	strsim@0.10.0
	svg_fmt@0.4.1
	syn@1.0.98
	tar@0.4.38
	termcolor@1.1.3
	thiserror-impl@1.0.31
	thiserror@1.0.31
	time@0.1.44
	tinyvec@1.6.0
	tinyvec_macros@0.1.0
	toml@0.5.9
	ttf-parser@0.15.2
	twox-hash@1.6.3
	unicode-bidi@0.3.8
	unicode-ident@1.0.1
	unicode-normalization@0.1.21
	unicode-segmentation@1.9.0
	unicode-width@0.1.9
	unicode-xid@0.2.3
	untrusted@0.7.1
	ureq@2.4.0
	url@2.2.2
	version_check@0.9.4
	wasi@0.10.0+wasi-snapshot-preview1
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.81
	wasm-bindgen-futures@0.4.31
	wasm-bindgen-macro-support@0.2.81
	wasm-bindgen-macro@0.2.81
	wasm-bindgen-shared@0.2.81
	wasm-bindgen@0.2.81
	wasm-timer@0.2.5
	wayland-client@0.29.4
	wayland-commons@0.29.4
	wayland-cursor@0.29.4
	wayland-egl@0.29.4
	wayland-protocols@0.29.4
	wayland-scanner@0.29.4
	wayland-sys@0.29.4
	web-sys@0.3.58
	webpki-roots@0.22.3
	webpki@0.22.0
	wgpu-core@0.13.1
	wgpu-hal@0.13.1
	wgpu-types@0.13.0
	wgpu@0.13.1
	wgpu_glyph@0.17.0
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.5
	winapi-wsapoll@0.1.1
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	window_clipboard@0.2.3
	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
	x11-dl@2.19.1
	x11rb@0.9.0
	xattr@0.2.3
	xcursor@0.3.4
	xi-unicode@0.3.0
	xml-rs@0.8.4
"

declare -A GIT_CRATES=(
	[glutin]='https://github.com/iced-rs/glutin;7a0ee02782eb2bf059095e0c953c4bb53f1eef0e;glutin-%commit%/glutin'
	[glutin_egl_sys]='https://github.com/iced-rs/glutin;7a0ee02782eb2bf059095e0c953c4bb53f1eef0e;glutin-%commit%/glutin_egl_sys'
	[glutin_emscripten_sys]='https://github.com/iced-rs/glutin;7a0ee02782eb2bf059095e0c953c4bb53f1eef0e;glutin-%commit%/glutin_emscripten_sys'
	[glutin_gles2_sys]='https://github.com/iced-rs/glutin;7a0ee02782eb2bf059095e0c953c4bb53f1eef0e;glutin-%commit%/glutin_gles2_sys'
	[glutin_glx_sys]='https://github.com/iced-rs/glutin;7a0ee02782eb2bf059095e0c953c4bb53f1eef0e;glutin-%commit%/glutin_glx_sys'
	[glutin_wgl_sys]='https://github.com/iced-rs/glutin;7a0ee02782eb2bf059095e0c953c4bb53f1eef0e;glutin-%commit%/glutin_wgl_sys'
	[iced]='https://github.com/hecrj/iced;66eb6263003c1bbedd1fd14d6b12f172d20a6211;iced-%commit%'
	[iced_core]='https://github.com/hecrj/iced;66eb6263003c1bbedd1fd14d6b12f172d20a6211;iced-%commit%/core'
	[iced_futures]='https://github.com/hecrj/iced;66eb6263003c1bbedd1fd14d6b12f172d20a6211;iced-%commit%/futures'
	[iced_glow]='https://github.com/hecrj/iced;66eb6263003c1bbedd1fd14d6b12f172d20a6211;iced-%commit%/glow'
	[iced_glutin]='https://github.com/hecrj/iced;66eb6263003c1bbedd1fd14d6b12f172d20a6211;iced-%commit%/glutin'
	[iced_graphics]='https://github.com/hecrj/iced;66eb6263003c1bbedd1fd14d6b12f172d20a6211;iced-%commit%/graphics'
	[iced_native]='https://github.com/hecrj/iced;66eb6263003c1bbedd1fd14d6b12f172d20a6211;iced-%commit%/native'
	[iced_pure]='https://github.com/hecrj/iced;66eb6263003c1bbedd1fd14d6b12f172d20a6211;iced-%commit%/pure'
	[iced_style]='https://github.com/hecrj/iced;66eb6263003c1bbedd1fd14d6b12f172d20a6211;iced-%commit%/style'
	[iced_wgpu]='https://github.com/hecrj/iced;66eb6263003c1bbedd1fd14d6b12f172d20a6211;iced-%commit%/wgpu'
	[iced_winit]='https://github.com/hecrj/iced;66eb6263003c1bbedd1fd14d6b12f172d20a6211;iced-%commit%/winit'
	[winit]='https://github.com/iced-rs/winit;02a12380960cec2f351c09a33d6a7cc2789d96a6;winit-%commit%'
)

inherit gnome2-utils cargo xdg

DESCRIPTION="Cross-platform GUI using ADB to debloat non-rooted Android devices"

HOMEPAGE="https://github.com/0x192/universal-android-debloater"

REPO_URI="https://github.com/0x192/universal-android-debloater"
COMMIT="2c85c67a0df9db3b78a156fc38f2542738352c23"
MY_P="${PN}-${COMMIT}"

if [[ ${PV} == 9999 ]]; then
	inherit git-r3
	EGIT_REPO_URI="${REPO_URI}"
else
	SRC_URI="${REPO_URI}/archive/${COMMIT}.tar.gz -> ${MY_P}.tar.gz
			${CARGO_CRATE_URIS}"
	S="${WORKDIR}/${MY_P}"
fi

LICENSE="GPL-3"
# Dependent crate licenses
LICENSE+=" Apache-2.0 BSD-2 BSD Boost-1.0 CC0-1.0 ISC MIT MPL-2.0 ZLIB"
SLOT="0"
KEYWORDS="~amd64"

DEPEND="
	dev-util/android-tools
"

RDEPEND="${DEPEND}"

RESTRICT="mirror test"

PATCHES="${FILESDIR}/replace-drain_filter.patch"

src_prepare() {
	default
	xdg_environment_reset
}

src_unpack() {
	if [[ ${PV} == 9999 ]]; then
		git-r3_src_unpack
		cargo_live_src_unpack
	else
		cargo_src_unpack
	fi
}

src_install() {
	default
	dobin target/release/uad_gui
}

pkg_postinst() {
	gnome2_schemas_update
	xdg_icon_cache_update
	xdg_desktop_database_update
	xdg_mimeinfo_database_update
}

pkg_postrm() {
	gnome2_schemas_update
	xdg_icon_cache_update
	xdg_desktop_database_update
	xdg_mimeinfo_database_update
}

QA_PRESTRIPPED="/usr/bin/uad_gui"