3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs
|
|
6 |
inherit autotools dist-kernel-utils flag-o-matic linux-mod-r1 multiprocessing
|
7 |
7 |
|
8 |
8 |
DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
|
9 |
9 |
HOMEPAGE="https://github.com/openzfs/zfs"
|
10 |
10 |
|
11 |
|
if [[ ${PV} == "9999" ]]; then
|
12 |
|
inherit git-r3
|
|
11 |
MODULES_KERNEL_MAX=6.2
|
|
12 |
MODULES_KERNEL_MIN=3.10
|
|
13 |
|
|
14 |
if [[ ${PV} == 9999 ]] ; then
|
13 |
15 |
EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
|
|
16 |
inherit git-r3
|
|
17 |
unset MODULES_KERNEL_MAX
|
14 |
18 |
else
|
15 |
|
VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc
|
|
19 |
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/openzfs.asc
|
16 |
20 |
inherit verify-sig
|
17 |
21 |
|
18 |
|
MY_PV="${PV/_rc/-rc}"
|
|
22 |
MY_PV=${PV/_rc/-rc}
|
19 |
23 |
SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
|
20 |
24 |
SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
|
21 |
25 |
S="${WORKDIR}/zfs-${PV%_rc?}"
|
22 |
|
ZFS_KERNEL_COMPAT="6.2"
|
23 |
26 |
|
24 |
|
# increments minor eg 5.14 -> 5.15, and still supports override.
|
|
27 |
ZFS_KERNEL_COMPAT="${MODULES_KERNEL_MAX}"
|
|
28 |
# Increments minor eg 5.14 -> 5.15, and still supports override.
|
25 |
29 |
ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
|
26 |
30 |
ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
|
27 |
31 |
|
28 |
|
if [[ ${PV} != *_rc* ]]; then
|
29 |
|
KEYWORDS="amd64 arm64 ppc64 ~riscv ~sparc"
|
|
32 |
if [[ ${PV} != *_rc* ]] ; then
|
|
33 |
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~sparc"
|
30 |
34 |
fi
|
31 |
35 |
fi
|
32 |
36 |
|
33 |
37 |
LICENSE="CDDL MIT debug? ( GPL-2+ )"
|
34 |
38 |
SLOT="0/${PVR}"
|
35 |
39 |
IUSE="custom-cflags debug +rootfs"
|
36 |
|
|
37 |
|
RDEPEND="${DEPEND}"
|
|
40 |
RESTRICT="test"
|
38 |
41 |
|
39 |
42 |
BDEPEND="
|
40 |
43 |
dev-lang/perl
|
41 |
44 |
app-alternatives/awk
|
42 |
45 |
"
|
43 |
46 |
|
44 |
|
# we want dist-kernel block in BDEPEND because of portage resolver.
|
45 |
|
# since linux-mod.eclass already sets version-unbounded dep, portage
|
46 |
|
# will pull new versions. So we set it in BDEPEND which takes priority.
|
47 |
|
# and we don't need in in git ebuild.
|
48 |
|
if [[ ${PV} != "9999" ]] ; then
|
49 |
|
BDEPEND+="
|
50 |
|
verify-sig? ( sec-keys/openpgp-keys-openzfs )
|
51 |
|
dist-kernel? ( <virtual/dist-kernel-${ZFS_KERNEL_DEP}:= )
|
|
47 |
if [[ ${PV} != 9999 ]] ; then
|
|
48 |
BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )"
|
|
49 |
|
|
50 |
IUSE+=" +dist-kernel-cap"
|
|
51 |
RDEPEND="
|
|
52 |
dist-kernel-cap? ( dist-kernel? (
|
|
53 |
<virtual/dist-kernel-${ZFS_KERNEL_DEP}
|
|
54 |
) )
|
52 |
55 |
"
|
53 |
56 |
fi
|
54 |
57 |
|
55 |
|
# PDEPEND in this form is needed to trick portage suggest
|
56 |
|
# enabling dist-kernel if only 1 package have it set
|
|
58 |
# Used to suggest matching USE, but without suggesting to disable
|
57 |
59 |
PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
|
58 |
60 |
|
59 |
|
RESTRICT="debug? ( strip ) test"
|
60 |
|
|
61 |
|
DOCS=( AUTHORS COPYRIGHT META README.md )
|
|
61 |
PATCHES=(
|
|
62 |
"${FILESDIR}"/${PN}-2.1.11-gentoo.patch
|
|
63 |
)
|
62 |
64 |
|
63 |
65 |
pkg_pretend() {
|
64 |
66 |
use rootfs || return 0
|
... | ... | |
72 |
74 |
}
|
73 |
75 |
|
74 |
76 |
pkg_setup() {
|
75 |
|
CONFIG_CHECK="
|
76 |
|
!DEBUG_LOCK_ALLOC
|
|
77 |
local CONFIG_CHECK="
|
77 |
78 |
EFI_PARTITION
|
78 |
|
MODULES
|
79 |
|
!PAX_KERNEXEC_PLUGIN_METHOD_OR
|
80 |
|
!TRIM_UNUSED_KSYMS
|
81 |
79 |
ZLIB_DEFLATE
|
82 |
80 |
ZLIB_INFLATE
|
|
81 |
!DEBUG_LOCK_ALLOC
|
|
82 |
!PAX_KERNEXEC_PLUGIN_METHOD_OR
|
83 |
83 |
"
|
84 |
|
|
85 |
|
use debug && CONFIG_CHECK="${CONFIG_CHECK}
|
86 |
|
FRAME_POINTER
|
|
84 |
use debug && CONFIG_CHECK+="
|
87 |
85 |
DEBUG_INFO
|
|
86 |
FRAME_POINTER
|
88 |
87 |
!DEBUG_INFO_REDUCED
|
89 |
88 |
"
|
90 |
|
|
91 |
|
use rootfs && \
|
92 |
|
CONFIG_CHECK="${CONFIG_CHECK}
|
93 |
|
BLK_DEV_INITRD
|
94 |
|
DEVTMPFS
|
|
89 |
use rootfs && CONFIG_CHECK+="
|
|
90 |
BLK_DEV_INITRD
|
|
91 |
DEVTMPFS
|
95 |
92 |
"
|
96 |
93 |
|
97 |
|
kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
|
|
94 |
kernel_is -lt 5 && CONFIG_CHECK+=" IOSCHED_NOOP"
|
98 |
95 |
|
99 |
|
if [[ ${PV} != "9999" ]]; then
|
|
96 |
if [[ ${PV} != 9999 ]] ; then
|
100 |
97 |
local kv_major_max kv_minor_max zcompat
|
101 |
98 |
zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
|
102 |
99 |
kv_major_max="${zcompat%%.*}"
|
... | ... | |
104 |
101 |
kv_minor_max="${zcompat%%.*}"
|
105 |
102 |
kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
|
106 |
103 |
"Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
|
107 |
|
|
108 |
104 |
fi
|
109 |
105 |
|
110 |
|
kernel_is -ge 3 10 || die "Linux 3.10 or newer required"
|
111 |
|
|
112 |
|
linux-mod_pkg_setup
|
113 |
|
}
|
114 |
|
|
115 |
|
src_unpack() {
|
116 |
|
if use verify-sig ; then
|
117 |
|
# Needed for downloaded patch (which is unsigned, which is fine)
|
118 |
|
verify-sig_verify_detached "${DISTDIR}"/zfs-${MY_PV}.tar.gz{,.asc}
|
119 |
|
fi
|
120 |
|
|
121 |
|
default
|
|
106 |
linux-mod-r1_pkg_setup
|
122 |
107 |
}
|
123 |
108 |
|
124 |
109 |
src_prepare() {
|
... | ... | |
127 |
112 |
# Run unconditionally (bug #792627)
|
128 |
113 |
eautoreconf
|
129 |
114 |
|
130 |
|
if [[ ${PV} != "9999" ]]; then
|
|
115 |
if [[ ${PV} != 9999 ]] ; then
|
131 |
116 |
# Set module revision number
|
132 |
|
sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
|
|
117 |
sed -Ei "s/(Release:.*)1/\1${PR}-gentoo/" META || die
|
133 |
118 |
fi
|
134 |
119 |
}
|
135 |
120 |
|
136 |
121 |
src_configure() {
|
137 |
|
set_arch_to_kernel
|
138 |
|
|
139 |
122 |
use custom-cflags || strip-flags
|
140 |
|
|
141 |
123 |
filter-ldflags -Wl,*
|
142 |
124 |
|
143 |
|
# Set CROSS_COMPILE in the environment.
|
144 |
|
# This allows the user to override it via make.conf or via a local Makefile.
|
145 |
|
# https://bugs.gentoo.org/811600
|
146 |
|
export CROSS_COMPILE=${CROSS_COMPILE-${CHOST}-}
|
147 |
|
|
148 |
125 |
local myconf=(
|
149 |
|
HOSTCC="$(tc-getBUILD_CC)"
|
150 |
|
--bindir="${EPREFIX}/bin"
|
151 |
|
--sbindir="${EPREFIX}/sbin"
|
|
126 |
--bindir="${EPREFIX}"/bin
|
|
127 |
--sbindir="${EPREFIX}"/sbin
|
152 |
128 |
--with-config=kernel
|
153 |
129 |
--with-linux="${KV_DIR}"
|
154 |
130 |
--with-linux-obj="${KV_OUT_DIR}"
|
155 |
131 |
$(use_enable debug)
|
|
132 |
|
|
133 |
# See gentoo.patch
|
|
134 |
GENTOO_MAKEARGS_EVAL="${MODULES_MAKEARGS[*]@Q}"
|
|
135 |
TEST_JOBS="$(makeopts_jobs)"
|
156 |
136 |
)
|
157 |
137 |
|
158 |
138 |
econf "${myconf[@]}"
|
159 |
139 |
}
|
160 |
140 |
|
161 |
141 |
src_compile() {
|
162 |
|
set_arch_to_kernel
|
163 |
|
|
164 |
|
myemakeargs=(
|
165 |
|
HOSTCC="$(tc-getBUILD_CC)"
|
166 |
|
V=1
|
167 |
|
)
|
168 |
|
|
169 |
|
emake "${myemakeargs[@]}"
|
|
142 |
emake "${MODULES_MAKEARGS[@]}"
|
170 |
143 |
}
|
171 |
144 |
|
172 |
145 |
src_install() {
|
173 |
|
set_arch_to_kernel
|
174 |
|
|
175 |
|
myemakeargs+=(
|
176 |
|
DEPMOD=:
|
177 |
|
# INSTALL_MOD_PATH ?= $(DESTDIR) in module/Makefile
|
178 |
|
DESTDIR="${D}"
|
179 |
|
)
|
180 |
|
|
181 |
|
emake "${myemakeargs[@]}" install
|
|
146 |
emake "${MODULES_MAKEARGS[@]}" DESTDIR="${ED}" install
|
|
147 |
modules_post_process
|
182 |
148 |
|
183 |
|
einstalldocs
|
|
149 |
dodoc AUTHORS COPYRIGHT META README.md
|
184 |
150 |
}
|
185 |
151 |
|
186 |
152 |
pkg_postinst() {
|
187 |
|
linux-mod_pkg_postinst
|
|
153 |
linux-mod-r1_pkg_postinst
|
188 |
154 |
|
189 |
|
if [[ -z ${ROOT} ]] && use dist-kernel; then
|
190 |
|
set_arch_to_pkgmgr
|
|
155 |
if [[ -z ${ROOT} ]] && use dist-kernel ; then
|
191 |
156 |
dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
|
192 |
157 |
fi
|
193 |
158 |
|
194 |
|
if use x86 || use arm; then
|
|
159 |
if use x86 || use arm ; then
|
195 |
160 |
ewarn "32-bit kernels will likely require increasing vmalloc to"
|
196 |
161 |
ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
|
197 |
162 |
fi
|
198 |
163 |
|
199 |
|
if has_version sys-boot/grub; then
|
|
164 |
if has_version sys-boot/grub ; then
|
200 |
165 |
ewarn "This version of OpenZFS includes support for new feature flags"
|
201 |
166 |
ewarn "that are incompatible with previous versions. GRUB2 support for"
|
202 |
167 |
ewarn "/boot with the new feature flags is not yet available."
|