1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit flag-o-matic libtool toolchain-funcs multilib-minimal usr-ldscript
8 DESCRIPTION="Extended attributes tools"
9 HOMEPAGE="https://savannah.nongnu.org/projects/attr"
10 SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz"
14 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~amd64-linux ~x86-linux"
15 IUSE="debug nls static-libs"
17 DEPEND="nls? ( sys-devel/gettext )"
20 "${FILESDIR}/${P}-perl-5.26.patch"
21 "${FILESDIR}/${P}-switch-back-to-syscall.patch"
25 # Remove -flto* from flags as this breaks binaries (bug #644048)
27 append-ldflags "-Wl,--no-gc-sections" #700116
35 multilib_src_configure() {
36 unset PLATFORM #184564
37 export OPTIMIZER=${CFLAGS}
40 tc-ld-disable-gold #644048
43 --bindir="${EPREFIX}"/bin
45 $(use_enable static-libs static)
47 --libexecdir="${EPREFIX}"/usr/$(get_libdir)
50 ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
53 multilib_src_install() {
54 emake DESTDIR="${D%/}" install
56 # Sanity check until we track down why this is happening. #644048
57 local lib="${ED%/}/usr/$(get_libdir)/libattr.so.1"
58 if [[ -e ${lib} ]] ; then
59 local versions=$(readelf -V "${lib}")
60 local symbols=$(readelf -sW "${lib}")
61 if [[ "${versions}" != *"ATTR_1.0"* || \
62 "${versions}" != *"ATTR_1.1"* || \
63 "${versions}" != *"ATTR_1.2"* || \
64 "${versions}" != *"ATTR_1.3"* || \
65 "${symbols}" != *"getxattr@ATTR_1.0"* ]] ; then
66 echo "# readelf -V ${lib}"
68 echo "# readelf -sW ${lib}"
70 die "symbol version sanity check failed; please comment on https://bugs.gentoo.org/644048"
72 einfo "${lib} passed symbol checks"
76 if multilib_is_native_abi; then
77 # we install attr into /bin, so we need the shared lib with it
78 gen_usr_ldscript -a attr
81 # Add a wrapper until people upgrade.
82 insinto /usr/include/attr
83 newins "${FILESDIR}"/xattr-shim.h xattr.h
86 multilib_src_install_all() {
87 if ! use static-libs; then
88 find "${ED%/}" -name '*.la' -delete || die