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