add zfs 0.7 snapshot
[portage-squeep] / sys-fs / zfs-kmod / zfs-kmod-0.7.13.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5
6 if [ ${PV} == "9999" ]; then
7 AUTOTOOLS_AUTORECONF="1"
8 EGIT_REPO_URI="https://github.com/zfsonlinux/zfs.git"
9 inherit git-r3
10 else
11 SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-${PV}/zfs-${PV}.tar.gz"
12 S="${WORKDIR}/zfs-${PV}"
13 KEYWORDS="amd64"
14 fi
15
16 inherit flag-o-matic linux-info linux-mod toolchain-funcs autotools-utils
17
18 DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
19 HOMEPAGE="https://zfsonlinux.org/"
20
21 LICENSE="CDDL debug? ( GPL-2+ )"
22 SLOT="0"
23 IUSE="custom-cflags debug +rootfs"
24 RESTRICT="debug? ( strip ) test"
25
26 DEPEND="
27 =sys-kernel/spl-${PV}*
28 dev-lang/perl
29 virtual/awk
30 "
31
32 RDEPEND="${DEPEND}
33 !sys-fs/zfs-fuse
34 "
35
36 AT_M4DIR="config"
37 AUTOTOOLS_IN_SOURCE_BUILD="1"
38
39 DOCS=( AUTHORS COPYRIGHT DISCLAIMER README.markdown )
40
41 pkg_setup() {
42 linux-info_pkg_setup
43 CONFIG_CHECK="
44 !DEBUG_LOCK_ALLOC
45 EFI_PARTITION
46 MODULES
47 !PAX_KERNEXEC_PLUGIN_METHOD_OR
48 !TRIM_UNUSED_KSYMS
49 ZLIB_DEFLATE
50 ZLIB_INFLATE
51 "
52
53 use debug && CONFIG_CHECK="${CONFIG_CHECK}
54 FRAME_POINTER
55 DEBUG_INFO
56 !DEBUG_INFO_REDUCED
57 "
58
59 use rootfs && \
60 CONFIG_CHECK="${CONFIG_CHECK}
61 BLK_DEV_INITRD
62 DEVTMPFS
63 "
64
65 kernel_is lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
66
67 kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required"
68
69 [ ${PV} != "9999" ] && \
70 { kernel_is le 5 0 || die "Linux 5.0 is the latest supported version."; }
71
72 check_extra_config
73 }
74
75 src_prepare() {
76 # Remove GPLv2-licensed ZPIOS unless we are debugging
77 use debug || sed -e 's/^subdir-m += zpios$//' -i "${S}/module/Makefile.in"
78
79 # Set module revision number
80 [ ${PV} != "9999" ] && \
81 { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
82
83 autotools-utils_src_prepare
84 }
85
86 src_configure() {
87 local SPL_PATH="$(basename $(echo "${EROOT}usr/src/spl-"*))"
88 use custom-cflags || strip-flags
89 filter-ldflags -Wl,*
90
91 set_arch_to_kernel
92 local myeconfargs=(${myeconfargs}
93 --bindir="${EPREFIX}/bin"
94 --sbindir="${EPREFIX}/sbin"
95 --with-config=kernel
96 --with-linux="${KV_DIR}"
97 --with-linux-obj="${KV_OUT_DIR}"
98 --with-spl="${EROOT}usr/src/${SPL_PATH}"
99 --with-spl-obj="${EROOT}usr/src/${SPL_PATH}/${KV_FULL}"
100 $(use_enable debug)
101 )
102
103 autotools-utils_src_configure
104 }
105
106 src_install() {
107 autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
108 }
109
110 pkg_postinst() {
111 linux-mod_pkg_postinst
112
113 # Remove old modules
114 if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/zfs" ]
115 then
116 ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/zfs"
117 ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/zfs"
118 ewarn "Automatically removing old modules to avoid problems."
119 rm -r "${EROOT}lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
120 rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
121 fi
122
123 if use x86 || use arm
124 then
125 ewarn "32-bit kernels will likely require increasing vmalloc to"
126 ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
127 fi
128
129 ewarn "This version of ZFSOnLinux includes support for new feature flags"
130 ewarn "that are incompatible with previous versions. GRUB2 support for"
131 ewarn "/boot with the new feature flags is not yet available."
132 ewarn "Do *NOT* upgrade root pools to use the new feature flags."
133 ewarn "Any new pools will be created with the new feature flags by default"
134 ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
135 ewarn "create a newpool that is backward compatible wih GRUB2, use "
136 ewarn
137 ewarn "zpool create -d -o feature@async_destroy=enabled "
138 ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
139 ewarn " -o feature@spacemap_histogram=enabled"
140 ewarn " -o feature@enabled_txg=enabled "
141 ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled"
142 ewarn " ..."
143 ewarn
144 ewarn "GRUB2 support will be updated as soon as either the GRUB2"
145 ewarn "developers do a tag or the Gentoo developers find time to backport"
146 ewarn "support from GRUB2 HEAD."
147 }