From 736168721073bc5585050629c9a60b1284e0db35 Mon Sep 17 00:00:00 2001 From: cryptapus Date: Mon, 5 Oct 2015 16:43:10 +0000 Subject: [PATCH] fixed scripts for wine build --- contrib/build-wine/archive.patch | 12 ------- contrib/build-wine/build-electrum-git.sh | 15 +++----- contrib/build-wine/deterministic.spec | 44 +++++++++++++++++------- contrib/build-wine/prepare-wine.sh | 33 ++++++++++-------- 4 files changed, 53 insertions(+), 51 deletions(-) delete mode 100644 contrib/build-wine/archive.patch diff --git a/contrib/build-wine/archive.patch b/contrib/build-wine/archive.patch deleted file mode 100644 index e9513527f..000000000 --- a/contrib/build-wine/archive.patch +++ /dev/null @@ -1,12 +0,0 @@ -252a253,255 -> class NoZlib: -> def decompress(self, data): -> return data -253a257,259 -> def compress(self, data, lvl): -> return data -> -316c322 -< zlib = DummyZlib() ---- -> zlib = NoZlib() diff --git a/contrib/build-wine/build-electrum-git.sh b/contrib/build-wine/build-electrum-git.sh index 279b364da..724927f84 100755 --- a/contrib/build-wine/build-electrum-git.sh +++ b/contrib/build-wine/build-electrum-git.sh @@ -7,7 +7,7 @@ NAME_ROOT=electrum # These settings probably don't need any change export WINEPREFIX=/opt/wine-electrum -PYHOME=c:/python26 +PYHOME=c:/python27 PYTHON="wine $PYHOME/python.exe -OO -B" # Let's begin! @@ -42,24 +42,17 @@ cp -r electrum-git $WINEPREFIX/drive_c/electrum cp electrum-git/LICENCE . # Build Qt resources -wine $WINEPREFIX/drive_c/Python26/Lib/site-packages/PyQt4/pyrcc4.exe C:/electrum/icons.qrc -o C:/electrum/lib/icons_rc.py - -# Copy ZBar libraries to electrum -#cp "$WINEPREFIX/drive_c/Program Files (x86)/ZBar/bin/"*.dll "$WINEPREFIX/drive_c/electrum/" +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 cd .. rm -rf dist/ -# 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 +wine "$WINEPREFIX/drive_c/Program Files/NSIS/makensis.exe" electrum.nsi DATE=`date +"%Y%m%d"` cd dist diff --git a/contrib/build-wine/deterministic.spec b/contrib/build-wine/deterministic.spec index 174f28ed0..e1d9f8c8a 100644 --- a/contrib/build-wine/deterministic.spec +++ b/contrib/build-wine/deterministic.spec @@ -1,15 +1,25 @@ # -*- mode: python -*- +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(['electrum', 'gui/qt/main_window.py', 'gui/qt/lite_window.py', 'gui/text.py', - 'lib/util.py', 'lib/wallet.py', 'lib/simple_config.py', - 'lib/bitcoin.py' +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', + home+'lib/simple_config.py', + home+'lib/bitcoin.py', + home+'lib/dnssec.py', + home+'lib/commands.py', + home+'packages/requests/utils.py' ], - hiddenimports=["lib","gui"], pathex=['lib','gui','plugins','packages'], - hookspath=None) + hiddenimports=['lib','gui'], + hookspath=[]) -##### include mydir in distribution ####### +##### include folder in distribution ####### def extra_datas(mydir): def rec_glob(p, files): import os @@ -22,7 +32,14 @@ def extra_datas(mydir): rec_glob("%s/*" % mydir, files) extra_datas = [] for f in files: - extra_datas.append((f, f, 'DATA')) + d = f.split('\\') + t = '' + for a in d[2:]: + if len(t)==0: + t = a + else: + t = t+'\\'+a + extra_datas.append((t, f, 'DATA')) return extra_datas ########################################### @@ -30,12 +47,13 @@ def extra_datas(mydir): # append dirs # cacert.pem -a.datas += [ ('requests/cacert.pem', 'packages/requests/cacert.pem', 'DATA') ] +a.datas += [ ('requests/cacert.pem', home+'packages/requests/cacert.pem', 'DATA') ] # Py folders that are needed because of the magic import finding -a.datas += extra_datas('gui') -a.datas += extra_datas('lib') -a.datas += extra_datas('plugins') +a.datas += extra_datas(home+'gui') +a.datas += extra_datas(home+'lib') +a.datas += extra_datas(home+'plugins') +a.datas += extra_datas(home+'packages') pyz = PYZ(a.pure) exe = EXE(pyz, @@ -46,7 +64,7 @@ exe = EXE(pyz, debug=False, strip=None, upx=False, - icon='icons/electrum.ico', + icon=home+'icons/electrum.ico', console=False) # The console True makes an annoying black box pop up, but it does make Electrum output command line commands, with this turned off no output will be given but commands can still be used @@ -57,6 +75,6 @@ coll = COLLECT(exe, strip=None, upx=True, debug=False, - icon='icons/electrum.ico', + icon=home+'icons/electrum.ico', console=False, name=os.path.join('dist', 'electrum')) diff --git a/contrib/build-wine/prepare-wine.sh b/contrib/build-wine/prepare-wine.sh index 6764ae7bf..a646565e4 100755 --- a/contrib/build-wine/prepare-wine.sh +++ b/contrib/build-wine/prepare-wine.sh @@ -1,16 +1,16 @@ #!/bin/bash # 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=http://downloads.sourceforge.net/project/pyinstaller/2.0/pyinstaller-2.0.zip +PYTHON_URL=http://www.python.org/ftp/python/2.7.8/python-2.7.8.msi +PYQT4_URL=http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.1/PyQt4-4.11.1-gpl-Py2.7-Qt4.8.6-x32.exe +PYWIN32_URL=http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py2.7.exe/download +PYINSTALLER_URL=https://pypi.python.org/packages/source/P/PyInstaller/PyInstaller-2.1.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 +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 -PYHOME=c:/python26 +PYHOME=c:/python27 PYTHON="wine $PYHOME/python.exe -OO -B" # Let's begin! @@ -31,7 +31,7 @@ cd tmp # Install Python wget -O python.msi "$PYTHON_URL" -msiexec /q /i python.msi +wine msiexec /q /i python.msi # Install PyWin32 wget -O pywin32.exe "$PYWIN32_URL" @@ -41,28 +41,31 @@ wine pywin32.exe 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 +mv PyInstaller-2.1 $WINEPREFIX/drive_c/pyinstaller # 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 setuptools +wget -O setuptools.exe "$SETUPTOOLS_URL" +wine setuptools.exe + # Install dependencies -wget -q -O - "http://python-distribute.org/distribute_setup.py" | $PYTHON -wine "$PYHOME\\Scripts\\easy_install.exe" ecdsa slowaes #zbar +wine "$PYHOME\\Scripts\\easy_install.exe" ecdsa #zbar # Install NSIS installer -wget -q -O nsis.exe "http://prdownloads.sourceforge.net/nsis/nsis-2.46-setup.exe?download" +wget -q -O nsis.exe "$NSIS_URL" wine nsis.exe # Install UPX #wget -O upx.zip "http://upx.sourceforge.net/download/upx308w.zip" #unzip -o upx.zip #cp upx*/upx.exe . + +# add dlls needed for pyinstaller: +cp $WINEPREFIX/drive_c/windows/system32/msvcp90.dll $WINEPREFIX/drive_c/Python27/ +cp $WINEPREFIX/drive_c/windows/system32/msvcm90.dll $WINEPREFIX/drive_c/Python27/