# Maintainer: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Richard Murri <admin@richardmurri.com>
# Contributor: Michal Krenek <mikos@sg1.cz>

pkgname=ecryptfs-utils
pkgver=111
pkgrel=4
arch=('x86_64')
pkgdesc="Enterprise-class stacked cryptographic filesystem for Linux"
url="https://launchpad.net/ecryptfs"
license=('GPL')
makedepends=('swig' 'intltool' 'gettext' 'python2')
depends=('nss' 'pam')
optdepends=('python2: for python module')
source=("https://launchpad.net/ecryptfs/trunk/${pkgver}/+download/${pkgname}_${pkgver}.orig.tar.gz"
        "${pkgname}_${pkgver}.orig.tar.gz.sig::https://launchpad.net/ecryptfs/trunk/${pkgver}/+download/..-${pkgname}_${pkgver}.orig.tar.gz.asc"
        "openssl-1.1.x.patch")
md5sums=('83513228984f671930752c3518cac6fd'
         'SKIP'
         'bc69f5adcd397220bb8575252486c69f')
validpgpkeys=('E2D9E1C5F9F5D59291F4607D95E64373F1529469')

prepare() {
  cd "${pkgname}-${pkgver}"
  patch -Np0 -i $srcdir/openssl-1.1.x.patch
}

build() {
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr --with-pamdir=/usr/lib/security PYTHON=python2
  make
}

package() {
  cd "${pkgname}-${pkgver}"
  make DESTDIR="$pkgdir/" rootsbindir='/usr/bin' install
  chmod +s "$pkgdir/usr/bin/mount.ecryptfs_private"
}
