#!/bin/sh

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

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

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

cd /usr
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/2.10.0/loaders
mv /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll lib/gdk-pixbuf-2.0/2.10.0/loaders
rm -f /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll.a
rm -f /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.la
zip $LOADERZIP lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll
