Guest User

Untitled

a guest
Sep 17th, 2018
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. # Copyright 1999-2018 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3.  
  4. EAPI="5"
  5.  
  6. if [ ${PV} == "9999" ]; then
  7. AUTOTOOLS_AUTORECONF="1"
  8. EGIT_REPO_URI="https://github.com/zfsonlinux/zfs.git"
  9. inherit git-r3
  10. else
  11. SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-0.8.0-rc1/zfs-0.8.0-rc1.tar.gz"
  12. S="${WORKDIR}/zfs-${PV}"
  13. KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
  14. fi
  15.  
  16. inherit flag-o-matic linux-info linux-mod toolchain-funcs autotools-utils
  17.  
  18. DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
  19. HOMEPAGE="http://zfsonlinux.org/"
  20.  
  21. LICENSE="CDDL GPL-2+"
  22. SLOT="0"
  23. IUSE="custom-cflags debug +rootfs"
  24. RESTRICT="debug? ( strip ) test"
  25.  
  26. DEPEND="
  27. dev-lang/perl
  28. virtual/awk
  29. "
  30.  
  31. RDEPEND="${DEPEND}
  32. !sys-fs/zfs-fuse
  33. !sys-kernel/spl
  34. "
  35.  
  36. AT_M4DIR="config"
  37. AUTOTOOLS_IN_SOURCE_BUILD="1"
  38.  
  39. DOCS=( AUTHORS COPYRIGHT NOTICE META README.md )
  40.  
  41. pkg_setup() {
  42. linux-info_pkg_setup
  43. CONFIG_CHECK="
  44. !DEBUG_LOCK_ALLOC
  45. !GRKERNSEC_RANDSTRUCT
  46. !PAX_KERNEXEC_PLUGIN_METHOD_OR
  47. !TRIM_UNUSED_KSYMS
  48. EFI_PARTITION
  49. IOSCHED_NOOP
  50. KALLSYMS
  51. MODULES
  52. ZLIB_DEFLATE
  53. ZLIB_INFLATE
  54. "
  55.  
  56. use debug && CONFIG_CHECK="${CONFIG_CHECK}
  57. FRAME_POINTER
  58. DEBUG_INFO
  59. !DEBUG_INFO_REDUCED
  60. "
  61.  
  62. use rootfs && \
  63. CONFIG_CHECK="${CONFIG_CHECK}
  64. BLK_DEV_INITRD
  65. DEVTMPFS
  66. "
  67.  
  68. kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required"
  69.  
  70. [ ${PV} != "9999" ] && \
  71. { kernel_is le 4 18 || die "Linux 4.18 is the latest supported version."; }
  72.  
  73. check_extra_config
  74. }
  75.  
  76. src_prepare() {
  77. # Remove GPLv2-licensed ZPIOS unless we are debugging
  78. use debug || sed -e 's/^subdir-m += zpios$//' -i "${S}/module/Makefile.in"
  79.  
  80. # Set module revision number
  81. [ ${PV} != "9999" ] && \
  82. { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
  83.  
  84. autotools-utils_src_prepare
  85. }
  86.  
  87. src_configure() {
  88. use custom-cflags || strip-flags
  89. filter-ldflags -Wl,*
  90.  
  91. set_arch_to_kernel
  92. local myeconfargs=(${myeconfargs}
  93. --bindir="${EPREFIX}/bin"
  94. --sbindir="${EPREFIX}/sbin"
  95. --with-config=kernel
  96. --with-linux="${KV_DIR}"
  97. --with-linux-obj="${KV_OUT_DIR}"
  98. $(use_enable debug)
  99. )
  100.  
  101. autotools-utils_src_configure
  102. }
  103.  
  104. src_install() {
  105. autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
  106. }
  107.  
  108. pkg_postinst() {
  109. linux-mod_pkg_postinst
  110.  
  111. # Remove old modules
  112. if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/zfs" ]
  113. then
  114. ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/zfs"
  115. ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/zfs"
  116. ewarn "Automatically removing old modules to avoid problems."
  117. rm -r "${EROOT}lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
  118. rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
  119. fi
  120. }
Advertisement
Add Comment
Please, Sign In to add comment