dev-util/ccache: arm64 stable (bug #725006)
[gentoo.git] / sys-fs / e2fsprogs / e2fsprogs-1.45.6.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 systemd toolchain-funcs udev usr-ldscript
7
8 DESCRIPTION="Standard EXT2/EXT3/EXT4 filesystem utilities"
9 HOMEPAGE="http://e2fsprogs.sourceforge.net/"
10 SRC_URI="mirror://sourceforge/e2fsprogs/${P}.tar.xz
11         https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v${PV}/${P}.tar.xz
12         elibc_mintlib? ( mirror://gentoo/${PN}-1.42.9-mint-r1.patch.xz )"
13
14 LICENSE="GPL-2 BSD"
15 SLOT="0"
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~m68k-mint"
17 IUSE="cron fuse nls static-libs elibc_FreeBSD"
18
19 RDEPEND="~sys-libs/${PN}-libs-${PV}
20         >=sys-apps/util-linux-2.16
21         cron? ( sys-fs/lvm2[-device-mapper-only(-)] )
22         fuse? ( sys-fs/fuse:0 )
23         nls? ( virtual/libintl )"
24 DEPEND="${RDEPEND}"
25 BDEPEND="
26         nls? ( sys-devel/gettext )
27         virtual/pkgconfig
28         sys-apps/texinfo
29 "
30
31 PATCHES=(
32         "${FILESDIR}"/${PN}-1.40-fbsd.patch
33         "${FILESDIR}"/${PN}-1.42.13-fix-build-cflags.patch #516854
34
35         # Upstream patches (can usually removed with next version bump)
36 )
37
38 src_prepare() {
39         if [[ ${CHOST} == *-mint* ]] ; then
40                 PATCHES+=( "${WORKDIR}"/${PN}-1.42.9-mint-r1.patch )
41         fi
42
43         default
44
45         cp doc/RelNotes/v${PV}.txt ChangeLog || die "Failed to copy Release Notes"
46
47         # Get rid of doc -- we don't use them. This also prevents a sandbox
48         # violation due to mktexfmt invocation
49         rm -r doc || die "Failed to remove doc dir"
50
51         # blargh ... trick e2fsprogs into using e2fsprogs-libs
52         sed -i -r \
53                 -e 's:@LIBINTL@:@LTLIBINTL@:' \
54                 -e '/^(STATIC_)?LIB(COM_ERR|SS)/s:[$][(]LIB[)]/lib([^@]*)@(STATIC_)?LIB_EXT@:-l\1:' \
55                 -e '/^DEP(STATIC_)?LIB(COM_ERR|SS)/s:=.*:=:' \
56                 MCONFIG.in || die "muck libs" #122368
57         sed -i -r \
58                 -e '/^LIB_SUBDIRS/s:lib/(et|ss)::g' \
59                 Makefile.in || die "remove subdirs"
60         ln -s $(which mk_cmds) lib/ss/ || die
61
62         # Avoid rebuild
63         echo '#include_next <ss/ss_err.h>' > lib/ss/ss_err.h
64 }
65
66 src_configure() {
67         # Keep the package from doing silly things #261411
68         export VARTEXFONTS="${T}/fonts"
69
70         # needs open64() prototypes and friends
71         append-cppflags -D_GNU_SOURCE
72
73         local myeconfargs=(
74                 --with-root-prefix="${EPREFIX}"
75                 $(use_with cron crond-dir "${EPREFIX}/etc/cron.d")
76                 --with-systemd-unit-dir="$(systemd_get_systemunitdir)"
77                 --with-udev-rules-dir="${EPREFIX}$(get_udevdir)/rules.d"
78                 --enable-symlink-install
79                 --enable-elf-shlibs
80                 $(tc-has-tls || echo --disable-tls)
81                 --without-included-gettext
82                 $(use_enable fuse fuse2fs)
83                 $(use_enable nls)
84                 --disable-libblkid
85                 --disable-libuuid
86                 --disable-fsck
87                 --disable-uuidd
88         )
89         ac_cv_path_LDCONFIG=: econf "${myeconfargs[@]}"
90
91         if [[ ${CHOST} != *-uclibc ]] && grep -qs 'USE_INCLUDED_LIBINTL.*yes' config.{log,status} ; then
92                 eerror "INTL sanity check failed, aborting build."
93                 eerror "Please post your ${S}/config.log file as an"
94                 eerror "attachment to https://bugs.gentoo.org/show_bug.cgi?id=81096"
95                 die "Preventing included intl cruft from building"
96         fi
97 }
98
99 src_compile() {
100         emake V=1 COMPILE_ET=compile_et MK_CMDS=mk_cmds
101
102         # Build the FreeBSD helper
103         if use elibc_FreeBSD ; then
104                 cp "${FILESDIR}"/fsck_ext2fs.c .
105                 emake V=1 fsck_ext2fs
106         fi
107 }
108
109 src_install() {
110         # need to set root_libdir= manually as any --libdir options in the
111         # econf above (i.e. multilib) will screw up the default #276465
112         emake \
113                 STRIP=: \
114                 root_libdir="${EPREFIX}/usr/$(get_libdir)" \
115                 DESTDIR="${D}" \
116                 install
117
118         einstalldocs
119
120         insinto /etc
121         doins "${FILESDIR}"/e2fsck.conf
122
123         # Move shared libraries to /lib/, install static libraries to
124         # /usr/lib/, and install linker scripts to /usr/lib/.
125         gen_usr_ldscript -a e2p ext2fs
126
127         # configure doesn't have an option to disable static libs :/
128         if ! use static-libs ; then
129                 find "${ED}" -name '*.a' -delete || die
130         fi
131
132         if use elibc_FreeBSD ; then
133                 # Install helpers for us
134                 into /
135                 dosbin "${S}"/fsck_ext2fs
136                 doman "${FILESDIR}"/fsck_ext2fs.8
137
138                 # filefrag is linux only
139                 rm \
140                         "${ED}"/usr/sbin/filefrag \
141                         "${ED}"/usr/share/man/man8/filefrag.8 || die
142         fi
143 }