1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit versionator linux-info eutils flag-o-matic toolchain-funcs udev
8 MY_P="${PN}-$(replace_version_separator 2 "-")"
10 DESCRIPTION="Open-iSCSI is a high performance, transport independent, multi-platform implementation of RFC3720"
11 HOMEPAGE="http://www.open-iscsi.org/"
12 SRC_URI="http://www.open-iscsi.org/bits/${MY_P}.tar.gz"
16 KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
17 IUSE="debug slp +tcp infiniband rdma"
19 DEPEND="slp? ( net-libs/openslp ) infiniband? ( sys-fabric/ofed )"
23 REQUIRED_USE="infiniband? ( rdma ) || ( rdma tcp )"
24 S="${WORKDIR}/${MY_P}"
29 if kernel_is -lt 2 6 16; then
30 die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
33 # Needs to be done, as iscsid currently only starts, when having the iSCSI
34 # support loaded as module. Kernel builtin options don't work. See this for
36 # https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
37 # If there's a new release, check whether this is still valid!
38 TCP_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
39 RDMA_MODULES="INFINIBAND_ISER"
40 INFINIBAND_MODULES="INFINIBAND_IPOIB INIBAND_USER_MAD INFINIBAND_USER_ACCESS"
41 CONFIG_CHECK_MODULES="tcp? ( ${TCP_MODULES} ) rdma? ( ${RDMA_MODULES} ) infiniband? ( ${INFINIBAND_MODULES} )"
42 if linux_config_exists; then
44 for module in ${TCP_MODULES}; do
45 linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
48 if use infiniband; then
49 for module in ${INFINIBAND_MODULES}; do
50 linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
54 for module in ${RDMA_MODULES}; do
55 linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"$
62 epatch "${FILESDIR}"/${P}-Makefiles.patch
63 epatch "${FILESDIR}"/${P}-memset.patch
64 epatch "${FILESDIR}"/musl-fixes.patch
68 sed -i -e 's:^\(iscsid.startup\)\s*=.*:\1 = /usr/sbin/iscsid:' etc/iscsid.conf || die
72 use debug && append-cppflags -DDEBUG_TCP -DDEBUG_SCSI
75 cd utils/open-isns || die
77 # SSL (--with-security) is broken
78 econf $(use_with slp) \
83 # Stuffing CPPFLAGS into CFLAGS isn't entirely correct, but the build
84 # is messed up already here, so it's not making it that much worse.
85 KSRC="${KV_DIR}" CFLAGS="" \
87 OPTFLAGS="${CFLAGS} ${CPPFLAGS}" \
88 AR="$(tc-getAR)" CC="$(tc-getCC)" \
93 emake DESTDIR="${ED}" sbindir="/usr/sbin" install
101 newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example
104 udev_dorules "${FILESDIR}"/99-iscsi.rules
105 exeinto /etc/udev/scripts
106 doexe "${FILESDIR}"/iscsidev.sh
108 newconfd "${FILESDIR}"/iscsid-conf.d iscsid
109 newinitd "${FILESDIR}"/iscsid-init.d iscsid
111 keepdir /var/db/iscsi
112 fperms 700 /var/db/iscsi
113 fperms 600 /etc/iscsi/iscsid.conf