open-iscsi-2.0.872-r3.ebuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=2
  4. inherit versionator linux-info eutils flag-o-matic toolchain-funcs
  5. DESCRIPTION="Open-iSCSI is a high performance, transport independent, multi-platform implementation of RFC3720"
  6. HOMEPAGE="http://www.open-iscsi.org/"
  7. MY_PV="${PN}-$(replace_version_separator 2 "-" $MY_PV)"
  8. SRC_URI="http://www.open-iscsi.org/bits/${MY_PV}.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. virtual/udev
  16. sys-fs/lsscsi
  17. sys-apps/util-linux"
  18. S="${WORKDIR}/${MY_PV}"
  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 builtion 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. CONFIG_CHECK_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
  30. if linux_config_exists; then
  31. for module in ${CONFIG_CHECK_MODULES}; do
  32. linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
  33. done
  34. fi
  35. }
  36. src_prepare() {
  37. export EPATCH_OPTS="-d${S}"
  38. epatch "${FILESDIR}"/${PN}-2.0.872-makefile-cleanup.patch
  39. epatch "${FILESDIR}"/${P}-glibc212.patch
  40. epatch "${FILESDIR}"/${P}-dont-call-configure.patch
  41. epatch "${FILESDIR}"/${P}-ldflags.patch
  42. epatch "${FILESDIR}"/${P}-isns-slp.patch
  43. epatch "${FILESDIR}"/${PN}-2.0.872-makefile-cleanup-pass2.patch
  44. }
  45. src_configure() {
  46. cd utils/open-isns || die
  47. econf $(use_with slp)
  48. }
  49. src_compile() {
  50. use debug && append-flags -DDEBUG_TCP -DDEBUG_SCSI
  51. einfo "Building userspace"
  52. local SLP_LIBS
  53. use slp && SLP_LIBS="-lslp"
  54. cd "${S}" && \
  55. KSRC="${KV_DIR}" CFLAGS="" \
  56. emake \
  57. OPTFLAGS="${CFLAGS}" SLP_LIBS="${SLP_LIBS}" \
  58. AR="$(tc-getAR)" CC="$(tc-getCC)" \
  59. user \
  60. || die "emake failed"
  61. }
  62. src_install() {
  63. einfo "Installing userspace"
  64. dosbin usr/iscsid usr/iscsiadm usr/iscsistart || die
  65. einfo "Installing utilities"
  66. dosbin utils/iscsi-iname utils/iscsi_discovery || die
  67. einfo "Installing docs"
  68. doman doc/*[1-8] || die
  69. dodoc README THANKS || die
  70. docinto test || die
  71. dodoc test/* || die
  72. einfo "Installing configuration"
  73. insinto /etc/iscsi
  74. doins etc/iscsid.conf || die
  75. newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example || die
  76. insinto /etc/iscsi/ifaces
  77. doins etc/iface.example || die
  78. newconfd "${FILESDIR}"/${P}-conf.d iscsid || die
  79. newinitd "${FILESDIR}"/${P}-init.d-r1 iscsid || die
  80. # udev pieces
  81. insinto /etc/udev/scripts
  82. doins "${FILESDIR}"/iscsidev.sh
  83. insinto /lib/udev/rules.d
  84. doins "${FILESDIR}"/99-iscsi.rules
  85. keepdir /var/db/iscsi
  86. fperms 700 /var/db/iscsi || die
  87. fperms 600 /etc/iscsi/iscsid.conf || die
  88. }
  89. pkg_postinst() {
  90. in='/etc/iscsi/initiatorname.iscsi'
  91. if [ ! -f "${ROOT}${in}" -a -f "${ROOT}${in}.example" ]; then
  92. cp -f "${ROOT}${in}.example" "${ROOT}${in}"
  93. fi
  94. }