open-iscsi-2.0.874.ebuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit versionator linux-info flag-o-matic toolchain-funcs udev
  5. DESCRIPTION="A performant, transport independent, multi-platform implementation of RFC3720"
  6. HOMEPAGE="http://www.open-iscsi.org/"
  7. SRC_URI="http://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
  8. LICENSE="GPL-2"
  9. SLOT="0"
  10. KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
  11. IUSE="debug infiniband slp +tcp rdma"
  12. DEPEND="sys-block/open-isns:=
  13. slp? ( net-libs/openslp )
  14. infiniband? ( sys-fabric/ofed )"
  15. RDEPEND="${DEPEND}
  16. sys-fs/lsscsi
  17. sys-apps/util-linux"
  18. REQUIRED_USE="infiniband? ( rdma ) || ( rdma tcp )"
  19. PATCHES=(
  20. "${FILESDIR}/${P}-Makefiles.patch"
  21. "${FILESDIR}/${P}-musl-fixes.patch"
  22. "${FILESDIR}/${P}-musl-ethtool-compat.patch"
  23. )
  24. pkg_setup() {
  25. linux-info_pkg_setup
  26. if kernel_is -lt 2 6 16; then
  27. die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
  28. fi
  29. # Needs to be done, as iscsid currently only starts, when having the iSCSI
  30. # support loaded as module. Kernel builtin options don't work. See this for
  31. # more information:
  32. # https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
  33. # If there's a new release, check whether this is still valid!
  34. TCP_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
  35. RDMA_MODULES="INFINIBAND_ISER"
  36. INFINIBAND_MODULES="INFINIBAND_IPOIB INIBAND_USER_MAD INFINIBAND_USER_ACCESS"
  37. CONFIG_CHECK_MODULES="tcp? ( ${TCP_MODULES} ) rdma? ( ${RDMA_MODULES} ) infiniband? ( ${INFINIBAND_MODULES} )"
  38. if linux_config_exists; then
  39. if use tcp; then
  40. for module in ${TCP_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 infiniband; then
  45. for module in ${INFINIBAND_MODULES}; do
  46. linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
  47. done
  48. fi
  49. if use rdma; then
  50. for module in ${RDMA_MODULES}; do
  51. linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"$
  52. done
  53. fi
  54. fi
  55. }
  56. src_prepare() {
  57. sed -i -e 's:^\(iscsid.startup\)\s*=.*:\1 = /usr/sbin/iscsid:' etc/iscsid.conf || die
  58. default
  59. }
  60. src_configure() {
  61. use debug && append-cppflags -DDEBUG_TCP -DDEBUG_SCSI
  62. append-lfs-flags
  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. }