openafs-kernel-1.6.20.1.ebuild 3.7 KB

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