# Copyright 2017-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Auto-Generated by cargo-ebuild 0.3.1

EAPI=7

CRATES="
ab_glyph_rasterizer-0.1.4
adler-1.0.2
adler32-1.2.0
ansi_term-0.11.0
anyhow-1.0.38
arrayref-0.3.6
arrayvec-0.5.2
atty-0.2.14
autocfg-1.0.1
base64-0.13.0
bincode-1.3.1
bitflags-1.2.1
blake2b_simd-0.5.11
block-0.1.6
bytemuck-1.5.1
byteorder-1.4.2
cc-1.0.67
cfg-if-0.1.10
cfg-if-1.0.0
chrono-0.4.19
clap-2.33.3
clipboard-0.5.0
clipboard-win-2.2.0
clipboard-win-4.0.3
cmake-0.1.45
cocoa-0.24.0
cocoa-foundation-0.1.0
color_quant-1.1.0
constant_time_eq-0.1.5
conv-0.3.3
core-foundation-0.9.1
core-foundation-sys-0.8.2
core-graphics-0.22.2
core-graphics-types-0.1.1
core-text-19.2.0
crc32fast-1.2.1
crossbeam-channel-0.5.0
crossbeam-deque-0.8.0
crossbeam-epoch-0.9.3
crossbeam-utils-0.8.3
custom_derive-0.1.7
deflate-0.8.6
dirs-2.0.2
dirs-3.0.1
dirs-sys-0.3.5
dwrote-0.11.0
either-1.6.1
env_logger-0.8.3
error-code-2.0.2
expat-sys-2.1.6
flate2-1.0.20
float-ord-0.2.0
fnv-1.0.7
font-kit-0.10.0
foreign-types-0.3.2
foreign-types-shared-0.1.1
freetype-0.7.0
freetype-sys-0.13.1
getrandom-0.1.16
getrandom-0.2.2
hashbrown-0.9.1
heck-0.3.2
hermit-abi-0.1.18
humantime-2.1.0
image-0.23.13
imageproc-0.22.0
indexmap-1.6.1
itertools-0.9.0
itoa-0.4.7
jpeg-decoder-0.1.22
lazy_static-1.4.0
lazycell-1.3.0
libc-0.2.87
line-wrap-0.1.1
log-0.4.14
malloc_buf-0.0.6
matrixmultiply-0.1.15
memoffset-0.6.1
miniz_oxide-0.3.7
miniz_oxide-0.4.4
num-0.1.42
num-0.3.1
num-bigint-0.3.1
num-complex-0.3.1
num-integer-0.1.44
num-iter-0.1.42
num-rational-0.3.2
num-traits-0.2.14
num_cpus-1.13.0
objc-0.2.7
objc-foundation-0.1.1
objc_id-0.1.1
onig-6.1.1
onig_sys-69.6.0
os_info-3.0.1
owned_ttf_parser-0.6.0
pasteboard-0.1.2
pathfinder_geometry-0.5.1
pathfinder_simd-0.5.0
pkg-config-0.3.19
plist-1.1.0
png-0.16.8
ppv-lite86-0.2.10
proc-macro-error-1.0.4
proc-macro-error-attr-1.0.4
proc-macro2-1.0.24
quote-1.0.9
rand-0.7.3
rand-0.8.3
rand_chacha-0.2.2
rand_chacha-0.3.0
rand_core-0.5.1
rand_core-0.6.2
rand_distr-0.2.2
rand_hc-0.2.0
rand_hc-0.3.0
rawpointer-0.1.0
rayon-1.5.0
rayon-core-1.9.0
redox_syscall-0.1.57
redox_syscall-0.2.5
redox_users-0.3.5
regex-syntax-0.6.22
remove_dir_all-0.5.3
rulinalg-0.4.2
rust-argon2-0.8.3
rustc_version-0.2.3
rusttype-0.9.2
ryu-1.0.5
safemem-0.3.3
same-file-1.0.6
scopeguard-1.1.0
semver-0.9.0
semver-parser-0.7.0
serde-1.0.123
serde_derive-1.0.123
serde_json-1.0.64
servo-fontconfig-0.5.1
servo-fontconfig-sys-5.1.0
shell-words-1.0.0
str-buf-1.0.5
strsim-0.8.0
structopt-0.3.21
structopt-derive-0.4.14
syn-1.0.60
syntect-4.5.0
tempfile-3.2.0
term_size-0.3.2
termcolor-1.1.2
textwrap-0.11.0
ttf-parser-0.6.2
unicode-segmentation-1.7.1
unicode-width-0.1.8
unicode-xid-0.2.1
vec_map-0.8.2
version_check-0.9.2
walkdir-2.3.1
wasi-0.10.2+wasi-snapshot-preview1
wasi-0.9.0+wasi-snapshot-preview1
winapi-0.3.9
winapi-i686-pc-windows-gnu-0.4.0
winapi-util-0.1.5
winapi-x86_64-pc-windows-gnu-0.4.0
wio-0.2.2
x11-clipboard-0.3.3
xcb-0.8.2
xml-rs-0.8.3
"

PYTHON_COMPAT=( python3_{7..9} )

inherit cargo python-any-r1

DESCRIPTION="Create beautiful image of your code"
HOMEPAGE="https://github.com/Aloxaf/silicon"
SRC_URI="https://github.com/Aloxaf/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
	$(cargo_crate_uris ${CRATES})"
# Prevent portage from trying to fetch bunch of *.crate from mirror despite they are not mirrored.
RESTRICT="mirror"
LICENSE="Apache-2.0 Boost-1.0 BSD-2 CC0-1.0 MIT MPL-2.0 ZLIB"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

BDEPEND="
	virtual/pkgconfig
	${PYTHON_DEPS}"
DEPEND="
	media-libs/fontconfig
	media-libs/freetype
	x11-libs/libxcb"
RDEPEND="${DEPEND}
	x11-misc/xclip"

QA_FLAGS_IGNORED="usr/bin/silicon"

src_unpack() {
	cargo_src_unpack

	# Apply patch <https://github.com/rtbo/rust-xcb/pull/87> for python 3.9 support.
	( cd "${WORKDIR}"/cargo_home/gentoo/xcb-0.8.2 && eapply "${FILESDIR}"/rust-xcb-0.8.2-python-3.9.patch )
}

src_install() {
	cargo_src_install

	dodoc README.md
}
