1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 if [ ${PV} == "9999" ]; then
7 AUTOTOOLS_AUTORECONF="1"
8 EGIT_REPO_URI="https://github.com/zfsonlinux/zfs.git"
11 SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-${PV}/zfs-${PV}.tar.gz"
12 S="${WORKDIR}/zfs-${PV}"
16 inherit flag-o-matic linux-info linux-mod toolchain-funcs autotools-utils
18 DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
19 HOMEPAGE="https://zfsonlinux.org/"
21 LICENSE="CDDL debug? ( GPL-2+ )"
23 IUSE="custom-cflags debug +rootfs"
24 RESTRICT="debug? ( strip ) test"
27 =sys-kernel/spl-${PV}*
37 AUTOTOOLS_IN_SOURCE_BUILD="1"
39 DOCS=( AUTHORS COPYRIGHT DISCLAIMER README.markdown )
47 !PAX_KERNEXEC_PLUGIN_METHOD_OR
53 use debug && CONFIG_CHECK="${CONFIG_CHECK}
60 CONFIG_CHECK="${CONFIG_CHECK}
65 kernel_is lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
67 kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required"
69 [ ${PV} != "9999" ] && \
70 { kernel_is le 5 0 || die "Linux 5.0 is the latest supported version."; }
76 # Remove GPLv2-licensed ZPIOS unless we are debugging
77 use debug || sed -e 's/^subdir-m += zpios$//' -i "${S}/module/Makefile.in"
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"; }
83 autotools-utils_src_prepare
87 local SPL_PATH="$(basename $(echo "${EROOT}usr/src/spl-"*))"
88 use custom-cflags || strip-flags
92 local myeconfargs=(${myeconfargs}
93 --bindir="${EPREFIX}/bin"
94 --sbindir="${EPREFIX}/sbin"
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}"
103 autotools-utils_src_configure
107 autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
111 linux-mod_pkg_postinst
114 if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/zfs" ]
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"
123 if use x86 || use arm
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."
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 "
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"
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."