open-iscsi-2.0.872-r2.ebuild 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Copyright 1999-2014 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. sys-apps/util-linux"
  16. S="${WORKDIR}/${MY_PV}"
  17. pkg_setup() {
  18. linux-info_pkg_setup
  19. if kernel_is -lt 2 6 16; then
  20. die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
  21. fi
  22. # Needs to be done, as iscsid currently only starts, when having the iSCSI
  23. # support loaded as module. Kernel builtion options don't work. See this for
  24. # more information:
  25. # https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
  26. # If there's a new release, check whether this is still valid!
  27. CONFIG_CHECK_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
  28. if linux_config_exists; then
  29. for module in ${CONFIG_CHECK_MODULES}; do
  30. linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
  31. done
  32. fi
  33. }
  34. src_prepare() {
  35. export EPATCH_OPTS="-d${S}"
  36. epatch "${FILESDIR}"/${PN}-2.0.872-makefile-cleanup.patch
  37. epatch "${FILESDIR}"/${P}-glibc212.patch
  38. epatch "${FILESDIR}"/${P}-dont-call-configure.patch
  39. epatch "${FILESDIR}"/${P}-ldflags.patch
  40. epatch "${FILESDIR}"/${P}-isns-slp.patch
  41. epatch "${FILESDIR}"/${PN}-2.0.872-makefile-cleanup-pass2.patch
  42. }
  43. src_configure() {
  44. cd utils/open-isns || die
  45. econf $(use_with slp)
  46. }
  47. src_compile() {
  48. use debug && append-flags -DDEBUG_TCP -DDEBUG_SCSI
  49. einfo "Building userspace"
  50. local SLP_LIBS
  51. use slp && SLP_LIBS="-lslp"
  52. cd "${S}" && \
  53. KSRC="${KV_DIR}" CFLAGS="" \
  54. emake \
  55. OPTFLAGS="${CFLAGS}" SLP_LIBS="${SLP_LIBS}" \
  56. AR="$(tc-getAR)" CC="$(tc-getCC)" \
  57. user \
  58. || die "emake failed"
  59. }
  60. src_install() {
  61. einfo "Installing userspace"
  62. dosbin usr/iscsid usr/iscsiadm usr/iscsistart || die
  63. einfo "Installing utilities"
  64. dosbin utils/iscsi-iname utils/iscsi_discovery || die
  65. einfo "Installing docs"
  66. doman doc/*[1-8] || die
  67. dodoc README THANKS || die
  68. docinto test || die
  69. dodoc test/* || die
  70. einfo "Installing configuration"
  71. insinto /etc/iscsi
  72. doins etc/iscsid.conf || die
  73. newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example || die
  74. insinto /etc/iscsi/ifaces
  75. doins etc/iface.example || die
  76. newconfd "${FILESDIR}"/${P}-conf.d iscsid || die
  77. newinitd "${FILESDIR}"/${P}-init.d-r1 iscsid || die
  78. keepdir /var/db/iscsi
  79. fperms 700 /var/db/iscsi || die
  80. fperms 600 /etc/iscsi/iscsid.conf || die
  81. }
  82. pkg_postinst() {
  83. in='/etc/iscsi/initiatorname.iscsi'
  84. if [ ! -f "${ROOT}${in}" -a -f "${ROOT}${in}.example" ]; then
  85. cp -f "${ROOT}${in}.example" "${ROOT}${in}"
  86. fi
  87. }