1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit toolchain-funcs multilib
8 DESCRIPTION="xfs filesystem utilities"
9 HOMEPAGE="https://xfs.wiki.kernel.org/"
10 SRC_URI="https://www.kernel.org/pub/linux/utils/fs/xfs/${PN}/${P}.tar.xz"
14 KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 ~sh sparc x86"
15 IUSE="libedit nls readline static static-libs"
16 REQUIRED_USE="static? ( static-libs )"
18 LIB_DEPEND=">=sys-apps/util-linux-2.17.2[static-libs(+)]
19 readline? ( sys-libs/readline:0=[static-libs(+)] )
20 !readline? ( libedit? ( dev-libs/libedit[static-libs(+)] ) )"
21 RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
26 readline? ( sys-libs/ncurses:0=[static-libs] )
28 nls? ( sys-devel/gettext )"
31 "${FILESDIR}"/${PN}-4.12.0-sharedlibs.patch
32 "${FILESDIR}"/${PN}-4.7.0-libxcmd-link.patch
33 "${FILESDIR}"/${PN}-4.9.0-underlinking.patch
37 if use readline && use libedit ; then
38 ewarn "You have USE='readline libedit' but these are exclusive."
39 ewarn "Defaulting to readline; please disable this USE flag if you want libedit."
46 # LLDFLAGS is used for programs, so apply -all-static when USE=static is enabled.
47 # Clear out -static from all flags since we want to link against dynamic xfs libs.
49 -e "/^PKG_DOC_DIR/s:@pkg_name@:${PF}:" \
50 -e "1iLLDFLAGS += $(usex static '-all-static' '')" \
51 include/builddefs.in || die
52 find -name Makefile -exec \
53 sed -i -r -e '/^LLDFLAGS [+]?= -static(-libtool-libs)?$/d' {} +
55 # TODO: Write a patch for configure.ac to use pkg-config for the uuid-part.
56 if use static && use readline ; then
58 -e 's|-lreadline|& -lncurses|' \
59 -e 's|-lblkid|& -luuid|' \
66 export OPTIMIZER=${CFLAGS}
67 unset PLATFORM # if set in user env, this breaks configure
70 $(use_enable nls gettext)
71 $(use_enable readline)
72 $(usex readline --disable-editline $(use_enable libedit editline))
74 if use static || use static-libs ; then
75 myconf+=( --enable-static )
77 myconf+=( --disable-static )
86 emake DIST_ROOT="${ED}" install
87 # parallel install fails on this target for >=xfsprogs-3.2.0
88 emake -j1 DIST_ROOT="${ED}" install-dev
90 # handle is for xfsdump, the rest for xfsprogs
91 gen_usr_ldscript -a handle xcmd xfs xlog
92 # removing unnecessary .la files if not needed
93 use static-libs || find "${ED}" -name '*.la' -delete