blob: 955b59d2cc5f140ffa7fcb5d7a3dd3302f65304c (
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
|
# Copyright 2022-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
#CRATES=""
RUST_MULTILIB=1
RUST_MIN_VER="1.81"
inherit cargo flag-o-matic multilib-minimal rust-toolchain
DESCRIPTION="C-to-rustls bindings"
HOMEPAGE="https://github.com/rustls/rustls-ffi"
if [[ ${PV} == 9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rustls/rustls-ffi.git"
else
SRC_URI="https://github.com/rustls/rustls-ffi/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" ${CARGO_CRATE_URIS}"
KEYWORDS="~amd64"
fi
# Strictly speaking the core package is "|| ( Apache-2.0 MIT ISC )"
# but dependencies explicitly require at least one of each.
LICENSE+=" Apache-2.0 BSD ISC MIT Unicode-3.0 MPL-2.0"
# For Ring (see its LICENSE)
LICENSE+=" ISC openssl SSLeay MIT"
SLOT="0/${PV%.*}"
BDEPEND="dev-util/cargo-c"
QA_FLAGS_IGNORED="usr/lib.*/librustls.*"
src_unpack() {
if [[ ${PV} == 9999 ]]; then
git-r3_src_unpack
cargo_live_src_unpack
else
cargo_src_unpack
fi
}
src_prepare() {
default
if ! [[ ${PV} == 9999 ]]; then # We already fetched all the crates...
# Currently only used for development, we can skip this
# and significantly reduce the number of required crates.
# Produces a docgen binary that we may want to use in the future. Just API docs?
rm -r tools || die
sed '/ "tools"/d' -i Cargo.toml || die
cargo_update_crates
fi
multilib_copy_sources
}
src_configure() {
# bug #927231
filter-lto
multilib-minimal_src_configure
}
src_compile() {
multilib-minimal_src_compile
}
multilib_src_compile() {
local cargoargs=(
--library-type=cdylib
--prefix="${EPREFIX}"/usr
--libdir="${EPREFIX}/usr/$(get_libdir)"
--target="$(rust_abi)"
$(usev !debug '--release')
)
cargo cbuild "${cargoargs[@]}" || die "cargo cbuild failed"
}
src_test() {
multilib-minimal_src_test
}
multilib_src_test() {
local cargoargs=(
--prefix="${EPREFIX}"/usr
--libdir="${EPREFIX}/usr/$(get_libdir)"
--target="$(rust_abi)"
$(usex debug '--debug' '--release')
)
cargo ctest "${cargoargs[@]}" || die "cargo ctest failed"
}
src_install() {
multilib-minimal_src_install
}
multilib_src_install() {
local cargoargs=(
--library-type=cdylib
--prefix="${EPREFIX}"/usr
--libdir="${EPREFIX}/usr/$(get_libdir)"
--target="$(rust_abi)"
--destdir="${D}"
$(usex debug '--debug' '--release')
)
cargo cinstall "${cargoargs[@]}" || die "cargo cinstall failed"
}
|