| 1 |
ryao |
1.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-r2.ebuild,v 1.1 2012/06/25 20:21:55 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 && CONFIG_CHECK="${CONFIG_CHECK} DEVTMPFS"
|
| 68 |
|
|
kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
|
| 69 |
|
|
check_extra_config
|
| 70 |
|
|
}
|
| 71 |
|
|
|
| 72 |
|
|
src_prepare() {
|
| 73 |
|
|
# Workaround for hard coded path
|
| 74 |
|
|
sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/common.sh.in || die
|
| 75 |
|
|
# Workaround rename
|
| 76 |
|
|
sed -i "s|/usr/bin/scsi-rescan|/usr/sbin/rescan-scsi-bus|" scripts/common.sh.in || die
|
| 77 |
|
|
|
| 78 |
|
|
if [ ${PV} != "9999" ]
|
| 79 |
|
|
then
|
| 80 |
|
|
epatch "${FILESDIR}/${P}-hardened-support.patch"
|
| 81 |
|
|
|
| 82 |
|
|
# Fix various deadlocks
|
| 83 |
|
|
epatch "${FILESDIR}/${P}-use-pushpage.patch"
|
| 84 |
|
|
epatch "${FILESDIR}/${P}-remove-pfmalloc-1-of-3.patch"
|
| 85 |
|
|
epatch "${FILESDIR}/${P}-remove-pfmalloc-2-of-3.patch"
|
| 86 |
|
|
epatch "${FILESDIR}/${P}-remove-pfmalloc-3-of-3.patch"
|
| 87 |
|
|
epatch "${FILESDIR}/${P}-range-lock-caller-allocate.patch"
|
| 88 |
|
|
fi
|
| 89 |
|
|
|
| 90 |
|
|
autotools-utils_src_prepare
|
| 91 |
|
|
}
|
| 92 |
|
|
|
| 93 |
|
|
src_configure() {
|
| 94 |
|
|
use custom-cflags || strip-flags
|
| 95 |
|
|
set_arch_to_kernel
|
| 96 |
|
|
local myeconfargs=(
|
| 97 |
|
|
--bindir="${EPREFIX}/bin"
|
| 98 |
|
|
--sbindir="${EPREFIX}/sbin"
|
| 99 |
|
|
--with-config=all
|
| 100 |
|
|
--with-linux="${KV_DIR}"
|
| 101 |
|
|
--with-linux-obj="${KV_OUT_DIR}"
|
| 102 |
|
|
--with-udevdir="${EPREFIX}/lib/udev"
|
| 103 |
|
|
$(use_enable debug)
|
| 104 |
|
|
)
|
| 105 |
|
|
autotools-utils_src_configure
|
| 106 |
|
|
}
|
| 107 |
|
|
|
| 108 |
|
|
src_test() {
|
| 109 |
|
|
if [ $UID -ne 0 ]
|
| 110 |
|
|
then
|
| 111 |
|
|
ewarn "Cannot run make check tests with FEATURES=userpriv."
|
| 112 |
|
|
ewarn "Skipping make check tests."
|
| 113 |
|
|
else
|
| 114 |
|
|
autotools-utils_src_test
|
| 115 |
|
|
fi
|
| 116 |
|
|
}
|
| 117 |
|
|
|
| 118 |
|
|
src_install() {
|
| 119 |
|
|
autotools-utils_src_install
|
| 120 |
|
|
gen_usr_ldscript -a uutil nvpair zpool zfs
|
| 121 |
|
|
use dracut || rm -rf "${ED}usr/share/dracut"
|
| 122 |
|
|
use test-suite || rm -rf "${ED}usr/libexec"
|
| 123 |
|
|
|
| 124 |
|
|
if use rootfs
|
| 125 |
|
|
then
|
| 126 |
|
|
doinitd "${FILESDIR}/zfs-shutdown"
|
| 127 |
|
|
exeinto /usr/share/zfs
|
| 128 |
|
|
doexe "${FILESDIR}/linuxrc"
|
| 129 |
|
|
fi
|
| 130 |
|
|
|
| 131 |
|
|
}
|
| 132 |
|
|
|
| 133 |
|
|
pkg_postinst() {
|
| 134 |
|
|
linux-mod_pkg_postinst
|
| 135 |
|
|
|
| 136 |
|
|
use x86 && ewarn "32-bit kernels are unsupported by ZFSOnLinux upstream. Do not file bug reports."
|
| 137 |
|
|
|
| 138 |
|
|
[ -e "${EROOT}/etc/runlevels/boot/zfs" ] \
|
| 139 |
|
|
|| ewarn 'You should add zfs to the boot runlevel.'
|
| 140 |
|
|
|
| 141 |
|
|
use rootfs && ([ -e "${EROOT}/etc/runlevels/shutdown/zfs-shutdown" ] \
|
| 142 |
|
|
|| ewarn 'You should add zfs-shutdown to the shutdown runlevel.')
|
| 143 |
|
|
|
| 144 |
|
|
}
|