# Maintainer: josephgbr <rafael.f.f1 at gmail.com>
# Contributor: Janax <janax99@yahoo.com>
_pkgbase=pam
pkgname=lib32-${_pkgbase}
pkgver=1.1.6
pkgrel=1
pkgdesc="PAM (Pluggable Authentication Modules) library (32 bit)"
arch=('any')
license=('GPL2')
url="http://www.kernel.org/pub/linux/libs/pam/"
depends=('lib32-libtirpc' 'lib32-db' 'lib32-cracklib' "${_pkgbase}")
makedepends=('lib32-flex' 'gcc-multilib')
options=('!libtool' '!emptydirs')
source=(https://fedorahosted.org/releases/l/i/linux-pam/Linux-PAM-${pkgver}.tar.bz2
ftp://ftp.archlinux.org/other/pam_unix2/pam_unix2-2.9.1.tar.bz2
pam_unix2-glibc216.patch
pam_namespace-build-1.1.6.patch)
md5sums=('7b73e58b7ce79ffa321d408de06db2c4'
'da6a46e5f8cd3eaa7cbc4fc3a7e2b555'
'931b91bd50289c1f1e0bada7743ad272'
'7e7a3c5a1d18aa2ac804d05d43d15c88')
build() {
export CC='gcc -m32'
export CXX='g++ -m32'
export PKG_CONFIG_PATH='/usr/lib32/pkgconfig'
cd "${srcdir}/Linux-PAM-${pkgver}"
./configure --libdir=/usr/lib32
patch --verbose -Np0 -i "${srcdir}/pam_namespace-build-1.1.6.patch"
make
cd "${srcdir}/pam_unix2-2.9.1"
sed -e 's|pam_syslog (pam_handle_t|pam_syslog (const pam_handle_t|g' \
-i src/public.h src/support.c
patch -Np1 -i "${srcdir}/pam_unix2-glibc216.patch"
./configure --libdir=/usr/lib32
make
}
package() {
cd "${srcdir}/Linux-PAM-${pkgver}"
make DESTDIR="${pkgdir}" SCONFIGDIR=/etc/security install
cd "${srcdir}/pam_unix2-2.9.1"
#make DESTDIR="${pkgdir}" install
install src/pam_unix2.so "${pkgdir}/usr/lib32/security/pam_unix2.so"
# fix some missing symlinks from old pam for compatibility
cd "${pkgdir}/usr/lib32/security"
ln -s pam_unix.so pam_unix_acct.so
ln -s pam_unix.so pam_unix_auth.so
ln -s pam_unix.so pam_unix_passwd.so
ln -s pam_unix.so pam_unix_session.so
# cleanup for lib32 package
rm -rf "${pkgdir}"/{etc,sbin,usr/{include,share}}
}