#!/bin/sh -e

# Standalone sftp client crashes without
# libedit, so it is mandatory.

./configure \
    --prefix=/usr \
    --sbindir=/usr/bin \
    --datadir=/usr/share/openssh \
    --sysconfdir=/etc/ssh \
    --without-selinux \
    --with-privsep-user=nobody \
    --with-mantype=doc \
    --without-rpath \
    --disable-strip \
    --with-ssl-engine \
    --with-pid-dir=/run \
    --disable-wtmp \
    --disable-utmp \
    --with-libedit \

make sftp sftp-server

mkdir -p "$1/usr/bin" "$1/usr/libexec"

cp sftp        "$1/usr/bin"
cp sftp-server "$1/usr/libexec"

chmod 755 "$1/usr/bin/sftp" "$1/usr/libexec/sftp-server"