abinfo "Configuring Privoxy ..."
"$SRCDIR"/configure ${AUTOTOOLS_DEF[@]} ${AUTOTOOLS_AFTER[@]}

abinfo "Building Privoxy ..."
make

abinfo "Installing Privoxy ..."
install -Dvm755 "$SRCDIR"/privoxy \
    "$PKGDIR"/usr/bin/privoxy

abinfo "Installing Privoxy man page ..."
install -Dvm644 "$SRCDIR"/man/privoxy.8 \
    "$PKGDIR"/usr/share/man/man1/privoxy.8

abinfo "Installing Privoxy log directory ..."
install -dvo442 -g442 "$PKGDIR"/var/log/privoxy

abinfo "Instaling configuration files ..."
install -dv "$PKGDIR"/etc/privoxy/
install -vm664 \
    "$SRCDIR"/config \
    "$SRCDIR"/trust \
    "$SRCDIR"/*.{action,filter} \
    -t "$PKGDIR"/etc/privoxy/

abinfo "Installing configuration templates ..."
find "$SRCDIR"/templates -type f \
    -exec install -Dvm644 '{}' -t "$PKGDIR"/etc/privoxy/templates/ \;

abinfo "Installing documentation ..."
install -Dvm644 "$SRCDIR"/doc/webserver/privoxy-index.html \
    "$SRCDIR"/usr/share/doc/privoxy/index.html
install -vm644 \
    "$SRCDIR"/doc/webserver/p_doc.css \
    "$SRCDIR"/{AUTHORS,README,ChangeLog} \
    -t "$SRCDIR"/usr/share/doc/privoxy/
install -Dvm644 "$SRCDIR"/doc/webserver/p_doc.css \
    "$SRCDIR"/usr/share/doc/privoxy/user-manual/p_doc.css
(
    cd "$SRCDIR"/doc/webserver
    find user-manual developer-manual faq man-page \( -name '*.html' -o -name '*.jpg' \) \
        -exec install -Dvm644 '{}' "$PKGDIR"/usr/share/doc/privoxy/'{}' \;
)
