#!/bin/sh
# tardist: make up a tar.gz distribution of wxWindows 2
# Supply a source (e.g. ~/wx2) and destination (e.g. ~/wx2/deliver)

init=""
WXVER=2.2.0
if [ $1 = "" ]
then
  exit
fi

if [ $2 = "" ]
then
  exit
fi

echo About to archive wxWindows:
echo   From   $1
echo   To     $2
echo CTRL-C if this is not correct.
read dummy

cd $1

echo Removing backup files...
rm *~ */*~ */*/*~ */*/*/*~ */*/*/*/*~

echo Setting permissions...
chmod a+x $1/configure $1/config.sub $1/config.guess $1/samples/configure $1/demos/configure $1/contrib/configure

rm -f $2/wxMotif-${WXVER}*.tgz
rm -f $2/wxWindows*.tgz
rm -f $2/tex2rtf2.tgz
rm -f $2/ogl3.tgz
rm -f $2/jpeg.tgz
rm -f $2/tiff.tgz

echo Tarring...

### wxMotif
ls `cat $1/distrib/msw/generic.rsp $1/distrib/msw/motif.rsp $1/distrib/msw/makefile.rsp $1/distrib/msw/utilmake.rsp $1/distrib/msw/jpeg.rsp $1/distrib/msw/tiff.rsp $1/distrib/msw/wx_html.rsp $1/distrib/msw/tex2rtf.rsp $1/distrib/msw/dialoged.rsp $1/distrib/msw/utils.rsp` > /tmp/wxmotif.txt
tar cvf $2/wxMotif-${WXVER}.tar -T /tmp/wxmotif.txt
gzip $2/wxMotif-${WXVER}.tar
mv $2/wxMotif-${WXVER}.tar.gz $2/wxMotif-${WXVER}.tgz

### HTML docs
ls `cat $1/distrib/msw/wx_html.rsp` > /tmp/html.txt
tar cvf $2/wxWindows-${WXVER}-HTML.tar -T /tmp/html.txt
gzip $2/wxWindows-${WXVER}-HTML.tar
mv $2/wxWindows-${WXVER}-HTML.tar.gz $2/wxWindows-${WXVER}-HTML.tgz

### HTB (wxHTML Help) docs
ls `cat $1/distrib/msw/wx_htb.rsp` > /tmp/htb.txt
tar cvf $2/wxWindows-${WXVER}-HTB.tar -T /tmp/htb.txt
gzip $2/wxWindows-${WXVER}-HTB.tar
mv $2/wxWindows-${WXVER}-HTB.tar.gz $2/wxWindows-${WXVER}-HTB.tgz

### PDF docs
ls `cat $1/distrib/msw/wx_pdf.rsp` > /tmp/pdf.txt
tar cvf $2/wxWindows-${WXVER}-PDF.tar -T /tmp/pdf.txt
gzip $2/wxWindows-${WXVER}-PDF.tar
mv $2/wxWindows-${WXVER}-PDF.tar.gz $2/wxWindows-${WXVER}-PDF.tgz

### Stubs files
#ls `cat $1/distrib/msw/stubs.rsp` > /tmp/stubs.txt
#tar cvf $2/wxWindows-${WXVER}-stubs.tar -T /tmp/stubs.txt
#gzip $2/wxWindows-${WXVER}-stubs.tar
#mv $2/wxWindows-${WXVER}-stubs.tar.gz $2/wxWindows-${WXVER}-stubs.tgz

### Tex2RTF
ls `cat $1/distrib/msw/tex2rtf.rsp` > /tmp/tex2rtf.txt
tar cvf $2/tex2rtf2.tar -T /tmp/tex2rtf.txt
gzip $2/tex2rtf2.tar
mv $2/tex2rtf2.tar.gz $2/tex2rtf2.tgz

### OGL
ls `cat $1/distrib/msw/ogl.rsp` > /tmp/ogl.txt
tar cvf $2/ogl3.tar -T /tmp/ogl.txt
gzip $2/ogl3.tar
mv $2/ogl3.tar.gz $2/ogl3.tgz

### JPEG
#ls `cat $1/distrib/msw/jpeg.rsp` > /tmp/jpeg.txt
#tar cvf $2/jpeg.tar -T /tmp/jpeg.txt
#gzip $2/jpeg.tar
#mv $2/jpeg.tar.gz $2/jpeg.tgz

### TIFF
#ls `cat $1/distrib/msw/tiff.rsp` > /tmp/tiff.txt
#tar cvf $2/tiff.tar -T /tmp/tiff.txt
#gzip $2/tiff.tar
#mv $2/tiff.tar.gz $2/tiff.tgz

echo Done!
