sys-apps/fd: bump to 8.1.1
[gentoo.git] / sys-apps / attr / attr-9999.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5
6 inherit flag-o-matic libtool toolchain-funcs multilib-minimal usr-ldscript
7
8 if [[ ${PV} == 9999 ]] ; then
9         EGIT_REPO_URI="https://git.savannah.gnu.org/git/${PN}.git"
10
11         inherit autotools git-r3
12 else
13         KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
14         SRC_URI="mirror://nongnu/${PN}/${P}.tar.gz"
15 fi
16
17 DESCRIPTION="Extended attributes tools"
18 HOMEPAGE="https://savannah.nongnu.org/projects/attr"
19 LICENSE="LGPL-2.1"
20 SLOT="0"
21
22 IUSE="debug nls static-libs"
23
24 DEPEND="nls? ( sys-devel/gettext )"
25
26 pkg_setup() {
27         # Remove -flto* from flags as this breaks binaries (bug #644048)
28         filter-flags -flto*
29 }
30
31 src_prepare() {
32         default
33
34         if [[ ${PV} == 9999 ]] ; then
35                 po/update-potfiles || die
36                 eautopoint
37                 eautoreconf
38         else
39                 elibtoolize #580792
40         fi
41 }
42
43 multilib_src_configure() {
44         unset PLATFORM #184564
45         export OPTIMIZER=${CFLAGS}
46         export DEBUG=-DNDEBUG
47
48         tc-ld-disable-gold #644048
49
50         local myeconfargs=(
51                 --bindir="${EPREFIX}"/bin
52                 --enable-shared
53                 $(use_enable static-libs static)
54                 $(use_enable nls)
55                 --libexecdir="${EPREFIX}"/usr/$(get_libdir)
56                 $(use_enable debug)
57         )
58         ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
59 }
60
61 multilib_src_install() {
62         emake DESTDIR="${D}" install
63
64         # Sanity check until we track down why this is happening. #644048
65         local lib="${ED}/usr/$(get_libdir)/libattr.so.1"
66         if [[ -e ${lib} ]] ; then
67                 local versions=$(readelf -V "${lib}")
68                 local symbols=$(readelf -sW "${lib}")
69                 if [[ "${versions}" != *"ATTR_1.0"* || \
70                       "${versions}" != *"ATTR_1.1"* || \
71                       "${versions}" != *"ATTR_1.2"* || \
72                       "${versions}" != *"ATTR_1.3"* || \
73                       "${symbols}" != *"getxattr@ATTR_1.0"* ]] ; then
74                         echo "# readelf -V ${lib}"
75                         echo "${versions}"
76                         echo "# readelf -sW ${lib}"
77                         echo "${symbols}"
78                         die "symbol version sanity check failed; please comment on https://bugs.gentoo.org/644048"
79                 else
80                         einfo "${lib} passed symbol checks"
81                 fi
82         fi
83
84         if multilib_is_native_abi; then
85                 # we install attr into /bin, so we need the shared lib with it
86                 gen_usr_ldscript -a attr
87         fi
88
89         # Add a wrapper until people upgrade.
90         insinto /usr/include/attr
91         newins "${FILESDIR}"/xattr-shim.h xattr.h
92 }
93
94 multilib_src_install_all() {
95         if ! use static-libs; then
96                 find "${ED}" -name '*.la' -delete || die
97         fi
98
99         einstalldocs
100 }