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

# Auto-Generated by cargo-ebuild 0.5.4-r1

# Shouldn't be a rolling (9999) package since a lot of dependencies might change.

EAPI=8

CRATES="
	actix-codec@0.5.1
	actix-http@3.4.0
	actix-macros@0.2.4
	actix-router@0.5.1
	actix-rt@2.9.0
	actix-server@2.3.0
	actix-service@2.0.2
	actix-utils@3.0.1
	actix-web@4.4.0
	actix-web-codegen@4.2.2
	actix-web-codegen-const-routes@0.2.0
	addr2line@0.21.0
	adler@1.0.2
	ahash@0.7.6
	ahash@0.8.3
	aho-corasick@1.1.2
	alloc-no-stdlib@2.0.4
	alloc-stdlib@0.2.2
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	ascii@0.9.3
	async-trait@0.1.74
	autocfg@1.1.0
	backtrace@0.3.69
	base64@0.13.1
	base64@0.21.4
	bincode@1.3.3
	bitflags@1.3.2
	bitflags@2.4.1
	block-buffer@0.10.4
	brotli@3.4.0
	brotli-decompressor@2.5.0
	bumpalo@3.14.0
	byteorder@1.5.0
	bytes@1.5.0
	bytestring@1.3.0
	cc@1.0.83
	cfg-if@1.0.0
	chrono@0.4.31
	combine@3.8.1
	config@0.13.3
	convert_case@0.4.0
	cookie@0.16.2
	core-foundation@0.9.3
	core-foundation-sys@0.8.4
	cpufeatures@0.2.9
	crc32fast@1.3.2
	crossbeam-epoch@0.9.15
	crossbeam-utils@0.8.16
	crypto-common@0.1.6
	deranged@0.3.9
	derive_more@0.99.17
	digest@0.10.7
	dlv-list@0.3.0
	either@1.9.0
	encoding_rs@0.8.33
	env_logger@0.10.0
	equivalent@1.0.1
	errno@0.3.5
	fastrand@2.0.1
	filetime@0.2.22
	flate2@1.0.28
	fnv@1.0.7
	foreign-types@0.3.2
	foreign-types-shared@0.1.1
	form_urlencoded@1.2.0
	fs2@0.4.3
	futures@0.3.28
	futures-channel@0.3.28
	futures-core@0.3.28
	futures-executor@0.3.28
	futures-io@0.3.28
	futures-macro@0.3.28
	futures-sink@0.3.28
	futures-task@0.3.28
	futures-util@0.3.28
	fxhash@0.2.1
	generic-array@0.14.7
	getrandom@0.2.10
	gimli@0.28.0
	graphql-introspection-query@0.2.0
	graphql-parser@0.4.0
	graphql_client@0.13.0
	graphql_client_codegen@0.13.0
	graphql_query_derive@0.13.0
	h2@0.3.21
	hashbrown@0.12.3
	hashbrown@0.14.2
	heck@0.4.1
	hermit-abi@0.3.3
	home@0.5.5
	http@0.2.9
	http-body@0.4.5
	httparse@1.8.0
	httpdate@1.0.3
	humantime@2.1.0
	hyper@0.14.27
	hyper-tls@0.5.0
	iana-time-zone@0.1.58
	iana-time-zone-haiku@0.1.2
	idna@0.4.0
	indexmap@1.9.3
	indexmap@2.0.2
	instant@0.1.12
	ipnet@2.8.0
	is-terminal@0.4.9
	itoa@1.0.9
	itoap@1.0.1
	jobserver@0.1.27
	js-sys@0.3.64
	json5@0.4.1
	language-tags@0.3.2
	lazy_static@1.4.0
	libc@0.2.149
	line-wrap@0.1.1
	linked-hash-map@0.5.6
	linux-raw-sys@0.4.10
	local-channel@0.1.4
	local-waker@0.1.3
	lock_api@0.4.11
	log@0.4.20
	memchr@2.6.4
	memoffset@0.9.0
	mime@0.3.17
	minimal-lexical@0.2.1
	miniz_oxide@0.7.1
	mio@0.8.8
	native-tls@0.2.11
	nom@7.1.3
	num-traits@0.2.17
	num_cpus@1.16.0
	object@0.32.1
	once_cell@1.18.0
	onig@6.4.0
	onig_sys@69.8.1
	openssl@0.10.57
	openssl-macros@0.1.1
	openssl-probe@0.1.5
	openssl-sys@0.9.93
	ordered-multimap@0.4.3
	parking_lot@0.11.2
	parking_lot@0.12.1
	parking_lot_core@0.8.6
	parking_lot_core@0.9.9
	paste@1.0.14
	pathdiff@0.2.1
	percent-encoding@2.3.0
	pest@2.7.4
	pest_derive@2.7.4
	pest_generator@2.7.4
	pest_meta@2.7.4
	pin-project-lite@0.2.13
	pin-utils@0.1.0
	pkg-config@0.3.27
	plist@1.5.0
	powerfmt@0.2.0
	ppv-lite86@0.2.17
	pretty_env_logger@0.5.0
	proc-macro2@1.0.69
	quick-xml@0.29.0
	quote@1.0.33
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	redox_syscall@0.2.16
	redox_syscall@0.3.5
	redox_syscall@0.4.1
	regex@1.10.2
	regex-automata@0.4.3
	regex-syntax@0.7.5
	regex-syntax@0.8.2
	reqwest@0.11.22
	ron@0.7.1
	rust-ini@0.18.0
	rustc-demangle@0.1.23
	rustc_version@0.4.0
	rustix@0.38.20
	ryu@1.0.15
	safemem@0.3.3
	sailfish@0.8.1
	sailfish-compiler@0.8.1
	sailfish-macros@0.8.1
	same-file@1.0.6
	schannel@0.1.22
	scopeguard@1.2.0
	security-framework@2.9.2
	security-framework-sys@2.9.1
	semver@1.0.20
	serde@1.0.189
	serde_derive@1.0.189
	serde_json@1.0.107
	serde_spanned@0.6.3
	serde_urlencoded@0.7.1
	sha1@0.10.6
	sha2@0.10.8
	signal-hook-registry@1.4.1
	slab@0.4.9
	sled@0.34.7
	smallvec@1.11.1
	socket2@0.4.9
	socket2@0.5.4
	syn@1.0.109
	syn@2.0.38
	syntect@5.1.0
	system-configuration@0.5.1
	system-configuration-sys@0.5.0
	tempfile@3.8.0
	termcolor@1.3.0
	thiserror@1.0.50
	thiserror-impl@1.0.50
	time@0.3.30
	time-core@0.1.2
	time-macros@0.2.15
	tinyvec@1.6.0
	tinyvec_macros@0.1.1
	tokio@1.33.0
	tokio-native-tls@0.3.1
	tokio-util@0.7.9
	toml@0.5.11
	toml@0.7.8
	toml_datetime@0.6.3
	toml_edit@0.19.15
	tower-service@0.3.2
	tracing@0.1.40
	tracing-core@0.1.32
	try-lock@0.2.4
	typenum@1.17.0
	ucd-trie@0.1.6
	unicode-bidi@0.3.13
	unicode-ident@1.0.12
	unicode-normalization@0.1.22
	unreachable@1.0.0
	url@2.4.1
	vcpkg@0.2.15
	version_check@0.9.4
	void@1.0.2
	walkdir@2.4.0
	want@0.3.1
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen@0.2.87
	wasm-bindgen-backend@0.2.87
	wasm-bindgen-futures@0.4.37
	wasm-bindgen-macro@0.2.87
	wasm-bindgen-macro-support@0.2.87
	wasm-bindgen-shared@0.2.87
	web-sys@0.3.64
	winapi@0.3.9
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.6
	winapi-x86_64-pc-windows-gnu@0.4.0
	windows-core@0.51.1
	windows-sys@0.48.0
	windows-targets@0.48.5
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_msvc@0.48.5
	windows_i686_gnu@0.48.5
	windows_i686_msvc@0.48.5
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_msvc@0.48.5
	winnow@0.5.17
	winreg@0.50.0
	yaml-rust@0.4.5
	zstd@0.12.4
	zstd-safe@6.0.6
	zstd-sys@2.0.9+zstd.1.5.5
"

inherit cargo

DESCRIPTION="Alternative private front-end to Medium"
# Double check the homepage as the cargo_metadata crate
# does not provide this value so instead repository is used
HOMEPAGE="https://libmedium.batsense.net"
#SRC_URI="${CARGO_CRATE_URIS}"
# commit 82 of libmedium
SHA="1808d2fd77526d335ab6ab4e85b99b1ddbbf07ed"
SRC_URI="https://github.com/realaravinth/libmedium/archive/${SHA}.tar.gz"
SRC_URI+=" ${CARGO_CRATE_URIS}"

# License set may be more restrictive as OR is not respected
# use cargo-license for a more accurate license picture
LICENSE="0BSD AGPL-3+ Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD Boost-1.0 ISC MIT Unicode-DFS-2016 Unlicense ZLIB"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="acct-user/libmedium
	acct-group/libmedium"

# rust does not use *FLAGS from make.conf, silence portage warning
# update with proper path to binaries this crate installs, omit leading /
QA_FLAGS_IGNORED="usr/bin/${PN}"
S="${WORKDIR}/${PN}-${SHA}"

src_prepare() {
	sed -i -e 's/#cache = "\/var\/lib\/libmedium"/cache = "\/var\/cache\/libmedium"/' 'config/default.toml' || die
}

src_install() {
	cargo_src_install
	newinitd "${FILESDIR}/libmedium.initd" "libmedium"
	insinto "/etc/libmedium"
	newins "config/default.toml" "config.toml"
}
