| 1 |
# Copyright 1999-2013 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.95-r4.ebuild,v 1.2 2012/11/28 10:55:33 ssuominen Exp $
|
| 4 |
|
| 5 |
EAPI=3
|
| 6 |
inherit eutils multilib toolchain-funcs autotools linux-info
|
| 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 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
|
| 16 |
|
| 17 |
IUSE="readline static static-libs clvm cman +lvm1 selinux +udev +thin"
|
| 18 |
|
| 19 |
DEPEND_COMMON="!!sys-fs/device-mapper
|
| 20 |
readline? ( sys-libs/readline )
|
| 21 |
clvm? ( =sys-cluster/libdlm-3*
|
| 22 |
cman? ( =sys-cluster/cman-3* ) )
|
| 23 |
udev? ( virtual/udev[static-libs?] )"
|
| 24 |
|
| 25 |
# /run is now required for locking during early boot. /var cannot be assumed to
|
| 26 |
# be available.
|
| 27 |
RDEPEND="${DEPEND_COMMON}
|
| 28 |
!<sys-apps/openrc-0.10.1
|
| 29 |
>=sys-apps/baselayout-2.1-r1
|
| 30 |
!!sys-fs/lvm-user
|
| 31 |
!!sys-fs/clvm
|
| 32 |
>=sys-apps/util-linux-2.16
|
| 33 |
thin? ( sys-block/thin-provisioning-tools )"
|
| 34 |
|
| 35 |
# Upgrading to this LVM will break older cryptsetup
|
| 36 |
RDEPEND="${RDEPEND}
|
| 37 |
!<sys-fs/cryptsetup-1.1.2"
|
| 38 |
|
| 39 |
DEPEND="${DEPEND_COMMON}
|
| 40 |
virtual/pkgconfig
|
| 41 |
>=sys-devel/binutils-2.20.1-r1
|
| 42 |
static? ( virtual/udev[static-libs] )"
|
| 43 |
|
| 44 |
S="${WORKDIR}/${PN/lvm/LVM}.${PV}"
|
| 45 |
|
| 46 |
pkg_setup() {
|
| 47 |
local CONFIG_CHECK="~SYSVIPC"
|
| 48 |
use udev && local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
|
| 49 |
check_extra_config
|
| 50 |
# 1. Genkernel no longer copies /sbin/lvm blindly.
|
| 51 |
if use static; then
|
| 52 |
elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
|
| 53 |
elog "their static versions. If you need the static binaries,"
|
| 54 |
elog "you must append .static to the filename!"
|
| 55 |
fi
|
| 56 |
}
|
| 57 |
|
| 58 |
src_unpack() {
|
| 59 |
unpack ${A}
|
| 60 |
}
|
| 61 |
|
| 62 |
src_prepare() {
|
| 63 |
epatch "${FILESDIR}"/lvm.conf-2.02.67.patch
|
| 64 |
|
| 65 |
# Should not be needed due to upstream re-arrangement of build
|
| 66 |
#epatch "${FILESDIR}"/${PN}-2.02.56-dmeventd.patch
|
| 67 |
# Should not be need with new upstream udev rules
|
| 68 |
#epatch "${FILESDIR}"/${PN}-2.02.56-device-mapper-export-format.patch
|
| 69 |
|
| 70 |
# Merged upstream:
|
| 71 |
#epatch "${FILESDIR}"/${PN}-2.02.51-as-needed.patch
|
| 72 |
# Merged upstream:
|
| 73 |
#epatch "${FILESDIR}"/${PN}-2.02.48-fix-pkgconfig.patch
|
| 74 |
# Merged upstream:
|
| 75 |
#epatch "${FILESDIR}"/${PN}-2.02.51-fix-pvcreate.patch
|
| 76 |
# Fixed differently upstream:
|
| 77 |
#epatch "${FILESDIR}"/${PN}-2.02.51-dmsetup-selinux-linking-fix-r3.patch
|
| 78 |
|
| 79 |
epatch "${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch
|
| 80 |
epatch "${FILESDIR}"/lvm2-2.02.56-lvm2create_initrd.patch
|
| 81 |
# bug 318513 - merged upstream
|
| 82 |
#epatch "${FILESDIR}"/${PN}-2.02.64-dmeventd-libs.patch
|
| 83 |
# bug 301331
|
| 84 |
epatch "${FILESDIR}"/${PN}-2.02.67-createinitrd.patch
|
| 85 |
# bug 330373
|
| 86 |
epatch "${FILESDIR}"/${PN}-2.02.92-locale-muck.patch
|
| 87 |
# --as-needed
|
| 88 |
epatch "${FILESDIR}"/${PN}-2.02.70-asneeded.patch
|
| 89 |
# bug 332905
|
| 90 |
epatch "${FILESDIR}"/${PN}-2.02.92-dynamic-static-ldflags.patch
|
| 91 |
# bug 361429 - merged upstream in .85
|
| 92 |
#epatch "${FILESDIR}"/${PN}-2.02.84-udev-pkgconfig.patch
|
| 93 |
|
| 94 |
# Merged upstream
|
| 95 |
#epatch "${FILESDIR}"/${PN}-2.02.73-asneeded.patch
|
| 96 |
|
| 97 |
epatch "${FILESDIR}"/${PN}-2.02.88-respect-cc.patch
|
| 98 |
|
| 99 |
# Upstream bug of LVM path
|
| 100 |
epatch "${FILESDIR}"/${PN}-2.02.95-lvmpath.patch
|
| 101 |
|
| 102 |
# Upstream patch for http://bugs.gentoo.org/424810
|
| 103 |
epatch "${FILESDIR}"/${PN}-2.02.95-udev185.patch
|
| 104 |
|
| 105 |
eautoreconf
|
| 106 |
}
|
| 107 |
|
| 108 |
src_configure() {
|
| 109 |
local myconf
|
| 110 |
local buildmode
|
| 111 |
|
| 112 |
myconf="${myconf} --enable-dmeventd"
|
| 113 |
myconf="${myconf} --enable-cmdlib"
|
| 114 |
myconf="${myconf} --enable-applib"
|
| 115 |
myconf="${myconf} --enable-fsadm"
|
| 116 |
myconf="${myconf} --enable-lvmetad"
|
| 117 |
|
| 118 |
# Most of this package does weird stuff.
|
| 119 |
# The build options are tristate, and --without is NOT supported
|
| 120 |
# options: 'none', 'internal', 'shared'
|
| 121 |
if use static ; then
|
| 122 |
einfo "Building static LVM, for usage inside genkernel"
|
| 123 |
buildmode="internal"
|
| 124 |
# This only causes the .static versions to become available
|
| 125 |
# We explicitly provide the .static versions so that they can be included in
|
| 126 |
# initramfs environments.
|
| 127 |
myconf="${myconf} --enable-static_link"
|
| 128 |
else
|
| 129 |
ewarn "Building shared LVM, it will not work inside genkernel!"
|
| 130 |
buildmode="shared"
|
| 131 |
fi
|
| 132 |
|
| 133 |
# dmeventd requires mirrors to be internal, and snapshot available
|
| 134 |
# so we cannot disable them
|
| 135 |
myconf="${myconf} --with-mirrors=internal"
|
| 136 |
myconf="${myconf} --with-snapshots=internal"
|
| 137 |
use thin \
|
| 138 |
&& myconf="${myconf} --with-thin=internal" \
|
| 139 |
|| myconf="${myconf} --with-thin=none"
|
| 140 |
|
| 141 |
if use lvm1 ; then
|
| 142 |
myconf="${myconf} --with-lvm1=${buildmode}"
|
| 143 |
else
|
| 144 |
myconf="${myconf} --with-lvm1=none"
|
| 145 |
fi
|
| 146 |
|
| 147 |
# disable O_DIRECT support on hppa, breaks pv detection (#99532)
|
| 148 |
use hppa && myconf="${myconf} --disable-o_direct"
|
| 149 |
|
| 150 |
if use clvm; then
|
| 151 |
myconf="${myconf} --with-cluster=${buildmode}"
|
| 152 |
# 4-state! Make sure we get it right, per bug 210879
|
| 153 |
# Valid options are: none, cman, gulm, all
|
| 154 |
#
|
| 155 |
# 2009/02:
|
| 156 |
# gulm is removed now, now dual-state:
|
| 157 |
# cman, none
|
| 158 |
# all still exists, but is not needed
|
| 159 |
#
|
| 160 |
# 2009/07:
|
| 161 |
# TODO: add corosync and re-enable ALL
|
| 162 |
local clvmd=""
|
| 163 |
use cman && clvmd="cman"
|
| 164 |
#clvmd="${clvmd/cmangulm/all}"
|
| 165 |
[ -z "${clvmd}" ] && clvmd="none"
|
| 166 |
myconf="${myconf} --with-clvmd=${clvmd}"
|
| 167 |
myconf="${myconf} --with-pool=${buildmode}"
|
| 168 |
else
|
| 169 |
myconf="${myconf} --with-clvmd=none --with-cluster=none"
|
| 170 |
fi
|
| 171 |
|
| 172 |
local udevdir="${EPREFIX}/lib/udev/rules.d"
|
| 173 |
use udev && udevdir="${EPREFIX}$($(tc-getPKG_CONFIG) --variable=udevdir udev)/rules.d"
|
| 174 |
|
| 175 |
econf \
|
| 176 |
$(use_enable readline) \
|
| 177 |
$(use_enable selinux) \
|
| 178 |
--enable-pkgconfig \
|
| 179 |
--with-confdir="${EPREFIX}/etc" \
|
| 180 |
--sbindir="${EPREFIX}/sbin" \
|
| 181 |
--with-staticdir="${EPREFIX}/sbin" \
|
| 182 |
--libdir="${EPREFIX}/$(get_libdir)" \
|
| 183 |
--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \
|
| 184 |
--with-default-run-dir=/run/lvm \
|
| 185 |
--with-default-locking-dir=/run/lock/lvm \
|
| 186 |
--with-dmeventd-path=/sbin/dmeventd \
|
| 187 |
$(use_enable udev udev_rules) \
|
| 188 |
$(use_enable udev udev_sync) \
|
| 189 |
$(use_with udev udevdir "${udevdir}") \
|
| 190 |
${myconf} \
|
| 191 |
CLDFLAGS="${LDFLAGS}"
|
| 192 |
}
|
| 193 |
|
| 194 |
src_compile() {
|
| 195 |
einfo "Doing symlinks"
|
| 196 |
pushd include
|
| 197 |
emake || die "Failed to prepare symlinks"
|
| 198 |
popd
|
| 199 |
|
| 200 |
einfo "Starting main build"
|
| 201 |
emake || die "compile fail"
|
| 202 |
}
|
| 203 |
|
| 204 |
src_install() {
|
| 205 |
emake DESTDIR="${D}" install || die "Failed to emake install"
|
| 206 |
|
| 207 |
dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{conf,c,txt}
|
| 208 |
newinitd "${FILESDIR}"/lvm.rc-2.02.95-r2 lvm || die
|
| 209 |
newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.67-r2 lvm-monitoring || die
|
| 210 |
newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm || die
|
| 211 |
if use clvm; then
|
| 212 |
newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd || die
|
| 213 |
newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd || die
|
| 214 |
fi
|
| 215 |
|
| 216 |
# move shared libs to /lib(64)
|
| 217 |
if use static-libs; then
|
| 218 |
dolib.a libdm/ioctl/libdevmapper.a || die "dolib.a libdevmapper.a"
|
| 219 |
#gen_usr_ldscript libdevmapper.so
|
| 220 |
fi
|
| 221 |
|
| 222 |
dosbin "${S}"/scripts/lvm2create_initrd/lvm2create_initrd
|
| 223 |
doman "${S}"/scripts/lvm2create_initrd/lvm2create_initrd.8
|
| 224 |
newdoc "${S}"/scripts/lvm2create_initrd/README README.lvm2create_initrd
|
| 225 |
|
| 226 |
insinto /etc
|
| 227 |
doins "${FILESDIR}"/dmtab
|
| 228 |
|
| 229 |
# Device mapper stuff
|
| 230 |
newinitd "${FILESDIR}"/device-mapper.rc-2.02.95-r2 device-mapper || die
|
| 231 |
newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper || die
|
| 232 |
|
| 233 |
newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd || die
|
| 234 |
if use static-libs; then
|
| 235 |
dolib.a daemons/dmeventd/libdevmapper-event.a \
|
| 236 |
|| die "dolib.a libdevmapper-event.a"
|
| 237 |
#gen_usr_ldscript libdevmapper-event.so
|
| 238 |
fi
|
| 239 |
|
| 240 |
use static-libs || \
|
| 241 |
rm -f "${D}"/usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a
|
| 242 |
|
| 243 |
#insinto /etc/udev/rules.d/
|
| 244 |
#newins "${FILESDIR}"/64-device-mapper.rules-2.02.56-r3 64-device-mapper.rules || die
|
| 245 |
|
| 246 |
# do not rely on /lib -> /libXX link
|
| 247 |
sed -i \
|
| 248 |
-e "s|/lib/rcscripts/|/$(get_libdir)/rcscripts/|" \
|
| 249 |
"${ED}"/etc/init.d/* || die
|
| 250 |
|
| 251 |
elog "USE flag nocman is deprecated and replaced"
|
| 252 |
elog "with the cman USE flag."
|
| 253 |
elog ""
|
| 254 |
elog "USE flags clvm and cman are masked"
|
| 255 |
elog "by default and need to be unmasked to be used"
|
| 256 |
elog ""
|
| 257 |
elog "If you are using genkernel and root-on-LVM, rebuild the initramfs."
|
| 258 |
}
|
| 259 |
|
| 260 |
pkg_postinst() {
|
| 261 |
elog "lvm volumes are no longer automatically created for"
|
| 262 |
elog "baselayout-2 users. If you are using baselayout-2, be sure to"
|
| 263 |
elog "run: # rc-update add lvm boot"
|
| 264 |
elog "Do NOT add it if you are still using baselayout-1."
|
| 265 |
}
|
| 266 |
|
| 267 |
src_test() {
|
| 268 |
einfo "Testcases disabled because of device-node mucking"
|
| 269 |
einfo "If you want them, compile the package and see ${S}/tests"
|
| 270 |
}
|