open-iscsi-2.0.873-r2.ebuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit versionator linux-info eutils flag-o-matic toolchain-funcs udev
  5. MY_P="${PN}-$(replace_version_separator 2 "-")"
  6. DESCRIPTION="Open-iSCSI is a high performance, transport independent, multi-platform implementation of RFC3720"
  7. HOMEPAGE="http://www.open-iscsi.org/"
  8. SRC_URI="http://www.open-iscsi.org/bits/${MY_P}.tar.gz"
  9. LICENSE="GPL-2"
  10. SLOT="0"
  11. KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
  12. IUSE="debug slp +tcp infiniband rdma"
  13. DEPEND="slp? ( net-libs/openslp ) infiniband? ( sys-fabric/ofed )"
  14. RDEPEND="${DEPEND}
  15. sys-fs/lsscsi
  16. sys-apps/util-linux"
  17. REQUIRED_USE="infiniband? ( rdma ) || ( rdma tcp )"
  18. S="${WORKDIR}/${MY_P}"
  19. pkg_setup() {
  20. linux-info_pkg_setup
  21. if kernel_is -lt 2 6 16; then
  22. die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
  23. fi
  24. # Needs to be done, as iscsid currently only starts, when having the iSCSI
  25. # support loaded as module. Kernel builtin options don't work. See this for
  26. # more information:
  27. # https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
  28. # If there's a new release, check whether this is still valid!
  29. TCP_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
  30. RDMA_MODULES="INFINIBAND_ISER"
  31. INFINIBAND_MODULES="INFINIBAND_IPOIB INIBAND_USER_MAD INFINIBAND_USER_ACCESS"
  32. CONFIG_CHECK_MODULES="tcp? ( ${TCP_MODULES} ) rdma? ( ${RDMA_MODULES} ) infiniband? ( ${INFINIBAND_MODULES} )"
  33. if linux_config_exists; then
  34. if use tcp; then
  35. for module in ${TCP_MODULES}; do
  36. linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
  37. done
  38. fi
  39. if use infiniband; then
  40. for module in ${INFINIBAND_MODULES}; do
  41. linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
  42. done
  43. fi
  44. if use rdma; then
  45. for module in ${RDMA_MODULES}; do
  46. linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"$
  47. done
  48. fi
  49. fi
  50. }
  51. src_prepare() {
  52. epatch "${FILESDIR}"/${P}-Makefiles.patch
  53. epatch "${FILESDIR}"/${P}-memset.patch
  54. sed -i -e 's:^\(iscsid.startup\)\s*=.*:\1 = /usr/sbin/iscsid:' etc/iscsid.conf || die
  55. }
  56. src_configure() {
  57. use debug && append-cppflags -DDEBUG_TCP -DDEBUG_SCSI
  58. append-lfs-flags
  59. cd utils/open-isns || die
  60. # SSL (--with-security) is broken
  61. econf $(use_with slp) \
  62. --without-security
  63. }
  64. src_compile() {
  65. # Stuffing CPPFLAGS into CFLAGS isn't entirely correct, but the build
  66. # is messed up already here, so it's not making it that much worse.
  67. KSRC="${KV_DIR}" CFLAGS="" \
  68. emake \
  69. OPTFLAGS="${CFLAGS} ${CPPFLAGS}" \
  70. AR="$(tc-getAR)" CC="$(tc-getCC)" \
  71. user
  72. }
  73. src_install() {
  74. emake DESTDIR="${ED}" sbindir="/usr/sbin" install
  75. dodoc README THANKS
  76. docinto test/
  77. dodoc test/*
  78. insinto /etc/iscsi
  79. newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example
  80. # udev pieces
  81. udev_dorules "${FILESDIR}"/99-iscsi.rules
  82. exeinto /etc/udev/scripts
  83. doexe "${FILESDIR}"/iscsidev.sh
  84. newconfd "${FILESDIR}"/iscsid-conf.d iscsid
  85. newinitd "${FILESDIR}"/iscsid-init.d iscsid
  86. keepdir /var/db/iscsi
  87. fperms 700 /var/db/iscsi
  88. fperms 600 /etc/iscsi/iscsid.conf
  89. }