zfs-kmod-0.6.5.2.ebuild 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="4"
  4. AT_M4DIR="config"
  5. AUTOTOOLS_AUTORECONF="1"
  6. AUTOTOOLS_IN_SOURCE_BUILD="1"
  7. inherit flag-o-matic linux-info linux-mod toolchain-funcs autotools-utils
  8. if [ ${PV} == "9999" ] ; then
  9. inherit git-2
  10. EGIT_REPO_URI="https://github.com/zfsonlinux/zfs.git"
  11. else
  12. inherit eutils versionator
  13. SRC_URI="https://github.com/zfsonlinux/zfs/archive/zfs-${PV}.tar.gz"
  14. S="${WORKDIR}/zfs-zfs-${PV}"
  15. KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
  16. fi
  17. DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
  18. HOMEPAGE="http://zfsonlinux.org/"
  19. LICENSE="CDDL debug? ( GPL-2+ )"
  20. SLOT="0"
  21. IUSE="custom-cflags debug +rootfs"
  22. RESTRICT="debug? ( strip ) test"
  23. DEPEND="
  24. =sys-kernel/spl-${PV}*
  25. dev-lang/perl
  26. virtual/awk
  27. "
  28. RDEPEND="${DEPEND}
  29. !sys-fs/zfs-fuse
  30. "
  31. pkg_setup() {
  32. linux-info_pkg_setup
  33. CONFIG_CHECK="!DEBUG_LOCK_ALLOC
  34. EFI_PARTITION
  35. IOSCHED_NOOP
  36. MODULES
  37. !PAX_KERNEXEC_PLUGIN_METHOD_OR
  38. !PAX_USERCOPY_SLABS
  39. ZLIB_DEFLATE
  40. ZLIB_INFLATE
  41. "
  42. use debug && CONFIG_CHECK="${CONFIG_CHECK}
  43. FRAME_POINTER
  44. DEBUG_INFO
  45. !DEBUG_INFO_REDUCED
  46. "
  47. use rootfs && \
  48. CONFIG_CHECK="${CONFIG_CHECK}
  49. BLK_DEV_INITRD
  50. DEVTMPFS
  51. "
  52. kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required"
  53. [ ${PV} != "9999" ] && \
  54. { kernel_is le 4 3 || die "Linux 4.3 is the latest supported version."; }
  55. check_extra_config
  56. }
  57. src_prepare() {
  58. # Remove GPLv2-licensed ZPIOS unless we are debugging
  59. use debug || sed -e 's/^subdir-m += zpios$//' -i "${S}/module/Makefile.in"
  60. # Set module revision number
  61. [ ${PV} != "9999" ] && \
  62. { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
  63. autotools-utils_src_prepare
  64. }
  65. src_configure() {
  66. local SPL_PATH="$(basename $(echo "${EROOT}usr/src/spl-"*))"
  67. use custom-cflags || strip-flags
  68. filter-ldflags -Wl,*
  69. set_arch_to_kernel
  70. local myeconfargs=(${myeconfargs}
  71. --bindir="${EPREFIX}/bin"
  72. --sbindir="${EPREFIX}/sbin"
  73. --with-config=kernel
  74. --with-linux="${KV_DIR}"
  75. --with-linux-obj="${KV_OUT_DIR}"
  76. --with-spl="${EROOT}usr/src/${SPL_PATH}"
  77. --with-spl-obj="${EROOT}usr/src/${SPL_PATH}/${KV_FULL}"
  78. $(use_enable debug)
  79. )
  80. autotools-utils_src_configure
  81. }
  82. src_install() {
  83. autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
  84. dodoc AUTHORS COPYRIGHT DISCLAIMER README.markdown
  85. }
  86. pkg_postinst() {
  87. linux-mod_pkg_postinst
  88. # Remove old modules
  89. if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/zfs" ]
  90. then
  91. ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/zfs"
  92. ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/zfs"
  93. ewarn "Automatically removing old modules to avoid problems."
  94. rm -r "${EROOT}lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
  95. rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
  96. fi
  97. if use x86 || use arm
  98. then
  99. ewarn "32-bit kernels will likely require increasing vmalloc to"
  100. ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
  101. fi
  102. ewarn "This version of ZFSOnLinux includes support for new feature flags"
  103. ewarn "that are incompatible with previous versions. GRUB2 support for"
  104. ewarn "/boot with the new feature flags is not yet available."
  105. ewarn "Do *NOT* upgrade root pools to use the new feature flags."
  106. ewarn "Any new pools will be created with the new feature flags by default"
  107. ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
  108. ewarn "create a newpool that is backward compatible wih GRUB2, use "
  109. ewarn
  110. ewarn "zpool create -d -o feature@async_destroy=enabled "
  111. ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
  112. ewarn " -o feature@spacemap_histogram=enabled"
  113. ewarn " -o feature@enabled_txg=enabled "
  114. ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled"
  115. ewarn " ..."
  116. ewarn
  117. ewarn "GRUB2 support will be updated as soon as either the GRUB2"
  118. ewarn "developers do a tag or the Gentoo developers find time to backport"
  119. ewarn "support from GRUB2 HEAD."
  120. }