forked from bitcoin-core/HWI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_bin.sh
executable file
·63 lines (48 loc) · 1.51 KB
/
build_bin.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/bash
# Script for building standalone binary releases deterministically
# Usage: First script parameter can be `--without-gui` to build without UI support
set -ex
ARCH=$(uname -m | tr '[:upper:]' '[:lower:]')
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
pip install -U pip
pip install poetry
gui_support="${1:---with-gui}";
# Setup poetry and install the dependencies
if [[ $gui_support == "--with-gui" && $ARCH == "x86_64" ]]; then
poetry install -E qt
else
poetry install
fi
# We also need to change the timestamps of all of the base library files
lib_dir=$(pyenv prefix)/lib/python3.9
TZ=UTC find ${lib_dir} -name '*.py' -type f -execdir touch -t "201901010000.00" '{}' \;
# Make the standalone binary
export PYTHONHASHSEED=42
poetry run pyinstaller hwi.spec
if [[ $gui_support == "--with-gui" && $ARCH == "x86_64" ]]; then
poetry run contrib/generate-ui.sh
poetry run pyinstaller hwi-qt.spec
fi
unset PYTHONHASHSEED
# Make the final compressed package
pushd dist
VERSION=`poetry run hwi --version | cut -d " " -f 2`
OS=`uname | tr '[:upper:]' '[:lower:]'`
if [[ $OS == "darwin" ]]; then
OS="mac"
fi
target_tarfile="hwi-${VERSION}-${OS}-${ARCH}.tar.gz"
if [[ $gui_support == "--with-gui" ]]; then
tar -czf $target_tarfile hwi hwi-qt
else
tar -czf $target_tarfile hwi
fi
# Copy the binaries to subdir for shasum
target_dir="$target_tarfile.dir"
mkdir $target_dir
mv hwi $target_dir
if [[ $gui_support == "--with-gui" && $arch == "x86_64" ]]; then
mv hwi-qt $target_dir
fi
popd