Skip to content

Commit

Permalink
Merge f1dbac6 into 52acb7a
Browse files Browse the repository at this point in the history
  • Loading branch information
bauerj committed Feb 2, 2018
2 parents 52acb7a + f1dbac6 commit d75adff
Show file tree
Hide file tree
Showing 14 changed files with 148 additions and 56 deletions.
12 changes: 2 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions contrib/build-osx/README.md
Original file line number Diff line number Diff line change
@@ -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
75 changes: 75 additions & 0 deletions contrib/build-osx/make_osx
Original file line number Diff line number Diff line change
@@ -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"
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"
4 changes: 2 additions & 2 deletions contrib/osx.spec → contrib/build-osx/osx.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ for i, x in enumerate(sys.argv):
else:
raise BaseException('no version')

electrum = "../"
block_cipher=None
electrum = os.path.abspath(".") + "/"
block_cipher = None

# see https://github.com/pyinstaller/pyinstaller/issues/2005
hiddenimports = []
Expand Down
3 changes: 2 additions & 1 deletion contrib/build-wine/build-electrum-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ cp -r electrum-locale/locale $WINEPREFIX/drive_c/electrum/lib/
cp electrum-icons/icons_rc.py $WINEPREFIX/drive_c/electrum/gui/qt/

# Install frozen dependencies
$PYTHON -m pip install -r ../../requirements.txt
$PYTHON -m pip install -r ../../deterministic-build/requirements.txt
$PYTHON -m pip install -r ../../deterministic-build/requirements-hw.txt

pushd $WINEPREFIX/drive_c/electrum
$PYTHON setup.py install
Expand Down
3 changes: 1 addition & 2 deletions contrib/build-wine/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ rm "$here"/build/* -rf
rm "$here"/dist/* -rf

$here/prepare-wine.sh && \
$here/prepare-pyinstaller.sh && \
$here/prepare-hw.sh || exit 1
$here/prepare-pyinstaller.sh || exit 1

echo "Resetting modification time in C:\Python..."
# (Because of some bugs in pyinstaller)
Expand Down
28 changes: 0 additions & 28 deletions contrib/build-wine/prepare-hw.sh

This file was deleted.

15 changes: 15 additions & 0 deletions contrib/deterministic-build/requirements-hw.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
btchip-python==0.1.24
certifi==2017.11.5
chardet==3.0.4
Cython==0.27.3
ecdsa==0.13
hidapi==0.7.99.post21
idna==2.6
keepkey==4.0.2
mnemonic==0.18
pbkdf2==1.3
protobuf==3.5.1
requests==2.18.4
six==1.11.0
trezor==0.7.16
urllib3==1.22
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ ecdsa==0.13
idna==2.6
jsonrpclib-pelix==0.3.1
pbkdf2==1.3
protobuf==3.5.0.post1
protobuf==3.5.1
pyaes==1.6.1
PySocks==1.6.7
PySocks==1.6.8
qrcode==5.3
requests==2.18.4
six==1.11.0
Expand Down
23 changes: 20 additions & 3 deletions contrib/freeze_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,34 @@ contrib=$(dirname "$0")

which virtualenv > /dev/null 2>&1 || { echo "Please install virtualenv" && exit 1; }

# standard Electrum dependencies

rm "$venv_dir" -rf
virtualenv -p $(which python3) $venv_dir

source $venv_dir/bin/activate

echo "Installing dependencies"
echo "Installing main dependencies"

pushd $contrib/..
python setup.py install
popd

pip freeze | sed '/^Electrum/ d' > $contrib/requirements.txt
pip freeze | sed '/^Electrum/ d' > $contrib/deterministic-build/requirements.txt


# hw wallet library dependencies

rm "$venv_dir" -rf
virtualenv -p $(which python3) $venv_dir

source $venv_dir/bin/activate

echo "Installing hw wallet dependencies"

python -m pip install -r ../requirements-hw.txt --upgrade

pip freeze | sed '/^Electrum/ d' > $contrib/deterministic-build/requirements-hw.txt


echo "Updated requirements"
echo "Done. Updated requirements"
6 changes: 0 additions & 6 deletions contrib/make_osx

This file was deleted.

2 changes: 1 addition & 1 deletion contrib/make_packages
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ if [ $? -ne 0 ] ; then echo "Install pip3" ; exit ; fi
rm "$contrib"/../packages/ -r

#Install pure python modules in electrum directory
pip3 install -r $contrib/requirements.txt -t $contrib/../packages
pip3 install -r $contrib/deterministic-build/requirements.txt -t $contrib/../packages

4 changes: 4 additions & 0 deletions requirements-hw.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Cython>=0.27
trezor
keepkey
btchip-python
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
import imp
import argparse

with open('requirements-hw.txt') as f:
requirements_hw = f.read().splitlines()

version = imp.load_source('version', 'lib/version.py')

if sys.version_info[:3] < (3, 4, 0):
sys.exit("Error: Electrum requires Python version >= 3.4.0...")

data_files = []
data_files = ['requirements-hw.txt']

if platform.system() in ['Linux', 'FreeBSD', 'DragonFly']:
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -46,6 +49,9 @@
'jsonrpclib-pelix',
'PySocks>=1.6.6',
],
extras_require={
'hardware': requirements_hw,
},
packages=[
'electrum',
'electrum_gui',
Expand Down

0 comments on commit d75adff

Please sign in to comment.