#!/bin/sh
name="pam"
short_desc="Linux Pluggable Authentication Modules"
desc="Linux Pluggable Authentication Modules (PAM) is a suite of libraries that allow a Linux system
administrator to configure methods to authenticate users.

It provides a flexible and centralized way to switch authentication methods for secured applications
by using configuration files instead of changing application code. There are Linux PAM
libraries allowing authentication using methods such as local passwords, LDAP, or fingerprint readers.

Linux PAM is evolved from the Unix Pluggable Authentication Modules architecture."
category="security"
version="1.5.3_1"
version2="${version%%_*}"
maintainer="ffqq@danwin1210.de"
www="https://github.com/linux-pam/linux-pam"
master_site="https://github.com/linux-pam/linux-pam/releases/download/v$version2"
source_name="linux-$name-$version2.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-$version2
    curl -LO https://github.com/linux-pam/linux-pam/releases/download/v$version2/Linux-PAM-$version2-docs.tar.xz # fetch docs
    tar -xf Linux-PAM-$version2-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
    mkdir -p $TAMANDUA_STAGE_DIR/etc/pam.d
    cp -v $TAMANDUA_FILES_DIR/* $TAMANDUA_STAGE_DIR/etc/pam.d
}