games-board/freedoko: Drop old
[gentoo.git] / sys-cluster / drbd / drbd-8.4.3-r2.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit bash-completion-r1 versionator udev
6
7 DESCRIPTION="mirror/replicate block-devices across a network-connection"
8 SRC_URI="http://oss.linbit.com/drbd/$(get_version_component_range 1-2 ${PV})/${P}.tar.gz"
9 HOMEPAGE="http://www.drbd.org"
10
11 LICENSE="GPL-2"
12 KEYWORDS="amd64 x86"
13 IUSE="heartbeat pacemaker +udev xen"
14 SLOT="0"
15
16 PATCHES=(
17         # https://bugs.gentoo.org/show_bug.cgi?id=518774
18         "${FILESDIR}"/${P}-block-drbd.patch
19 )
20
21 src_prepare() {
22         default
23
24         # respect LDFLAGS, #453442
25         sed -e "s/\$(CC) -o/\$(CC) \$(LDFLAGS) -o/" \
26                 -e "/\$(DESTDIR)\$(localstatedir)\/lock/d" \
27                 -i user{,/legacy}/Makefile.in || die
28         # respect multilib
29         sed -i -e "s:/lib/:/$(get_libdir)/:g" \
30                 Makefile.in scripts/{Makefile.in,global_common.conf,drbd.conf.example} || die
31         sed -e "s:@prefix@/lib:@prefix@/$(get_libdir):" \
32                 -e "s:(DESTDIR)/lib:(DESTDIR)/$(get_libdir):" \
33                 -i user/{,legacy/}Makefile.in || die
34         # correct install paths (really correct this time)
35         sed -i -e "s:\$(sysconfdir)/bash_completion.d:$(get_bashcompdir):" \
36                 scripts/Makefile.in || die
37         # don't participate in user survey bug 360483
38         sed -i -e '/usage-count/ s/yes/no/' scripts/drbd.conf.example || die
39         sed -i -e "s:\$(sysconfdir)/udev:$(get_udevdir):" scripts/Makefile.in || die
40 }
41
42 src_configure() {
43         econf \
44                 --localstatedir=/var \
45                 --with-utils \
46                 --without-km \
47                 --without-rgmanager \
48                 $(use_with udev) \
49                 $(use_with xen) \
50                 $(use_with pacemaker) \
51                 $(use_with heartbeat) \
52                 --with-bashcompletion \
53                 --with-distro=gentoo
54 }
55
56 src_compile() {
57         # only compile the tools
58         emake OPTFLAGS="${CFLAGS}" tools
59 }
60
61 src_install() {
62         # only install the tools
63         emake DESTDIR="${D}" install-tools
64         einstalldocs
65
66         # install our own init script
67         newinitd "${FILESDIR}"/${PN}-8.0.rc ${PN}
68
69         dodoc scripts/drbd.conf.example
70 }
71
72 pkg_postinst() {
73         einfo
74         einfo "Please copy and gunzip the configuration file:"
75         einfo "from /usr/share/doc/${PF}/${PN}.conf.example.bz2 to /etc/${PN}.conf"
76         einfo "and edit it to your needs. Helpful commands:"
77         einfo "man 5 drbd.conf"
78         einfo "man 8 drbdsetup"
79         einfo "man 8 drbdadm"
80         einfo "man 8 drbddisk"
81         einfo "man 8 drbdmeta"
82         einfo
83
84         einfo "Remember to enable drbd support in kernel."
85 }