Use https by default
[gentoo.git] / net-fs / openafs-kernel / openafs-kernel-1.6.11-r1.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 inherit autotools eutils linux-mod multilib toolchain-funcs versionator
8
9 MY_PV=$(delete_version_separator '_')
10 MY_PN="${PN/-kernel}"
11 MY_P="${MY_PN}-${MY_PV}"
12 PVER="20150813"
13
14 DESCRIPTION="The OpenAFS distributed file system kernel module"
15 HOMEPAGE="http://www.openafs.org/"
16 # We always d/l the doc tarball as man pages are not USE=doc material
17 [[ ${PV} == *_pre* ]] && MY_PRE="candidate/" || MY_PRE=""
18 SRC_URI="
19         http://openafs.org/dl/openafs/${MY_PRE}${MY_PV}/${MY_P}-src.tar.bz2
20         http://openafs.org/dl/openafs/${MY_PV}/${MY_P}-doc.tar.bz2
21         https://dev.gentoo.org/~bircoph/afs/${MY_PN}-patches-${PVER}.tar.xz
22 "
23
24 LICENSE="IBM BSD openafs-krb5-a APSL-2"
25 SLOT="0"
26 KEYWORDS="~amd64 ~amd64-fbsd ~amd64-linux ~sparc ~x86 ~x86-fbsd ~x86-linux"
27 IUSE=""
28
29 S=${WORKDIR}/${MY_P}
30
31 CONFIG_CHECK="!DEBUG_RODATA ~!AFS_FS KEYS"
32 ERROR_DEBUG_RODATA="OpenAFS is incompatible with linux' CONFIG_DEBUG_RODATA option"
33 ERROR_AFS_FS="OpenAFS conflicts with the in-kernel AFS-support.  Make sure not to load both at the same time!"
34 ERROR_KEYS="OpenAFS needs CONFIG_KEYS option enabled"
35
36 QA_TEXTRELS_x86_fbsd="/boot/modules/libafs.ko"
37 QA_TEXTRELS_amd64_fbsd="/boot/modules/libafs.ko"
38
39 pkg_pretend() {
40         if use kernel_linux && kernel_is ge 4 ; then
41                 ewarn "Gentoo supports kernels which are supported by OpenAFS"
42                 ewarn "which are limited to the kernel versions: <4.0"
43                 ewarn ""
44                 ewarn "You are free to utilize epatch_user to provide whatever"
45                 ewarn "support you feel is appropriate, but will not receive"
46                 ewarn "support as a result of those changes."
47                 ewarn ""
48                 ewarn "Please do not file a bug report about this."
49         fi
50 }
51
52 pkg_setup() {
53         if use kernel_linux; then
54                 linux-mod_pkg_setup
55         fi
56 }
57
58 src_prepare() {
59         # do not tamper with CFLAGS for the kernel module
60         EPATCH_EXCLUDE="040_all_flags.patch" \
61         EPATCH_SUFFIX="patch" \
62         epatch "${WORKDIR}"/gentoo/patches
63         epatch "${WORKDIR}"/gentoo/security-patches/CVE-2015-{3282..3287}.patch
64         epatch_user
65
66         # packaging is f-ed up, so we can't run eautoreconf
67         # run autotools commands based on what is listed in regen.sh
68         eaclocal -I src/cf
69         eautoconf
70         eautoconf -o configure-libafs configure-libafs.ac
71         eautoheader
72         einfo "Deleting autom4te.cache directory"
73         rm -rf autom4te.cache
74 }
75
76 src_configure() {
77         local myconf=""
78         # OpenAFS 1.6.11 has a bug with kernels 3.17-3.17.2 that requires a config option
79         if use kernel_linux && kernel_is -ge 3 17 && kernel_is -le 3 17 2; then
80                 myconf="--enable-linux-d_splice_alias-extra-iput"
81         fi
82
83         local ARCH="$(tc-arch-kernel)"
84         local MY_ARCH="$(tc-arch)"
85         local BSD_BUILD_DIR="/usr/src/sys/${MY_ARCH}/compile/GENERIC"
86
87         if use kernel_linux; then
88                 myconf+=( --with-linux-kernel-headers="${KV_DIR}" \
89                         --with-linux-kernel-build="${KV_OUT_DIR}"
90                 )
91         elif use kernel_FreeBSD; then
92                 myconf+=( --with-bsd-kernel-build="${BSD_BUILD_DIR}" )
93         fi
94         econf "${myconf[@]}"
95 }
96
97 src_compile() {
98         ARCH="$(tc-arch-kernel)" AR="$(tc-getAR)" emake V=1 -j1 only_libafs
99 }
100
101 src_install() {
102         if use kernel_linux; then
103                 local srcdir=$(expr "${S}"/src/libafs/MODLOAD-*)
104                 [[ -f ${srcdir}/libafs.${KV_OBJ} ]] || die "Couldn't find compiled kernel module"
105
106                 MODULE_NAMES="libafs(fs/openafs:${srcdir})"
107
108                 linux-mod_src_install
109         elif use kernel_FreeBSD; then
110                 insinto /boot/modules
111                 doins "${S}"/src/libafs/MODLOAD/libafs.ko
112         fi
113 }
114
115 pkg_postinst() {
116         # Update linker.hints file
117         use kernel_FreeBSD && /usr/sbin/kldxref "${EPREFIX}/boot/modules"
118         use kernel_linux && linux-mod_pkg_postinst
119 }
120
121 pkg_postrm() {
122         # Update linker.hints file
123         use kernel_FreeBSD && /usr/sbin/kldxref "${EPREFIX}/boot/modules"
124         use kernel_linux && linux-mod_pkg_postrm
125 }