blob: af77f15e2a08ae559df2ecb38ceee0fd45367bcd (
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
|
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
CRATES=" "
inherit edo cargo toolchain-funcs
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
MY_P=${PN}-c-${PV}
SRC_URI="https://github.com/pkgcraft/pkgcraft/releases/download/${MY_P}/${MY_P}.tar.xz"
S="${WORKDIR}"/${MY_P}
KEYWORDS="~amd64"
fi
LICENSE="MIT"
# Dependent crate licenses
LICENSE+=" Apache-2.0 BSD ISC MIT MPL-2.0 Unicode-DFS-2016"
SLOT="0/${PV}"
IUSE="test"
RESTRICT="!test? ( test )"
# clang needed for bindgen
BDEPEND+="
dev-util/cargo-c
sys-devel/clang
>=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)"
)
# For scallop building bash
tc-export AR CC
# Can pass -vv if need more output from e.g. scallop configure
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
# There are no tests for pkgcraft-c. Test via e.g. dev-python/pkgcraft.
:;
fi
}
src_install() {
local cargoargs=(
--library-type=cdylib
--prefix=/usr
--libdir="/usr/$(get_libdir)"
--destdir="${ED}"
)
edo cargo cinstall "${cargoargs[@]}"
}
|