| 1 |
# Copyright 1999-2013 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/spl-9999.ebuild,v 1.36 2013/04/17 13:34:54 ryao Exp $ |
| 4 |
|
| 5 |
EAPI="4" |
| 6 |
AUTOTOOLS_AUTORECONF="1" |
| 7 |
|
| 8 |
inherit flag-o-matic linux-info linux-mod autotools-utils |
| 9 |
|
| 10 |
if [[ ${PV} == "9999" ]] ; then |
| 11 |
inherit git-2 |
| 12 |
EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git" |
| 13 |
else |
| 14 |
inherit eutils versionator |
| 15 |
MY_PV=$(replace_version_separator 3 '-') |
| 16 |
SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz" |
| 17 |
S="${WORKDIR}/${PN}-${PN}-${MY_PV}" |
| 18 |
KEYWORDS="~amd64" |
| 19 |
fi |
| 20 |
|
| 21 |
DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs" |
| 22 |
HOMEPAGE="http://zfsonlinux.org/" |
| 23 |
|
| 24 |
LICENSE="GPL-2" |
| 25 |
SLOT="0" |
| 26 |
IUSE="custom-cflags debug debug-log" |
| 27 |
RESTRICT="test" |
| 28 |
|
| 29 |
COMMON_DEPEND="dev-lang/perl |
| 30 |
virtual/awk" |
| 31 |
|
| 32 |
DEPEND="${COMMON_DEPEND}" |
| 33 |
|
| 34 |
RDEPEND="${COMMON_DEPEND} |
| 35 |
!sys-devel/spl" |
| 36 |
|
| 37 |
AT_M4DIR="config" |
| 38 |
AUTOTOOLS_IN_SOURCE_BUILD="1" |
| 39 |
|
| 40 |
pkg_setup() { |
| 41 |
linux-info_pkg_setup |
| 42 |
CONFIG_CHECK=" |
| 43 |
!DEBUG_LOCK_ALLOC |
| 44 |
!GRKERNSEC_HIDESYM |
| 45 |
MODULES |
| 46 |
KALLSYMS |
| 47 |
!PAX_KERNEXEC_PLUGIN_METHOD_OR |
| 48 |
ZLIB_DEFLATE |
| 49 |
ZLIB_INFLATE |
| 50 |
" |
| 51 |
|
| 52 |
kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required" |
| 53 |
|
| 54 |
[ ${PV} != "9999" ] && \ |
| 55 |
{ kernel_is le 3 9 || die "Linux 3.9 is the latest supported version."; } |
| 56 |
|
| 57 |
check_extra_config |
| 58 |
} |
| 59 |
|
| 60 |
src_prepare() { |
| 61 |
# Workaround for hard coded path |
| 62 |
sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die |
| 63 |
|
| 64 |
if [ ${PV} != "9999" ] |
| 65 |
then |
| 66 |
# Be more like FreeBSD and Illumos when handling hostids |
| 67 |
epatch "${FILESDIR}/${PN}-0.6.0_rc14-simplify-hostid-logic.patch" |
| 68 |
fi |
| 69 |
|
| 70 |
# splat is unnecessary unless we are debugging |
| 71 |
use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in" |
| 72 |
|
| 73 |
autotools-utils_src_prepare |
| 74 |
} |
| 75 |
|
| 76 |
src_configure() { |
| 77 |
use custom-cflags || strip-flags |
| 78 |
filter-ldflags -Wl,* |
| 79 |
|
| 80 |
set_arch_to_kernel |
| 81 |
local myeconfargs=( |
| 82 |
--bindir="${EPREFIX}/bin" |
| 83 |
--sbindir="${EPREFIX}/sbin" |
| 84 |
--with-config=all |
| 85 |
--with-linux="${KV_DIR}" |
| 86 |
--with-linux-obj="${KV_OUT_DIR}" |
| 87 |
$(use_enable debug) |
| 88 |
$(use_enable debug-log) |
| 89 |
) |
| 90 |
autotools-utils_src_configure |
| 91 |
} |
| 92 |
|
| 93 |
src_install() { |
| 94 |
autotools-utils_src_install |
| 95 |
dodoc AUTHORS DISCLAIMER README.markdown |
| 96 |
} |
| 97 |
|
| 98 |
pkg_postinst() { |
| 99 |
linux-mod_pkg_postinst |
| 100 |
|
| 101 |
# Remove old modules |
| 102 |
if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ] |
| 103 |
then |
| 104 |
ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl" |
| 105 |
ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl" |
| 106 |
ewarn "Automatically removing old modules to avoid problems." |
| 107 |
rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules" |
| 108 |
rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon" |
| 109 |
fi |
| 110 |
} |