open-iscsi-2.0.873-r1.ebuild 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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"
  13. DEPEND="slp? ( net-libs/openslp )"
  14. RDEPEND="${DEPEND}
  15. sys-fs/lsscsi
  16. sys-apps/util-linux"
  17. S="${WORKDIR}/${MY_P}"
  18. pkg_setup() {
  19. linux-info_pkg_setup
  20. if kernel_is -lt 2 6 16; then
  21. die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
  22. fi
  23. # Needs to be done, as iscsid currently only starts, when having the iSCSI
  24. # support loaded as module. Kernel builtion options don't work. See this for
  25. # more information:
  26. # https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
  27. # If there's a new release, check whether this is still valid!
  28. CONFIG_CHECK_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
  29. if linux_config_exists; then
  30. for module in ${CONFIG_CHECK_MODULES}; do
  31. linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
  32. done
  33. fi
  34. }
  35. src_prepare() {
  36. epatch "${FILESDIR}"/${P}-Makefiles.patch
  37. epatch "${FILESDIR}"/${P}-memset.patch
  38. sed -i -e 's:^\(iscsid.startup\)\s*=.*:\1 = /usr/sbin/iscsid:' etc/iscsid.conf || die
  39. }
  40. src_configure() {
  41. use debug && append-cppflags -DDEBUG_TCP -DDEBUG_SCSI
  42. append-lfs-flags
  43. cd utils/open-isns || die
  44. # SSL (--with-security) is broken
  45. econf $(use_with slp) \
  46. --without-security
  47. }
  48. src_compile() {
  49. # Stuffing CPPFLAGS into CFLAGS isn't entirely correct, but the build
  50. # is messed up already here, so it's not making it that much worse.
  51. KSRC="${KV_DIR}" CFLAGS="" \
  52. emake \
  53. OPTFLAGS="${CFLAGS} ${CPPFLAGS}" \
  54. AR="$(tc-getAR)" CC="$(tc-getCC)" \
  55. user
  56. }
  57. src_install() {
  58. emake DESTDIR="${ED}" sbindir="/usr/sbin" install
  59. dodoc README THANKS
  60. docinto test/
  61. dodoc test/*
  62. insinto /etc/iscsi
  63. newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example
  64. # udev pieces
  65. udev_dorules "${FILESDIR}"/99-iscsi.rules
  66. exeinto /etc/udev/scripts
  67. doexe "${FILESDIR}"/iscsidev.sh
  68. newconfd "${FILESDIR}"/iscsid-conf.d iscsid
  69. newinitd "${FILESDIR}"/iscsid-init.d iscsid
  70. keepdir /var/db/iscsi
  71. fperms 700 /var/db/iscsi
  72. fperms 600 /etc/iscsi/iscsid.conf
  73. }