#!/bin/sh
name="pam"
short_desc="Linux Pluggable Authentication Modules"
desc="libxcrypt is a modern library for one-way hashing of passwords. It supports a wide variety
of both modern and historical hashing methods:

yescrypt, gost-yescrypt, scrypt, bcrypt, sha512crypt, sha256crypt, md5crypt, SunMD5, sha1crypt, NT, bsdicrypt,bigcrypt, and descrypt.

It provides the traditional Unix crypt and crypt_r interfaces, as well as a set of extended
interfaces pioneered by Openwall Linux, crypt_rn, crypt_ra, crypt_gensalt, crypt_gensalt_rn, and crypt_gensalt_ra."
category="security"
version="1.5.3"
maintainer="ffqq@danwin1210.de"
www="https://github.com/linux-pam/linux-pam"
master_site="https://github.com/linux-pam/linux-pam/releases/download/v$version"
source_name="linux-$name-$version.tar.xz"
license_logic="single" # accepted values: single, and, or
licenses=("GPLv2")

build_dependencies=("devel/gmake" "lang/gcc" "security/libxcrypt" "textproc/flex")
run_dependencies=("system/glibc" "security/libxcrypt")

build_process() {
    cd Linux-PAM-$version
    curl -LO https://github.com/linux-pam/linux-pam/releases/download/v$version/Linux-PAM-$version-docs.tar.xz # fetch docs
    tar -xf Linux-PAM-$version-docs.tar.xz
    ./configure --prefix=/usr                \
        --sbindir=/usr/sbin                  \
        --sysconfdir=/etc                    \
        --libdir=/usr/lib                    \
        --enable-securedir=/usr/lib/security \
        --docdir=/usr/share/doc/Linux-PAM    \
        || exit 1
    make -j$(nproc)
    make DESTDIR="$TAMANDUA_STAGE_DIR" install
    chmod -v 4755 $TAMANDUA_STAGE_DIR/usr/sbin/unix_chkpwd
}