www-client/google-chrome-beta: automated update (84.0.4147.30)
[gentoo.git] / sys-apps / attr / attr-2.4.48-r3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="6"
5
6 inherit flag-o-matic libtool toolchain-funcs multilib-minimal usr-ldscript
7
8 DESCRIPTION="Extended attributes tools"
9 HOMEPAGE="https://savannah.nongnu.org/projects/attr"
10 SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz"
11
12 LICENSE="LGPL-2.1"
13 SLOT="0"
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"
16
17 DEPEND="nls? ( sys-devel/gettext )"
18
19 PATCHES=(
20         "${FILESDIR}/${P}-perl-5.26.patch"
21         "${FILESDIR}/${P}-switch-back-to-syscall.patch"
22 )
23
24 pkg_setup() {
25         # Remove -flto* from flags as this breaks binaries (bug #644048)
26         filter-flags -flto*
27         append-ldflags "-Wl,--no-gc-sections" #700116
28 }
29
30 src_prepare() {
31         default
32         elibtoolize #580792
33 }
34
35 multilib_src_configure() {
36         unset PLATFORM #184564
37         export OPTIMIZER=${CFLAGS}
38         export DEBUG=-DNDEBUG
39
40         tc-ld-disable-gold #644048
41
42         local myeconfargs=(
43                 --bindir="${EPREFIX}"/bin
44                 --enable-shared
45                 $(use_enable static-libs static)
46                 $(use_enable nls)
47                 --libexecdir="${EPREFIX}"/usr/$(get_libdir)
48                 $(use_enable debug)
49         )
50         ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
51 }
52
53 multilib_src_install() {
54         emake DESTDIR="${D%/}" install
55
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}"
67                         echo "${versions}"
68                         echo "# readelf -sW ${lib}"
69                         echo "${symbols}"
70                         die "symbol version sanity check failed; please comment on https://bugs.gentoo.org/644048"
71                 else
72                         einfo "${lib} passed symbol checks"
73                 fi
74         fi
75
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
79         fi
80
81         # Add a wrapper until people upgrade.
82         insinto /usr/include/attr
83         newins "${FILESDIR}"/xattr-shim.h xattr.h
84 }
85
86 multilib_src_install_all() {
87         if ! use static-libs; then
88                 find "${ED%/}" -name '*.la' -delete || die
89         fi
90
91         einstalldocs
92 }