| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
|
CRATES=" "
|
|
6 |
RUST_MIN_VER="1.90.0"
|
| 7 |
7 |
|
| 8 |
|
RUST_MIN_VER="1.77.1"
|
| 9 |
|
|
| 10 |
|
inherit edo cargo flag-o-matic multiprocessing toolchain-funcs
|
|
8 |
inherit cargo edo
|
| 11 |
9 |
|
| 12 |
10 |
DESCRIPTION="C library for pkgcraft"
|
| 13 |
11 |
HOMEPAGE="https://pkgcraft.github.io/"
|
| 14 |
12 |
|
|
13 |
MY_PN=${PN}-c
|
|
14 |
MY_P=${MY_PN}-${PV}
|
|
15 |
|
| 15 |
16 |
if [[ ${PV} == 9999 ]] ; then
|
|
17 |
SCALLOP_VERSION="9999"
|
| 16 |
18 |
EGIT_REPO_URI="https://github.com/pkgcraft/pkgcraft"
|
| 17 |
19 |
inherit git-r3
|
| 18 |
|
|
| 19 |
|
S="${WORKDIR}"/${P}/crates/pkgcraft-c
|
| 20 |
|
|
| 21 |
|
BDEPEND="test? ( dev-util/cargo-nextest )"
|
|
20 |
S="${WORKDIR}"/${P}/crates/${MY_PN}
|
| 22 |
21 |
else
|
| 23 |
|
MY_P=${PN}-c-${PV}
|
|
22 |
# For releases, SCALLOP_VERSION must match the value of PACKAGE_VERSION in
|
|
23 |
# the vendored library's configure script.
|
|
24 |
#
|
|
25 |
# To get the value from the repo use the following command:
|
|
26 |
# sed -rn "/^PACKAGE_VERSION=/ s/^.*='(.*)'/\1/p" **/scallop/bash/configure
|
|
27 |
SCALLOP_VERSION="5.3.9.20251212"
|
| 24 |
28 |
SRC_URI="https://github.com/pkgcraft/pkgcraft/releases/download/${MY_P}/${MY_P}.tar.xz"
|
| 25 |
29 |
S="${WORKDIR}"/${MY_P}
|
| 26 |
|
|
| 27 |
|
KEYWORDS="amd64 ~arm64"
|
|
30 |
KEYWORDS="~amd64"
|
| 28 |
31 |
fi
|
| 29 |
32 |
|
| 30 |
33 |
LICENSE="MIT"
|
| 31 |
|
# Dependent crate licenses
|
|
34 |
# dependent crate licenses
|
| 32 |
35 |
LICENSE+=" Apache-2.0 BSD ISC MIT MPL-2.0 Unicode-DFS-2016"
|
| 33 |
36 |
SLOT="0/${PV}"
|
| 34 |
|
IUSE="test"
|
| 35 |
|
RESTRICT="!test? ( test )"
|
| 36 |
37 |
|
| 37 |
|
# clang needed for bindgen
|
| 38 |
|
BDEPEND+="
|
|
38 |
# Strict dependency versioning is required since the system library must match
|
|
39 |
# the vendored copy as scallop exports many parts of bash that aren't meant to
|
|
40 |
# be a public interface and compatibility is not guaranteed between releases.
|
|
41 |
RDEPEND="~sys-libs/scallop-${SCALLOP_VERSION}"
|
|
42 |
DEPEND="${RDEPEND}"
|
|
43 |
# clang needed by bindgen to generate bash bindings
|
|
44 |
BDEPEND="
|
| 39 |
45 |
dev-util/cargo-c
|
| 40 |
46 |
llvm-core/clang
|
|
47 |
virtual/pkgconfig
|
| 41 |
48 |
"
|
| 42 |
49 |
|
| 43 |
50 |
QA_FLAGS_IGNORED="usr/lib.*/libpkgcraft.so.*"
|
| ... | ... | |
| 52 |
59 |
}
|
| 53 |
60 |
|
| 54 |
61 |
src_compile() {
|
|
62 |
# use system scallop library
|
|
63 |
export SCALLOP_NO_VENDOR=1
|
|
64 |
|
| 55 |
65 |
local cargoargs=(
|
| 56 |
66 |
--library-type=cdylib
|
| 57 |
67 |
--prefix=/usr
|
| ... | ... | |
| 59 |
69 |
$(usev !debug '--release')
|
| 60 |
70 |
)
|
| 61 |
71 |
|
| 62 |
|
# For scallop building bash
|
| 63 |
|
tc-export AR CC
|
| 64 |
|
|
| 65 |
|
# scallop uses modified bash-5.2 which relies on unprotoyped functions
|
| 66 |
|
append-cflags -std=gnu17
|
| 67 |
|
|
| 68 |
|
# Can pass -vv if need more output from e.g. scallop configure
|
| 69 |
72 |
edo cargo cbuild "${cargoargs[@]}"
|
| 70 |
73 |
}
|
| 71 |
74 |
|
| 72 |
|
src_test() {
|
| 73 |
|
if [[ ${PV} == 9999 ]] ; then
|
| 74 |
|
# It's interesting to test the whole thing rather than just
|
| 75 |
|
# pkgcraft-c.
|
| 76 |
|
cd "${WORKDIR}"/${P} || die
|
| 77 |
|
|
| 78 |
|
local -x NEXTEST_TEST_THREADS="$(makeopts_jobs)"
|
| 79 |
|
|
| 80 |
|
# Need nextest per README (separate processes required)
|
| 81 |
|
# Invocation from https://github.com/pkgcraft/pkgcraft/blob/main/.github/workflows/ci.yml#L56
|
| 82 |
|
edo cargo nextest run $(usev !debug '--release') --color always --all-features --tests
|
| 83 |
|
else
|
| 84 |
|
# There are no tests for pkgcraft-c. Test via e.g. dev-python/pkgcraft.
|
| 85 |
|
:;
|
| 86 |
|
fi
|
| 87 |
|
}
|
| 88 |
|
|
| 89 |
75 |
src_install() {
|
| 90 |
76 |
local cargoargs=(
|
| 91 |
77 |
--library-type=cdylib
|