| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-0.6.0_rc9-r3.ebuild,v 1.1 2012/06/25 21:03:27 ryao Exp $ |
| 4 |
|
| 5 |
EAPI="4" |
| 6 |
|
| 7 |
AT_M4DIR="config" |
| 8 |
AUTOTOOLS_AUTORECONF="1" |
| 9 |
AUTOTOOLS_IN_SOURCE_BUILD="1" |
| 10 |
|
| 11 |
inherit flag-o-matic linux-mod toolchain-funcs autotools-utils |
| 12 |
|
| 13 |
if [ ${PV} == "9999" ] ; then |
| 14 |
inherit git-2 |
| 15 |
EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git" |
| 16 |
else |
| 17 |
inherit eutils versionator |
| 18 |
MY_PV=$(replace_version_separator 3 '-') |
| 19 |
SRC_URI="https://github.com/downloads/zfsonlinux/${PN}/${PN}-${MY_PV}.tar.gz" |
| 20 |
S="${WORKDIR}/${PN}-${MY_PV}" |
| 21 |
KEYWORDS="~amd64" |
| 22 |
fi |
| 23 |
|
| 24 |
DESCRIPTION="Native ZFS for Linux" |
| 25 |
HOMEPAGE="http://zfsonlinux.org/" |
| 26 |
|
| 27 |
LICENSE="CDDL GPL-2" |
| 28 |
SLOT="0" |
| 29 |
IUSE="custom-cflags debug dracut +rootfs test test-suite static-libs" |
| 30 |
|
| 31 |
DEPEND=" |
| 32 |
=sys-kernel/spl-${PV}* |
| 33 |
sys-apps/util-linux[static-libs?] |
| 34 |
sys-libs/zlib[static-libs(+)?] |
| 35 |
" |
| 36 |
RDEPEND="${DEPEND} |
| 37 |
!sys-fs/zfs-fuse |
| 38 |
!prefix? ( sys-fs/udev ) |
| 39 |
test-suite? ( |
| 40 |
sys-apps/gawk |
| 41 |
sys-apps/util-linux |
| 42 |
sys-devel/bc |
| 43 |
sys-block/parted |
| 44 |
sys-fs/lsscsi |
| 45 |
sys-fs/mdadm |
| 46 |
sys-process/procps |
| 47 |
virtual/modutils |
| 48 |
) |
| 49 |
rootfs? ( |
| 50 |
app-arch/cpio |
| 51 |
app-misc/pax-utils |
| 52 |
) |
| 53 |
" |
| 54 |
DEPEND+=" |
| 55 |
test? ( sys-fs/mdadm ) |
| 56 |
" |
| 57 |
|
| 58 |
pkg_setup() { |
| 59 |
CONFIG_CHECK="!DEBUG_LOCK_ALLOC |
| 60 |
!PREEMPT |
| 61 |
!PREEMPT_VOLUNTARY |
| 62 |
BLK_DEV_LOOP |
| 63 |
EFI_PARTITION |
| 64 |
MODULES |
| 65 |
ZLIB_DEFLATE |
| 66 |
ZLIB_INFLATE" |
| 67 |
use rootfs && \ |
| 68 |
CONFIG_CHECK="${CONFIG_CHECK} BLK_DEV_INITRD |
| 69 |
DEVTMPFS" |
| 70 |
kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required" |
| 71 |
check_extra_config |
| 72 |
} |
| 73 |
|
| 74 |
src_prepare() { |
| 75 |
# Workaround for hard coded path |
| 76 |
sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/common.sh.in || die |
| 77 |
# Workaround rename |
| 78 |
sed -i "s|/usr/bin/scsi-rescan|/usr/sbin/rescan-scsi-bus|" scripts/common.sh.in || die |
| 79 |
|
| 80 |
if [ ${PV} != "9999" ] |
| 81 |
then |
| 82 |
epatch "${FILESDIR}/${P}-hardened-support.patch" |
| 83 |
|
| 84 |
# Fix various deadlocks |
| 85 |
epatch "${FILESDIR}/${P}-use-pushpage.patch" |
| 86 |
epatch "${FILESDIR}/${P}-remove-pfmalloc-1-of-3.patch" |
| 87 |
epatch "${FILESDIR}/${P}-remove-pfmalloc-2-of-3.patch" |
| 88 |
epatch "${FILESDIR}/${P}-remove-pfmalloc-3-of-3.patch" |
| 89 |
epatch "${FILESDIR}/${P}-range-lock-caller-allocate.patch" |
| 90 |
fi |
| 91 |
|
| 92 |
autotools-utils_src_prepare |
| 93 |
} |
| 94 |
|
| 95 |
src_configure() { |
| 96 |
use custom-cflags || strip-flags |
| 97 |
set_arch_to_kernel |
| 98 |
local myeconfargs=( |
| 99 |
--bindir="${EPREFIX}/bin" |
| 100 |
--sbindir="${EPREFIX}/sbin" |
| 101 |
--with-config=all |
| 102 |
--with-linux="${KV_DIR}" |
| 103 |
--with-linux-obj="${KV_OUT_DIR}" |
| 104 |
--with-udevdir="${EPREFIX}/lib/udev" |
| 105 |
$(use_enable debug) |
| 106 |
) |
| 107 |
autotools-utils_src_configure |
| 108 |
} |
| 109 |
|
| 110 |
src_test() { |
| 111 |
if [ $UID -ne 0 ] |
| 112 |
then |
| 113 |
ewarn "Cannot run make check tests with FEATURES=userpriv." |
| 114 |
ewarn "Skipping make check tests." |
| 115 |
else |
| 116 |
autotools-utils_src_test |
| 117 |
fi |
| 118 |
} |
| 119 |
|
| 120 |
src_install() { |
| 121 |
autotools-utils_src_install |
| 122 |
gen_usr_ldscript -a uutil nvpair zpool zfs |
| 123 |
use dracut || rm -rf "${ED}usr/share/dracut" |
| 124 |
use test-suite || rm -rf "${ED}usr/libexec" |
| 125 |
|
| 126 |
if use rootfs |
| 127 |
then |
| 128 |
doinitd "${FILESDIR}/zfs-shutdown" |
| 129 |
exeinto /usr/share/zfs |
| 130 |
doexe "${FILESDIR}/linuxrc" |
| 131 |
fi |
| 132 |
|
| 133 |
} |
| 134 |
|
| 135 |
pkg_postinst() { |
| 136 |
linux-mod_pkg_postinst |
| 137 |
|
| 138 |
use x86 && ewarn "32-bit kernels are unsupported by ZFSOnLinux upstream. Do not file bug reports." |
| 139 |
|
| 140 |
[ -e "${EROOT}/etc/runlevels/boot/zfs" ] \ |
| 141 |
|| ewarn 'You should add zfs to the boot runlevel.' |
| 142 |
|
| 143 |
use rootfs && ([ -e "${EROOT}/etc/runlevels/shutdown/zfs-shutdown" ] \ |
| 144 |
|| ewarn 'You should add zfs-shutdown to the shutdown runlevel.') |
| 145 |
|
| 146 |
} |