Use https by default
[gentoo.git] / sys-fs / zfs-kmod / zfs-kmod-0.6.3-r1.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
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-info linux-mod toolchain-funcs autotools-utils
12
13 if [ ${PV} == "9999" ] ; then
14         inherit git-2
15         EGIT_REPO_URI="https://github.com/zfsonlinux/zfs.git"
16 else
17         inherit eutils versionator
18         SRC_URI="https://github.com/zfsonlinux/zfs/archive/zfs-${PV}.tar.gz
19                 https://dev.gentoo.org/~ryao/dist/zfs-${PV}-patches-${PR}.tar.xz"
20         S="${WORKDIR}/zfs-zfs-${PV}"
21         KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
22 fi
23
24 DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
25 HOMEPAGE="http://zfsonlinux.org/"
26
27 LICENSE="CDDL debug? ( GPL-2+ )"
28 SLOT="0"
29 IUSE="custom-cflags debug +rootfs"
30 RESTRICT="debug? ( strip ) test"
31
32 DEPEND="
33         =sys-kernel/spl-${PV}*
34         dev-lang/perl
35         virtual/awk
36 "
37
38 RDEPEND="${DEPEND}
39         !sys-fs/zfs-fuse
40 "
41
42 pkg_setup() {
43         linux-info_pkg_setup
44         CONFIG_CHECK="!DEBUG_LOCK_ALLOC
45                 BLK_DEV_LOOP
46                 EFI_PARTITION
47                 IOSCHED_NOOP
48                 MODULES
49                 !PAX_KERNEXEC_PLUGIN_METHOD_OR
50                 !PAX_RANDKSTACK
51                 !PAX_USERCOPY_SLABS
52                 ZLIB_DEFLATE
53                 ZLIB_INFLATE
54         "
55
56         use debug && CONFIG_CHECK="${CONFIG_CHECK}
57                 FRAME_POINTER
58                 DEBUG_INFO
59                 !DEBUG_INFO_REDUCED
60         "
61
62         use rootfs && \
63                 CONFIG_CHECK="${CONFIG_CHECK}
64                         BLK_DEV_INITRD
65                         DEVTMPFS
66         "
67
68         kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
69
70         [ ${PV} != "9999" ] && \
71                 { kernel_is le 3 17 || die "Linux 3.17 is the latest supported version."; }
72
73         check_extra_config
74 }
75
76 src_prepare() {
77         if [ ${PV} != "9999" ]
78         then
79                 # Apply patch set
80                 EPATCH_SUFFIX="patch" \
81                 EPATCH_FORCE="yes" \
82                 epatch "${WORKDIR}/zfs-${PV}-patches"
83         fi
84
85         # Remove GPLv2-licensed ZPIOS unless we are debugging
86         use debug || sed -e 's/^subdir-m += zpios$//' -i "${S}/module/Makefile.in"
87
88         # Set module revision number
89         [ ${PV} != "9999" ] && \
90                 { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
91
92         autotools-utils_src_prepare
93 }
94
95 src_configure() {
96         local SPL_PATH="$(basename $(echo "${EROOT}usr/src/spl-"*))"
97         use custom-cflags || strip-flags
98         filter-ldflags -Wl,*
99
100         set_arch_to_kernel
101         local myeconfargs=(${myeconfargs}
102                 --bindir="${EPREFIX}/bin"
103                 --sbindir="${EPREFIX}/sbin"
104                 --with-config=kernel
105                 --with-linux="${KV_DIR}"
106                 --with-linux-obj="${KV_OUT_DIR}"
107                 --with-spl="${EROOT}usr/src/${SPL_PATH}"
108                 --with-spl-obj="${EROOT}usr/src/${SPL_PATH}/${KV_FULL}"
109                 $(use_enable debug)
110         )
111
112         autotools-utils_src_configure
113 }
114
115 src_install() {
116         autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
117         dodoc AUTHORS COPYRIGHT DISCLAIMER README.markdown
118 }
119
120 pkg_postinst() {
121         linux-mod_pkg_postinst
122
123         # Remove old modules
124         if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/zfs" ]
125         then
126                 ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/zfs"
127                 ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/zfs"
128                 ewarn "Automatically removing old modules to avoid problems."
129                 rm -r "${EROOT}lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
130                 rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
131         fi
132
133         if use x86 || use arm
134         then
135                 ewarn "32-bit kernels will likely require increasing vmalloc to"
136                 ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
137         fi
138
139         ewarn "This version of ZFSOnLinux includes support for features flags."
140         ewarn "If you upgrade your pools to make use of feature flags, you will lose"
141         ewarn "the ability to import them using older versions of ZFSOnLinux."
142         ewarn "Any new pools will be created with feature flag support and will"
143         ewarn "not be compatible with older versions of ZFSOnLinux. To create a new"
144         ewarn "pool that is backward compatible, use zpool create -o version=28 ..."
145 }