#!/bin/sh

mingwb="$(ls /usr/ | grep mingw32 | head --lines 1)"
qtx11d="$(pwd)/qt4-x11"
#if [ ! -f "sevnz.dll" ] || [ ! -f "sevnz.exe" ]
#then
#svloc=$(wget "http://7-zip.org/" -O - | grep --ignore-case "a href=\"http://downloads.sourceforge.net/sevenzip/" | grep -v ".msi" | grep -v "x64" | head --lines 1 | tr "<" "\n" | tr ">" "\n" | tr "\"" "\n" | grep "http://downloads.sourceforge.net/sevenzip/")
#wget "$svloc" -O sevenzip.exe
#7z e sevenzip.exe 7z.exe 7z.dll
#mv 7z.exe sevnz.exe
#mv 7z.dll sevnz.dll
#fi
rvern="$(bzr revno)"
make clean
rm Makefile*
rm release/*
lupdate unetbootin.pro
lrelease unetbootin.pro
./qmake-windows "DEFINES += UBFEUP" "RESOURCES += unetbootin-ubfeup.qrc"
#./qmake-windows
make
$mingwb-strip --strip-all release/unetbootin.exe
#mv release/unetbootin.exe release/unetbootin-windows-$rvern.exe
./upx --lzma release/unetbootin.exe
mv release/unetbootin.exe release/unetbootin-feup.exe
#./qmake-linux "DEFINES += UBFEUP" "RESOURCES += unetbootin-ubfeup.qrc"
#make
#$mingwb-strip --strip-all unetbootin
#mv unetbootin release/unetbootin-linux
#./upx --lzma release/unetbootin-linux

