zfs-kmod-0.6.5-r1.ebuild 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. BLK_DEV_LOOP
  35. EFI_PARTITION
  36. IOSCHED_NOOP
  37. MODULES
  38. !PAX_KERNEXEC_PLUGIN_METHOD_OR
  39. !PAX_USERCOPY_SLABS
  40. ZLIB_DEFLATE
  41. ZLIB_INFLATE
  42. "
  43. use debug && CONFIG_CHECK="${CONFIG_CHECK}
  44. FRAME_POINTER
  45. DEBUG_INFO
  46. !DEBUG_INFO_REDUCED
  47. "
  48. use rootfs && \
  49. CONFIG_CHECK="${CONFIG_CHECK}
  50. BLK_DEV_INITRD
  51. DEVTMPFS
  52. "
  53. kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required"
  54. [ ${PV} != "9999" ] && \
  55. { kernel_is le 4 2 || die "Linux 4.2 is the latest supported version."; }
  56. check_extra_config
  57. }
  58. src_prepare() {
  59. if [ ${PV} != "9999" ]
  60. then
  61. # Fix zvol data loss regression
  62. # https://github.com/zfsonlinux/zfs/pull/3798
  63. epatch "${FILESDIR}/${P}-discard-on-zvol-fix.patch"
  64. fi
  65. # Remove GPLv2-licensed ZPIOS unless we are debugging
  66. use debug || sed -e 's/^subdir-m += zpios$//' -i "${S}/module/Makefile.in"
  67. # Set module revision number
  68. [ ${PV} != "9999" ] && \
  69. { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
  70. autotools-utils_src_prepare
  71. }
  72. src_configure() {
  73. local SPL_PATH="$(basename $(echo "${EROOT}usr/src/spl-"*))"
  74. use custom-cflags || strip-flags
  75. filter-ldflags -Wl,*
  76. set_arch_to_kernel
  77. local myeconfargs=(${myeconfargs}
  78. --bindir="${EPREFIX}/bin"
  79. --sbindir="${EPREFIX}/sbin"
  80. --with-config=kernel
  81. --with-linux="${KV_DIR}"
  82. --with-linux-obj="${KV_OUT_DIR}"
  83. --with-spl="${EROOT}usr/src/${SPL_PATH}"
  84. --with-spl-obj="${EROOT}usr/src/${SPL_PATH}/${KV_FULL}"
  85. $(use_enable debug)
  86. )
  87. autotools-utils_src_configure
  88. }
  89. src_install() {
  90. autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
  91. dodoc AUTHORS COPYRIGHT DISCLAIMER README.markdown
  92. }
  93. pkg_postinst() {
  94. linux-mod_pkg_postinst
  95. # Remove old modules
  96. if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/zfs" ]
  97. then
  98. ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/zfs"
  99. ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/zfs"
  100. ewarn "Automatically removing old modules to avoid problems."
  101. rm -r "${EROOT}lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
  102. rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
  103. fi
  104. if use x86 || use arm
  105. then
  106. ewarn "32-bit kernels will likely require increasing vmalloc to"
  107. ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
  108. fi
  109. ewarn "This version of ZFSOnLinux includes support for new feature flags"
  110. ewarn "that are incompatible with previous versions. GRUB2 support for"
  111. ewarn "/boot with the new feature flags is not yet available."
  112. ewarn "Do *NOT* upgrade root pools to use the new feature flags."
  113. ewarn "Any new pools will be created with the new feature flags by default"
  114. ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
  115. ewarn "create a newpool that is backward compatible wih GRUB2, use "
  116. ewarn
  117. ewarn "zpool create -d -o feature@async_destroy=enabled "
  118. ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
  119. ewarn " -o feature@spacemap_histogram=enabled"
  120. ewarn " -o feature@enabled_txg=enabled "
  121. ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled"
  122. ewarn " ..."
  123. ewarn
  124. ewarn "GRUB2 support will be updated as soon as either the GRUB2"
  125. ewarn "developers do a tag or the Gentoo developers find time to backport"
  126. ewarn "support from GRUB2 HEAD."
  127. }