#!/bin/sh
# Set initial variables:
PKGNAM=lvm2
VERSION=2.02.40
ARCH=${ARCH:-x86_64}
BUILD=1

. /etc/pkghelpers
pkghelpers_env

rm -rf $PKG
mkdir -p $PKG
cd $TMP
rm -rf LVM2.$VERSION
tar xjvf $CWD/LVM2.$VERSION.tar.bz2
cd LVM2.$VERSION

pkghelpers_permissions

CFLAGS="$SLKCFLAGS" \
./configure \
  --libdir=/lib$LIBSUFFIX \
  --disable-readline \
  --enable-cmdlib \
  --enable-dmeventd \
  --enable-static_link \
  --mandir=/usr/man \
  --with-lvm1=internal

make -j6 || exit 1
make install DESTDIR=$PKG || exit 1
mv $PKG/etc/lvm/lvm.conf $PKG/etc/lvm/lvm.conf.new

mkdir -p $PKG/usr/doc/LVM2.$VERSION
cp -a \
  COPYING* INSTALL README* VERSION WHATS_NEW \
  $PKG/usr/doc/LVM2.$VERSION

mkdir -p $PKG/install
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
pkghelpers_fixup
pkghelpers_makepkg