Use https by default
[gentoo.git] / sys-kernel / spl / spl-0.6.2-r5.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="4"
6 AUTOTOOLS_AUTORECONF="1"
7
8 inherit flag-o-matic linux-info linux-mod autotools-utils
9
10 if [[ ${PV} == "9999" ]] ; then
11         inherit git-2
12         EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
13 else
14         inherit eutils versionator
15         MY_PV=$(replace_version_separator 3 '-')
16         SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz
17                 https://dev.gentoo.org/~ryao/dist/${PN}-${MY_PV}-p4.tar.xz"
18         S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
19         KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
20 fi
21
22 DESCRIPTION="The Solaris Porting Layer is a Linux kernel module which provides many of the Solaris kernel APIs"
23 HOMEPAGE="http://zfsonlinux.org/"
24
25 LICENSE="GPL-2"
26 SLOT="0"
27 IUSE="custom-cflags debug debug-log"
28 RESTRICT="test"
29
30 COMMON_DEPEND="dev-lang/perl
31         virtual/awk"
32
33 DEPEND="${COMMON_DEPEND}"
34
35 RDEPEND="${COMMON_DEPEND}
36         !sys-devel/spl"
37
38 AT_M4DIR="config"
39 AUTOTOOLS_IN_SOURCE_BUILD="1"
40
41 pkg_setup() {
42         linux-info_pkg_setup
43         CONFIG_CHECK="
44                 !DEBUG_LOCK_ALLOC
45                 !GRKERNSEC_HIDESYM
46                 MODULES
47                 KALLSYMS
48                 !PAX_KERNEXEC_PLUGIN_METHOD_OR
49                 ZLIB_DEFLATE
50                 ZLIB_INFLATE
51         "
52
53         kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
54
55         [ ${PV} != "9999" ] && \
56                 { kernel_is le 3 14 || die "Linux 3.14 is the latest supported version."; }
57
58         check_extra_config
59 }
60
61 src_prepare() {
62         # Workaround for hard coded path
63         sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
64
65         if [ ${PV} != "9999" ]
66         then
67                 # Apply patch set
68                 EPATCH_SUFFIX="patch" \
69                 EPATCH_FORCE="yes" \
70                 epatch "${WORKDIR}/${PN}-${MY_PV}-patches"
71         fi
72
73         # splat is unnecessary unless we are debugging
74         use debug || sed -e 's/^subdir-m += splat$//' -i "${S}/module/Makefile.in"
75
76         autotools-utils_src_prepare
77 }
78
79 src_configure() {
80         use custom-cflags || strip-flags
81         filter-ldflags -Wl,*
82
83         set_arch_to_kernel
84         local myeconfargs=(
85                 --bindir="${EPREFIX}/bin"
86                 --sbindir="${EPREFIX}/sbin"
87                 --with-config=all
88                 --with-linux="${KV_DIR}"
89                 --with-linux-obj="${KV_OUT_DIR}"
90                 $(use_enable debug)
91                 $(use_enable debug-log)
92         )
93         autotools-utils_src_configure
94 }
95
96 src_install() {
97         autotools-utils_src_install
98         dodoc AUTHORS DISCLAIMER README.markdown
99 }
100
101 pkg_postinst() {
102         linux-mod_pkg_postinst
103
104         # Remove old modules
105         if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/spl" ]
106         then
107                 ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/spl"
108                 ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/spl"
109                 ewarn "Automatically removing old modules to avoid problems."
110                 rm -r "${EROOT}lib/modules/${KV_FULL}/addon/spl" || die "Cannot remove modules"
111                 rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
112         fi
113 }