electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 146f2dd56839619dfac4f83080a1d03fbf445531
parent 08bf966f32219bfec94d3ba942ac921b35053efd
Author: ThomasV <thomasv@electrum.org>
Date:   Wed,  7 Feb 2018 17:14:29 +0100

Merge pull request #3814 from bauerj/macos-build

Update macOS build
Diffstat:
MREADME.rst | 12++----------
Acontrib/build-osx/README.md | 17+++++++++++++++++
Acontrib/build-osx/make_osx | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontrib/build-osx/osx.spec | 87+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dcontrib/make_osx | 6------
Dcontrib/osx.spec | 87-------------------------------------------------------------------------------
6 files changed, 181 insertions(+), 103 deletions(-)

diff --git a/README.rst b/README.rst @@ -93,20 +93,12 @@ This directory contains the python dependencies used by Electrum. Mac OS X / macOS -------- -:: - - # On MacPorts installs: - sudo python3 setup-release.py py2app - - # On Homebrew installs: - ARCHFLAGS="-arch i386 -arch x86_64" sudo python3 setup-release.py py2app --includes sip - - sudo hdiutil create -fs HFS+ -volname "Electrum" -srcfolder dist/Electrum.app dist/electrum-VERSION-macosx.dmg +See `contrib/build-osx/`. Windows ------- -See `contrib/build-wine/README` file. +See `contrib/build-wine/`. Android diff --git a/contrib/build-osx/README.md b/contrib/build-osx/README.md @@ -0,0 +1,17 @@ +Building Mac OS binaries +======================== + +This guide explains how to build Electrum binaries for macOS systems. +We build our binaries on El Capitan (10.11.6) as building it on High Sierra +makes the binaries incompatible with older versions. + +This assumes that the Xcode command line tools (and thus git) are already installed. + + +## 1. Run the script + + + + ./make_osx + +## 2. Done diff --git a/contrib/build-osx/make_osx b/contrib/build-osx/make_osx @@ -0,0 +1,75 @@ +#!/bin/bash +RED='\033[0;31m' +BLUE='\033[0,34m' +NC='\033[0m' # No Color +function info { + printf "\r💬 ${BLUE}INFO:${NC} ${1}\n" +} +function fail { + printf "\r🗯 ${RED}ERROR:${NC} ${1}\n" + exit 1 +} + +build_dir=$(dirname "$0") +test -n "$build_dir" -a -d "$build_dir" || exit +cd $build_dir/../.. + +export PYTHONHASHSEED=22 +VERSION=`git describe --tags` +PYTHON_VERSION=3.6.4 + + +info "Installing Python $PYTHON_VERSION" +export PATH="~/.pyenv/bin:~/.pyenv/shims:$PATH:~/Library/Python/3.6/bin" +if [ -d "~/.pyenv" ]; then + pyenv update +else + curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash > /dev/null 2>&1 +fi +PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install -s $PYTHON_VERSION && \ +pyenv global $PYTHON_VERSION || \ +fail "Unable to use Python $PYTHON_VERSION" + + +if ! which pyinstaller > /dev/null; then + info "Installing pyinstaller" + python3 -m pip install pyinstaller -I --user || fail "Could not install pyinstaller" +fi + +info "Using these versions for building Electrum:" +sw_vers +python3 --version +echo -n "Pyinstaller " +pyinstaller --version + +rm -rf ./dist + + +rm -rf /tmp/electrum-build > /dev/null 2>&1 +mkdir /tmp/electrum-build + +info "Downloading icons and locale..." +for repo in icons locale; do + git clone https://github.com/spesmilo/electrum-$repo /tmp/electrum-build/electrum-$repo +done + +cp -R /tmp/electrum-build/electrum-locale/locale/ ./lib/locale/ +cp /tmp/electrum-build/electrum-icons/icons_rc.py ./gui/qt/ + +info "Installing requirements..." +python3 -m pip install -Ir ./contrib/deterministic-build/requirements.txt --user && \ +python3 -m pip install pyqt5 --user || \ +fail "Could not install requirements" + +info "Installing hardware wallet requirements..." +python3 -m pip install -Ir ./contrib/deterministic-build/requirements-hw.txt --user || \ +fail "Could not install hardware wallet requirements" + +info "Building Electrum..." +python3 setup.py install --user > /dev/null || fail "Could not build Electrum" + +info "Building binary" +pyinstaller --noconfirm --ascii --name $VERSION contrib/build-osx/osx.spec || fail "Could not build binary" + +info "Creating .DMG" +hdiutil create -fs HFS+ -volname "Electrum" -srcfolder dist/Electrum.app dist/electrum-$VERSION.dmg || fail "Could not create .DMG" diff --git a/contrib/build-osx/osx.spec b/contrib/build-osx/osx.spec @@ -0,0 +1,86 @@ +# -*- mode: python -*- + +from PyInstaller.utils.hooks import collect_data_files, collect_submodules + +import sys +import os + +for i, x in enumerate(sys.argv): + if x == '--name': + VERSION = sys.argv[i+1] + break +else: + raise BaseException('no version') + +electrum = os.path.abspath(".") + "/" +block_cipher = None + +# see https://github.com/pyinstaller/pyinstaller/issues/2005 +hiddenimports = [] +hiddenimports += collect_submodules('trezorlib') +hiddenimports += collect_submodules('btchip') +hiddenimports += collect_submodules('keepkeylib') + +datas = [ + (electrum+'lib/currencies.json', 'electrum'), + (electrum+'lib/servers.json', 'electrum'), + (electrum+'lib/checkpoints.json', 'electrum'), + (electrum+'lib/servers_testnet.json', 'electrum'), + (electrum+'lib/checkpoints_testnet.json', 'electrum'), + (electrum+'lib/wordlist/english.txt', 'electrum/wordlist'), + (electrum+'lib/locale', 'electrum/locale'), + (electrum+'plugins', 'electrum_plugins'), +] +datas += collect_data_files('trezorlib') +datas += collect_data_files('btchip') +datas += collect_data_files('keepkeylib') + +# 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+'electrum', + electrum+'gui/qt/main_window.py', + electrum+'gui/text.py', + electrum+'lib/util.py', + electrum+'lib/wallet.py', + electrum+'lib/simple_config.py', + electrum+'lib/bitcoin.py', + electrum+'lib/dnssec.py', + electrum+'lib/commands.py', + electrum+'plugins/cosigner_pool/qt.py', + electrum+'plugins/email_requests/qt.py', + electrum+'plugins/trezor/client.py', + electrum+'plugins/trezor/qt.py', + electrum+'plugins/keepkey/qt.py', + electrum+'plugins/ledger/qt.py', + ], + datas=datas, + hiddenimports=hiddenimports, + hookspath=[]) + +# http://stackoverflow.com/questions/19055089/pyinstaller-onefile-warning-pyconfig-h-when-importing-scipy-or-scipy-signal +for d in a.datas: + if 'pyconfig' in d[0]: + a.datas.remove(d) + break + +pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) + +exe = EXE(pyz, + a.scripts, + a.binaries, + a.datas, + name='Electrum', + debug=False, + strip=False, + upx=True, + icon=electrum+'electrum.icns', + console=False) + +app = BUNDLE(exe, + version = VERSION, + name='Electrum.app', + icon=electrum+'electrum.icns', + bundle_identifier=None, + info_plist = { + 'NSHighResolutionCapable':'True' + } +)+ \ No newline at end of file diff --git a/contrib/make_osx b/contrib/make_osx @@ -1,6 +0,0 @@ -#!/bin/bash -rm -rf dist -export PYTHONHASHSEED=22 -VERSION=`git describe --tags` -pyinstaller --noconfirm --ascii --name $VERSION contrib/osx.spec -hdiutil create -fs HFS+ -volname "Electrum" -srcfolder dist/Electrum.app dist/electrum-$VERSION.dmg diff --git a/contrib/osx.spec b/contrib/osx.spec @@ -1,86 +0,0 @@ -# -*- mode: python -*- - -from PyInstaller.utils.hooks import collect_data_files, collect_submodules - -import sys -import os - -for i, x in enumerate(sys.argv): - if x == '--name': - VERSION = sys.argv[i+1] - break -else: - raise BaseException('no version') - -electrum = "../" -block_cipher=None - -# see https://github.com/pyinstaller/pyinstaller/issues/2005 -hiddenimports = [] -hiddenimports += collect_submodules('trezorlib') -hiddenimports += collect_submodules('btchip') -hiddenimports += collect_submodules('keepkeylib') - -datas = [ - (electrum+'lib/currencies.json', 'electrum'), - (electrum+'lib/servers.json', 'electrum'), - (electrum+'lib/checkpoints.json', 'electrum'), - (electrum+'lib/servers_testnet.json', 'electrum'), - (electrum+'lib/checkpoints_testnet.json', 'electrum'), - (electrum+'lib/wordlist/english.txt', 'electrum/wordlist'), - (electrum+'lib/locale', 'electrum/locale'), - (electrum+'plugins', 'electrum_plugins'), -] -datas += collect_data_files('trezorlib') -datas += collect_data_files('btchip') -datas += collect_data_files('keepkeylib') - -# 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+'electrum', - electrum+'gui/qt/main_window.py', - electrum+'gui/text.py', - electrum+'lib/util.py', - electrum+'lib/wallet.py', - electrum+'lib/simple_config.py', - electrum+'lib/bitcoin.py', - electrum+'lib/dnssec.py', - electrum+'lib/commands.py', - electrum+'plugins/cosigner_pool/qt.py', - electrum+'plugins/email_requests/qt.py', - electrum+'plugins/trezor/client.py', - electrum+'plugins/trezor/qt.py', - electrum+'plugins/keepkey/qt.py', - electrum+'plugins/ledger/qt.py', - ], - datas=datas, - hiddenimports=hiddenimports, - hookspath=[]) - -# http://stackoverflow.com/questions/19055089/pyinstaller-onefile-warning-pyconfig-h-when-importing-scipy-or-scipy-signal -for d in a.datas: - if 'pyconfig' in d[0]: - a.datas.remove(d) - break - -pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) - -exe = EXE(pyz, - a.scripts, - a.binaries, - a.datas, - name='Electrum', - debug=False, - strip=False, - upx=True, - icon=electrum+'electrum.icns', - console=False) - -app = BUNDLE(exe, - version = VERSION, - name='Electrum.app', - icon=electrum+'electrum.icns', - bundle_identifier=None, - info_plist = { - 'NSHighResolutionCapable':'True' - } -)- \ No newline at end of file