1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit flag-o-matic systemd toolchain-funcs udev usr-ldscript
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 )"
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"
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 )"
26 nls? ( sys-devel/gettext )
32 "${FILESDIR}"/${PN}-1.40-fbsd.patch
33 "${FILESDIR}"/${PN}-1.42.13-fix-build-cflags.patch #516854
35 # Upstream patches (can usually removed with next version bump)
39 if [[ ${CHOST} == *-mint* ]] ; then
40 PATCHES+=( "${WORKDIR}"/${PN}-1.42.9-mint-r1.patch )
45 cp doc/RelNotes/v${PV}.txt ChangeLog || die "Failed to copy Release Notes"
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"
51 # blargh ... trick e2fsprogs into using e2fsprogs-libs
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
58 -e '/^LIB_SUBDIRS/s:lib/(et|ss)::g' \
59 Makefile.in || die "remove subdirs"
60 ln -s $(which mk_cmds) lib/ss/ || die
63 echo '#include_next <ss/ss_err.h>' > lib/ss/ss_err.h
67 # Keep the package from doing silly things #261411
68 export VARTEXFONTS="${T}/fonts"
70 # needs open64() prototypes and friends
71 append-cppflags -D_GNU_SOURCE
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
80 $(tc-has-tls || echo --disable-tls)
81 --without-included-gettext
82 $(use_enable fuse fuse2fs)
89 ac_cv_path_LDCONFIG=: econf "${myeconfargs[@]}"
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"
100 emake V=1 COMPILE_ET=compile_et MK_CMDS=mk_cmds
102 # Build the FreeBSD helper
103 if use elibc_FreeBSD ; then
104 cp "${FILESDIR}"/fsck_ext2fs.c .
105 emake V=1 fsck_ext2fs
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
114 root_libdir="${EPREFIX}/usr/$(get_libdir)" \
121 doins "${FILESDIR}"/e2fsck.conf
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
127 # configure doesn't have an option to disable static libs :/
128 if ! use static-libs ; then
129 find "${ED}" -name '*.a' -delete || die
132 if use elibc_FreeBSD ; then
133 # Install helpers for us
135 dosbin "${S}"/fsck_ext2fs
136 doman "${FILESDIR}"/fsck_ext2fs.8
138 # filefrag is linux only
140 "${ED}"/usr/sbin/filefrag \
141 "${ED}"/usr/share/man/man8/filefrag.8 || die