Line 0
Link Here
|
|
|
1 |
# Copyright 1999-2014 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/lvm2-2.02.110.ebuild,v 1.3 2014/08/29 07:15:02 ssuominen Exp $ |
4 |
|
5 |
EAPI=5 |
6 |
inherit autotools eutils linux-info multilib systemd toolchain-funcs udev flag-o-matic |
7 |
|
8 |
DESCRIPTION="User-land utilities for LVM2 (device-mapper) software" |
9 |
HOMEPAGE="http://sources.redhat.com/lvm2/" |
10 |
SRC_URI="ftp://sources.redhat.com/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz |
11 |
ftp://sources.redhat.com/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz" |
12 |
|
13 |
LICENSE="GPL-2" |
14 |
SLOT="0" |
15 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux" |
16 |
IUSE="readline static static-libs systemd clvm cman lvm1 lvm2create_initrd selinux +udev +thin device-mapper-only" |
17 |
REQUIRED_USE="device-mapper-only? ( !clvm !cman !lvm1 !lvm2create_initrd !thin ) |
18 |
systemd? ( udev ) |
19 |
static? ( !udev )" #520450 |
20 |
|
21 |
DEPEND_COMMON="clvm? ( cman? ( =sys-cluster/cman-3* ) =sys-cluster/libdlm-3* ) |
22 |
readline? ( sys-libs/readline ) |
23 |
udev? ( >=virtual/libudev-208:=[static-libs?] )" |
24 |
# /run is now required for locking during early boot. /var cannot be assumed to |
25 |
# be available -- thus, pull in recent enough baselayout for /run. |
26 |
# This version of LVM is incompatible with cryptsetup <1.1.2. |
27 |
RDEPEND="${DEPEND_COMMON} |
28 |
>=sys-apps/baselayout-2.2 |
29 |
!<sys-apps/openrc-0.11 |
30 |
!<sys-fs/cryptsetup-1.1.2 |
31 |
!!sys-fs/clvm |
32 |
!!sys-fs/lvm-user |
33 |
>=sys-apps/util-linux-2.16 |
34 |
lvm2create_initrd? ( sys-apps/makedev ) |
35 |
thin? ( >=sys-block/thin-provisioning-tools-0.3.0 )" |
36 |
# note: thin- 0.3.0 is required to avoid --disable-thin_check_needs_check |
37 |
DEPEND="${DEPEND_COMMON} |
38 |
virtual/pkgconfig |
39 |
>=sys-devel/binutils-2.20.1-r1 |
40 |
static? ( |
41 |
selinux? ( sys-libs/libselinux[static-libs] ) |
42 |
udev? ( >=virtual/libudev-208:=[static-libs] ) |
43 |
>=sys-apps/util-linux-2.16[static-libs] |
44 |
)" |
45 |
|
46 |
S=${WORKDIR}/${PN/lvm/LVM}.${PV} |
47 |
|
48 |
pkg_setup() { |
49 |
local CONFIG_CHECK="~SYSVIPC" |
50 |
|
51 |
if use udev; then |
52 |
local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n" |
53 |
if linux_config_exists; then |
54 |
local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH) |
55 |
if [ -n "${uevent_helper_path}" ] && [ "${uevent_helper_path}" != '""' ]; then |
56 |
ewarn "It's recommended to set an empty value to the following kernel config option:" |
57 |
ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}" |
58 |
fi |
59 |
fi |
60 |
fi |
61 |
|
62 |
check_extra_config |
63 |
|
64 |
# 1. Genkernel no longer copies /sbin/lvm blindly. |
65 |
if use static; then |
66 |
elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with" |
67 |
elog "their static versions. If you need the static binaries," |
68 |
elog "you must append .static to the filename!" |
69 |
fi |
70 |
} |
71 |
|
72 |
src_prepare() { |
73 |
# Gentoo specific modification(s): |
74 |
epatch "${FILESDIR}"/${PN}-2.02.108-example.conf.in.patch |
75 |
|
76 |
sed -i \ |
77 |
-e "1iAR = $(tc-getAR)" \ |
78 |
-e "s:CC ?= @CC@:CC = $(tc-getCC):" \ |
79 |
make.tmpl.in || die #444082 |
80 |
|
81 |
sed -i -e '/FLAG/s:-O2::' configure{.in,} || die #480212 |
82 |
|
83 |
if use udev && ! use device-mapper-only; then |
84 |
sed -i -e '/use_lvmetad =/s:0:1:' conf/example.conf.in || die #514196 |
85 |
elog "Notice that \"use_lvmetad\" setting is enabled with USE=\"udev\" in" |
86 |
elog "/etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad" |
87 |
elog "if it was previously disabled." |
88 |
fi |
89 |
|
90 |
sed -i -e "s:/usr/bin/true:$(type -P true):" scripts/blk_availability_systemd_red_hat.service.in || die #517514 |
91 |
|
92 |
# For upstream -- review and forward: |
93 |
epatch "${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch |
94 |
epatch "${FILESDIR}"/${PN}-2.02.56-lvm2create_initrd.patch |
95 |
epatch "${FILESDIR}"/${PN}-2.02.67-createinitrd.patch #301331 |
96 |
epatch "${FILESDIR}"/${PN}-2.02.99-locale-muck.patch #330373 |
97 |
epatch "${FILESDIR}"/${PN}-2.02.70-asneeded.patch # -Wl,--as-needed |
98 |
epatch "${FILESDIR}"/${PN}-2.02.92-dynamic-static-ldflags.patch #332905 |
99 |
epatch "${FILESDIR}"/${PN}-2.02.108-static-pkgconfig-libs.patch #370217, #439414 + blkid |
100 |
epatch "${FILESDIR}"/${PN}-2.02.106-pthread-pkgconfig.patch #492450 |
101 |
# Patches for musl |
102 |
epatch "${FILESDIR}"/${PN}-fix-stdio-usage.patch # Patch from alpine linux |
103 |
epatch "${FILESDIR}"/${PN}-musl-fixes.patch |
104 |
|
105 |
# Without thin-privision-tools, there is nothing to install for target install_man7: |
106 |
use thin || { sed -i -e '/^install_lvm2/s:install_man7::' man/Makefile.in || die; } |
107 |
|
108 |
eautoreconf |
109 |
} |
110 |
|
111 |
src_configure() { |
112 |
filter-flags -flto |
113 |
local myconf |
114 |
local buildmode |
115 |
|
116 |
myconf="${myconf} $(use_enable !device-mapper-only dmeventd)" |
117 |
myconf="${myconf} $(use_enable !device-mapper-only cmdlib)" |
118 |
myconf="${myconf} $(use_enable !device-mapper-only applib)" |
119 |
myconf="${myconf} $(use_enable !device-mapper-only fsadm)" |
120 |
myconf="${myconf} $(use_enable !device-mapper-only lvmetad)" |
121 |
use device-mapper-only && myconf="${myconf} --disable-udev-systemd-background-jobs" |
122 |
|
123 |
# Most of this package does weird stuff. |
124 |
# The build options are tristate, and --without is NOT supported |
125 |
# options: 'none', 'internal', 'shared' |
126 |
if use static; then |
127 |
buildmode="internal" |
128 |
# This only causes the .static versions to become available |
129 |
myconf="${myconf} --enable-static_link" |
130 |
else |
131 |
buildmode="shared" |
132 |
fi |
133 |
dmbuildmode=$(use !device-mapper-only && echo internal || echo none) |
134 |
|
135 |
# dmeventd requires mirrors to be internal, and snapshot available |
136 |
# so we cannot disable them |
137 |
myconf="${myconf} --with-mirrors=${dmbuildmode}" |
138 |
myconf="${myconf} --with-snapshots=${dmbuildmode}" |
139 |
if use thin; then |
140 |
myconf="${myconf} --with-thin=internal --with-cache=internal" |
141 |
local texec |
142 |
for texec in check dump repair restore; do |
143 |
myconf="${myconf} --with-thin-${texec}=${EPREFIX}/sbin/thin_${texec}" |
144 |
myconf="${myconf} --with-cache-${texec}=${EPREFIX}/sbin/cache_${texec}" |
145 |
done |
146 |
else |
147 |
myconf="${myconf} --with-thin=none --with-cache=none" |
148 |
fi |
149 |
|
150 |
if use lvm1; then |
151 |
myconf="${myconf} --with-lvm1=${buildmode}" |
152 |
else |
153 |
myconf="${myconf} --with-lvm1=none" |
154 |
fi |
155 |
|
156 |
# disable O_DIRECT support on hppa, breaks pv detection (#99532) |
157 |
use hppa && myconf="${myconf} --disable-o_direct" |
158 |
|
159 |
if use clvm; then |
160 |
myconf="${myconf} --with-cluster=${buildmode}" |
161 |
# 4-state! Make sure we get it right, per bug 210879 |
162 |
# Valid options are: none, cman, gulm, all |
163 |
# |
164 |
# 2009/02: |
165 |
# gulm is removed now, now dual-state: |
166 |
# cman, none |
167 |
# all still exists, but is not needed |
168 |
# |
169 |
# 2009/07: |
170 |
# TODO: add corosync and re-enable ALL |
171 |
local clvmd="" |
172 |
use cman && clvmd="cman" |
173 |
#clvmd="${clvmd/cmangulm/all}" |
174 |
[ -z "${clvmd}" ] && clvmd="none" |
175 |
myconf="${myconf} --with-clvmd=${clvmd}" |
176 |
myconf="${myconf} --with-pool=${buildmode}" |
177 |
else |
178 |
myconf="${myconf} --with-clvmd=none --with-cluster=none" |
179 |
fi |
180 |
|
181 |
econf \ |
182 |
$(use_enable readline) \ |
183 |
$(use_enable selinux) \ |
184 |
--enable-pkgconfig \ |
185 |
--with-confdir="${EPREFIX}"/etc \ |
186 |
--exec-prefix="${EPREFIX}" \ |
187 |
--sbindir="${EPREFIX}/sbin" \ |
188 |
--with-staticdir="${EPREFIX}"/sbin \ |
189 |
--libdir="${EPREFIX}/$(get_libdir)" \ |
190 |
--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \ |
191 |
--with-default-dm-run-dir=/run \ |
192 |
--with-default-run-dir=/run/lvm \ |
193 |
--with-default-locking-dir=/run/lock/lvm \ |
194 |
--with-default-pid-dir=/run \ |
195 |
$(use_enable udev udev_rules) \ |
196 |
$(use_enable udev udev_sync) \ |
197 |
$(use_with udev udevdir "$(get_udevdir)"/rules.d) \ |
198 |
$(use_enable systemd udev-systemd-background-jobs) \ |
199 |
"$(systemd_with_unitdir)" \ |
200 |
${myconf} \ |
201 |
CLDFLAGS="${LDFLAGS}" |
202 |
} |
203 |
|
204 |
src_compile() { |
205 |
pushd include >/dev/null |
206 |
emake |
207 |
popd >/dev/null |
208 |
|
209 |
if use device-mapper-only ; then |
210 |
emake device-mapper |
211 |
else |
212 |
emake |
213 |
emake CC="$(tc-getCC)" -C scripts lvm2_activation_generator_systemd_red_hat |
214 |
fi |
215 |
} |
216 |
|
217 |
src_install() { |
218 |
local inst |
219 |
INSTALL_TARGETS="install install_systemd_units install_systemd_generators install_tmpfiles_configuration" |
220 |
use device-mapper-only && INSTALL_TARGETS="install_device-mapper" |
221 |
for inst in ${INSTALL_TARGETS}; do |
222 |
emake DESTDIR="${D}" ${inst} |
223 |
done |
224 |
|
225 |
newinitd "${FILESDIR}"/device-mapper.rc-2.02.105-r2 device-mapper |
226 |
newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper |
227 |
|
228 |
if use !device-mapper-only ; then |
229 |
newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd |
230 |
newinitd "${FILESDIR}"/lvm.rc-2.02.105-r2 lvm |
231 |
newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm |
232 |
|
233 |
newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.105-r2 lvm-monitoring |
234 |
newinitd "${FILESDIR}"/lvmetad.initd-2.02.105-r2 lvmetad |
235 |
fi |
236 |
|
237 |
if use clvm; then |
238 |
newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd |
239 |
newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd |
240 |
fi |
241 |
|
242 |
if use static-libs; then |
243 |
dolib.a libdm/ioctl/libdevmapper.a |
244 |
dolib.a libdaemon/client/libdaemonclient.a #462908 |
245 |
#gen_usr_ldscript libdevmapper.so |
246 |
dolib.a daemons/dmeventd/libdevmapper-event.a |
247 |
#gen_usr_ldscript libdevmapper-event.so |
248 |
else |
249 |
rm -f "${ED}"usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a |
250 |
fi |
251 |
|
252 |
if use lvm2create_initrd; then |
253 |
dosbin scripts/lvm2create_initrd/lvm2create_initrd |
254 |
doman scripts/lvm2create_initrd/lvm2create_initrd.8 |
255 |
newdoc scripts/lvm2create_initrd/README README.lvm2create_initrd |
256 |
fi |
257 |
|
258 |
insinto /etc |
259 |
doins "${FILESDIR}"/dmtab |
260 |
|
261 |
dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf |
262 |
} |
263 |
|
264 |
pkg_postinst() { |
265 |
ewarn "Make sure the \"lvm\" init script is in the runlevels:" |
266 |
ewarn "# rc-update add lvm boot" |
267 |
ewarn |
268 |
ewarn "Make sure to enable lvmetad in /etc/lvm/lvm.conf if you want" |
269 |
ewarn "to enable lvm autoactivation and metadata caching." |
270 |
} |
271 |
|
272 |
src_test() { |
273 |
einfo "Tests are disabled because of device-node mucking, if you want to" |
274 |
einfo "run tests, compile the package and see ${S}/tests" |
275 |
} |