#!/bin/sh
SWNAME=w3m-0.3
rm -rf $SWNAME
tar zxvf $SWNAME.tar.gz
cd $SWNAME
cp -p configure _configure
cat _configure | sed -e 's/\"\/etc\/mailcap\"/\"\/etc\/w3m\/mailcap\"/g'  > configure
cp -p config.h.dist _config.h.dist
cat _config.h.dist |  sed -e 's/\"\/etc\/mailcap\"/\"\/etc\/w3m\/mailcap\"/g' >  config.h.dist
cp -p w3mhelperpanel.c _w3mhelperpanel.c
cat _w3mhelperpanel.c | sed -e 's/\"\/etc\/mailcap\"/\"\/etc\/w3m\/mailcap\"/g' > w3mhelperpanel.c
./configure -prefix=/usr -sysconfdir=/etc/w3m -lang=ja --mimetypes=/etc/w3m/mime.types <<EOF





E


5
y


y













EOF
make
rm -rf ../pkg
mkdir -p ../pkg/usr/man/man1
mkdir -p ../pkg/usr/man/ja_JP.eucJP/man1
make install DESTDIR=`pwd`/../pkg
chown -R root:root doc
chown -R root:root doc-jp
gzip doc/w3m.1
mv doc/w3m.1.gz ../pkg/usr/man/man1/.
gzip doc-jp/w3m.1
mv doc-jp/w3m.1.gz ../pkg/usr/man/ja_JP.eucJP/man1/.
mkdir -p ../pkg/usr/doc/$SWNAME
cp -p ChangeLog NEWS README ../pkg/usr/doc/$SWNAME/.
mv doc ../pkg/usr/doc/$SWNAME/.
mv doc-jp ../pkg/usr/doc/$SWNAME/.
cat ../plamobuild.sh > ../pkg/usr/doc/$SWNAME/plamobuild.sh
mkdir -p ../pkg/etc/w3m
touch ../pkg/etc/w3m/mime.types
cat > ../pkg/etc/w3m/mailcap <<EOF
image/gif;	xv %s
image/jpeg;	xv %s
image/png;	xv %s
image/x-png;	xv %s
image/tiff;	xv %s
image/x-tiff;	xv %s
image/x-MS-bmp;	xv %s
image/bmp;	xv %s
image/x-xpixmap;	xv %s
image/x-xbitmap;	xv %s
application/pdf;	acroread %s
application/postscript;	gv %s
audio/mid;	timidity -s 32 -a -idqqqqqqq %s
audio/x-midi;	timidity -s 32 -a -idqqqqqqq %s
audio/midi;	timidity -s 32 -a -idqqqqqqq %s
audio/x-midi;	timidity -s 32 -a -idqqqqqqq %s
audio/mpeg;	mpg123 -q -b 1024 %s
audio/x-mpeg;	mpg123 -q -b 1024 %s
audio/mpeg2;	mpg123 -q -b 1024 %s
audio/x-mpeg2;	mpg123 -q -b 1024 %s
audio/mpeg3;	mpg123 -q -b 1024 %s
audio/x-mpeg3;	mpg123 -q -b 1024 %s
audio/wav;	wavplay -q %s
audio/x-wav;	wavplay -q %s

EOF
cd ../pkg
chown -R root:root usr/doc
makepkg $SWNAME.tgz <<EOF
y
y
EOF

