#!/bin/sh

# Build runtime and developer zipfiles for libwps on Win32.

ZIP=libwps-@WPS_VERSION@-MinGW.zip
DEVZIP=libwps-devel-@WPS_VERSION@-MinGW.zip
TOOLSZIP=libwps-tools-@WPS_VERSION@.zip

cd $DESTDIR@prefix@

DLLDIR=lib
[ -f bin/libwps-@WPS_MAJOR_VERSION@.@WPS_MINOR_VERSION@.dll ] && \
DLLDIR=bin

@STRIP@ --strip-all \
$DLLDIR/libwps-@WPS_MAJOR_VERSION@.@WPS_MINOR_VERSION@.dll \
bin/wps2html.exe \
bin/wps2raw.exe \
bin/wps2text.exe

upx -qqq --best \
$DLLDIR/libwps-@WPS_MAJOR_VERSION@.@WPS_MINOR_VERSION@.dll \
bin/wps2html.exe \
bin/wps2raw.exe \
bin/wps2text.exe

rm $ZIP
zip -q $ZIP -@ <<EOF
$DLLDIR/libwps-@WPS_MAJOR_VERSION@.@WPS_MINOR_VERSION@.dll
EOF

rm $DEVZIP
zip -q -r $DEVZIP -@ <<EOF
include/libwps-@WPS_MAJOR_VERSION@.@WPS_MINOR_VERSION@
lib/libwps-@WPS_MAJOR_VERSION@.@WPS_MINOR_VERSION@.dll.a
lib/libwps-@WPS_MAJOR_VERSION@.@WPS_MINOR_VERSION@.a
lib/pkgconfig/libwps-@WPS_MAJOR_VERSION@.@WPS_MINOR_VERSION@.pc
EOF

rm $TOOLSZIP
zip -q -j $TOOLSZIP -@ <<EOF
bin/wps2html.exe
bin/wps2raw.exe
bin/wps2text.exe
EOF
