#!/bin/sh -e

xmkmf -a

make
make DESTDIR="$1" install

mkdir -p "$1/usr/lib"

for file in libXaw.so libXaw.so.7 libXaw.so.7.0.0.1 libXaw3d.so libXaw3d.so.8 libXaw3d.so.8.0.0.1
do ln -s /usr/lib/libXawM.so "$1/usr/lib/$file"
done

for dir in Xaw Xaw3d
do ln -s /usr/include/X11/XawM "$1/usr/include/X11/$dir"
done

install -Dm644 xawm.pc "$1/usr/lib/pkgconfig/"
