x11-drivers/xf86-video-i740: ia64 stable wrt bug #611056
[gentoo.git] / sys-block / open-iscsi / open-iscsi-2.0.873-r3.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit versionator linux-info eutils flag-o-matic toolchain-funcs udev
7
8 MY_P="${PN}-$(replace_version_separator 2 "-")"
9
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"
13
14 LICENSE="GPL-2"
15 SLOT="0"
16 KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
17 IUSE="debug slp +tcp infiniband rdma"
18
19 DEPEND="slp? ( net-libs/openslp ) infiniband? ( sys-fabric/ofed )"
20 RDEPEND="${DEPEND}
21         sys-fs/lsscsi
22         sys-apps/util-linux"
23 REQUIRED_USE="infiniband? ( rdma ) || ( rdma tcp )"
24 S="${WORKDIR}/${MY_P}"
25
26 pkg_setup() {
27         linux-info_pkg_setup
28
29         if kernel_is -lt 2 6 16; then
30                 die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
31         fi
32
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
35         # more information:
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
43                 if use tcp; 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)"
46                 done
47                 fi
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)"
51                 done
52                 fi
53                 if use rdma; then
54                         for module in ${RDMA_MODULES}; do
55                                 linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"$
56                         done
57                 fi
58         fi
59 }
60
61 src_prepare() {
62         epatch "${FILESDIR}"/${P}-Makefiles.patch
63         epatch "${FILESDIR}"/${P}-memset.patch
64         epatch "${FILESDIR}"/musl-fixes.patch
65
66         epatch_user
67
68         sed -i -e 's:^\(iscsid.startup\)\s*=.*:\1 = /usr/sbin/iscsid:' etc/iscsid.conf || die
69 }
70
71 src_configure() {
72         use debug && append-cppflags -DDEBUG_TCP -DDEBUG_SCSI
73         append-lfs-flags
74
75         cd utils/open-isns || die
76
77         # SSL (--with-security) is broken
78         econf $(use_with slp) \
79                 --without-security
80 }
81
82 src_compile() {
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="" \
86         emake \
87                 OPTFLAGS="${CFLAGS} ${CPPFLAGS}" \
88                 AR="$(tc-getAR)" CC="$(tc-getCC)" \
89                 user
90 }
91
92 src_install() {
93         emake DESTDIR="${ED}" sbindir="/usr/sbin" install
94
95         dodoc README THANKS
96
97         docinto test/
98         dodoc test/*
99
100         insinto /etc/iscsi
101         newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example
102
103         # udev pieces
104         udev_dorules "${FILESDIR}"/99-iscsi.rules
105         exeinto /etc/udev/scripts
106         doexe "${FILESDIR}"/iscsidev.sh
107
108         newconfd "${FILESDIR}"/iscsid-conf.d iscsid
109         newinitd "${FILESDIR}"/iscsid-init.d iscsid
110
111         keepdir /var/db/iscsi
112         fperms 700 /var/db/iscsi
113         fperms 600 /etc/iscsi/iscsid.conf
114 }