9c4506c9ced4d3f757841d2aa0f23ad917c9ca81
[gentoo.git] / sys-fs / xfsprogs / xfsprogs-4.17.0-r1.ebuild
1 # Copyright 1999-2018 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit toolchain-funcs multilib systemd
7
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"
11
12 LICENSE="LGPL-2.1"
13 SLOT="0"
14 KEYWORDS="alpha amd64 ~arm arm64 hppa ~ia64 ~mips ppc ppc64 s390 sh ~sparc x86"
15 IUSE="icu libedit nls readline static-libs"
16
17 LIB_DEPEND=">=sys-apps/util-linux-2.17.2[static-libs(+)]
18         icu? ( dev-libs/icu:=[static-libs(+)] )
19         readline? ( sys-libs/readline:0=[static-libs(+)] )
20         !readline? ( libedit? ( dev-libs/libedit[static-libs(+)] ) )"
21 RDEPEND="${LIB_DEPEND//\[static-libs(+)]}
22         !<sys-fs/xfsdump-3"
23 DEPEND="${RDEPEND}
24         nls? ( sys-devel/gettext )"
25
26 PATCHES=(
27         "${FILESDIR}"/${PN}-4.9.0-underlinking.patch
28         "${FILESDIR}"/${PN}-4.15.0-sharedlibs.patch
29         "${FILESDIR}"/${PN}-4.15.0-docdir.patch
30 )
31
32 pkg_setup() {
33         if use readline && use libedit ; then
34                 ewarn "You have USE='readline libedit' but these are exclusive."
35                 ewarn "Defaulting to readline; please disable this USE flag if you want libedit."
36         fi
37 }
38
39 src_prepare() {
40         default
41
42         # Clear out -static from all flags since we want to link against dynamic xfs libs.
43         sed -i \
44                 -e "/^PKG_DOC_DIR/s:@pkg_name@:${PF}:" \
45                 include/builddefs.in || die
46         find -name Makefile -exec \
47                 sed -i -r -e '/^LLDFLAGS [+]?= -static(-libtool-libs)?$/d' {} +
48 }
49
50 src_configure() {
51         export DEBUG=-DNDEBUG
52         export OPTIMIZER=${CFLAGS}
53         unset PLATFORM # if set in user env, this breaks configure
54
55         local myconf=(
56                 --disable-lto #655638
57                 --enable-blkid
58                 --with-crond-dir="${EPREFIX}/etc/cron.d"
59                 --with-systemd-unit-dir="$(systemd_get_systemunitdir)"
60                 $(use_enable icu libicu)
61                 $(use_enable nls gettext)
62                 $(use_enable readline)
63                 $(usex readline --disable-editline $(use_enable libedit editline))
64         )
65         if use static-libs ; then
66                 myconf+=( --enable-static )
67         else
68                 myconf+=( --disable-static )
69         fi
70
71         econf "${myconf[@]}"
72
73         MAKEOPTS+=" V=1"
74 }
75
76 src_install() {
77         emake DIST_ROOT="${ED}" install
78         # parallel install fails on this target for >=xfsprogs-3.2.0
79         emake -j1 DIST_ROOT="${ED}" install-dev
80
81         # handle is for xfsdump, the rest for xfsprogs
82         gen_usr_ldscript -a handle xcmd xfs xlog frog
83         # removing unnecessary .la files if not needed
84         use static-libs || find "${ED}" -name '*.la' -delete
85 }