commit:     c726509edbce1bb066d87a43aaac8fdfb741c272
Author:     David Michael <fedora.dm0 <AT> gmail <DOT> com>
AuthorDate: Sat Dec 26 02:50:51 2020 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Dec 28 17:35:46 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c726509e

dev-libs/libatasmart: support cross-compiling

The strpool directory must be compiled natively.  The build system
makes an attempt to handle this by setting CC, AM_CFLAGS, etc., but
configure substitutes CFLAGS directly, so it winds up with CBUILD
CC and CHOST CFLAGS which breaks everything.  This just runs emake
in that directory while overriding flags with command arguments.

Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: David Michael <fedora.dm0 <AT> gmail.com>
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 dev-libs/libatasmart/libatasmart-0.19_p5.ebuild | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/dev-libs/libatasmart/libatasmart-0.19_p5.ebuild 
b/dev-libs/libatasmart/libatasmart-0.19_p5.ebuild
index 7da99e26ec2..8afa393021d 100644
--- a/dev-libs/libatasmart/libatasmart-0.19_p5.ebuild
+++ b/dev-libs/libatasmart/libatasmart-0.19_p5.ebuild
@@ -3,6 +3,8 @@
 
 EAPI=7
 
+inherit toolchain-funcs
+
 DESCRIPTION="A small and lightweight parser library for ATA S.M.A.R.T. hard 
disks"
 HOMEPAGE="https://salsa.debian.org/utopia-team/libatasmart";
 SRC_URI="mirror://debian/pool/main/liba/${PN}/${PN}_${PV/_p*}.orig.tar.xz
@@ -15,9 +17,7 @@ IUSE="static-libs"
 
 RDEPEND="virtual/libudev:="
 DEPEND="${RDEPEND}"
-BDEPEND="
-       virtual/pkgconfig
-"
+BDEPEND="virtual/pkgconfig"
 
 S="${WORKDIR}/${P/_p*}"
 
@@ -34,6 +34,17 @@ src_configure() {
        econf $(use_enable static-libs static)
 }
 
+src_compile() {
+       if tc-is-cross-compiler; then
+               tc-export_build_env
+               emake -C strpool strpool \
+                       CFLAGS="${BUILD_CFLAGS}" \
+                       CPPFLAGS="${BUILD_CPPFLAGS}" \
+                       LDFLAGS="${BUILD_LDFLAGS}"
+       fi
+       emake
+}
+
 src_install() {
        default
        find "${ED}" -type f -name "*.la" -delete || die

Reply via email to