URI: 
       tupdate windows building scripts - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit d48c2119609c5660fb7ad5a7156e007eec0cf3e5
   DIR parent 22575b976084cc1accd78c43c0f335b14e8945b0
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Fri, 23 Oct 2015 12:51:54 +0200
       
       update windows building scripts
       
       Diffstat:
         M contrib/build-wine/README           |       8 ++++----
         M contrib/build-wine/build-electrum-… |      44 +++++++++++++++++++++----------
         D contrib/build-wine/build-electrum.… |      50 -------------------------------
         M contrib/build-wine/deterministic.s… |       8 +++++---
         A contrib/build-wine/portable.patch   |      13 +++++++++++++
         A contrib/build-wine/prepare-hw.sh    |      89 +++++++++++++++++++++++++++++++
         M contrib/build-wine/prepare-wine.sh  |      14 ++++++++------
       
       7 files changed, 149 insertions(+), 77 deletions(-)
       ---
   DIR diff --git a/contrib/build-wine/README b/contrib/build-wine/README
       t@@ -1,10 +1,10 @@
        These scripts can be used for cross-compilation of Windows Electrum executables from Linux/Wine.
        
        Usage:
       -1. Copy content of this directory to /build-wine.
       -2. Install Wine (version 1.4 or 1.5+ works fine, 1.4.1 has bug).
       -3. Run "./prepare-wine.sh", it will download all dependencies. When you'll be asked, always leave default settings and press "Next >".
       -4. By running "./build-electrum.sh", sources will be packed into three separate versions to dist/ directory:
       +1. Install Wine (tested with wine-1.7.18)
       +2. Run "./prepare-wine.sh", it will download all dependencies. When you'll be asked, always leave default settings and press "Next >".
       +3. Run "./prepare-hw.sh" to build support for hardware wallets (trezor)
       +4. Run "./build-electrum-git.sh". Sources will be packed into three separate versions to dist/ directory:
          * Standalone compressed executable is "dist/electrum.exe"
          * Uncompressed binaries are in "dist/electrum". They're useful for comparsion with other builds.
          * NSIS-based installer of Electrum is "electrum-setup.exe"
   DIR diff --git a/contrib/build-wine/build-electrum-git.sh b/contrib/build-wine/build-electrum-git.sh
       t@@ -5,11 +5,14 @@ ELECTRUM_GIT_URL=git://github.com/spesmilo/electrum.git
        BRANCH=master
        NAME_ROOT=electrum
        
       +
        # These settings probably don't need any change
       -export WINEPREFIX=/opt/wine-electrum
       +export WINEPREFIX=/opt/electrum/wine64
       +
        PYHOME=c:/python27
        PYTHON="wine $PYHOME/python.exe -OO -B"
        
       +
        # Let's begin!
        cd `dirname $0`
        set -e
       t@@ -19,28 +22,28 @@ cd tmp
        if [ -d "electrum-git" ]; then
            # GIT repository found, update it
            echo "Pull"
       -
            cd electrum-git
            git pull
            cd ..
       -
        else
            # GIT repository not found, clone it
            echo "Clone"
       -
            git clone -b $BRANCH $ELECTRUM_GIT_URL electrum-git
        fi
        
        cd electrum-git
       -COMMIT_HASH=`git rev-parse HEAD | awk '{ print substr($1, 0, 11) }'`
       -echo "Last commit: $COMMIT_HASH"
       -cd ..
       +VERSION=`git describe --tags`
       +echo "Last commit: $VERSION"
        
       +cd ..
        
        rm -rf $WINEPREFIX/drive_c/electrum
        cp -r electrum-git $WINEPREFIX/drive_c/electrum
        cp electrum-git/LICENCE .
        
       +# add python packages (built with make_packages)
       +cp -r ../../../packages $WINEPREFIX/drive_c/electrum/
       +
        # Build Qt resources
        wine $WINEPREFIX/drive_c/Python27/Lib/site-packages/PyQt4/pyrcc4.exe C:/electrum/icons.qrc -o C:/electrum/lib/icons_rc.py
        wine $WINEPREFIX/drive_c/Python27/Lib/site-packages/PyQt4/pyrcc4.exe C:/electrum/icons.qrc -o C:/electrum/gui/qt/icons_rc.py
       t@@ -49,14 +52,27 @@ cd ..
        
        rm -rf dist/
        
       +# build standalone version
        $PYTHON "C:/pyinstaller/pyinstaller.py" --noconfirm --ascii -w deterministic.spec
        
       -# For building NSIS installer, run:
       -wine "$WINEPREFIX/drive_c/Program Files/NSIS/makensis.exe" electrum.nsi
       +# build NSIS installer
       +wine "$WINEPREFIX/drive_c/Program Files (x86)/NSIS/makensis.exe" electrum.nsi
        
       -DATE=`date +"%Y%m%d"`
        cd dist
       -mv electrum.exe $NAME_ROOT-$DATE-$COMMIT_HASH.exe
       -mv electrum $NAME_ROOT-$DATE-$COMMIT_HASH
       -mv electrum-setup.exe $NAME_ROOT-$DATE-$COMMIT_HASH-setup.exe
       -zip -r $NAME_ROOT-$DATE-$COMMIT_HASH.zip $NAME_ROOT-$DATE-$COMMIT_HASH
       +mv electrum.exe $NAME_ROOT-$VERSION.exe
       +mv electrum-setup.exe $NAME_ROOT-$VERSION-setup.exe
       +mv electrum $NAME_ROOT-$VERSION
       +zip -r $NAME_ROOT-$VERSION.zip $NAME_ROOT-$VERSION
       +cd ..
       +
       +# build portable version
       +cp portable.patch $WINEPREFIX/drive_c/electrum
       +pushd $WINEPREFIX/drive_c/electrum
       +patch < portable.patch 
       +popd
       +$PYTHON "C:/pyinstaller/pyinstaller.py" --noconfirm --ascii -w deterministic.spec
       +cd dist
       +mv electrum.exe $NAME_ROOT-$VERSION-portable.exe
       +cd ..
       +
       +echo "Done."
   DIR diff --git a/contrib/build-wine/build-electrum.sh b/contrib/build-wine/build-electrum.sh
       t@@ -1,50 +0,0 @@
       -#!/bin/bash
       -
       -# You probably need to update only this link
       -ELECTRUM_URL=http://electrum.bitcoin.cz/download/Electrum-1.6.1.tar.gz
       -NAME_ROOT=electrum-1.6.1
       -
       -# These settings probably don't need any change
       -export WINEPREFIX=/opt/wine-electrum
       -PYHOME=c:/python26
       -PYTHON="wine $PYHOME/python.exe -OO -B"
       -
       -# Let's begin!
       -cd `dirname $0`
       -set -e
       -
       -cd tmp
       -
       -# Download and unpack Electrum
       -wget -O electrum.tgz "$ELECTRUM_URL"
       -tar xf electrum.tgz
       -mv Electrum-* electrum
       -rm -rf $WINEPREFIX/drive_c/electrum
       -cp electrum/LICENCE .
       -mv electrum $WINEPREFIX/drive_c
       -
       -# Copy ZBar libraries to electrum
       -#cp "$WINEPREFIX/drive_c/Program Files (x86)/ZBar/bin/"*.dll "$WINEPREFIX/drive_c/electrum/"
       -
       -cd ..
       -
       -rm -rf dist/$NAME_ROOT
       -rm -f dist/$NAME_ROOT.zip
       -rm -f dist/$NAME_ROOT.exe
       -rm -f dist/$NAME_ROOT-setup.exe
       -
       -# For building standalone compressed EXE, run:
       -$PYTHON "C:/pyinstaller/pyinstaller.py" --noconfirm --ascii -w --onefile "C:/electrum/electrum"
       -
       -# For building uncompressed directory of dependencies, run:
       -$PYTHON "C:/pyinstaller/pyinstaller.py" --noconfirm --ascii -w deterministic.spec
       -
       -# For building NSIS installer, run:
       -wine "$WINEPREFIX/drive_c/Program Files (x86)/NSIS/makensis.exe" electrum.nsi
       -#wine $WINEPREFIX/drive_c/Program\ Files\ \(x86\)/NSIS/makensis.exe electrum.nsis
       -
       -cd dist
       -mv electrum.exe $NAME_ROOT.exe
       -mv electrum $NAME_ROOT
       -mv electrum-setup.exe $NAME_ROOT-setup.exe
       -zip -r $NAME_ROOT.zip $NAME_ROOT
   DIR diff --git a/contrib/build-wine/deterministic.spec b/contrib/build-wine/deterministic.spec
       t@@ -5,7 +5,6 @@ home = 'C:\\electrum\\'
        # We don't put these files in to actually include them in the script but to make the Analysis method scan them for imports
        a = Analysis([home+'electrum',
                      home+'gui/qt/main_window.py',
       -              home+'gui/qt/lite_window.py',
                      home+'gui/text.py',
                      home+'lib/util.py',
                      home+'lib/wallet.py',
       t@@ -13,10 +12,13 @@ a = Analysis([home+'electrum',
                      home+'lib/bitcoin.py',
                      home+'lib/dnssec.py',
                      home+'lib/commands.py',
       +              home+'plugins/cosigner_pool.py',
       +              home+'plugins/email_requests.py',
       +              home+'plugins/trezor.py',
                      home+'packages/requests/utils.py'
                      ],
       -             pathex=['lib','gui','plugins','packages'],
       -             hiddenimports=['lib','gui'],
       +             pathex=[home+'lib', home+'gui', home+'plugins', home+'packages'],
       +             hiddenimports=['lib', 'gui'],
                     hookspath=[])
        
        ##### include folder in distribution #######
   DIR diff --git a/contrib/build-wine/portable.patch b/contrib/build-wine/portable.patch
       t@@ -0,0 +1,13 @@
       +diff --git a/electrum b/electrum
       +index 8c972c6..46903b7 100755
       +--- a/electrum
       ++++ b/electrum
       +@@ -454,6 +454,8 @@ if __name__ == '__main__':
       +         if config_options.get('server'):
       +             config_options['auto_connect'] = False
       + 
       ++    config_options['portable'] = True
       ++
       +     if config_options.get('portable'):
       +         config_options['electrum_path'] = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'electrum_data')
       + 
   DIR diff --git a/contrib/build-wine/prepare-hw.sh b/contrib/build-wine/prepare-hw.sh
       t@@ -0,0 +1,89 @@
       +#!/bin/bash
       +
       +TREZOR_GIT_URL=git://github.com/trezor/python-trezor.git
       +KEEPKEY_GIT_URL=git://github.com/keepkey/python-keepkey.git
       +BTCHIP_GIT_URL=git://github.com/LedgerHQ/btchip-python.git
       +
       +BRANCH=master
       +
       +# These settings probably don't need any change
       +export WINEPREFIX=/opt/electrum/wine64
       +
       +PYHOME=c:/python27
       +PYTHON="wine $PYHOME/python.exe "
       +
       +# Let's begin!
       +cd `dirname $0`
       +set -e
       +
       +cd tmp
       +
       +# downoad mingw-get-setup.exe
       +#wget http://downloads.sourceforge.net/project/mingw/Installer/mingw-get-setup.exe
       +#wine mingw-get-setup.exe
       +
       +#echo "add c:\MinGW\bin to PATH using regedit"
       +#regedit
       +#exit
       +
       +#wine mingw-get install gcc
       +#wine mingw-get install mingw-utils
       +#wine mingw-get install mingw32-libz
       +
       +#create cfg file
       +#printf "[build]\ncompiler=mingw32\n" > /opt/me/wine64/drive_c/Python27/Lib/distutils/distutils.cfg
       +
       +# Install Cython
       +#wine "$PYHOME\\Scripts\\easy_install.exe" cython
       +
       +
       +# not working
       +##wine "$PYHOME\\Scripts\\easy_install.exe" hidapi
       +
       +#git clone https://github.com/trezor/cython-hidapi.git
       +
       +#replace: from distutils.core import setup, Extenstion
       +
       +#cd cython-hidapi
       +#git submodule init
       +#git submodule update
       +#$PYTHON setup.py install
       +#cd ..
       +
       +
       +
       +if [ -d "trezor-git" ]; then
       +    cd trezor-git
       +    git pull
       +    cd ..
       +else
       +    git clone -b $BRANCH $TREZOR_GIT_URL trezor-git
       +fi
       +cd trezor-git
       +$PYTHON setup.py install
       +cd ..
       +
       +#keepkey
       +if [ -d "keepkey-git" ]; then
       +    cd keepkey-git
       +    git pull
       +    cd ..
       +else
       +    git clone -b $BRANCH $KEEPKEY_GIT_URL keepkey-git
       +fi
       +cd keepkey-git
       +# fails $PYTHON setup.py install
       +cd ..
       +
       +#btchip
       +if [ -d "btchip-git" ]; then
       +    cd btchip-git
       +    git pull
       +    cd ..
       +else
       +    git clone -b $BRANCH $BTCHIP_GIT_URL btchip-git
       +fi
       +cd btchip-git
       +$PYTHON setup.py install
       +cd ..
       +
   DIR diff --git a/contrib/build-wine/prepare-wine.sh b/contrib/build-wine/prepare-wine.sh
       t@@ -8,8 +8,11 @@ PYINSTALLER_URL=https://pypi.python.org/packages/source/P/PyInstaller/PyInstalle
        NSIS_URL=http://prdownloads.sourceforge.net/nsis/nsis-2.46-setup.exe?download
        SETUPTOOLS_URL=https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe
        
       -# These settings probably don't need change
       -export WINEPREFIX=/opt/wine-electrum
       +
       +## These settings probably don't need change
       +export WINEPREFIX=/opt/electrum/wine64
       +#export WINEARCH='win32'
       +
        PYHOME=c:/python27
        PYTHON="wine $PYHOME/python.exe -OO -B"
        
       t@@ -19,9 +22,11 @@ set -e
        
        # Clean up Wine environment
        echo "Cleaning $WINEPREFIX"
       -rm -rf $WINEPREFIX/*
       +rm -rf $WINEPREFIX
        echo "done"
        
       +wine 'wineboot'
       +
        echo "Cleaning tmp"
        rm -rf tmp
        mkdir -p tmp
       t@@ -54,9 +59,6 @@ mv PyInstaller-2.1 $WINEPREFIX/drive_c/pyinstaller
        wget -O setuptools.exe "$SETUPTOOLS_URL"
        wine setuptools.exe
        
       -# Install dependencies
       -wine "$PYHOME\\Scripts\\easy_install.exe" ecdsa #zbar
       -
        # Install NSIS installer
        wget -q -O nsis.exe "$NSIS_URL"
        wine nsis.exe