#!/usr/bin/env sh

INSTALL="$HOME/.local"

# n-t-roff/sc uses minimal drop-in replacement for autoconf
# patches Makefile.in.vpath to use $HOME/.local
sed -Ei "s,^prefix.*,prefix=$INSTALL,g" Makefile.in.vpath
# patches configure to ignore arguments
sed -i 's/usage 1//g' configure

# install build prereqs
is-installed bison libncurses-dev | xargs -r sudo apt-get -y install

# let ~/.once.d/10-git-upstream.sh harmlessly run these again
# generated Makefile chokes if you run 'make install' in one go
./configure
make