#!/bin/sh

# Build distribution zipfiles for librsvg on Win32: Runtime,
# developer, engine and loader.

ZIP=/tmp/librsvg-@VERSION@.zip
DEVZIP=/tmp/librsvg-dev-@VERSION@.zip
ENGINEZIP=/tmp/svg-gtk-engine-@VERSION@.zip
LOADERZIP=/tmp/svg-gdk-pixbuf-loader-@VERSION@.zip

# The DLL name generated by libtool with the passed --version-info
DLLNAME=librsvg-2-@LIBRSVG_MAJOR_VERSION@.dll

cd @prefix@
rm $ZIP

zip $ZIP -@ <<EOF
bin/$DLLNAME
EOF

rm $DEVZIP
zip -r -D $DEVZIP -@ <<EOF
bin/rsvg-convert.exe
bin/rsvg-view.exe
include/librsvg-2.0
lib/librsvg-2.dll.a
lib/pkgconfig/librsvg-2.0.pc
EOF

rm $ENGINEZIP
zip $ENGINEZIP lib/gtk-2.0/@GTK2_BINARY_VERSION@/engines/libsvg.dll

rm $LOADERZIP
mkdir -p lib/gdk-pixbuf-2.0/@gdk_pixbuf_binary_version@/loaders
mv @gdk_pixbuf_binarydir@/loaders/libpixbufloader-svg.dll lib/gdk-pixbuf-2.0/@gdk_pixbuf_binary_version@/loaders
rm -f @gdk_pixbuf_binarydir@/loaders/libpixbufloader-svg.dll.a
rm -f @gdk_pixbuf_binarydir@/loaders/libpixbufloader-svg.la
zip $LOADERZIP lib/gdk-pixbuf-2.0/@gdk_pixbuf_binary_version@/loaders/libpixbufloader-svg.dll
