#!/bin/sh -e

# Fix a compile-time bug and build statically.
export CFLAGS="$CFLAGS -fcommon -static"

# Set what utils to make.
cp makefile.mid ./Makefile

make PREFIX=/usr
make PREFIX=/usr DESTDIR="$1" install

# Prevent 9yacc from actually installing
for file in /usr/bin/yacc /usr/yacc /usr/share/man/man1/yacc.1
do
  rm -rf "$1$file"
done
