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

# Autogenerated by pycargoebuild 0.15.0

EAPI=8

RUST_MIN_VER="1.85.0"

CRATES="
	ab_glyph@0.2.31
	ab_glyph_rasterizer@0.1.10
	addr2line@0.24.2
	adler2@2.0.1
	ahash@0.8.12
	aho-corasick@1.1.3
	allocator-api2@0.2.21
	android-activity@0.6.0
	android-properties@0.2.2
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	anstream@0.6.20
	anstyle-parse@0.2.7
	anstyle-query@1.1.4
	anstyle-wincon@3.0.10
	anstyle@1.0.11
	anyhow@1.0.99
	approx@0.5.1
	arrayref@0.3.9
	arrayvec@0.7.6
	as-raw-xcb-connection@1.0.1
	async-trait@0.1.89
	atomic-waker@1.1.2
	autocfg@1.5.0
	backtrace@0.3.75
	bindgen@0.72.1
	bitflags@1.3.2
	bitflags@2.9.4
	block2@0.5.1
	bumpalo@3.19.0
	bytemuck@1.23.2
	bytemuck_derive@1.10.1
	byteorder-lite@0.1.0
	byteorder@1.5.0
	bytes@0.4.12
	bytes@1.10.1
	calloop-wayland-source@0.3.0
	calloop@0.13.0
	cc@1.2.35
	cesu8@1.1.0
	cexpr@0.6.0
	cfg-if@1.0.3
	cfg_aliases@0.2.1
	cgl@0.3.2
	chrono@0.4.41
	clang-sys@1.8.1
	clap@4.5.47
	clap_builder@4.5.47
	clap_derive@4.5.47
	clap_lex@0.7.5
	clipboard-win@5.4.1
	colorchoice@1.0.4
	combine@4.6.7
	concurrent-queue@2.5.0
	convert_case@0.8.0
	copypasta@0.10.2
	core-foundation-sys@0.8.7
	core-foundation@0.9.4
	core-graphics-types@0.1.3
	core-graphics@0.23.2
	crc32fast@1.5.0
	crossbeam-utils@0.8.21
	csscolorparser@0.7.2
	cursor-icon@1.2.0
	deranged@0.5.3
	derive-new@0.7.0
	dirs-sys@0.5.0
	dirs@6.0.0
	dispatch2@0.3.0
	dispatch@0.2.0
	dlib@0.5.2
	downcast-rs@1.2.1
	dpi@0.1.2
	either@1.15.0
	equivalent@1.0.2
	errno@0.3.13
	error-code@3.3.2
	fdeflate@0.3.7
	file-id@0.2.3
	filetime@0.2.26
	find-msvc-tools@0.1.0
	flate2@1.1.2
	flexi_logger@0.31.2
	foldhash@0.1.5
	font-types@0.9.0
	foreign-types-macros@0.2.3
	foreign-types-shared@0.3.1
	foreign-types@0.5.0
	fsevent-sys@4.1.0
	futures-channel@0.3.31
	futures-core@0.3.31
	futures-executor@0.3.31
	futures-io@0.3.31
	futures-macro@0.3.31
	futures-sink@0.3.31
	futures-task@0.3.31
	futures-util@0.3.31
	futures@0.1.31
	futures@0.3.31
	gethostname@1.0.2
	getrandom@0.2.16
	getrandom@0.3.3
	gimli@0.31.1
	gl@0.14.0
	gl_generator@0.14.0
	glam@0.30.5
	glamour@0.18.0
	glob@0.3.3
	glutin-winit@0.5.0
	glutin@0.32.3
	glutin_egl_sys@0.7.1
	glutin_glx_sys@0.6.1
	glutin_wgl_sys@0.6.1
	hashbrown@0.15.5
	heck@0.5.0
	hermit-abi@0.5.2
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.63
	image@0.25.8
	indexmap@2.11.0
	indoc@2.0.6
	inotify-sys@0.1.5
	inotify@0.11.0
	io-uring@0.7.10
	iovec@0.1.4
	is_terminal_polyfill@1.70.1
	itertools@0.13.0
	itertools@0.14.0
	itoa@1.0.15
	jni-sys@0.3.0
	jni@0.21.1
	jobserver@0.1.34
	js-sys@0.3.78
	khronos_api@3.1.0
	kqueue-sys@1.0.4
	kqueue@1.1.1
	libc@0.2.175
	libloading@0.8.8
	libredox@0.1.9
	linux-raw-sys@0.4.15
	linux-raw-sys@0.9.4
	lock_api@0.4.13
	log@0.4.28
	lru@0.16.0
	memchr@2.7.5
	memmap2@0.9.8
	minimal-lexical@0.2.1
	miniz_oxide@0.8.9
	mio@1.0.4
	moxcms@0.7.5
	ndk-context@0.1.1
	ndk-sys@0.6.0+11769913
	ndk@0.9.0
	nom@7.1.3
	notify-debouncer-full@0.6.0
	notify-types@2.0.0
	notify@8.2.0
	num-bigint@0.4.6
	num-complex@0.4.6
	num-conv@0.1.0
	num-integer@0.1.46
	num-iter@0.1.45
	num-rational@0.4.2
	num-traits@0.2.19
	num@0.4.3
	num_enum@0.7.4
	num_enum_derive@0.7.4
	nvim-rs@0.9.2
	objc-sys@0.3.5
	objc2-app-kit@0.2.2
	objc2-app-kit@0.3.1
	objc2-cloud-kit@0.2.2
	objc2-contacts@0.2.2
	objc2-core-data@0.2.2
	objc2-core-foundation@0.3.1
	objc2-core-graphics@0.3.1
	objc2-core-image@0.2.2
	objc2-core-location@0.2.2
	objc2-core-video@0.3.1
	objc2-encode@4.1.0
	objc2-foundation@0.2.2
	objc2-foundation@0.3.1
	objc2-link-presentation@0.2.2
	objc2-metal@0.2.2
	objc2-metal@0.3.1
	objc2-quartz-core@0.2.2
	objc2-quartz-core@0.3.1
	objc2-symbols@0.2.2
	objc2-ui-kit@0.2.2
	objc2-uniform-type-identifiers@0.2.2
	objc2-user-notifications@0.2.2
	objc2@0.5.2
	objc2@0.6.2
	object@0.36.7
	once_cell@1.21.3
	once_cell_polyfill@1.70.1
	option-ext@0.2.0
	orbclient@0.3.48
	owned_ttf_parser@0.25.1
	parking_lot@0.12.4
	parking_lot_core@0.9.11
	paste@1.0.15
	percent-encoding@2.3.2
	phf@0.11.3
	phf_generator@0.11.3
	phf_macros@0.11.3
	phf_shared@0.11.3
	pin-project-internal@1.1.10
	pin-project-lite@0.2.16
	pin-project@1.1.10
	pin-utils@0.1.0
	pkg-config@0.3.32
	png@0.18.0
	polling@3.10.0
	powerfmt@0.2.0
	ppv-lite86@0.2.21
	prettyplease@0.2.37
	proc-macro-crate@3.3.0
	proc-macro2@1.0.101
	pxfm@0.1.21
	quick-xml@0.37.5
	quote@1.0.40
	r-efi@5.3.0
	rand@0.8.5
	rand@0.9.2
	rand_chacha@0.9.0
	rand_core@0.6.4
	rand_core@0.9.3
	raw-window-handle@0.6.2
	read-fonts@0.29.3
	redox_syscall@0.4.1
	redox_syscall@0.5.17
	redox_users@0.5.2
	regex-automata@0.4.10
	regex-syntax@0.8.6
	regex@1.11.2
	rmp@0.8.14
	rmpv@1.3.0
	rustc-demangle@0.1.26
	rustc-hash@2.1.1
	rustix@0.38.44
	rustix@1.0.8
	rustversion@1.0.22
	ryu@1.0.20
	same-file@1.0.6
	scc@2.4.0
	scoped-env@2.1.0
	scoped-tls@1.0.1
	scopeguard@1.2.0
	sctk-adwaita@0.10.1
	sdd@3.0.10
	serde@1.0.219
	serde_derive@1.0.219
	serde_json@1.0.143
	serde_spanned@1.0.0
	serial_test@3.2.0
	serial_test_derive@3.2.0
	shlex@1.3.0
	signal-hook-registry@1.4.6
	simd-adler32@0.3.7
	siphasher@1.0.1
	skia-bindings@0.88.0
	skia-safe@0.88.0
	skrifa@0.31.3
	slab@0.4.11
	smallvec@1.15.1
	smithay-client-toolkit@0.19.2
	smithay-clipboard@0.7.2
	smol_str@0.2.2
	socket2@0.6.0
	spin_sleep@1.3.2
	strict-num@0.1.1
	strsim@0.11.1
	strum@0.27.2
	strum_macros@0.27.2
	swash@0.2.5
	syn@2.0.106
	tar@0.4.44
	thiserror-impl@1.0.69
	thiserror-impl@2.0.16
	thiserror@1.0.69
	thiserror@2.0.16
	time-core@0.1.6
	time-macros@0.2.24
	time@0.3.43
	tiny-skia-path@0.11.4
	tiny-skia@0.11.4
	tokio-io@0.1.13
	tokio-macros@2.5.0
	tokio-util@0.7.16
	tokio@1.47.1
	toml@0.5.11
	toml@0.9.5
	toml_datetime@0.6.11
	toml_datetime@0.7.0
	toml_edit@0.22.27
	toml_parser@1.0.2
	toml_writer@1.0.2
	tracing-core@0.1.34
	tracing@0.1.41
	tracy-client-sys@0.26.1
	ttf-parser@0.25.1
	typed-path@0.10.0
	unicode-ident@1.0.18
	unicode-segmentation@1.12.0
	utf8parse@0.2.2
	uzers@0.12.1
	version_check@0.9.5
	walkdir@2.5.0
	wasi@0.11.1+wasi-snapshot-preview1
	wasi@0.14.3+wasi-0.2.4
	wasm-bindgen-backend@0.2.101
	wasm-bindgen-futures@0.4.51
	wasm-bindgen-macro-support@0.2.101
	wasm-bindgen-macro@0.2.101
	wasm-bindgen-shared@0.2.101
	wasm-bindgen@0.2.101
	wayland-backend@0.3.11
	wayland-client@0.31.11
	wayland-csd-frame@0.3.0
	wayland-cursor@0.31.11
	wayland-protocols-plasma@0.3.9
	wayland-protocols-wlr@0.3.9
	wayland-protocols@0.32.9
	wayland-scanner@0.31.7
	wayland-sys@0.31.7
	web-sys@0.3.78
	web-time@1.1.0
	winapi-util@0.1.10
	windows-collections@0.2.0
	windows-core@0.61.2
	windows-future@0.2.1
	windows-implement@0.60.0
	windows-interface@0.59.1
	windows-link@0.1.3
	windows-link@0.2.0
	windows-numerics@0.2.0
	windows-registry@0.5.3
	windows-result@0.3.4
	windows-strings@0.4.2
	windows-sys@0.45.0
	windows-sys@0.52.0
	windows-sys@0.59.0
	windows-sys@0.60.2
	windows-sys@0.61.0
	windows-targets@0.42.2
	windows-targets@0.52.6
	windows-targets@0.53.3
	windows-threading@0.1.0
	windows@0.61.3
	windows_aarch64_gnullvm@0.42.2
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_gnullvm@0.53.0
	windows_aarch64_msvc@0.42.2
	windows_aarch64_msvc@0.52.6
	windows_aarch64_msvc@0.53.0
	windows_i686_gnu@0.42.2
	windows_i686_gnu@0.52.6
	windows_i686_gnu@0.53.0
	windows_i686_gnullvm@0.52.6
	windows_i686_gnullvm@0.53.0
	windows_i686_msvc@0.42.2
	windows_i686_msvc@0.52.6
	windows_i686_msvc@0.53.0
	windows_x86_64_gnu@0.42.2
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnu@0.53.0
	windows_x86_64_gnullvm@0.42.2
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_gnullvm@0.53.0
	windows_x86_64_msvc@0.42.2
	windows_x86_64_msvc@0.52.6
	windows_x86_64_msvc@0.53.0
	winit@0.30.12
	winnow@0.7.13
	winres@0.1.12
	wit-bindgen@0.45.0
	wslpath-rs@0.2.0
	x11-clipboard@0.9.3
	x11-dl@2.21.0
	x11rb-protocol@0.13.2
	x11rb@0.13.2
	xattr@1.5.1
	xcursor@0.3.10
	xdg@3.0.0
	xkbcommon-dl@0.4.2
	xkeysym@0.2.1
	xml-rs@0.8.27
	yazi@0.2.1
	zeno@0.3.3
	zerocopy-derive@0.8.26
	zerocopy@0.8.26
"

inherit cargo desktop xdg-utils

# Bumping guide
# --- Getting the dependencies for CRATES:
# 1. clone git@github.com:neovide/neovide.git
# 2. run ./pycargoebuild ./ in that directory
# 3. CRATES variables will be in generated ebuild
#
# --- Getting the commits below
# 1. find in neovides cargo.toml which version of skia-safe is used
# 2. go to https://github.com/rust-skia/rust-skia/tags and browse the files of that version
# 3. note the commit of the skia-bindings/skia directory
# 3. click on the skia directory which links to https://github.com/rust-skia/skia/tree/somecommit
# 4. browse the releases page for the corresponding tag for that noted commit
# 5. browse the files of that tag
# 6. open the file DEPS
# 7. it contains a line that specifies the commit of wuff used.
SKIA_PV="m140-0.87.3"
WUFF_COMMIT="e3f919ccfe3ef542cfc983a82146070258fb57f8"

DESCRIPTION="Neovide: No Nonsense Neovim Gui"
HOMEPAGE="https://neovide.dev/"
SRC_URI="
	https://github.com/neovide/neovide/archive/${PV}.tar.gz -> ${P}.tar.gz
	https://codeload.github.com/rust-skia/skia/tar.gz/${SKIA_PV} -> skia-${SKIA_PV}.tar.gz
	https://github.com/google/wuffs-mirror-release-c/archive/${WUFF_COMMIT}.tar.gz -> wuffs-${WUFF_COMMIT}.tar.gz
	${CARGO_CRATE_URIS}
"

LICENSE="MIT"
LICENSE+="
	Apache-2.0 BSD-2 BSD Boost-1.0 CC0-1.0 ISC LGPL-3 MIT MPL-2.0
	Unicode-3.0 ZLIB
"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="
	dev-libs/openssl
	dev-libs/expat
	dev-libs/icu:=
	media-libs/fontconfig
	media-libs/freetype
	media-libs/harfbuzz:=
	media-libs/libjpeg-turbo:=
	media-libs/libpng:=
	virtual/zlib:=
"
DEPEND="${RDEPEND}"
BDEPEND="
	dev-build/gn
	dev-util/bindgen
	llvm-core/clang
"

# rust does not use *FLAGS from make.conf, silence portage warning
QA_FLAGS_IGNORED="usr/bin/.*"

src_unpack() {
	cargo_src_unpack
	mkdir -p "${WORKDIR}"/skia-"${SKIA_PV}"/third_party/externals/ || die
	ln -s "${WORKDIR}"/wuffs-mirror-release-c-"${WUFF_COMMIT}" \
		"${WORKDIR}"/skia-"${SKIA_PV}"/third_party/externals/wuffs || die
}

src_prepare() {
	eapply_user
	cargo_src_configure
	sed -i "${S}/Cargo.toml" -e 's/strip = true/strip = false/'

	export SKIA_SOURCE_DIR="${WORKDIR}/skia-${SKIA_PV}"
	export SKIA_GN_COMMAND="gn"
	export SKIA_NINJA_COMMAND="ninja"
	export SKIA_USE_SYSTEM_LIBRARIES="true"

	pushd "${WORKDIR}" || die
}

src_install() {
	cargo_src_install
	domenu assets/neovide.desktop
	newicon assets/neovide.svg neovide
}

pkg_postinst() {
	xdg_desktop_database_update
}

pkg_postrm() {
	xdg_desktop_database_update
}