summaryrefslogtreecommitdiff
blob: db15bda1f7db6a12a0c2efaf540885e76853bbc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CRATES="
	ahash-0.7.6
	aho-corasick-0.7.20
	annotate-snippets-0.6.1
	async-trait-0.1.62
	async_once-0.2.6
	autocfg-1.1.0
	autotools-0.2.5
	bindgen-0.63.0
	bitflags-1.3.2
	cached-0.42.0
	cached_proc_macro-0.16.0
	cached_proc_macro_types-0.1.0
	camino-1.1.2
	cc-1.0.78
	cexpr-0.6.0
	cfg-if-1.0.0
	chic-1.2.2
	clang-sys-1.4.0
	clap-4.1.1
	clap_derive-4.1.0
	clap_lex-0.3.1
	crossbeam-channel-0.5.6
	crossbeam-utils-0.8.14
	ctor-0.1.26
	darling-0.14.2
	darling_core-0.14.2
	darling_macro-0.14.2
	dlv-list-0.3.0
	either-1.8.0
	enum-as-inner-0.5.1
	errno-0.2.8
	errno-dragonfly-0.1.2
	fastrand-1.8.0
	filetime-0.2.19
	fnv-1.0.7
	futures-0.3.25
	futures-channel-0.3.25
	futures-core-0.3.25
	futures-executor-0.3.25
	futures-io-0.3.25
	futures-macro-0.3.25
	futures-sink-0.3.25
	futures-task-0.3.25
	futures-util-0.3.25
	getrandom-0.2.8
	glob-0.3.1
	hashbrown-0.12.3
	hashbrown-0.13.2
	heck-0.4.0
	hermit-abi-0.2.6
	ident_case-1.0.1
	indexmap-1.9.2
	indoc-1.0.8
	instant-0.1.12
	io-lifetimes-1.0.4
	is-terminal-0.4.2
	is_executable-1.0.1
	itertools-0.10.5
	lazy_static-1.4.0
	lazycell-1.3.0
	libc-0.2.139
	libloading-0.7.4
	linux-raw-sys-0.1.4
	log-0.4.17
	memchr-2.5.0
	memoffset-0.7.1
	minimal-lexical-0.2.1
	nix-0.26.2
	nom-7.1.3
	nu-ansi-term-0.46.0
	num_cpus-1.15.0
	once_cell-1.17.0
	ordered-multimap-0.4.3
	os_str_bytes-6.4.1
	overload-0.1.1
	peeking_take_while-0.1.2
	peg-0.8.1
	peg-macros-0.8.1
	peg-runtime-0.8.1
	pin-project-lite-0.2.9
	pin-utils-0.1.0
	pkgcraft-0.0.4
	proc-macro-error-1.0.4
	proc-macro-error-attr-1.0.4
	proc-macro2-1.0.50
	quote-1.0.23
	redox_syscall-0.2.16
	regex-1.7.1
	regex-syntax-0.6.28
	remove_dir_all-0.5.3
	roxmltree-0.17.0
	rust-ini-0.18.0
	rustc-hash-1.1.0
	rustix-0.36.7
	rustversion-1.0.11
	same-file-1.0.6
	scallop-0.0.3
	serde-1.0.152
	serde_derive-1.0.152
	serde_with-2.2.0
	serde_with_macros-2.2.0
	sharded-slab-0.1.4
	shlex-1.1.0
	slab-0.4.7
	smallvec-1.10.0
	static_assertions-1.1.0
	strsim-0.10.0
	strum-0.24.1
	strum_macros-0.24.3
	syn-1.0.107
	sys-info-0.9.1
	tempfile-3.3.0
	termcolor-1.2.0
	thiserror-1.0.38
	thiserror-impl-1.0.38
	thread_local-1.1.4
	tokio-1.24.2
	tokio-macros-1.8.2
	toml-0.5.11
	tracing-0.1.37
	tracing-attributes-0.1.23
	tracing-core-0.1.30
	tracing-log-0.1.3
	tracing-subscriber-0.3.16
	unicode-ident-1.0.6
	valuable-0.1.0
	version_check-0.9.4
	walkdir-2.3.2
	wasi-0.11.0+wasi-snapshot-preview1
	which-4.4.0
	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
	windows-sys-0.42.0
	windows_aarch64_gnullvm-0.42.1
	windows_aarch64_msvc-0.42.1
	windows_i686_gnu-0.42.1
	windows_i686_msvc-0.42.1
	windows_x86_64_gnu-0.42.1
	windows_x86_64_gnullvm-0.42.1
	windows_x86_64_msvc-0.42.1
	xmlparser-0.13.5
"
CRATES+="
	pkgcraft-c-${PV}
"

inherit edo cargo

DESCRIPTION="C library for pkgcraft"
HOMEPAGE="https://pkgcraft.github.io/"

if [[ ${PV} == 9999 ]] ; then
	EGIT_REPO_URI="https://github.com/pkgcraft/pkgcraft"
	inherit git-r3

	S="${WORKDIR}"/${P}/crates/pkgcraft-c

	BDEPEND="test? ( dev-util/cargo-nextest )"
else
	SRC_URI="$(cargo_crate_uris)"
	S="${WORKDIR}"/cargo_home/gentoo/pkgcraft-c-${PV}

	KEYWORDS="~amd64"
fi

LICENSE="BSD-1"
# Dependent crate licenses
LICENSE+=" Apache-2.0 BSD GPL-3+ ISC MIT Unicode-DFS-2016"
SLOT="0/${PV}"
IUSE="test"
RESTRICT="!test? ( test )"

BDEPEND+="
	dev-util/cargo-c
	>=virtual/rust-1.65
"

QA_FLAGS_IGNORED="usr/lib.*/libpkgcraft.so.*"

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

src_compile() {
	local cargoargs=(
		--library-type=cdylib
		--prefix=/usr
		--libdir="/usr/$(get_libdir)"
	)

	edo cargo cbuild "${cargoargs[@]}"
}

src_test() {
	if [[ ${PV} == 9999 ]] ; then
		# It's interesting to test the whole thing rather than just
		# pkgcraft-c.
		cd "${WORKDIR}"/${P} || die

		# Need nextest per README (separate processes required)
		# Invocation from https://github.com/pkgcraft/pkgcraft/blob/main/.github/workflows/ci.yml#L56
		edo cargo nextest run --color always --all-features
	else
		cargo_src_test
	fi
}

src_install() {
	local cargoargs=(
		--library-type=cdylib
		--prefix=/usr
		--libdir="/usr/$(get_libdir)"
		--destdir="${ED}"
	)

	edo cargo cinstall "${cargoargs[@]}"
}