tLinux/Wine based build scripts for Windows executables and installer - electrum - Electrum Bitcoin wallet
 (HTM) git clone https://git.parazyd.org/electrum
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
       ---
 (DIR) commit c54372f32485714cd4c056ce8b98baf273077ffa
 (DIR) parent f0f2a0687c0b268c8f45bbf05d3a0b9b597e810f
 (HTM) Author: slush <info@bitcoin.cz>
       Date:   Sun,  9 Dec 2012 10:40:31 +0100
       
       Linux/Wine based build scripts for Windows executables and installer
       
       Diffstat:
         A contrib/build-wine/README           |      10 ++++++++++
         A contrib/build-wine/archive.patch    |      12 ++++++++++++
         A contrib/build-wine/build-wine.sh    |     115 +++++++++++++++++++++++++++++++
         A contrib/build-wine/deterministic.s… |      24 ++++++++++++++++++++++++
         A contrib/build-wine/electrum.nsis    |     129 +++++++++++++++++++++++++++++++
       
       5 files changed, 290 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/contrib/build-wine/README b/contrib/build-wine/README
       t@@ -0,0 +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 / (root)
       +2. Install Wine (version 1.4 or 1.5+ works fine, 1.4.1 has bug).
       +3. Run "./build-wine.sh", it will download all dependencies. When you'll be asked, always leave default settings and press "Next >".
       +6. Build will create three separate versions in dist/ directory. One is "dist/electrum.exe", standalone compressed executable. Second one is directory "dist/electrum" containing uncompressed binaries, useful for comparsion with other builds. Third version is "electrum-setup.exe", NSIS-based installer of Electrum.
       +7. If you want to rebuild new version of Electrum, just change path to ZIP file in "build-wine.sh" and re-run script with "./build-wine.sh update". It will skip downloading all dependencie
       +
       +For more information contact: slush <info@bitcoin.cz>
 (DIR) diff --git a/contrib/build-wine/archive.patch b/contrib/build-wine/archive.patch
       t@@ -0,0 +1,12 @@
       +252a253,255
       +> class NoZlib:
       +>     def decompress(self, data):
       +>         return data
       +253a257,259
       +>     def compress(self, data, lvl):
       +>         return data
       +>     
       +316c322
       +<             zlib = DummyZlib()
       +---
       +>             zlib = NoZlib()
 (DIR) diff --git a/contrib/build-wine/build-wine.sh b/contrib/build-wine/build-wine.sh
       t@@ -0,0 +1,115 @@
       +#!/bin/bash
       +
       +# call "./build-wine.sh" to build everything from scratch
       +# call "./build-wine.sh update" to skip building full environment (it re-download only Electrum)
       +
       +# You probably need to update only this link
       +ELECTRUM_URL=https://github.com/downloads/spesmilo/electrum/Electrum-1.5.6.tar.gz
       +NAME_ROOT=electrum-1.5.6
       +
       +# Please update these links carefully, some versions won't work under Wine
       +PYTHON_URL=http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi
       +PYQT4_URL=http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.9.5/PyQt-Py2.6-x86-gpl-4.9.5-1.exe
       +PYWIN32_URL=http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win32-py2.6.exe/download
       +PYINSTALLER_URL=https://github.com/downloads/pyinstaller/pyinstaller/pyinstaller-2.0.zip
       +NSIS_URL=http://prdownloads.sourceforge.net/nsis/nsis-2.46-setup.exe?download
       +#ZBAR_URL=http://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10-setup.exe/download
       +
       +# These settings probably don't need change
       +export WINEPREFIX=~/.wine-electrum
       +PYHOME=c:/python26
       +PYTHON="wine $PYHOME/python.exe -OO -B"
       +
       +# Let's begin!
       +cd `dirname $0`
       +set -e
       +
       +if [ "x$1" != "xupdate" ]; then
       +
       +    # Clean Wine environment
       +    echo "Cleaning $WINEPREFIX"
       +    rm -rf $WINEPREFIX
       +    echo "done"
       +
       +    echo "Cleaning tmp"
       +    rm -rf tmp
       +    mkdir -p tmp
       +    echo "done"
       +
       +    cd tmp
       +
       +    # Install Python
       +    wget -O python.msi "$PYTHON_URL"
       +    msiexec /q /i python.msi
       +
       +    # Install PyWin32
       +    wget -O pywin32.exe "$PYWIN32_URL"
       +    wine pywin32.exe
       +
       +    # Install PyQt4
       +    wget -O PyQt.exe "$PYQT4_URL"
       +    wine PyQt.exe
       +
       +    #cp -r /electrum-wine/pyinstaller $WINEPREFIX/drive_c/
       +    # Install pyinstaller
       +    wget -O pyinstaller.zip "$PYINSTALLER_URL"
       +    unzip pyinstaller.zip
       +    mv pyinstaller-2.0 $WINEPREFIX/drive_c/pyinstaller
       +
       +    # Patch pyinstaller's DummyZlib
       +    patch $WINEPREFIX/drive_c/pyinstaller/PyInstaller/loader/archive.py < ../archive.patch
       +
       +    # Install ZBar
       +    #wget -q -O zbar.exe "http://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10-setup.exe/download"
       +    #wine zbar.exe
       +
       +    # Install dependencies
       +    wget -q -O - "http://python-distribute.org/distribute_setup.py" | $PYTHON
       +    wine "$PYHOME\\Scripts\\easy_install.exe" ecdsa slowaes #zbar
       +
       +    # Install NSIS installer
       +    wget -q -O nsis.exe "http://prdownloads.sourceforge.net/nsis/nsis-2.46-setup.exe?download"
       +    wine nsis.exe
       +
       +    # Install UPX
       +    #wget -O upx.zip "http://upx.sourceforge.net/download/upx308w.zip"
       +    #unzip -o upx.zip
       +    #cp upx*/upx.exe .
       + 
       +    cd ..
       +fi
       +
       +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
       +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.nsis
       +#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@@ -0,0 +1,24 @@
       +# -*- mode: python -*-
       +a = Analysis(['C:/electrum/electrum'],
       +             pathex=['Z:\\electrum-wine'],
       +             hiddenimports=[],
       +             excludes=['Tkinter'],
       +             hookspath=None)
       +pyz = PYZ(a.pure, level=0)
       +exe = EXE(pyz,
       +          a.scripts,
       +          exclude_binaries=1,
       +          name=os.path.join('build\\pyi.win32\\electrum', 'electrum.exe'),
       +          debug=False,
       +          strip=None,
       +          upx=True,
       +          console=False )
       +coll = COLLECT(exe,
       +               a.binaries,
       +               a.zipfiles,
       +               a.datas,
       +               strip=None,
       +               upx=True,
       +               name=os.path.join('dist', 'electrum'))
       +app = BUNDLE(coll,
       +             name=os.path.join('dist', 'electrum.app'))
 (DIR) diff --git a/contrib/build-wine/electrum.nsis b/contrib/build-wine/electrum.nsis
       t@@ -0,0 +1,129 @@
       +; -------------------------------
       +; Start
       + 
       + 
       +  !define MUI_PRODUCT "Electrum"
       +  !define MUI_FILE "electrum"
       +  !define MUI_VERSION ""
       +  !define MUI_BRANDINGTEXT "Electrum"
       +  CRCCheck On
       + 
       +  !include "${NSISDIR}\Contrib\Modern UI\System.nsh"
       + 
       + 
       +;--------------------------------
       +;General
       + 
       +  OutFile "dist\electrum-setup.exe"
       +  ShowInstDetails "nevershow"
       +  ShowUninstDetails "nevershow"
       +  ;SetCompressor "lzma"
       + 
       +  ;!define MUI_ICON "icon.ico"
       +  ;!define MUI_UNICON "icon.ico"
       +  ;!define MUI_SPECIALBITMAP "Bitmap.bmp"
       + 
       + 
       +;--------------------------------
       +;Folder selection page
       + 
       +  InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
       + 
       + 
       +;--------------------------------
       +;Modern UI Configuration
       + 
       +  !define MUI_WELCOMEPAGE  
       +  !define MUI_LICENSEPAGE
       +  !define MUI_DIRECTORYPAGE
       +  !define MUI_ABORTWARNING
       +  !define MUI_UNINSTALLER
       +  !define MUI_UNCONFIRMPAGE
       +  !define MUI_FINISHPAGE  
       + 
       + 
       +;--------------------------------
       +;Language
       + 
       +  !insertmacro MUI_LANGUAGE "English"
       + 
       + 
       +;-------------------------------- 
       +;Modern UI System
       + 
       +  ;!insertmacro MUI_SYSTEM 
       + 
       + 
       +;--------------------------------
       +;Data
       + 
       +  LicenseData "license.txt"
       + 
       + 
       +;-------------------------------- 
       +;Installer Sections     
       +Section "install" ;Installation info
       + 
       +;Add files
       +  SetOutPath "$INSTDIR"
       + 
       +  ;File "${MUI_FILE}.exe"
       +  ;File "${MUI_FILE}.ini"
       +  ;File "license.txt"
       +  SetOutPath "$INSTDIR"  
       +  file /r dist\electrum\*.*
       + 
       +;create desktop shortcut
       +  CreateShortCut "$DESKTOP\${MUI_PRODUCT}.lnk" "$INSTDIR\${MUI_FILE}.exe" ""
       + 
       +;create start-menu items
       +  CreateDirectory "$SMPROGRAMS\${MUI_PRODUCT}"
       +  CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
       +  CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT}\${MUI_PRODUCT}.lnk" "$INSTDIR\${MUI_FILE}.exe" "" "$INSTDIR\${MUI_FILE}.exe" 0
       + 
       +;write uninstall information to the registry
       +  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "DisplayName" "${MUI_PRODUCT} (remove only)"
       +  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "UninstallString" "$INSTDIR\Uninstall.exe"
       + 
       +  WriteUninstaller "$INSTDIR\Uninstall.exe"
       + 
       +SectionEnd
       + 
       + 
       +;--------------------------------    
       +;Uninstaller Section  
       +Section "Uninstall"
       + 
       +;Delete Files 
       +  RMDir /r "$INSTDIR\*.*"    
       + 
       +;Remove the installation directory
       +  RMDir "$INSTDIR"
       + 
       +;Delete Start Menu Shortcuts
       +  Delete "$DESKTOP\${MUI_PRODUCT}.lnk"
       +  Delete "$SMPROGRAMS\${MUI_PRODUCT}\*.*"
       +  RmDir  "$SMPROGRAMS\${MUI_PRODUCT}"
       + 
       +;Delete Uninstaller And Unistall Registry Entries
       +  DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${MUI_PRODUCT}"
       +  DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"  
       + 
       +SectionEnd
       + 
       + 
       +;--------------------------------    
       +;MessageBox Section
       + 
       + 
       +;Function that calls a messagebox when installation finished correctly
       +Function .onInstSuccess
       +  MessageBox MB_OK "You have successfully installed ${MUI_PRODUCT}. Use the desktop icon to start the program."
       +FunctionEnd
       + 
       + 
       +Function un.onUninstSuccess
       +  MessageBox MB_OK "You have successfully uninstalled ${MUI_PRODUCT}."
       +FunctionEnd
       + 
       +;eof