# Description: A library for manipulating storage volume encryption keys and storing them separately from volumes to handle forgotten passphrases
# URL: https://pagure.io/volume_key
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: cryptsetup glib gpgme nss

name=volume_key
version=0.3.12
release=2
source=(https://releases.pagure.org/$name/$name-$version.tar.xz
  volume_key-0.3.12-fix_resource_leaks.patch
  volume_key-0.3.12-support_LUKS2_and_more.patch
  volume_key-0.3.12-find_python3.patch)

build() {
  cd $name-$version

  patch -Np1 -i $SRC/volume_key-0.3.12-fix_resource_leaks.patch
  patch -Np1 -i $SRC/volume_key-0.3.12-support_LUKS2_and_more.patch
  patch -Np1 -i $SRC/volume_key-0.3.12-find_python3.patch

  find . -name ".pyc" -delete
  autoreconf -fiv

  export CFLAGS+=" $(/usr/bin/python3-config --includes)"

  ./configure \
      --prefix=/usr \
      --with-python3 \
      --with-python=no \
      --disable-nls
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
  make DESTDIR=$PKG install
}
