summaryrefslogtreecommitdiff
path: root/net-misc/zerotier/zerotier-1.14.0.ebuild
blob: 8a00c6b945326acc76cf2348155c3c16ea113715 (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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CARGO_OPTIONAL=1

CRATES="
	addr2line@0.21.0
	adler@1.0.2
	ahash@0.8.11
	aho-corasick@1.1.2
	allocator-api2@0.2.16
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	ansi_term@0.12.1
	anstyle@1.0.6
	anyhow@1.0.81
	async-stream-impl@0.3.5
	async-stream@0.3.5
	async-trait@0.1.78
	atty@0.2.14
	autocfg@1.1.0
	axum-core@0.3.4
	axum@0.6.20
	backoff@0.4.0
	backtrace@0.3.69
	base16ct@0.2.0
	base64@0.13.1
	base64@0.21.7
	base64ct@1.6.0
	bitflags@1.3.2
	bitflags@2.5.0
	block-buffer@0.10.4
	bumpalo@3.15.4
	byteorder@1.5.0
	bytes@1.5.0
	cbindgen@0.20.0
	cc@1.0.90
	cfg-if@1.0.0
	chrono@0.4.35
	clap@2.34.0
	const-oid@0.9.6
	convert_case@0.4.0
	core-foundation-sys@0.8.6
	core-foundation@0.9.4
	cpufeatures@0.2.12
	crossbeam-channel@0.5.12
	crossbeam-queue@0.3.11
	crossbeam-utils@0.8.19
	crypto-bigint@0.5.5
	crypto-common@0.1.6
	curve25519-dalek-derive@0.1.1
	curve25519-dalek@4.1.2
	darling@0.20.8
	darling_core@0.20.8
	darling_macro@0.20.8
	dashmap@5.5.3
	der@0.7.8
	deranged@0.3.11
	derive_builder@0.20.0
	derive_builder_core@0.20.0
	derive_builder_macro@0.20.0
	derive_more@0.99.17
	digest@0.10.7
	downcast@0.11.0
	dyn-clone@1.0.17
	ecdsa@0.16.9
	ed25519-dalek@2.1.1
	ed25519@2.2.3
	either@1.10.0
	elliptic-curve@0.13.8
	encoding_rs@0.8.33
	enum-iterator-derive@1.3.0
	enum-iterator@2.0.0
	enum_dispatch@0.3.12
	equivalent@1.0.1
	erased-serde@0.4.4
	errno@0.3.8
	fastrand@2.0.1
	ff@0.13.0
	fiat-crypto@0.2.6
	fixedbitset@0.4.2
	fnv@1.0.7
	foreign-types-shared@0.1.1
	foreign-types@0.3.2
	form_urlencoded@1.2.1
	fragile@2.0.0
	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-retry@0.6.0
	futures-sink@0.3.30
	futures-task@0.3.30
	futures-timer@3.0.3
	futures-util@0.3.30
	futures@0.3.30
	generic-array@0.14.7
	getrandom@0.2.12
	gimli@0.28.1
	governor@0.6.3
	group@0.13.0
	h2@0.3.25
	hashbrown@0.12.3
	hashbrown@0.14.3
	heck@0.3.3
	heck@0.4.1
	hermit-abi@0.1.19
	hermit-abi@0.3.9
	hex@0.4.3
	hkdf@0.12.4
	hmac@0.12.1
	home@0.5.9
	http-body@0.4.6
	http@0.2.12
	httparse@1.8.0
	httpdate@1.0.3
	hyper-timeout@0.4.1
	hyper-tls@0.5.0
	hyper@0.14.28
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.60
	ident_case@1.0.1
	idna@0.5.0
	indexmap@1.9.3
	indexmap@2.2.5
	instant@0.1.12
	inventory@0.3.15
	ipnet@2.9.0
	itertools@0.10.5
	itertools@0.11.0
	itertools@0.12.1
	itoa@1.0.10
	js-sys@0.3.69
	lazy_static@1.4.0
	libc@0.2.153
	libm@0.2.8
	linux-raw-sys@0.4.13
	lock_api@0.4.11
	log@0.4.21
	lru@0.12.3
	matchers@0.1.0
	matchit@0.7.3
	memchr@2.7.1
	mime@0.3.17
	miniz_oxide@0.7.2
	mio@0.8.11
	mockall@0.12.1
	mockall_derive@0.12.1
	multimap@0.8.3
	native-tls@0.2.11
	no-std-compat@0.4.1
	nonzero_ext@0.3.0
	nu-ansi-term@0.46.0
	num-bigint-dig@0.8.4
	num-conv@0.1.0
	num-integer@0.1.46
	num-iter@0.1.44
	num-traits@0.2.18
	num_cpus@1.16.0
	oauth2@4.4.2
	object@0.32.2
	once_cell@1.19.0
	openidconnect@3.5.0
	openssl-macros@0.1.1
	openssl-probe@0.1.5
	openssl-sys@0.9.101
	openssl@0.10.64
	opentelemetry@0.22.0
	ordered-float@2.10.1
	overload@0.1.1
	p256@0.13.2
	p384@0.13.0
	parking_lot@0.12.1
	parking_lot_core@0.9.9
	pem-rfc7468@0.7.0
	percent-encoding@2.3.1
	petgraph@0.6.4
	pin-project-internal@1.1.5
	pin-project-lite@0.2.13
	pin-project@1.1.5
	pin-utils@0.1.0
	pkcs1@0.7.5
	pkcs8@0.10.2
	pkg-config@0.3.30
	platforms@3.3.0
	portable-atomic@1.6.0
	powerfmt@0.2.0
	ppv-lite86@0.2.17
	predicates-core@1.0.6
	predicates-tree@1.0.9
	predicates@3.1.0
	prettyplease@0.2.16
	primeorder@0.13.6
	proc-macro2@1.0.79
	prometheus@0.13.3
	prost-build@0.12.3
	prost-derive@0.12.3
	prost-types@0.12.3
	prost-wkt-build@0.5.0
	prost-wkt-types@0.5.0
	prost-wkt@0.5.0
	prost@0.12.3
	protobuf@2.28.0
	quanta@0.12.2
	quote@1.0.35
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	raw-cpuid@11.0.1
	redox_syscall@0.4.1
	regex-automata@0.1.10
	regex-automata@0.4.6
	regex-syntax@0.6.29
	regex-syntax@0.8.2
	regex@1.10.3
	reqwest@0.11.26
	rfc6979@0.4.0
	ring@0.17.8
	ringbuf@0.3.3
	rsa@0.9.6
	rustc-demangle@0.1.23
	rustc_version@0.4.0
	rustix@0.38.31
	rustls-native-certs@0.7.0
	rustls-pemfile@1.0.4
	rustls-pemfile@2.1.1
	rustls-pki-types@1.3.1
	rustls-webpki@0.102.2
	rustls@0.22.2
	rustversion@1.0.14
	ryu@1.0.17
	schannel@0.1.23
	scopeguard@1.2.0
	sec1@0.7.3
	security-framework-sys@2.9.1
	security-framework@2.9.2
	semver@1.0.22
	serde-value@0.7.0
	serde@1.0.197
	serde_derive@1.0.197
	serde_json@1.0.114
	serde_path_to_error@0.1.16
	serde_plain@1.0.2
	serde_urlencoded@0.7.1
	serde_with@3.7.0
	serde_with_macros@3.7.0
	sha2@0.10.8
	sharded-slab@0.1.7
	signal-hook-registry@1.4.1
	signature@2.2.0
	siphasher@1.0.1
	slab@0.4.9
	slotmap@1.0.7
	smallvec@1.13.1
	socket2@0.5.6
	spin@0.5.2
	spin@0.9.8
	spinning_top@0.3.0
	spki@0.7.3
	strsim@0.10.0
	strsim@0.8.0
	subtle@2.5.0
	syn@1.0.109
	syn@2.0.53
	sync_wrapper@0.1.2
	system-configuration-sys@0.5.0
	system-configuration@0.5.1
	tempfile@3.10.1
	termtree@0.4.1
	textwrap@0.11.0
	thiserror-impl@1.0.58
	thiserror@1.0.58
	thread_local@1.1.8
	time-core@0.1.2
	time-macros@0.2.17
	time@0.3.34
	tinyvec@1.6.0
	tinyvec_macros@0.1.1
	tokio-io-timeout@1.2.0
	tokio-macros@2.2.0
	tokio-native-tls@0.3.1
	tokio-rustls@0.25.0
	tokio-stream@0.1.15
	tokio-util@0.7.10
	tokio@1.36.0
	toml@0.5.11
	tonic-build@0.11.0
	tonic@0.11.0
	tower-layer@0.3.2
	tower-service@0.3.2
	tower@0.4.13
	tracing-attributes@0.1.27
	tracing-core@0.1.32
	tracing-log@0.2.0
	tracing-subscriber@0.3.18
	tracing@0.1.40
	try-lock@0.2.5
	typenum@1.17.0
	typetag-impl@0.2.16
	typetag@0.2.16
	unicode-bidi@0.3.15
	unicode-ident@1.0.12
	unicode-normalization@0.1.23
	unicode-segmentation@1.11.0
	unicode-width@0.1.11
	untrusted@0.9.0
	url@2.5.0
	urlencoding@2.1.3
	uuid@1.8.0
	valuable@0.1.0
	vcpkg@0.2.15
	vec_map@0.8.2
	version_check@0.9.4
	want@0.3.1
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.92
	wasm-bindgen-futures@0.4.42
	wasm-bindgen-macro-support@0.2.92
	wasm-bindgen-macro@0.2.92
	wasm-bindgen-shared@0.2.92
	wasm-bindgen@0.2.92
	web-sys@0.3.69
	which@4.4.2
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-core@0.52.0
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-targets@0.48.5
	windows-targets@0.52.4
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.4
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.4
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.4
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.4
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.4
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.4
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.4
	winreg@0.50.0
	zerocopy-derive@0.7.32
	zerocopy@0.7.32
	zeroize@1.7.0
"

declare -A GIT_CRATES=(
	[jwt]='https://github.com/glimberg/rust-jwt;61a9291fdeec747c6edf14f4fa0caf235136c168;rust-jwt-%commit%'
	[rustfsm]='https://github.com/temporalio/sdk-core;4840a9c570fa3388e190e20f01f61065d0b7e965;sdk-core-%commit%/fsm'
	[rustfsm_procmacro]='https://github.com/temporalio/sdk-core;4840a9c570fa3388e190e20f01f61065d0b7e965;sdk-core-%commit%/fsm/rustfsm_procmacro'
	[rustfsm_trait]='https://github.com/temporalio/sdk-core;4840a9c570fa3388e190e20f01f61065d0b7e965;sdk-core-%commit%/fsm/rustfsm_trait'
	[temporal-client]='https://github.com/temporalio/sdk-core;4840a9c570fa3388e190e20f01f61065d0b7e965;sdk-core-%commit%/client'
	[temporal-sdk-core-api]='https://github.com/temporalio/sdk-core;4840a9c570fa3388e190e20f01f61065d0b7e965;sdk-core-%commit%/core-api'
	[temporal-sdk-core-protos]='https://github.com/temporalio/sdk-core;4840a9c570fa3388e190e20f01f61065d0b7e965;sdk-core-%commit%/sdk-core-protos'
	[temporal-sdk-core]='https://github.com/temporalio/sdk-core;4840a9c570fa3388e190e20f01f61065d0b7e965;sdk-core-%commit%/core'
	[temporal-sdk]='https://github.com/temporalio/sdk-core;4840a9c570fa3388e190e20f01f61065d0b7e965;sdk-core-%commit%/sdk'
)

inherit cargo systemd toolchain-funcs

DESCRIPTION="A software-based managed Ethernet switch for planet Earth"
HOMEPAGE="https://www.zerotier.com/"
SRC_URI="
	https://github.com/zerotier/ZeroTierOne/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
	sso? (
		${CARGO_CRATE_URIS}
	)
"
S="${WORKDIR}"/ZeroTierOne-${PV}

LICENSE="BUSL-1.1"
# Crate licenses
LICENSE+=" sso? ( Apache-2.0 BSD ISC MIT MPL-2.0 Unicode-DFS-2016 ZLIB )"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
IUSE="cpu_flags_arm_neon debug sso"

RDEPEND="
	dev-libs/openssl:=
	net-libs/libnatpmp
	>=net-libs/miniupnpc-2:=
"
DEPEND="${RDEPEND}"
BDEPEND="
	sso? (
		virtual/rust
	)
"

PATCHES=(
	"${FILESDIR}"/${PN}-1.14.0-respect-ldflags.patch
	"${FILESDIR}"/${PN}-1.10.1-add-armv7a-support.patch
	"${FILESDIR}"/${PN}-1.12.2-noexecstack.patch
)

DOCS=( README.md AUTHORS.md )

src_unpack() {
	unpack ${P}.tar.gz
	use sso && cargo_src_unpack
}

src_prepare() {
	default

	#1. Dont call cargo, we'll run it with cargo eclass functions
	#2. Remove man page compression and install, we'll handle it with ebuild functions
	sed -i \
		-e '/ifeq ($(ZT_SSO_SUPPORTED)/,/endif/ { /cargo build/d }' \
		-e '/install:/,/^$/ { /man[0-9]/d }' \
		make-linux.mk || die
}

src_configure() {
	tc-export CXX CC

	use cpu_flags_arm_neon || export ZT_DISABLE_NEON=1

	use sso && cargo_src_configure
}

src_compile() {
	#TODO: New rusty bit smeeclient isnt built
	myemakeargs=(
		CXX="${CXX}"
		STRIP=:

		# Debug doesnt do more than add preprocessor arguments normally,
		# but when rust is used it sets the correct rust directory to link against.
		# It would be added by cargo eclass eitherway, so instead of adding REQUIRED_USE
		# and patching the makefile its just easier to have it.
		ZT_DEBUG="$(usex debug 1 0)"
		ZT_SSO_SUPPORTED="$(usex sso 1 0)"
	)

	pushd rustybits/zeroidc > /dev/null || die
	use sso && cargo_src_compile
	popd > /dev/null || die

	emake "${myemakeargs[@]}" one
}

src_test() {
	emake "${myemakeargs[@]}" selftest
	./zerotier-selftest || die
}

src_install() {
	default

	newinitd "${FILESDIR}/${PN}".init-r1 "${PN}"
	systemd_dounit "${FILESDIR}/${PN}".service

	doman doc/zerotier-{cli.1,idtool.1,one.8}
}