Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/lvm2/, sys-fs/lvm2/files/
Date: Thu, 03 Dec 2015 11:33:55
Message-Id: 1449142424.e98c6edabec9e0b0e9b21da01c2ea2e0df89897b.polynomial-c@gentoo
1 commit: e98c6edabec9e0b0e9b21da01c2ea2e0df89897b
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 3 11:33:24 2015 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 3 11:33:44 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e98c6eda
7
8 sys-fs/lvm2: Bump to version 2.02.136
9
10 Package-Manager: portage-2.2.26
11 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
12
13 sys-fs/lvm2/Manifest | 1 +
14 .../lvm2-2.02.129-dynamic-static-ldflags.patch | 59 +++++
15 .../lvm2/files/lvm2-2.02.129-example.conf.in.patch | 52 ++++
16 .../lvm2-2.02.129-static-pkgconfig-libs.patch | 102 ++++++++
17 .../files/lvm2-2.02.130-pthread-pkgconfig.patch | 32 +++
18 sys-fs/lvm2/lvm2-2.02.136.ebuild | 275 +++++++++++++++++++++
19 6 files changed, 521 insertions(+)
20
21 diff --git a/sys-fs/lvm2/Manifest b/sys-fs/lvm2/Manifest
22 index 6822526..750b75a 100644
23 --- a/sys-fs/lvm2/Manifest
24 +++ b/sys-fs/lvm2/Manifest
25 @@ -2,3 +2,4 @@ DIST LVM2.2.02.103.tgz 1343887 SHA256 71c5a2e8842ed2f13f52e02b44eb183110a3410ded
26 DIST LVM2.2.02.109.tgz 1482167 SHA256 7bc95ba5209c8aa5bd492167b2e2797f156852ed11cfc63fb783070ade8e65e7 SHA512 210645cccf297112ffdbc63e0336385c31b2d17d226ae10813ba8ffd4f01ce07af44a4134e60644283e4360e10e925113e867378502ae0166f3fc91258caea68 WHIRLPOOL 7f2d91446f502440b2ed73df0f2ce29069364bbb198e675223b61c17e5cc6e1c162ce60a977cb07b71e44d672c688bbbf0247380f1b9c5adf325cf324f4c4bb7
27 DIST LVM2.2.02.110.tgz 1487448 SHA256 3dad1aa04a71b8420b15f44c53f041001436539d3f8073490c2d0c52f6fecd11 SHA512 5b4dfa5ed877d34efa5b109dc712e8fa9154b4954b267b0243f1925f9d2fa8c67f4ce8da36a85f3bba6c117f6153fdbf150e3753587ab90584a86d2654dc0812 WHIRLPOOL ea221ed3e9d3f79009d7c341a7a75b52eacc5be79e28f2498e7cdc0f4a97c2bebff405b032eb8086d3b5b5aaf79da2f281c5734562355bddbe6004058e114ced
28 DIST LVM2.2.02.116.tgz 1538340 SHA256 2479d6ea61c405efcfcd8a78390d00c1d2e9c92c0262f3ed599f2c0fb6f0b767 SHA512 992541339637d597257850b4ff7f5348fb7cdcccf806ac8d986a3be1ad1edc5f6bfaedeed5128690c541d1a485cdc75742e90a766363c39867901003518fb84d WHIRLPOOL 1e89ec941882fddba62c9649be46eb5bc6c9cb899669d4bbe4a4a1023c8bf7d8264c4815ef88bb39dedcb9637815411feb826aa102e629d77b80e45e099e398d
29 +DIST LVM2.2.02.136.tgz 1891010 SHA256 c6af90097d8f7cd851d38c4f57bb3ad7039cfa123f1e336dba957814a298bd8c SHA512 ebda683e7dbeb2c4860a583d47e60756d18127e37a373ab2958af8e54b9bee0d2e3370b7803d88fa4b08564345c88af55bfbac317081160118ce4b3733b69f9d WHIRLPOOL 8020fdddac648e32084801ffaf9b00b8a683870c8dd8dd5969851fd081eb1efd578decd82cd4a7a24fb6150c55afafdd819a76eb7eb6926cdc057455cc1d1618
30
31 diff --git a/sys-fs/lvm2/files/lvm2-2.02.129-dynamic-static-ldflags.patch b/sys-fs/lvm2/files/lvm2-2.02.129-dynamic-static-ldflags.patch
32 new file mode 100644
33 index 0000000..efdfb81
34 --- /dev/null
35 +++ b/sys-fs/lvm2/files/lvm2-2.02.129-dynamic-static-ldflags.patch
36 @@ -0,0 +1,59 @@
37 +--- LVM2.2.02.129/configure.in
38 ++++ LVM2.2.02.129/configure.in
39 +@@ -31,6 +31,7 @@
40 + linux*)
41 + CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
42 + ELDFLAGS="-Wl,--export-dynamic"
43 ++ STATIC_LDFLAGS="-Wl,--no-export-dynamic"
44 + # FIXME Generate list and use --dynamic-list=.dlopen.sym
45 + CLDWHOLEARCHIVE="-Wl,-whole-archive"
46 + CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
47 +@@ -2008,6 +2009,7 @@
48 + AC_SUBST(SELINUX_PC)
49 + AC_SUBST(SNAPSHOTS)
50 + AC_SUBST(STATICDIR)
51 ++AC_SUBST(STATIC_LDFLAGS)
52 + AC_SUBST(STATIC_LINK)
53 + AC_SUBST(TESTING)
54 + AC_SUBST(TESTSUITE_DATA)
55 +--- LVM2.2.02.129/daemons/dmeventd/Makefile.in
56 ++++ LVM2.2.02.129/daemons/dmeventd/Makefile.in
57 +@@ -66,7 +66,7 @@
58 + $(DL_LIBS) $(LVMLIBS) $(LIBS) -rdynamic
59 +
60 + dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a
61 +- $(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \
62 ++ $(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) $(STATIC_LDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \
63 + dmeventd.o $(DL_LIBS) $(LVMLIBS) $(LIBS) $(STATIC_LIBS)
64 +
65 + ifeq ("@PKGCONFIG@", "yes")
66 +--- LVM2.2.02.129/make.tmpl.in
67 ++++ LVM2.2.02.129/make.tmpl.in
68 +@@ -48,6 +48,7 @@
69 + # FIXME set this only where it's needed, not globally?
70 + CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
71 + LDFLAGS ?= @COPTIMISE_FLAG@ @LDFLAGS@
72 ++STATIC_LDFLAGS += @STATIC_LDFLAGS@
73 + CLDFLAGS += @CLDFLAGS@
74 + ELDFLAGS += @ELDFLAGS@
75 + LDDEPS += @LDDEPS@
76 +--- LVM2.2.02.129/tools/Makefile.in
77 ++++ LVM2.2.02.129/tools/Makefile.in
78 +@@ -129,7 +129,7 @@
79 + -o $@ dmsetup.o -ldevmapper $(LIBS)
80 +
81 + dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
82 +- $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
83 ++ $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) \
84 + -o $@ dmsetup.o -ldevmapper $(STATIC_LIBS) $(LIBS)
85 +
86 + all: device-mapper
87 +@@ -146,7 +146,7 @@
88 + endif
89 +
90 + lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a $(interfacebuilddir)/libdevmapper.a
91 +- $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
92 ++ $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
93 + $(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
94 +
95 + liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
96
97 diff --git a/sys-fs/lvm2/files/lvm2-2.02.129-example.conf.in.patch b/sys-fs/lvm2/files/lvm2-2.02.129-example.conf.in.patch
98 new file mode 100644
99 index 0000000..076e060
100 --- /dev/null
101 +++ b/sys-fs/lvm2/files/lvm2-2.02.129-example.conf.in.patch
102 @@ -0,0 +1,52 @@
103 +Maintainer note: Forward ported without editing from lvm2-2.02.108-example.conf.in.patch to apply cleanly.
104 +
105 +--- LVM2.2.02.129/conf/example.conf.in
106 ++++ LVM2.2.02.129/conf/example.conf.in
107 +@@ -128,6 +128,9 @@
108 + # Example
109 + # Accept every block device:
110 + # filter = [ "a|.*/|" ]
111 ++ # Gentoo: we exclude /dev/nbd by default, because it makes a lot of kernel
112 ++ # noise when you probed while not available.
113 ++ filter = [ "r|/dev/nbd.*|", "a/.*/" ]
114 + # Reject the cdrom drive:
115 + # filter = [ "r|/dev/cdrom|" ]
116 + # Work with just loopback devices, e.g. for testing:
117 +@@ -620,7 +623,8 @@
118 + # tools need to be installed with .lvm1 suffices, e.g. vgscan.lvm1.
119 + # They will stop working once the lvm2 on-disk metadata format is used.
120 + # This configuration option has an automatic default value.
121 +- # fallback_to_lvm1 = @DEFAULT_FALLBACK_TO_LVM1@
122 ++ # Gentoo: the LVM tools are a seperate package.
123 ++ fallback_to_lvm1 = 0
124 +
125 + # Configuration option global/format.
126 + # The default metadata format that commands should use.
127 +@@ -1413,7 +1417,7 @@
128 +
129 + # Configuration section metadata.
130 + # This configuration section has an automatic default value.
131 +-# metadata {
132 ++metadata {
133 +
134 + # Configuration option metadata/pvmetadatacopies.
135 + # Number of copies of metadata to store on each PV.
136 +@@ -1431,7 +1435,8 @@
137 + #
138 + # This configuration option is advanced.
139 + # This configuration option has an automatic default value.
140 +- # pvmetadatacopies = 1
141 ++ # Gentoo: enable for data safety, but PV resize is then disabled.
142 ++ # pvmetadatacopies = 2
143 +
144 + # Configuration option metadata/vgmetadatacopies.
145 + # Number of copies of metadata to maintain for each VG.
146 +@@ -1486,7 +1491,7 @@
147 + #
148 + # This configuration option is advanced.
149 + # This configuration option does not have a default value defined.
150 +-# }
151 ++}
152 +
153 + # Configuration section report.
154 + # LVM report command output formatting.
155
156 diff --git a/sys-fs/lvm2/files/lvm2-2.02.129-static-pkgconfig-libs.patch b/sys-fs/lvm2/files/lvm2-2.02.129-static-pkgconfig-libs.patch
157 new file mode 100644
158 index 0000000..2396945
159 --- /dev/null
160 +++ b/sys-fs/lvm2/files/lvm2-2.02.129-static-pkgconfig-libs.patch
161 @@ -0,0 +1,102 @@
162 +--- LVM2.2.02.129/configure.in
163 ++++ LVM2.2.02.129/configure.in
164 +@@ -1287,6 +1287,7 @@
165 + fi])
166 + if test "$BLKID_WIPING" = yes; then
167 + BLKID_PC="blkid"
168 ++ BLKID_STATIC_LIBS=`$PKG_CONFIG --static --libs $BLKID_PC`
169 + DEFAULT_USE_BLKID_WIPING=1
170 + AC_DEFINE([BLKID_WIPING_SUPPORT], 1, [Define to 1 to use libblkid detection of signatures when wiping.])
171 + else
172 +@@ -1332,6 +1333,7 @@
173 + if test "$UDEV_SYNC" = yes; then
174 + pkg_config_init
175 + PKG_CHECK_MODULES(UDEV, libudev >= 143, [UDEV_PC="libudev"])
176 ++ UDEV_STATIC_LIBS=`$PKG_CONFIG --static --libs libudev`
177 + AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.])
178 + fi
179 +
180 +@@ -1558,19 +1560,32 @@
181 + if test "$SELINUX" = yes; then
182 + AC_CHECK_LIB([sepol], [sepol_check_context], [
183 + AC_DEFINE([HAVE_SEPOL], 1, [Define to 1 if sepol_check_context is available.])
184 +- SELINUX_LIBS="-lsepol"])
185 ++ SEPOL_LIBS="-lsepol"])
186 ++
187 ++ dnl -- init pkgconfig if required
188 ++ if test x$PKGCONFIG_INIT != x1; then
189 ++ pkg_config_init
190 ++ fi
191 ++ PKG_CHECK_MODULES(SELINUX, libselinux, [
192 ++ SELINUX_PC="libselinux"
193 ++ SELINUX_STATIC_LIBS=`$PKG_CONFIG --static --libs libselinux`
194 ++ SELINUX_LIBS="$SELINUX_LIBS $SEPOL_LIBS"
195 ++ AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
196 ++ ],[
197 ++ dnl -- old non-pkgconfig method, is buggy with static builds
198 +
199 + AC_CHECK_LIB([selinux], [is_selinux_enabled], [
200 + AC_CHECK_HEADERS([selinux/selinux.h],, hard_bailout)
201 + AC_CHECK_HEADERS([selinux/label.h])
202 + AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
203 +- SELINUX_LIBS="-lselinux $SELINUX_LIBS"
204 ++ SELINUX_LIBS="-lselinux $SEPOL_LIBS"
205 + SELINUX_PC="libselinux"
206 + HAVE_SELINUX=yes ], [
207 + AC_MSG_WARN(Disabling selinux)
208 + SELINUX_LIBS=
209 + SELINUX_PC=
210 + HAVE_SELINUX=no ])
211 ++ ])
212 + fi
213 +
214 + ################################################################################
215 +@@ -1902,6 +1917,7 @@
216 + ################################################################################
217 + AC_SUBST(APPLIB)
218 + AC_SUBST(AWK)
219 ++AC_SUBST(BLKID_STATIC_LIBS)
220 + AC_SUBST(BLKID_PC)
221 + AC_SUBST(BUILD_CMIRRORD)
222 + AC_SUBST(BUILD_DMEVENTD)
223 +@@ -2005,6 +2021,7 @@
224 + AC_SUBST(SALCK_CFLAGS)
225 + AC_SUBST(SALCK_LIBS)
226 + AC_SUBST(SELINUX_LIBS)
227 ++AC_SUBST(SELINUX_STATIC_LIBS)
228 + AC_SUBST(SELINUX_PC)
229 + AC_SUBST(SNAPSHOTS)
230 + AC_SUBST(STATICDIR)
231 +@@ -2020,6 +2037,7 @@
232 + AC_SUBST(CACHE_DUMP_CMD)
233 + AC_SUBST(CACHE_REPAIR_CMD)
234 + AC_SUBST(CACHE_RESTORE_CMD)
235 ++AC_SUBST(UDEV_STATIC_LIBS)
236 + AC_SUBST(UDEV_PC)
237 + AC_SUBST(UDEV_RULES)
238 + AC_SUBST(UDEV_SYNC)
239 +--- LVM2.2.02.129/make.tmpl.in
240 ++++ LVM2.2.02.129/make.tmpl.in
241 +@@ -43,7 +43,7 @@
242 +
243 + LIBS = @LIBS@
244 + # Extra libraries always linked with static binaries
245 +-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
246 ++STATIC_LIBS = $(SELINUX_STATIC_LIBS) $(UDEV_STATIC_LIBS) $(BLKID_STATIC_LIBS)
247 + DEFS += @DEFS@
248 + # FIXME set this only where it's needed, not globally?
249 + CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
250 +@@ -58,10 +58,13 @@
251 + PTHREAD_LIBS = @PTHREAD_LIBS@
252 + READLINE_LIBS = @READLINE_LIBS@
253 + SELINUX_LIBS = @SELINUX_LIBS@
254 ++SELINUX_STATIC_LIBS = @SELINUX_STATIC_LIBS@
255 + UDEV_CFLAGS = @UDEV_CFLAGS@
256 + UDEV_LIBS = @UDEV_LIBS@
257 ++UDEV_STATIC_LIBS = @UDEV_STATIC_LIBS@
258 + BLKID_CFLAGS = @BLKID_CFLAGS@
259 + BLKID_LIBS = @BLKID_LIBS@
260 ++BLKID_STATIC_LIBS = @BLKID_STATIC_LIBS@
261 + VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
262 + TESTING = @TESTING@
263 +
264
265 diff --git a/sys-fs/lvm2/files/lvm2-2.02.130-pthread-pkgconfig.patch b/sys-fs/lvm2/files/lvm2-2.02.130-pthread-pkgconfig.patch
266 new file mode 100644
267 index 0000000..11db632
268 --- /dev/null
269 +++ b/sys-fs/lvm2/files/lvm2-2.02.130-pthread-pkgconfig.patch
270 @@ -0,0 +1,32 @@
271 +Make sure that libdm usage always brings in pthread libraries, both in
272 +pkgconfig and during manual build.
273 +
274 +--- LVM2.2.02.130/libdm/libdevmapper.pc.in
275 ++++ LVM2.2.02.130/libdm/libdevmapper.pc.in
276 +@@ -9,4 +9,4 @@
277 + Cflags: -I${includedir}
278 + Libs: -L${libdir} -ldevmapper
279 + Requires.private: @SELINUX_PC@ @UDEV_PC@
280 +-Libs.private: -lm @RT_LIB@
281 ++Libs.private: -lm @RT_LIB@ @PTHREAD_LIBS@
282 +--- LVM2.2.02.130/tools/Makefile.in
283 ++++ LVM2.2.02.130/tools/Makefile.in
284 +@@ -90,6 +90,7 @@
285 + INSTALL_LVM_TARGETS += install_tools_static
286 + INSTALL_DMSETUP_TARGETS += install_dmsetup_static
287 + INSTALL_CMDLIB_TARGETS += install_cmdlib_static
288 ++ STATIC_LIBS += @PTHREAD_LIBS@
289 + endif
290 +
291 + LVMLIBS = $(LVMINTERNAL_LIBS)
292 +@@ -120,6 +121,10 @@
293 +
294 + include $(top_builddir)/make.tmpl
295 +
296 ++ifeq ("@STATIC_LINK@", "yes")
297 ++ STATIC_LIBS += @PTHREAD_LIBS@
298 ++endif
299 ++
300 + device-mapper: $(TARGETS_DM)
301 +
302 + CFLAGS_dmsetup.o += $(UDEV_CFLAGS) $(EXTRA_EXEC_CFLAGS)
303
304 diff --git a/sys-fs/lvm2/lvm2-2.02.136.ebuild b/sys-fs/lvm2/lvm2-2.02.136.ebuild
305 new file mode 100644
306 index 0000000..96c067b
307 --- /dev/null
308 +++ b/sys-fs/lvm2/lvm2-2.02.136.ebuild
309 @@ -0,0 +1,275 @@
310 +# Copyright 1999-2015 Gentoo Foundation
311 +# Distributed under the terms of the GNU General Public License v2
312 +# $Id$
313 +
314 +EAPI=5
315 +inherit autotools eutils linux-info multilib systemd toolchain-funcs udev flag-o-matic
316 +
317 +DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
318 +HOMEPAGE="https://sources.redhat.com/lvm2/"
319 +SRC_URI="ftp://sources.redhat.com/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
320 + ftp://sources.redhat.com/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"
321 +
322 +LICENSE="GPL-2"
323 +SLOT="0"
324 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
325 +IUSE="readline static static-libs systemd clvm cman lvm1 lvm2create_initrd selinux +udev +thin device-mapper-only"
326 +REQUIRED_USE="device-mapper-only? ( !clvm !cman !lvm1 !lvm2create_initrd !thin )
327 + systemd? ( udev )
328 + clvm? ( !systemd )"
329 +
330 +DEPEND_COMMON="clvm? ( cman? ( =sys-cluster/cman-3* ) =sys-cluster/libdlm-3* )
331 + readline? ( sys-libs/readline:0= )
332 + udev? ( >=virtual/libudev-208:=[static-libs?] )"
333 +# /run is now required for locking during early boot. /var cannot be assumed to
334 +# be available -- thus, pull in recent enough baselayout for /run.
335 +# This version of LVM is incompatible with cryptsetup <1.1.2.
336 +RDEPEND="${DEPEND_COMMON}
337 + >=sys-apps/baselayout-2.2
338 + !<sys-apps/openrc-0.11
339 + !<sys-fs/cryptsetup-1.1.2
340 + !!sys-fs/clvm
341 + !!sys-fs/lvm-user
342 + >=sys-apps/util-linux-2.16
343 + lvm2create_initrd? ( sys-apps/makedev )
344 + thin? ( >=sys-block/thin-provisioning-tools-0.3.0 )"
345 +# note: thin- 0.3.0 is required to avoid --disable-thin_check_needs_check
346 +# USE 'static' currently only works with eudev, bug 520450
347 +DEPEND="${DEPEND_COMMON}
348 + virtual/pkgconfig
349 + >=sys-devel/binutils-2.20.1-r1
350 + static? (
351 + selinux? ( sys-libs/libselinux[static-libs] )
352 + udev? ( >=sys-fs/eudev-3.1.2[static-libs] )
353 + >=sys-apps/util-linux-2.16[static-libs]
354 + )"
355 +
356 +S=${WORKDIR}/${PN/lvm/LVM}.${PV}
357 +
358 +pkg_setup() {
359 + local CONFIG_CHECK="~SYSVIPC"
360 +
361 + if use udev; then
362 + local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
363 + if linux_config_exists; then
364 + local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
365 + if [ -n "${uevent_helper_path}" ] && [ "${uevent_helper_path}" != '""' ]; then
366 + ewarn "It's recommended to set an empty value to the following kernel config option:"
367 + ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
368 + fi
369 + fi
370 + fi
371 +
372 + check_extra_config
373 +
374 + # 1. Genkernel no longer copies /sbin/lvm blindly.
375 + if use static; then
376 + elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
377 + elog "their static versions. If you need the static binaries,"
378 + elog "you must append .static to the filename!"
379 + fi
380 +}
381 +
382 +src_prepare() {
383 + # Gentoo specific modification(s):
384 + epatch "${FILESDIR}"/${PN}-2.02.129-example.conf.in.patch
385 +
386 + sed -i \
387 + -e "1iAR = $(tc-getAR)" \
388 + -e "s:CC ?= @CC@:CC = $(tc-getCC):" \
389 + make.tmpl.in || die #444082
390 +
391 + sed -i -e '/FLAG/s:-O2::' configure{.in,} || die #480212
392 +
393 + if use udev && ! use device-mapper-only; then
394 + sed -i -e '/use_lvmetad =/s:0:1:' conf/example.conf.in || die #514196
395 + elog "Notice that \"use_lvmetad\" setting is enabled with USE=\"udev\" in"
396 + elog "/etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad"
397 + elog "if it was previously disabled."
398 + fi
399 +
400 + sed -i -e "s:/usr/bin/true:$(type -P true):" scripts/blk_availability_systemd_red_hat.service.in || die #517514
401 +
402 + # For upstream -- review and forward:
403 + epatch "${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch
404 + epatch "${FILESDIR}"/${PN}-2.02.56-lvm2create_initrd.patch
405 + epatch "${FILESDIR}"/${PN}-2.02.67-createinitrd.patch #301331
406 + epatch "${FILESDIR}"/${PN}-2.02.99-locale-muck.patch #330373
407 + epatch "${FILESDIR}"/${PN}-2.02.70-asneeded.patch # -Wl,--as-needed
408 + epatch "${FILESDIR}"/${PN}-2.02.129-dynamic-static-ldflags.patch #332905
409 + epatch "${FILESDIR}"/${PN}-2.02.129-static-pkgconfig-libs.patch #370217, #439414 + blkid
410 + epatch "${FILESDIR}"/${PN}-2.02.130-pthread-pkgconfig.patch #492450
411 +
412 + # Without thin-privision-tools, there is nothing to install for target install_man7:
413 + use thin || { sed -i -e '/^install_lvm2/s:install_man7::' man/Makefile.in || die; }
414 +
415 + eautoreconf
416 +}
417 +
418 +src_configure() {
419 + filter-flags -flto
420 + local myconf
421 + local buildmode
422 +
423 + myconf="${myconf} $(use_enable !device-mapper-only dmeventd)"
424 + myconf="${myconf} $(use_enable !device-mapper-only cmdlib)"
425 + myconf="${myconf} $(use_enable !device-mapper-only applib)"
426 + myconf="${myconf} $(use_enable !device-mapper-only fsadm)"
427 + myconf="${myconf} $(use_enable !device-mapper-only lvmetad)"
428 + use device-mapper-only && myconf="${myconf} --disable-udev-systemd-background-jobs"
429 +
430 + # Most of this package does weird stuff.
431 + # The build options are tristate, and --without is NOT supported
432 + # options: 'none', 'internal', 'shared'
433 + if use static; then
434 + buildmode="internal"
435 + # This only causes the .static versions to become available
436 + myconf="${myconf} --enable-static_link"
437 + else
438 + buildmode="shared"
439 + fi
440 + dmbuildmode=$(use !device-mapper-only && echo internal || echo none)
441 +
442 + # dmeventd requires mirrors to be internal, and snapshot available
443 + # so we cannot disable them
444 + myconf="${myconf} --with-mirrors=${dmbuildmode}"
445 + myconf="${myconf} --with-snapshots=${dmbuildmode}"
446 + if use thin; then
447 + myconf="${myconf} --with-thin=internal --with-cache=internal"
448 + local texec
449 + for texec in check dump repair restore; do
450 + myconf="${myconf} --with-thin-${texec}=${EPREFIX}/sbin/thin_${texec}"
451 + myconf="${myconf} --with-cache-${texec}=${EPREFIX}/sbin/cache_${texec}"
452 + done
453 + else
454 + myconf="${myconf} --with-thin=none --with-cache=none"
455 + fi
456 +
457 + if use lvm1; then
458 + myconf="${myconf} --with-lvm1=${buildmode}"
459 + else
460 + myconf="${myconf} --with-lvm1=none"
461 + fi
462 +
463 + # disable O_DIRECT support on hppa, breaks pv detection (#99532)
464 + use hppa && myconf="${myconf} --disable-o_direct"
465 +
466 + if use clvm; then
467 + myconf="${myconf} --with-cluster=${buildmode}"
468 + # 4-state! Make sure we get it right, per bug 210879
469 + # Valid options are: none, cman, gulm, all
470 + #
471 + # 2009/02:
472 + # gulm is removed now, now dual-state:
473 + # cman, none
474 + # all still exists, but is not needed
475 + #
476 + # 2009/07:
477 + # TODO: add corosync and re-enable ALL
478 + local clvmd=""
479 + use cman && clvmd="cman"
480 + #clvmd="${clvmd/cmangulm/all}"
481 + [ -z "${clvmd}" ] && clvmd="none"
482 + myconf="${myconf} --with-clvmd=${clvmd}"
483 + myconf="${myconf} --with-pool=${buildmode}"
484 + else
485 + myconf="${myconf} --with-clvmd=none --with-cluster=none"
486 + fi
487 +
488 + econf \
489 + $(use_enable readline) \
490 + $(use_enable selinux) \
491 + --enable-pkgconfig \
492 + --with-confdir="${EPREFIX}"/etc \
493 + --exec-prefix="${EPREFIX}" \
494 + --sbindir="${EPREFIX}/sbin" \
495 + --with-staticdir="${EPREFIX}"/sbin \
496 + --libdir="${EPREFIX}/$(get_libdir)" \
497 + --with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \
498 + --with-default-dm-run-dir=/run \
499 + --with-default-run-dir=/run/lvm \
500 + --with-default-locking-dir=/run/lock/lvm \
501 + --with-default-pid-dir=/run \
502 + $(use_enable udev udev_rules) \
503 + $(use_enable udev udev_sync) \
504 + $(use_with udev udevdir "$(get_udevdir)"/rules.d) \
505 + $(use_enable systemd udev-systemd-background-jobs) \
506 + "$(systemd_with_unitdir)" \
507 + ${myconf} \
508 + CLDFLAGS="${LDFLAGS}"
509 +}
510 +
511 +src_compile() {
512 + pushd include >/dev/null
513 + emake
514 + popd >/dev/null
515 +
516 + if use device-mapper-only ; then
517 + emake device-mapper
518 + else
519 + emake
520 + emake CC="$(tc-getCC)" -C scripts lvm2_activation_generator_systemd_red_hat
521 + fi
522 +}
523 +
524 +src_install() {
525 + local inst
526 + INSTALL_TARGETS="install install_tmpfiles_configuration"
527 + # install systemd related files only when requested, bug #522430
528 + use systemd && INSTALL_TARGETS="${INSTALL_TARGETS} install_systemd_units install_systemd_generators"
529 + use device-mapper-only && INSTALL_TARGETS="install_device-mapper"
530 + for inst in ${INSTALL_TARGETS}; do
531 + emake DESTDIR="${D}" ${inst}
532 + done
533 +
534 + newinitd "${FILESDIR}"/device-mapper.rc-2.02.105-r2 device-mapper
535 + newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper
536 +
537 + if use !device-mapper-only ; then
538 + newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd
539 + newinitd "${FILESDIR}"/lvm.rc-2.02.105-r2 lvm
540 + newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm
541 +
542 + newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.105-r2 lvm-monitoring
543 + newinitd "${FILESDIR}"/lvmetad.initd-2.02.105-r2 lvmetad
544 + fi
545 +
546 + if use clvm; then
547 + newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd
548 + newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd
549 + fi
550 +
551 + if use static-libs; then
552 + dolib.a libdm/ioctl/libdevmapper.a
553 + dolib.a libdaemon/client/libdaemonclient.a #462908
554 + #gen_usr_ldscript libdevmapper.so
555 + dolib.a daemons/dmeventd/libdevmapper-event.a
556 + #gen_usr_ldscript libdevmapper-event.so
557 + else
558 + rm -f "${ED}"usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a
559 + fi
560 +
561 + if use lvm2create_initrd; then
562 + dosbin scripts/lvm2create_initrd/lvm2create_initrd
563 + doman scripts/lvm2create_initrd/lvm2create_initrd.8
564 + newdoc scripts/lvm2create_initrd/README README.lvm2create_initrd
565 + fi
566 +
567 + insinto /etc
568 + doins "${FILESDIR}"/dmtab
569 +
570 + dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf
571 +}
572 +
573 +pkg_postinst() {
574 + ewarn "Make sure the \"lvm\" init script is in the runlevels:"
575 + ewarn "# rc-update add lvm boot"
576 + ewarn
577 + ewarn "Make sure to enable lvmetad in /etc/lvm/lvm.conf if you want"
578 + ewarn "to enable lvm autoactivation and metadata caching."
579 +}
580 +
581 +src_test() {
582 + einfo "Tests are disabled because of device-node mucking, if you want to"
583 + einfo "run tests, compile the package and see ${S}/tests"
584 +}