Use https by default
[gentoo.git] / sys-block / iscsitarget / iscsitarget-9999.ebuild
1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="4"
6
7 inherit linux-mod eutils flag-o-matic
8
9 if [ ${PV} == "9999" ] ; then
10         inherit subversion
11         ESVN_REPO_URI="http://svn.code.sf.net/p/iscsitarget/code/trunk"
12 else
13         SRC_URI="https://dev.gentoo.org/~ryao/dist/${P}.tar.xz"
14         KEYWORDS="~amd64 ~ppc ~x86"
15 fi
16
17 DESCRIPTION="Open Source iSCSI target with professional features"
18 HOMEPAGE="http://iscsitarget.sourceforge.net/"
19
20 LICENSE="GPL-2"
21 SLOT="0"
22 IUSE=""
23
24 DEPEND="dev-libs/openssl"
25 RDEPEND="${DEPEND}"
26
27 MODULE_NAMES="iscsi_trgt(misc:${S}/kernel)"
28
29 pkg_setup() {
30         CONFIG_CHECK="CRYPTO_CRC32C"
31         ERROR_CFG="iscsitarget needs support for CRC32C in your kernel."
32
33         kernel_is ge 2 6 14 || die "Linux 2.6.14 or newer required"
34
35         [ ${PV} != "9999" ] && \
36                 { kernel_is le 3 11 || die "Linux 3.11 is the latest supported version."; }
37
38         linux-mod_pkg_setup
39 }
40 src_prepare() {
41         if [ ${PV} != "9999" ]
42         then
43                 # Fix build system to apply proper patches
44                 epatch "${FILESDIR}/${PN}-1.4.20.2_p20130103-fix-3.2-support.patch"
45
46                 # Respect LDFLAGS. Bug #365735
47                 epatch "${FILESDIR}/${PN}-1.4.20.2-respect-flags-v2.patch"
48
49                 # Avoid use of WRITE_SAME_16 in Linux 2.6.32 and earlier
50                 epatch "${FILESDIR}/${PN}-1.4.20.2_p20130103-restore-linux-2.6.32-support.patch"
51         fi
52
53         # Apply kernel-specific patches
54         emake KSRC="${KERNEL_DIR}" patch || die
55
56         epatch_user
57 }
58
59 src_compile() {
60         emake KSRC="${KERNEL_DIR}" usr || die
61
62         unset ARCH
63         filter-ldflags -Wl,*
64         emake KSRC="${KERNEL_DIR}" kernel || die
65 }
66
67 src_install() {
68         einfo "Installing userspace"
69
70         # Install ietd into libexec; we don't need ietd to be in the path
71         # for ROOT, since it's just a service.
72         exeinto /usr/libexec
73         doexe usr/ietd || die
74
75         dosbin usr/ietadm || die
76
77         insinto /etc
78         doins etc/ietd.conf etc/initiators.allow || die
79
80         # We moved ietd in /usr/libexec, so update the init script accordingly.
81         sed -e 's:/usr/sbin/ietd:/usr/libexec/ietd:' "${FILESDIR}"/ietd-init.d-2 > "${T}"/ietd-init.d
82         newinitd "${T}"/ietd-init.d ietd || die
83         newconfd "${FILESDIR}"/ietd-conf.d ietd || die
84
85         # Lock down perms, per bug 198209
86         fperms 0640 /etc/ietd.conf /etc/initiators.allow
87
88         doman doc/manpages/*.[1-9] || die
89         dodoc ChangeLog README RELEASE_NOTES README.initiators README.mcs README.vmware || die
90
91         einfo "Installing kernel module"
92         unset ARCH
93         linux-mod_src_install || die
94 }