#!/bin/sh -e

# Normally MTM will try to install manuals to  a
# directory that doesn't exist. This is a kludge
# to work around that by disabling manpage install.

sed -i '22{/cp/d;}'  Makefile

# This is another kludge to fix a problematic
# flag in the makefile. Doesn't cause any
# problems.

sed -i s/"cp -i"/cp/ Makefile

# Link against regular ncurses.
sed -i s/ncursesw\\/curses.h/ncurses.h/ config.def.h

make
install -Dm755 mtm "$1/usr/bin/mtm"
install -Dm755 mtm.1 "$1/usr/share/man/man1/mtm.1"
