#!/bin/sh

# clean
rm -f yacas-*.tar.gz
make distclean

# Rebuild yacas and the documentation
./makemake
./configure CXXFLAGS="-O9 -DDISABLE_DYNAMIC" CFLAGS="-O9 -DDISABLE_DYNAMIC" --enable-server --enable-ps-doc --enable-pdf-doc --enable-archive --disable-shared
make
make # make a second time, for adding statically linked libraries
sudo make install
cd JavaYacas
make -f makefile.yacas
cd ..
make dist
# make distcheck


# Copy all the files to a homepage directory
if [ -d homepage ] ; then : ; else  mkdir homepage ; fi; 
cd homepage

cp ../manmake/*.html .
cp ../docs/yacaslogo.gif .
tar -zcvf manual.html.tar.gz *
cp ../manmake/*.ps .
cp ../manmake/*.pdf .
tar -zcvf manual.ps.tar.gz *.ps
tar -zcvf manual.pdf.tar.gz *.pdf
rm *.ps *.pdf

cp ../docs/*.gif ../docs/*.png ../docs/*.html .
cp yacas.html index.html
yacas --patchload -pc ../docs/downloads.html.in > downloads.html

cp ../JavaYacas/yacas.jar .
cp ../JavaYacas/yacasconsole.html .
cp ../JavaYacas/yacasconsole.html.hints .
cp ../JavaYacas/scripts.zip .
cp ../JavaYacas/wizard.zip .

if [ -d backups ] ; then : ; else  mkdir backups ; fi; 
mv manual.html.tar.gz backups
mv manual.ps.tar.gz backups
mv manual.pdf.tar.gz backups
cd backups
mv ../../yacas-*.tar.gz .
cd ..
# chmod -R 755 *
tar -zcf ../homepage.tgz *
cd ..
rm -rf homepage/

