1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 PYTHON_COMPAT=( python3_6 )
7 if [[ ${PV} == "9999" ]] ; then
8 AUTOTOOLS_AUTORECONF="1"
9 EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git"
12 SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-${PV}/${P}.tar.gz"
16 inherit flag-o-matic linux-info linux-mod python-single-r1 autotools-utils
18 DESCRIPTION="The Solaris Porting Layer provides many of the Solaris kernel APIs"
19 HOMEPAGE="https://zfsonlinux.org/"
23 IUSE="custom-cflags debug"
24 RESTRICT="debug? ( strip ) test"
30 DEPEND="${COMMON_DEPEND}"
32 RDEPEND="${COMMON_DEPEND}
36 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
39 AUTOTOOLS_IN_SOURCE_BUILD="1"
40 DOCS=( AUTHORS DISCLAIMER )
43 python-single-r1_pkg_setup
49 !PAX_KERNEXEC_PLUGIN_METHOD_OR
56 use debug && CONFIG_CHECK="${CONFIG_CHECK}
62 kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required"
64 [ ${PV} != "9999" ] && \
65 { kernel_is le 5 0 || die "Linux 5.0 is the latest supported version."; }
71 # Workaround for hard coded path
72 sed -i "s|/sbin/lsmod|/bin/lsmod|" "${S}/scripts/check.sh" || \
73 die "Cannot patch check.sh"
75 # splat is unnecessary unless we are debugging
76 use debug || { sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in" || die ; }
78 # Set module revision number
79 [ ${PV} != "9999" ] && \
80 { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
82 autotools-utils_src_prepare
86 use custom-cflags || strip-flags
91 --bindir="${EPREFIX}/bin"
92 --sbindir="${EPREFIX}/sbin"
94 --with-linux="${KV_DIR}"
95 --with-linux-obj="${KV_OUT_DIR}"
98 autotools-utils_src_configure
102 autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
103 # enforce selected python implementation
104 python_fix_shebang "${ED}/bin"
108 linux-mod_pkg_postinst
111 if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
113 ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
114 ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
115 ewarn "Automatically removing old modules to avoid problems."
116 rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
117 rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"