#!/bin/sh -e

# Fix a compile-time error.
sed s/multiSrcObjectClass/asciiSrcObjectClass/g dayeditor.c > dayeditor.c.new
mv dayeditor.c.new dayeditor.c

xmkmf -a
make

install -Dc   xcalendar "$1/usr/bin/xcalendar"
sed 's;%%XCALENDAR_LIBDIR%%;/usr/lib/X11/xcalendar;'    < XCalendar.sed         > XCalendar.ad
install -Dc -m 0444 XCalendar.ad "$1/usr/lib/X11/app-defaults/XCalendar"
sed 's;%%XCALENDAR_LIBDIR%%;/usr/lib/X11/xcalendar;'    < XCal-uj.sed   > XCal-uj.ad
mkdir -p "$1/usr/lib/X11/ja_JP.EUC/app-defaults"
install -Dc -m 0444 XCal-uj.ad "$1/usr/lib/X11/ja_JP.EUC/app-defaults/XCalendar"
mkdir -p "$1/usr/lib/X11/xcalendar"
install -Dc -m 0444 larrow.xbm "$1/usr/lib/X11/xcalendar"
install -Dc -m 0444 qmark.xbm "$1/usr/lib/X11/xcalendar"
install -Dc -m 0444 quit.xbm "$1/usr/lib/X11/xcalendar"
install -Dc -m 0444 rarrow.xbm "$1/usr/lib/X11/xcalendar"
install -Dc -m 0444 xcalendar.hlp "$1/usr/lib/X11/xcalendar"
