sys-fs/xfsprogs: Bump to version 4.16.1
[gentoo.git] / sys-fs / xfsprogs / xfsprogs-4.16.1.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
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="http://oss.sgi.com/projects/xfs/"
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="libedit nls readline static static-libs"
16 REQUIRED_USE="static? ( static-libs )"
17
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(+)]} )
22         !<sys-fs/xfsdump-3"
23 DEPEND="${RDEPEND}
24         static? (
25                 ${LIB_DEPEND}
26                 readline? ( sys-libs/ncurses:0=[static-libs] )
27         )
28         nls? ( sys-devel/gettext )"
29
30 PATCHES=(
31         "${FILESDIR}"/${PN}-4.9.0-underlinking.patch
32         "${FILESDIR}"/${PN}-4.15.0-sharedlibs.patch
33         "${FILESDIR}"/${PN}-4.15.0-docdir.patch
34 )
35
36 pkg_setup() {
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."
40         fi
41 }
42
43 src_prepare() {
44         default
45
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.
48         sed -i \
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' {} +
54
55         # TODO: Write a patch for configure.ac to use pkg-config for the uuid-part.
56         if use static && use readline ; then
57                 sed -i \
58                         -e 's|-lreadline|& -lncurses|' \
59                         -e 's|-lblkid|& -luuid|' \
60                         configure || die
61         fi
62 }
63
64 src_configure() {
65         export DEBUG=-DNDEBUG
66         export OPTIMIZER=${CFLAGS}
67         unset PLATFORM # if set in user env, this breaks configure
68
69         local myconf=(
70                 --with-crond-dir="${EPREFIX}/etc/cron.d"
71                 --with-systemd-unit-dir="$(systemd_get_systemunitdir)"
72                 $(use_enable nls gettext)
73                 $(use_enable readline)
74                 $(usex readline --disable-editline $(use_enable libedit editline))
75         )
76         if use static || use static-libs ; then
77                 myconf+=( --enable-static )
78         else
79                 myconf+=( --disable-static )
80         fi
81
82         econf "${myconf[@]}"
83
84         MAKEOPTS+=" V=1"
85 }
86
87 src_install() {
88         emake DIST_ROOT="${ED}" install
89         # parallel install fails on this target for >=xfsprogs-3.2.0
90         emake -j1 DIST_ROOT="${ED}" install-dev
91
92         # handle is for xfsdump, the rest for xfsprogs
93         gen_usr_ldscript -a handle xcmd xfs xlog frog
94         # removing unnecessary .la files if not needed
95         use static-libs || find "${ED}" -name '*.la' -delete
96 }