#!/bin/bash
echo "Cgminer Lketc Win32 builder:"
echo ""
export folder=$(pwd)
cd ~
git clone https://github.com/wareck/cgminer-lketc.git
cd cgminer-lketc
autoreconf -fi
CFLAGS="-O2 -msse2" ./configure --host=i686-w64-mingw32.static --disable-shared --enable-static --enable-zeus --enable-lketc --enable-gridseed --enable-scrypt --prefix=/home/wareck/out
make -j4
strip cgminer.exe
#upx cgminer.exe
mkdir /tmp/cgminer-lketc
cp cgminer.exe /tmp/cgminer-lketc
cp $folder/packages/lketc/manual.pdf /tmp/cgminer-lketc/
cp $folder/packages/lketc/start.bat /tmp/cgminer-lketc/
cp $folder/packages/lketc/zadig-2.7.exe /tmp/cgminer-lketc/
cp $folder/packages/lketc/cgminer.conf /tmp/cgminer-lketc/
cd /tmp/
version=`git ls-remote -h https://github.com/wareck/cgminer-lketc.git | awk '{print $1}' |cut -c1-7`
7z a -tzip cgminer-lketc-$version.zip cgminer-lketc
lftp -u wareck,zorn692611 ftpperso.free.fr <<EOF
put cgminer-lketc-$version.zip -o /crypto/cgminer/cgminer-lketc-$version.zip
EOF
if ! [ -d /home/$USER/Bureau/win32_build/ ]; then mkdir /home/$USER/Bureau/win32_build ;fi
cp cgminer-lketc-$version.zip /home/$USER/Bureau/win32_build
