blob: db35ca3ce79058a7eb3a6b7a242cd7f5874fb4f6 [file] [log] [blame]
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python2_7 )
DISTUTILS_OPTIONAL="1"
inherit multilib toolchain-funcs eutils distutils-r1
if [[ ${PV} == "9999" ]] ; then
EGIT_REPO_URI="git://git.kernel.org/pub/scm/utils/dtc/dtc.git"
inherit git-r3
else
SRC_URI="mirror://kernel/software/utils/${PN}/${P}.tar.xz"
KEYWORDS="*"
fi
DESCRIPTION="Open Firmware device tree compiler"
HOMEPAGE="https://devicetree.org/ https://git.kernel.org/cgit/utils/dtc/dtc.git/"
LICENSE="GPL-2"
SLOT="0"
IUSE="python static-libs"
RDEPEND="python? ( ${PYTHON_DEPS} )"
DEPEND="${RDEPEND}
python? (
dev-lang/swig
)
sys-devel/bison
sys-devel/flex
"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
DOCS="
${S}/Documentation/dt-object-internal.txt
${S}/Documentation/dts-format.txt
${S}/Documentation/manual.txt
"
src_prepare() {
# patch -p0 does not work when creating files, so force -p1.
EPATCH_OPTS="-p1" epatch "${FILESDIR}"/*.patch
default
sed -i \
-e '/^CFLAGS =/s:=:+=:' \
-e '/^CPPFLAGS =/s:=:+=:' \
-e 's:-Werror::' \
-e 's:-g -Os::' \
-e "/^PREFIX =/s:=.*:= ${EPREFIX}/usr:" \
-e "/^LIBDIR =/s:=.*:= \$(PREFIX)/$(get_libdir):" \
Makefile || die
tc-export AR CC
export V=1
if use python ; then
cd pylibfdt
distutils-r1_src_prepare
fi
}
src_configure() {
if use python ; then
cd pylibfdt
distutils-r1_src_configure
fi
}
src_compile() {
emake NO_PYTHON=1
if use python ; then
cd pylibfdt
distutils-r1_src_compile
fi
}
src_install() {
NO_PYTHON=1 default
use static-libs || find "${ED}" -name '*.a' -delete
if use python ; then
cd pylibfdt
distutils-r1_src_install
fi
}