# Description: Userspace toolset for logical volume management
# URL: http://sourceware.org/lvm2/
# Maintainer: Juergen Daubert, jue at crux dot nu
# Depends on: libdevmapper libaio

name=lvm2
version=2.03.41
release=1
source=(https://mirrors.kernel.org/sourceware/lvm2/LVM2.$version.tgz)

build() {
    cd LVM2.$version

    #fix the install_lvm2 make target
    sed '/SIMPLE_RECURSIVE_TARGETS/s/=/= install_lvm2/' -i libdm/make.tmpl.in

    # needed for static linking
    export LIBS="-lpthread -luuid -lm"

    ./configure \
        --prefix=/usr \
        --exec-prefix= \
        --with-libexecdir=/usr/lib/lvm2 \
        --datarootdir=/usr \
        --mandir=/usr/share/man \
        --with-udev-prefix= \
        --disable-readline \
        --disable-selinux \
        --enable-pkgconfig \
        --enable-static_link \
        --enable-udev_sync \
        --enable-udev_rules \
        --with-{user,group}=root

    make
    make DESTDIR=$PKG install_lvm2

    install -d -m 0700 $PKG/etc/lvm/{archive,backup,cache}
    install -d -m 1777 $PKG/var/lock
    install -d -m 0700 $PKG/var/lock/lvm
}
