sys-fs/xfsprogs: ia64 stable wrt bug #704336
[gentoo.git] / sys-fs / xfsprogs / xfsprogs-5.4.0.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit flag-o-matic toolchain-funcs systemd usr-ldscript
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"
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 BDEPEND="
25         nls? ( sys-devel/gettext )
26 "
27
28 PATCHES=(
29         "${FILESDIR}"/${PN}-4.15.0-docdir.patch
30         "${FILESDIR}"/${PN}-5.3.0-libdir.patch
31 )
32
33 pkg_setup() {
34         if use readline && use libedit ; then
35                 ewarn "You have USE='readline libedit' but these are exclusive."
36                 ewarn "Defaulting to readline; please disable this USE flag if you want libedit."
37         fi
38 }
39
40 src_prepare() {
41         default
42
43         # Fix doc dir
44         sed -i \
45                 -e "/^PKG_DOC_DIR/s:@pkg_name@:${PF}:" \
46                 include/builddefs.in || die
47
48         # Don't install compressed docs
49         sed 's@\(CHANGES\)\.gz[[:space:]]@\1 @' -i doc/Makefile || die
50 }
51
52 src_configure() {
53         # include/builddefs.in will add FCFLAGS to CFLAGS which will
54         # unnecessarily clutter CFLAGS (and fortran isn't used)
55         unset FCFLAGS
56
57         export DEBUG=-DNDEBUG
58
59         # Package is honoring CFLAGS; No need to use OPTIMIZER anymore.
60         # However, we have to provide an empty value to avoid default
61         # flags.
62         export OPTIMIZER=" "
63
64         unset PLATFORM # if set in user env, this breaks configure
65
66         # Upstream does NOT support --disable-static anymore,
67         # https://www.spinics.net/lists/linux-xfs/msg30185.html
68         # https://www.spinics.net/lists/linux-xfs/msg30272.html
69         local myconf=(
70                 --enable-blkid
71                 --with-crond-dir="${EPREFIX}/etc/cron.d"
72                 --with-systemd-unit-dir="$(systemd_get_systemunitdir)"
73                 $(use_enable icu libicu)
74                 $(use_enable nls gettext)
75                 $(use_enable readline)
76                 $(usex readline --disable-editline $(use_enable libedit editline))
77         )
78
79         if is-flagq -fno-lto ; then
80                 einfo "LTO disabled via {C,CXX,F,FC}FLAGS"
81                 myconf+=( --disable-lto )
82         else
83                 if is-flagq -flto ; then
84                         einfo "LTO forced via {C,CXX,F,FC}FLAGS"
85                         myconf+=( --enable-lto )
86                 elif use amd64 || use x86  ; then
87                         # match upstream default
88                         myconf+=( --enable-lto )
89                 else
90                         # LTO can cause problems on some architectures, bug 655638
91                         myconf+=( --disable-lto )
92                 fi
93         fi
94
95         econf "${myconf[@]}"
96 }
97
98 src_compile() {
99         emake V=1
100 }
101
102 src_install() {
103         emake DIST_ROOT="${ED}" install
104         emake DIST_ROOT="${ED}" install-dev
105
106         gen_usr_ldscript -a handle
107 }