1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python{2_7,3_6,3_7,3_8} )
9 inherit distutils-r1 flag-o-matic toolchain-funcs
11 DESCRIPTION="I2C tools for bus probing, chip dumping, EEPROM decoding, and more"
12 HOMEPAGE="https://www.kernel.org/pub/software/utils/i2c-tools"
13 SRC_URI="https://www.kernel.org/pub/software/utils/${PN}/${P}.tar.xz"
17 KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~sparc ~x86"
18 IUSE="perl python static-libs"
19 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
22 python? ( ${PYTHON_DEPS} )"
25 perl? ( dev-lang/perl )"
29 use python && distutils-r1_src_prepare
31 # Cut out the eeprom/ & stub/ dirs as only perl scripts live there.
33 sed -i '/^SRCDIRS/s: eeprom stub : :g' Makefile || die
38 use python && distutils-r1_src_configure
40 # Always build & use dynamic libs if possible.
41 if tc-is-static-only ; then
42 export BUILD_DYNAMIC_LIB=0
43 export USE_STATIC_LIB=1
44 export BUILD_STATIC_LIB=1
46 export BUILD_DYNAMIC_LIB=1
47 export USE_STATIC_LIB=0
48 export BUILD_STATIC_LIB=$(usex static-libs 1 0)
53 emake AR="$(tc-getAR)" CC="$(tc-getCC)" all-lib # parallel make
54 emake CC="$(tc-getCC)"
55 emake -C eepromer CC="$(tc-getCC)" CFLAGS="${CFLAGS}"
59 append-cppflags -I../include
60 distutils-r1_src_compile
65 emake DESTDIR="${D}" libdir="/usr/$(get_libdir)" PREFIX="/usr" install-lib install
66 dosbin eepromer/eeprom{,er}
67 rm -rf "${D}"/usr/include || die # part of linux-headers
70 for d in $(usex perl eeprom '') eepromer ; do
79 distutils-r1_src_install