add zfs 0.7 snapshot
[portage-squeep] / sys-kernel / spl / spl-0.7.13.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5 PYTHON_COMPAT=( python3_6 )
6
7 if [[ ${PV} == "9999" ]] ; then
8 AUTOTOOLS_AUTORECONF="1"
9 EGIT_REPO_URI="https://github.com/zfsonlinux/${PN}.git"
10 inherit git-r3
11 else
12 SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-${PV}/${P}.tar.gz"
13 KEYWORDS="amd64"
14 fi
15
16 inherit flag-o-matic linux-info linux-mod python-single-r1 autotools-utils
17
18 DESCRIPTION="The Solaris Porting Layer provides many of the Solaris kernel APIs"
19 HOMEPAGE="https://zfsonlinux.org/"
20
21 LICENSE="GPL-2"
22 SLOT="0"
23 IUSE="custom-cflags debug"
24 RESTRICT="debug? ( strip ) test"
25
26 COMMON_DEPEND="
27 dev-lang/perl
28 virtual/awk"
29
30 DEPEND="${COMMON_DEPEND}"
31
32 RDEPEND="${COMMON_DEPEND}
33 ${PYTHON_DEPS}
34 !sys-devel/spl"
35
36 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
37
38 AT_M4DIR="config"
39 AUTOTOOLS_IN_SOURCE_BUILD="1"
40 DOCS=( AUTHORS DISCLAIMER )
41
42 pkg_setup() {
43 python-single-r1_pkg_setup
44 linux-info_pkg_setup
45 CONFIG_CHECK="
46 !DEBUG_LOCK_ALLOC
47 MODULES
48 KALLSYMS
49 !PAX_KERNEXEC_PLUGIN_METHOD_OR
50 !PAX_SIZE_OVERFLOW
51 !TRIM_UNUSED_KSYMS
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 kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required"
63
64 [ ${PV} != "9999" ] && \
65 { kernel_is le 5 0 || die "Linux 5.0 is the latest supported version."; }
66
67 check_extra_config
68 }
69
70 src_prepare() {
71 # Workaround for hard coded path
72 sed -i "s|/sbin/lsmod|/bin/lsmod|" "${S}/scripts/check.sh" || \
73 die "Cannot patch check.sh"
74
75 # splat is unnecessary unless we are debugging
76 use debug || { sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in" || die ; }
77
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"; }
81
82 autotools-utils_src_prepare
83 }
84
85 src_configure() {
86 use custom-cflags || strip-flags
87 filter-ldflags -Wl,*
88
89 set_arch_to_kernel
90 local myeconfargs=(
91 --bindir="${EPREFIX}/bin"
92 --sbindir="${EPREFIX}/sbin"
93 --with-config=all
94 --with-linux="${KV_DIR}"
95 --with-linux-obj="${KV_OUT_DIR}"
96 $(use_enable debug)
97 )
98 autotools-utils_src_configure
99 }
100
101 src_install() {
102 autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
103 # enforce selected python implementation
104 python_fix_shebang "${ED}/bin"
105 }
106
107 pkg_postinst() {
108 linux-mod_pkg_postinst
109
110 # Remove old modules
111 if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
112 then
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"
118 fi
119 }