1 |
|
# Copyright 1999-2022 Gentoo Authors
|
|
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit toolchain-funcs
|
|
6 |
PYTHON_COMPAT=( python3_{10..11} )
|
|
7 |
inherit meson python-single-r1
|
7 |
8 |
|
8 |
|
if [[ ${PV} == "9999" ]] ; then
|
9 |
|
EGIT_REPO_URI="git://git.kernel.org/pub/scm/utils/dtc/dtc.git"
|
|
9 |
if [[ ${PV} == 9999 ]] ; then
|
|
10 |
EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/dtc/dtc.git"
|
10 |
11 |
inherit git-r3
|
11 |
12 |
else
|
12 |
13 |
SRC_URI="https://www.kernel.org/pub/software/utils/${PN}/${P}.tar.xz"
|
13 |
|
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
|
|
14 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
14 |
15 |
fi
|
15 |
16 |
|
16 |
17 |
DESCRIPTION="Open Firmware device tree compiler"
|
... | ... | |
18 |
19 |
|
19 |
20 |
LICENSE="GPL-2"
|
20 |
21 |
SLOT="0"
|
21 |
|
IUSE="static-libs yaml"
|
|
22 |
IUSE="python static-libs test yaml"
|
|
23 |
RESTRICT="!test? ( test )"
|
|
24 |
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
|
22 |
25 |
|
23 |
26 |
BDEPEND="
|
24 |
27 |
sys-devel/bison
|
25 |
28 |
sys-devel/flex
|
26 |
29 |
virtual/pkgconfig
|
|
30 |
python? ( dev-lang/swig )
|
|
31 |
"
|
|
32 |
RDEPEND="
|
|
33 |
python? ( ${PYTHON_DEPS} )
|
|
34 |
yaml? ( dev-libs/libyaml )
|
27 |
35 |
"
|
28 |
|
RDEPEND="yaml? ( dev-libs/libyaml )"
|
29 |
36 |
DEPEND="${RDEPEND}"
|
30 |
37 |
|
31 |
|
DOCS="
|
|
38 |
DOCS=(
|
32 |
39 |
Documentation/dt-object-internal.txt
|
33 |
40 |
Documentation/dts-format.txt
|
34 |
41 |
Documentation/manual.txt
|
35 |
|
"
|
|
42 |
)
|
36 |
43 |
|
37 |
|
_emake() {
|
38 |
|
# valgrind is used only in 'make checkm'
|
39 |
|
emake \
|
40 |
|
NO_PYTHON=1 \
|
41 |
|
NO_VALGRIND=1 \
|
42 |
|
NO_YAML=$(usex !yaml 1 0) \
|
43 |
|
\
|
44 |
|
AR="$(tc-getAR)" \
|
45 |
|
CC="$(tc-getCC)" \
|
46 |
|
PKG_CONFIG="$(tc-getPKG_CONFIG)" \
|
47 |
|
\
|
48 |
|
V=1 \
|
49 |
|
\
|
50 |
|
PREFIX="${EPREFIX}/usr" \
|
51 |
|
\
|
52 |
|
LIBDIR="\$(PREFIX)/$(get_libdir)" \
|
53 |
|
\
|
54 |
|
"$@"
|
|
44 |
PATCHES=(
|
|
45 |
"${FILESDIR}"/${P}-meson-tests.patch
|
|
46 |
"${FILESDIR}"/${P}-meson-macos.patch
|
|
47 |
)
|
|
48 |
|
|
49 |
pkg_setup() {
|
|
50 |
if use python ; then
|
|
51 |
export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
|
|
52 |
python-single-r1_pkg_setup
|
|
53 |
fi
|
55 |
54 |
}
|
56 |
55 |
|
57 |
56 |
src_prepare() {
|
58 |
57 |
default
|
59 |
58 |
|
60 |
|
sed -i \
|
61 |
|
-e '/^CFLAGS =/s:=:+=:' \
|
62 |
|
-e '/^CPPFLAGS =/s:=:+=:' \
|
63 |
|
-e 's:-Werror::' \
|
64 |
|
-e 's:-g -Os::' \
|
65 |
|
Makefile || die
|
66 |
|
|
67 |
|
tc-export AR CC PKG_CONFIG
|
|
59 |
if ! use test ; then
|
|
60 |
sed -i -e "/subdir('tests')/d" meson.build || die
|
|
61 |
fi
|
68 |
62 |
}
|
69 |
63 |
|
70 |
|
src_compile() {
|
71 |
|
_emake
|
72 |
|
}
|
73 |
|
|
74 |
|
src_test() {
|
75 |
|
_emake check
|
76 |
|
}
|
|
64 |
src_configure() {
|
|
65 |
local emesonargs=(
|
|
66 |
-Dtools=true
|
|
67 |
-Dvalgrind=disabled # only used for some tests
|
|
68 |
$(meson_feature python)
|
|
69 |
$(meson_feature yaml)
|
|
70 |
)
|
77 |
71 |
|
78 |
|
src_install() {
|
79 |
|
_emake DESTDIR="${D}" install
|
|
72 |
# bug #909366
|
|
73 |
use static-libs && emesonargs+=( -Dstatic-build=true )
|
80 |
74 |
|
81 |
|
use static-libs || find "${ED}" -name '*.a' -delete
|
|
75 |
meson_src_configure
|
82 |
76 |
}
|