# Copyright 2024 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.2
	actix-http@3.7.0
	actix-macros@0.2.4
	actix-router@0.5.3
	actix-rt@2.10.0
	actix-server@2.3.0
	actix-service@2.0.2
	actix-utils@3.0.1
	actix-web@4.7.0
	actix-web-codegen@4.3.0
	actix-web-codegen-const-routes@0.2.0
	addr2line@0.22.0
	adler@1.0.2
	ahash@0.8.11
	aho-corasick@1.1.3
	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.80
	autocfg@1.3.0
	backtrace@0.3.72
	base64@0.21.7
	base64@0.22.1
	bincode@1.3.3
	bitflags@1.3.2
	bitflags@2.5.0
	block-buffer@0.10.4
	brotli@6.0.0
	brotli-decompressor@4.0.1
	bumpalo@3.16.0
	byteorder@1.5.0
	bytes@1.6.0
	bytestring@1.3.1
	cc@1.0.98
	cfg-if@1.0.0
	chrono@0.4.38
	combine@3.8.1
	config@0.14.0
	const-random@0.1.18
	const-random-macro@0.1.16
	convert_case@0.4.0
	convert_case@0.6.0
	cookie@0.16.2
	core-foundation@0.9.4
	core-foundation-sys@0.8.6
	cpufeatures@0.2.12
	crc32fast@1.4.2
	crossbeam-epoch@0.9.18
	crossbeam-utils@0.8.20
	crunchy@0.2.2
	crypto-common@0.1.6
	deranged@0.3.11
	derive_more@0.99.17
	digest@0.10.7
	displaydoc@0.2.4
	dlv-list@0.5.2
	either@1.12.0
	encoding_rs@0.8.34
	env_logger@0.10.2
	equivalent@1.0.1
	errno@0.3.9
	fastrand@2.1.0
	filetime@0.2.23
	flate2@1.0.30
	fnv@1.0.7
	foreign-types@0.3.2
	foreign-types-shared@0.1.1
	form_urlencoded@1.2.1
	fs2@0.4.3
	futures@0.3.30
	futures-channel@0.3.30
	futures-core@0.3.30
	futures-executor@0.3.30
	futures-io@0.3.30
	futures-macro@0.3.30
	futures-sink@0.3.30
	futures-task@0.3.30
	futures-util@0.3.30
	fxhash@0.2.1
	generic-array@0.14.7
	getrandom@0.2.15
	gimli@0.29.0
	graphql-introspection-query@0.2.0
	graphql-parser@0.4.0
	graphql_client@0.14.0
	graphql_client_codegen@0.14.0
	graphql_query_derive@0.14.0
	h2@0.3.26
	hashbrown@0.13.2
	hashbrown@0.14.5
	heck@0.4.1
	hermit-abi@0.3.9
	hex@0.4.3
	home@0.5.9
	http@0.2.12
	http-body@0.4.6
	httparse@1.8.0
	httpdate@1.0.3
	humantime@2.1.0
	hyper@0.14.29
	hyper-tls@0.5.0
	iana-time-zone@0.1.60
	iana-time-zone-haiku@0.1.2
	icu_collections@1.5.0
	icu_locid@1.5.0
	icu_locid_transform@1.5.0
	icu_locid_transform_data@1.5.0
	icu_normalizer@1.5.0
	icu_normalizer_data@1.5.0
	icu_properties@1.5.0
	icu_properties_data@1.5.0
	icu_provider@1.5.0
	icu_provider_macros@1.5.0
	idna@1.0.0
	indexmap@2.2.6
	instant@0.1.13
	ipnet@2.9.0
	is-terminal@0.4.12
	itoa@1.0.11
	itoap@1.0.1
	jobserver@0.1.31
	js-sys@0.3.69
	json5@0.4.1
	language-tags@0.3.2
	lazy_static@1.4.0
	libc@0.2.155
	line-wrap@0.2.0
	linked-hash-map@0.5.6
	linux-raw-sys@0.4.14
	litemap@0.7.3
	local-channel@0.1.5
	local-waker@0.1.4
	lock_api@0.4.12
	log@0.4.21
	memchr@2.7.2
	mime@0.3.17
	minimal-lexical@0.2.1
	miniz_oxide@0.7.3
	mio@0.8.11
	native-tls@0.2.12
	nom@7.1.3
	num-conv@0.1.0
	num-traits@0.2.19
	num_cpus@1.16.0
	object@0.35.0
	once_cell@1.19.0
	onig@6.4.0
	onig_sys@69.8.1
	openssl@0.10.64
	openssl-macros@0.1.1
	openssl-probe@0.1.5
	openssl-sys@0.9.102
	ordered-multimap@0.6.0
	parking_lot@0.11.2
	parking_lot@0.12.3
	parking_lot_core@0.8.6
	parking_lot_core@0.9.10
	paste@1.0.15
	pathdiff@0.2.1
	percent-encoding@2.3.1
	pest@2.7.10
	pest_derive@2.7.10
	pest_generator@2.7.10
	pest_meta@2.7.10
	pin-project-lite@0.2.14
	pin-utils@0.1.0
	pkg-config@0.3.30
	plist@1.6.1
	powerfmt@0.2.0
	ppv-lite86@0.2.17
	pretty_env_logger@0.5.0
	proc-macro2@1.0.85
	quick-xml@0.31.0
	quote@1.0.36
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	redox_syscall@0.2.16
	redox_syscall@0.4.1
	redox_syscall@0.5.1
	regex@1.10.4
	regex-automata@0.4.6
	regex-lite@0.1.5
	regex-syntax@0.8.3
	reqwest@0.11.27
	ron@0.8.1
	rust-ini@0.19.0
	rustc-demangle@0.1.24
	rustc_version@0.4.0
	rustix@0.38.34
	rustls-pemfile@1.0.4
	ryu@1.0.18
	sailfish@0.8.3
	sailfish-compiler@0.8.3
	sailfish-macros@0.8.3
	same-file@1.0.6
	schannel@0.1.23
	scopeguard@1.2.0
	security-framework@2.11.0
	security-framework-sys@2.11.0
	semver@1.0.23
	serde@1.0.203
	serde_derive@1.0.203
	serde_json@1.0.117
	serde_spanned@0.6.6
	serde_urlencoded@0.7.1
	sha1@0.10.6
	sha2@0.10.8
	sha256@1.5.0
	signal-hook-registry@1.4.2
	slab@0.4.9
	sled@0.34.7
	smallvec@1.13.2
	socket2@0.5.7
	stable_deref_trait@1.2.0
	syn@1.0.109
	syn@2.0.66
	sync_wrapper@0.1.2
	synstructure@0.13.1
	syntect@5.2.0
	system-configuration@0.5.1
	system-configuration-sys@0.5.0
	tempfile@3.10.1
	termcolor@1.4.1
	thiserror@1.0.61
	thiserror-impl@1.0.61
	time@0.3.36
	time-core@0.1.2
	time-macros@0.2.18
	tiny-keccak@2.0.2
	tinystr@0.7.6
	tokio@1.38.0
	tokio-native-tls@0.3.1
	tokio-util@0.7.11
	toml@0.8.14
	toml_datetime@0.6.6
	toml_edit@0.22.14
	tower-service@0.3.2
	tracing@0.1.40
	tracing-core@0.1.32
	try-lock@0.2.5
	typenum@1.17.0
	ucd-trie@0.1.6
	unicode-ident@1.0.12
	unicode-segmentation@1.11.0
	unreachable@1.0.0
	url@2.5.1
	utf16_iter@1.0.5
	utf8_iter@1.0.4
	vcpkg@0.2.15
	version_check@0.9.4
	void@1.0.2
	walkdir@2.5.0
	want@0.3.1
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen@0.2.92
	wasm-bindgen-backend@0.2.92
	wasm-bindgen-futures@0.4.42
	wasm-bindgen-macro@0.2.92
	wasm-bindgen-macro-support@0.2.92
	wasm-bindgen-shared@0.2.92
	web-sys@0.3.69
	winapi@0.3.9
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.8
	winapi-x86_64-pc-windows-gnu@0.4.0
	windows-core@0.52.0
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-targets@0.48.5
	windows-targets@0.52.5
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.5
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.5
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.5
	windows_i686_gnullvm@0.52.5
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.5
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.5
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.5
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.5
	winnow@0.6.11
	winreg@0.50.0
	write16@1.0.0
	writeable@0.5.5
	yaml-rust@0.4.5
	yoke@0.7.4
	yoke-derive@0.7.4
	zerocopy@0.7.34
	zerocopy-derive@0.7.34
	zerofrom@0.1.4
	zerofrom-derive@0.1.4
	zerovec@0.10.2
	zerovec-derive@0.10.2
	zstd@0.13.1
	zstd-safe@7.1.0
	zstd-sys@2.0.10+zstd.1.5.6
"

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/"
# 2024-06-10
SHA="2ca90b1d3fc508e513e2d3574f7fb75df5dfb8a3"
SRC_URI="https://git.batsense.net/realaravinth/libmedium/archive/${SHA}.tar.gz -> libmedium-${PV}.tar.gz"
SRC_URI+=" ${CARGO_CRATE_URIS}"
S="${WORKDIR}/${PN}"

# 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 BSD-2 Boost-1.0 CC0-1.0 ISC MIT Unicode-3.0 Unicode-DFS-2016 Unlicense ZLIB"
SLOT="0"
KEYWORDS="~amd64"

DEPEND="dev-libs/openssl app-arch/zstd"
RDEPEND="${DEPEND} acct-user/libmedium acct-group/libmedium"
BDEPEND="${DEPEND} virtual/pkgconfig "

# 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}"

export OPENSSL_NO_VENDOR=1
export ZSTD_SYS_USE_PKG_CONFIG=1
export PKG_CONFIG_ALLOW_CROSS=1

src_prepare() {
	default
	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"
}
