1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit bash-completion-r1 eutils multilib udev versionator
10 DESCRIPTION="mirror/replicate block-devices across a network-connection"
11 SRC_URI="http://oss.linbit.com/drbd/${P/_/}.tar.gz"
12 HOMEPAGE="http://www.drbd.org"
14 KEYWORDS="~amd64 ~x86"
15 IUSE="heartbeat pacemaker +udev xen"
18 DEPEND="heartbeat? ( sys-cluster/heartbeat )
19 pacemaker? ( sys-cluster/pacemaker )
20 udev? ( virtual/udev )
24 S="${WORKDIR}/${P/_/}"
27 # respect LDFLAGS, #453442
28 sed -e "s/\$(CC) -o/\$(CC) \$(LDFLAGS) -o/" \
29 -e "/\$(DESTDIR)\$(localstatedir)\/lock/d" \
30 -i user/*/Makefile.in || die
33 sed -i -e "s:/lib/:/$(get_libdir)/:g" \
34 Makefile.in scripts/{Makefile.in,global_common.conf,drbd.conf.example} || die
35 sed -e "s:@prefix@/lib:@prefix@/$(get_libdir):" \
36 -e "s:(DESTDIR)/lib:(DESTDIR)/$(get_libdir):" \
37 -i user/*/Makefile.in || die
39 # correct install paths (really correct this time)
40 sed -i -e "s:\$(sysconfdir)/bash_completion.d:$(get_bashcompdir):" \
41 scripts/Makefile.in || die
43 # don't participate in user survey bug 360483
44 sed -i -e '/usage-count/ s/yes/no/' scripts/global_common.conf || die
45 sed -i -e "s:\$(sysconfdir)/udev:$(get_udevdir):" scripts/Makefile.in || die
47 epatch "${FILESDIR}"/run-lock.patch
54 --localstatedir=/var \
58 $(use_with pacemaker) \
59 $(use_with heartbeat) \
60 --with-bashcompletion \
65 # only compile the tools
66 emake OPTFLAGS="${CFLAGS}" tools
70 # only install the tools
71 emake DESTDIR="${D}" install-tools install-doc
72 dodoc README ChangeLog
74 # install our own init script
75 newinitd "${FILESDIR}"/${PN}-8.0.rc ${PN/-utils/}
77 dodoc scripts/drbd.conf.example
79 dosym /usr/sbin/drbdadm /sbin/drbdadm
84 einfo "Please copy and gunzip the configuration file:"
85 einfo "from /usr/share/doc/${PF}/${PN/-utils/}.conf.example.bz2 to /etc/${PN/-utils/}.conf"
86 einfo "and edit it to your needs. Helpful commands:"
87 einfo "man 5 drbd.conf"
88 einfo "man 8 drbdsetup"
90 einfo "man 8 drbddisk"
91 einfo "man 8 drbdmeta"
93 elog "Remember to enable drbd support in kernel."