zfs-kmod-0.6.3-r1.ebuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. https://dev.gentoo.org/~ryao/dist/zfs-${PV}-patches-${PR}.tar.xz"
  15. S="${WORKDIR}/zfs-zfs-${PV}"
  16. KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
  17. fi
  18. DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
  19. HOMEPAGE="http://zfsonlinux.org/"
  20. LICENSE="CDDL debug? ( GPL-2+ )"
  21. SLOT="0"
  22. IUSE="custom-cflags debug +rootfs"
  23. RESTRICT="debug? ( strip ) test"
  24. DEPEND="
  25. =sys-kernel/spl-${PV}*
  26. dev-lang/perl
  27. virtual/awk
  28. "
  29. RDEPEND="${DEPEND}
  30. !sys-fs/zfs-fuse
  31. "
  32. pkg_setup() {
  33. linux-info_pkg_setup
  34. CONFIG_CHECK="!DEBUG_LOCK_ALLOC
  35. BLK_DEV_LOOP
  36. EFI_PARTITION
  37. IOSCHED_NOOP
  38. MODULES
  39. !PAX_KERNEXEC_PLUGIN_METHOD_OR
  40. !PAX_RANDKSTACK
  41. !PAX_USERCOPY_SLABS
  42. ZLIB_DEFLATE
  43. ZLIB_INFLATE
  44. "
  45. use debug && CONFIG_CHECK="${CONFIG_CHECK}
  46. FRAME_POINTER
  47. DEBUG_INFO
  48. !DEBUG_INFO_REDUCED
  49. "
  50. use rootfs && \
  51. CONFIG_CHECK="${CONFIG_CHECK}
  52. BLK_DEV_INITRD
  53. DEVTMPFS
  54. "
  55. kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
  56. [ ${PV} != "9999" ] && \
  57. { kernel_is le 3 17 || die "Linux 3.17 is the latest supported version."; }
  58. check_extra_config
  59. }
  60. src_prepare() {
  61. if [ ${PV} != "9999" ]
  62. then
  63. # Apply patch set
  64. EPATCH_SUFFIX="patch" \
  65. EPATCH_FORCE="yes" \
  66. epatch "${WORKDIR}/zfs-${PV}-patches"
  67. fi
  68. # Remove GPLv2-licensed ZPIOS unless we are debugging
  69. use debug || sed -e 's/^subdir-m += zpios$//' -i "${S}/module/Makefile.in"
  70. # Set module revision number
  71. [ ${PV} != "9999" ] && \
  72. { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
  73. autotools-utils_src_prepare
  74. }
  75. src_configure() {
  76. local SPL_PATH="$(basename $(echo "${EROOT}usr/src/spl-"*))"
  77. use custom-cflags || strip-flags
  78. filter-ldflags -Wl,*
  79. set_arch_to_kernel
  80. local myeconfargs=(${myeconfargs}
  81. --bindir="${EPREFIX}/bin"
  82. --sbindir="${EPREFIX}/sbin"
  83. --with-config=kernel
  84. --with-linux="${KV_DIR}"
  85. --with-linux-obj="${KV_OUT_DIR}"
  86. --with-spl="${EROOT}usr/src/${SPL_PATH}"
  87. --with-spl-obj="${EROOT}usr/src/${SPL_PATH}/${KV_FULL}"
  88. $(use_enable debug)
  89. )
  90. autotools-utils_src_configure
  91. }
  92. src_install() {
  93. autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
  94. dodoc AUTHORS COPYRIGHT DISCLAIMER README.markdown
  95. }
  96. pkg_postinst() {
  97. linux-mod_pkg_postinst
  98. # Remove old modules
  99. if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/zfs" ]
  100. then
  101. ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/zfs"
  102. ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/zfs"
  103. ewarn "Automatically removing old modules to avoid problems."
  104. rm -r "${EROOT}lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
  105. rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
  106. fi
  107. if use x86 || use arm
  108. then
  109. ewarn "32-bit kernels will likely require increasing vmalloc to"
  110. ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
  111. fi
  112. ewarn "This version of ZFSOnLinux includes support for features flags."
  113. ewarn "If you upgrade your pools to make use of feature flags, you will lose"
  114. ewarn "the ability to import them using older versions of ZFSOnLinux."
  115. ewarn "Any new pools will be created with feature flag support and will"
  116. ewarn "not be compatible with older versions of ZFSOnLinux. To create a new"
  117. ewarn "pool that is backward compatible, use zpool create -o version=28 ..."
  118. }