1 |
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
6 |
inherit autotools bash-completion-r1 linux-info tmpfiles udev
|
7 |
7 |
|
8 |
8 |
DESCRIPTION="mirror/replicate block-devices across a network-connection"
|
9 |
|
SRC_URI="https://pkg.linbit.com/downloads/drbd/utils/${P}.tar.gz"
|
10 |
9 |
HOMEPAGE="https://www.linbit.com/drbd"
|
|
10 |
SRC_URI="https://pkg.linbit.com/downloads/drbd/utils/${P}.tar.gz"
|
|
11 |
S="${WORKDIR}/${P/_/}"
|
11 |
12 |
|
12 |
13 |
LICENSE="GPL-2"
|
13 |
14 |
SLOT="0"
|
14 |
|
KEYWORDS="amd64 x86"
|
15 |
|
IUSE="pacemaker +udev xen"
|
|
15 |
KEYWORDS="~amd64 ~x86"
|
|
16 |
IUSE="pacemaker split-usr +udev xen"
|
16 |
17 |
|
17 |
18 |
DEPEND="
|
18 |
19 |
pacemaker? ( sys-cluster/pacemaker )
|
19 |
|
udev? ( virtual/udev )"
|
|
20 |
udev? ( virtual/udev )
|
|
21 |
"
|
20 |
22 |
RDEPEND="${DEPEND}"
|
21 |
23 |
BDEPEND="sys-devel/flex"
|
22 |
24 |
|
23 |
|
DOCS=( ChangeLog README.md )
|
24 |
|
|
25 |
25 |
PATCHES=(
|
26 |
26 |
"${FILESDIR}"/${PN}-9.15.1-run-lock.patch
|
27 |
|
"${FILESDIR}"/${PN}-9.15.1-sysmacros.patch
|
28 |
|
"${FILESDIR}"/${PN}-9.19.1-configure-posix.diff
|
|
27 |
"${FILESDIR}"/${PN}-9.23.1-respect-flags.patch
|
29 |
28 |
)
|
30 |
29 |
|
31 |
|
S="${WORKDIR}/${P/_/}"
|
32 |
|
|
33 |
30 |
pkg_setup() {
|
34 |
31 |
# verify that CONFIG_BLK_DEV_DRBD is enabled in the kernel or
|
35 |
32 |
# warn otherwise
|
... | ... | |
47 |
44 |
}
|
48 |
45 |
|
49 |
46 |
src_prepare() {
|
50 |
|
# respect LDFLAGS, #453442
|
|
47 |
# Respect LDFLAGS, bug #453442
|
51 |
48 |
sed -e "s/\$(CC) -o/\$(CC) \$(LDFLAGS) -o/" \
|
52 |
49 |
-e "/\$(DESTDIR)\$(localstatedir)\/lock/d" \
|
53 |
50 |
-i user/*/Makefile.in || die
|
54 |
51 |
|
55 |
|
# respect multilib
|
56 |
|
# bug #698304
|
|
52 |
# Respect multilib, bug #698304
|
57 |
53 |
sed -i -e "s:/lib/:/$(get_libdir)/:g" \
|
58 |
54 |
Makefile.in scripts/{Makefile.in,global_common.conf,drbd.conf.example} || die
|
59 |
55 |
sed -e "s:@prefix@/lib:@prefix@/$(get_libdir):" \
|
60 |
56 |
-e "s:(DESTDIR)/lib:(DESTDIR)/$(get_libdir):" \
|
61 |
57 |
-i user/*/Makefile.in || die
|
62 |
|
|
63 |
58 |
sed -i -e "s/lib/$(get_libdir)/" scripts/drbd.service || die
|
64 |
59 |
|
65 |
|
# correct install paths (really correct this time)
|
|
60 |
# Correct install paths (really correct this time)
|
66 |
61 |
sed -i -e "s:\$(sysconfdir)/bash_completion.d:$(get_bashcompdir):" \
|
67 |
62 |
scripts/Makefile.in || die
|
68 |
63 |
|
69 |
|
# don't participate in user survey bug 360483
|
|
64 |
# Don't participate in user survey, bug #360483
|
70 |
65 |
sed -i -e '/usage-count/ s/yes/no/' scripts/global_common.conf || die
|
71 |
66 |
sed -i -e "s:\$(sysconfdir)/udev:$(get_udevdir):" scripts/Makefile.in || die
|
72 |
67 |
|
... | ... | |
75 |
70 |
}
|
76 |
71 |
|
77 |
72 |
src_configure() {
|
78 |
|
econf \
|
79 |
|
--localstatedir="${EPREFIX}"/var \
|
80 |
|
--with-bashcompletion \
|
81 |
|
--with-distro=gentoo \
|
82 |
|
--with-prebuiltman \
|
83 |
|
--without-rgmanager \
|
84 |
|
$(use_with pacemaker) \
|
85 |
|
$(use_with udev) \
|
|
73 |
local myeconfargs=(
|
|
74 |
--localstatedir="${EPREFIX}"/var
|
|
75 |
--with-bashcompletion
|
|
76 |
--with-distro=gentoo
|
|
77 |
--with-prebuiltman
|
|
78 |
--without-rgmanager
|
|
79 |
$(use_with pacemaker)
|
|
80 |
$(use_with udev)
|
86 |
81 |
$(use_with xen)
|
|
82 |
)
|
|
83 |
|
|
84 |
econf "${myeconfargs[@]}"
|
87 |
85 |
}
|
88 |
86 |
|
89 |
87 |
src_compile() {
|
90 |
|
# only compile the tools
|
91 |
|
emake OPTFLAGS="${CFLAGS}" tools doc
|
|
88 |
# Only compile the tools
|
|
89 |
emake CXXFLAGS="${CXXFLAGS}" OPTFLAGS="${CFLAGS}" tools doc
|
92 |
90 |
}
|
93 |
91 |
|
94 |
92 |
src_install() {
|
95 |
|
# only install the tools
|
|
93 |
# Only install the tools
|
96 |
94 |
emake DESTDIR="${D}" install-tools install-doc
|
97 |
95 |
|
98 |
|
# install our own init script
|
|
96 |
# Install our own init script
|
99 |
97 |
newinitd "${FILESDIR}"/${PN}-8.0.rc ${PN/-utils/}
|
100 |
98 |
|
101 |
99 |
dodoc scripts/drbd.conf.example
|
... | ... | |
105 |
103 |
|
106 |
104 |
newtmpfiles scripts/drbd.tmpfiles.conf drbd.conf
|
107 |
105 |
|
108 |
|
# https://bugs.gentoo.org/698304
|
109 |
|
dodir lib/drbd
|
|
106 |
# bug #698304
|
|
107 |
dodir /lib/drbd
|
110 |
108 |
local i
|
111 |
109 |
for i in drbdadm-83 drbdadm-84 drbdsetup-83 drbdsetup-84; do
|
112 |
|
dosym ../../lib64/drbd/"${i}" lib/drbd/"${i}"
|
|
110 |
dosym -r /$(get_libdir)/drbd/"${i}" /lib/drbd/"${i}"
|
113 |
111 |
done
|
114 |
112 |
|
115 |
113 |
einstalldocs
|
... | ... | |
120 |
118 |
|
121 |
119 |
einfo
|
122 |
120 |
einfo "Please copy and gunzip the configuration file:"
|
123 |
|
einfo "from /usr/share/doc/${PF}/${PN/-utils/}.conf.example.bz2 to /etc/${PN/-utils/}.conf"
|
|
121 |
einfo "from ${EROOT}/usr/share/doc/${PF}/${PN/-utils/}.conf.example.bz2 to ${EROOT}/etc/${PN/-utils/}.conf"
|
124 |
122 |
einfo "and edit it to your needs. Helpful commands:"
|
125 |
123 |
einfo "man 5 drbd.conf"
|
126 |
124 |
einfo "man 8 drbdsetup"
|