#!/bin/sh

rm -rf package
mkdir -p package

cp /usr/i486-mingw32/bin/lib{popt,charset,glib,gthread,iconv,intl}*.dll package/

export CFLAGS="-O2 -mms-bitfields"
export PKG_CONFIG_PATH="/usr/i486-mingw32/lib/pkgconfig/"

#chmod -R 755 spkg-1.0/
rm -rf spkg-1.0/
make distdir
cd spkg-1.0/
  
./configure \
  --prefix=/usr/i486-mingw32 \
  --host=i486-mingw32 \
  || exit 1

make || exit 1

cd ..

cp spkg-1.0/src/spkg.exe package/

#make -j1 DESTDIR=$startdir/pkg install || exit 1

upx `find package -name '*.exe' -o -name '*.dll'`

