open-iscsi-2.0.873-r3.ebuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # Copyright 1999-2017 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. epatch "${FILESDIR}"/musl-fixes.patch
  55. epatch_user
  56. sed -i -e 's:^\(iscsid.startup\)\s*=.*:\1 = /usr/sbin/iscsid:' etc/iscsid.conf || die
  57. }
  58. src_configure() {
  59. use debug && append-cppflags -DDEBUG_TCP -DDEBUG_SCSI
  60. append-lfs-flags
  61. cd utils/open-isns || die
  62. # SSL (--with-security) is broken
  63. econf $(use_with slp) \
  64. --without-security
  65. }
  66. src_compile() {
  67. # Stuffing CPPFLAGS into CFLAGS isn't entirely correct, but the build
  68. # is messed up already here, so it's not making it that much worse.
  69. KSRC="${KV_DIR}" CFLAGS="" \
  70. emake \
  71. OPTFLAGS="${CFLAGS} ${CPPFLAGS}" \
  72. AR="$(tc-getAR)" CC="$(tc-getCC)" \
  73. user
  74. }
  75. src_install() {
  76. emake DESTDIR="${ED}" sbindir="/usr/sbin" install
  77. dodoc README THANKS
  78. docinto test/
  79. dodoc test/*
  80. insinto /etc/iscsi
  81. newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example
  82. # udev pieces
  83. udev_dorules "${FILESDIR}"/99-iscsi.rules
  84. exeinto /etc/udev/scripts
  85. doexe "${FILESDIR}"/iscsidev.sh
  86. newconfd "${FILESDIR}"/iscsid-conf.d iscsid
  87. newinitd "${FILESDIR}"/iscsid-init.d iscsid
  88. keepdir /var/db/iscsi
  89. fperms 700 /var/db/iscsi
  90. fperms 600 /etc/iscsi/iscsid.conf
  91. }