#!/bin/sh
if [ ! -d external-libs ]; then
   echo "Please extract qpdf-external-libs-bin.zip and try again"
   exit 2
fi

set -e
set -x
cwd=`pwd`
PATH=$cwd/libqpdf/build:$PATH

rm -rf install-mingw install-msvc

./config-mingw
make check install
make distclean
./config-msvc
make check install
make distclean

cd install-mingw
v=`ls -d qpdf-*`
cd ..

cp -p README-windows-install.txt install-mingw/$v/README.txt
cp -p README-windows-install.txt install-msvc/$v/README.txt

cd install-mingw
zip -r ../$v-bin-mingw.zip $v
cd ../install-msvc
zip -r ../$v-bin-msvc.zip $v
cd ..

set +x

echo ""
echo "$v-bin-mingw.zip and $v-bin-msvc.zip have been created."