Merge github#363: sys-process/atop: add systemd support
[gentoo.git] / app-crypt / loop-aes-losetup / loop-aes-losetup-2.26.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 inherit eutils toolchain-funcs libtool flag-o-matic
8
9 MY_PV="${PV/_/-}"
10 MY_P="util-linux-${MY_PV}"
11 LOOPAES_PV="${PV}-20150310"
12 S="${WORKDIR}/${MY_P}"
13
14 DESCRIPTION="Various useful Linux utilities"
15 HOMEPAGE="https://www.kernel.org/pub/linux/utils/util-linux/"
16 SRC_URI="mirror://kernel/linux/utils/util-linux/v${PV:0:4}/${MY_P}.tar.xz
17         http://loop-aes.sourceforge.net/updates/util-linux-${LOOPAES_PV}.diff.bz2"
18 KEYWORDS="~amd64 ~arm ~hppa ~ppc ~sparc ~x86"
19
20 LICENSE="GPL-2 LGPL-2.1 BSD-4 MIT public-domain"
21 SLOT="0"
22 IUSE="nls selinux static"
23
24 RDEPEND="selinux? ( sys-libs/libselinux )"
25 DEPEND="${RDEPEND}
26         nls? ( sys-devel/gettext )
27         virtual/os-headers"
28
29 src_prepare() {
30         epatch "${WORKDIR}"/util-linux-*.diff
31         elibtoolize
32 }
33
34 lfs_fallocate_test() {
35         # Make sure we can use fallocate with LFS #300307
36         cat <<-EOF > "${T}"/fallocate.${ABI}.c
37                 #define _GNU_SOURCE
38                 #include <fcntl.h>
39                 main() { return fallocate(0, 0, 0, 0); }
40         EOF
41         append-lfs-flags
42         $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} "${T}"/fallocate.${ABI}.c -o /dev/null >/dev/null 2>&1 \
43                 || export ac_cv_func_fallocate=no
44         rm -f "${T}"/fallocate.${ABI}.c
45 }
46
47 src_configure() {
48         lfs_fallocate_test
49         # The scanf test in a run-time test which fails while cross-compiling.
50         # Blindly assume a POSIX setup since we require libmount, and libmount
51         # itself fails when the scanf test fails. #531856
52         tc-is-cross-compiler && export scanf_cv_alloc_modifier=ms
53         # We manually set --libdir to the default since on prefix, econf will set it to
54         # a value which the configure script does not recognize.  This makes it set the
55         # usrlib_execdir to a bad value. bug #518898#c2, fixed upstream for >2.25
56         ECONF_SOURCE=${S} \
57         econf \
58                 --libdir='${prefix}/'"$(get_libdir)" \
59                 --disable-all-programs \
60                 --enable-libsmartcols \
61                 --enable-losetup \
62                 --without-ncurses \
63                 --without-udev \
64                 $(use_enable nls) \
65                 $(use_with selinux) \
66                 $(tc-has-tls || echo --disable-tls) \
67                 $(use static && echo --enable-static-programs=losetup)
68 }
69
70 src_install() {
71         emake install DESTDIR="${T}/root"
72         newsbin "${T}/root/sbin/losetup" loop-aes-losetup
73         use static && newsbin "${T}/root/bin/losetup.static" loop-aes-losetup.static
74 }