build-wine: some clean-up. cache downloads. better status messages
This commit is contained in:
@@ -12,11 +12,11 @@ PYTHON="wine $PYHOME/python.exe -OO -B"
|
||||
|
||||
|
||||
# Let's begin!
|
||||
cd `dirname $0`
|
||||
set -e
|
||||
|
||||
mkdir -p tmp
|
||||
cd tmp
|
||||
here="$(dirname "$(readlink -e "$0")")"
|
||||
|
||||
. "$CONTRIB"/build_tools_util.sh
|
||||
|
||||
pushd $WINEPREFIX/drive_c/electrum
|
||||
|
||||
@@ -25,12 +25,11 @@ git submodule init
|
||||
git submodule update
|
||||
|
||||
VERSION=`git describe --tags --dirty --always`
|
||||
echo "Last commit: $VERSION"
|
||||
info "Last commit: $VERSION"
|
||||
|
||||
pushd ./contrib/deterministic-build/electrum-locale
|
||||
if ! which msgfmt > /dev/null 2>&1; then
|
||||
echo "Please install gettext"
|
||||
exit 1
|
||||
fail "Please install gettext"
|
||||
fi
|
||||
for i in ./locale/*; do
|
||||
dir=$WINEPREFIX/drive_c/electrum/electrum/$i/LC_MESSAGES
|
||||
@@ -42,24 +41,23 @@ popd
|
||||
find -exec touch -d '2000-11-11T11:11:11+00:00' {} +
|
||||
popd
|
||||
|
||||
cp $WINEPREFIX/drive_c/electrum/LICENCE .
|
||||
|
||||
# Install frozen dependencies
|
||||
$PYTHON -m pip install -r ../../deterministic-build/requirements.txt
|
||||
$PYTHON -m pip install -r "$CONTRIB"/deterministic-build/requirements.txt
|
||||
|
||||
$PYTHON -m pip install -r ../../deterministic-build/requirements-hw.txt
|
||||
$PYTHON -m pip install -r "$CONTRIB"/deterministic-build/requirements-hw.txt
|
||||
|
||||
pushd $WINEPREFIX/drive_c/electrum
|
||||
# see https://github.com/pypa/pip/issues/2195 -- pip makes a copy of the entire directory
|
||||
echo "Pip installing Electrum. This might take a long time if the project folder is large."
|
||||
info "Pip installing Electrum. This might take a long time if the project folder is large."
|
||||
$PYTHON -m pip install .
|
||||
popd
|
||||
|
||||
cd ..
|
||||
|
||||
rm -rf dist/
|
||||
|
||||
# build standalone and portable versions
|
||||
info "Running pyinstaller..."
|
||||
wine "$PYHOME/scripts/pyinstaller.exe" --noconfirm --ascii --clean --name $NAME_ROOT-$VERSION -w deterministic.spec
|
||||
|
||||
# set timestamps in dist, in order to make the installer reproducible
|
||||
@@ -67,7 +65,7 @@ pushd dist
|
||||
find -exec touch -d '2000-11-11T11:11:11+00:00' {} +
|
||||
popd
|
||||
|
||||
# build NSIS installer
|
||||
info "building NSIS installer"
|
||||
# $VERSION could be passed to the electrum.nsi script, but this would require some rewriting in the script itself.
|
||||
wine "$WINEPREFIX/drive_c/Program Files (x86)/NSIS/makensis.exe" /DPRODUCT_VERSION=$VERSION electrum.nsi
|
||||
|
||||
@@ -75,5 +73,4 @@ cd dist
|
||||
mv electrum-setup.exe $NAME_ROOT-$VERSION-setup.exe
|
||||
cd ..
|
||||
|
||||
echo "Done."
|
||||
sha256sum dist/electrum*exe
|
||||
sha256sum dist/electrum*.exe
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
|
||||
set -e
|
||||
|
||||
here="$(dirname "$(readlink -e "$0")")"
|
||||
LIBSECP_VERSION="b408c6a8b287003d1ade5709e6f7bc3c7f1d5be7"
|
||||
|
||||
. "$CONTRIB"/build_tools_util.sh
|
||||
|
||||
info "building libsecp256k1..."
|
||||
|
||||
|
||||
build_dll() {
|
||||
#sudo apt-get install -y mingw-w64
|
||||
export SOURCE_DATE_EPOCH=1530212462
|
||||
@@ -19,23 +27,26 @@ build_dll() {
|
||||
}
|
||||
|
||||
|
||||
cd /tmp/electrum-build
|
||||
cd "$CACHEDIR"
|
||||
|
||||
if [ -f "secp256k1/libsecp256k1.dll" ]; then
|
||||
info "libsecp256k1.dll already built, skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d secp256k1 ]; then
|
||||
git clone https://github.com/bitcoin-core/secp256k1.git
|
||||
cd secp256k1;
|
||||
else
|
||||
cd secp256k1
|
||||
git pull
|
||||
fi
|
||||
|
||||
LIBSECP_VERSION="b408c6a8b287003d1ade5709e6f7bc3c7f1d5be7"
|
||||
git reset --hard "$LIBSECP_VERSION"
|
||||
cd secp256k1
|
||||
git reset --hard
|
||||
git clean -f -x -q
|
||||
git checkout $LIBSECP_VERSION
|
||||
|
||||
build_dll i686-w64-mingw32 # 64-bit would be: x86_64-w64-mingw32
|
||||
mv .libs/libsecp256k1-0.dll libsecp256k1.dll
|
||||
|
||||
find -exec touch -d '2000-11-11T11:11:11+00:00' {} +
|
||||
|
||||
echo "building libsecp256k1 finished"
|
||||
info "building libsecp256k1 finished"
|
||||
|
||||
@@ -1,28 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Lucky number
|
||||
export PYTHONHASHSEED=22
|
||||
|
||||
here=$(dirname "$0")
|
||||
here="$(dirname "$(readlink -e "$0")")"
|
||||
test -n "$here" -a -d "$here" || exit
|
||||
|
||||
echo "Clearing $here/build and $here/dist..."
|
||||
export CONTRIB="$here/.."
|
||||
export CACHEDIR="$here/.cache"
|
||||
export PIP_CACHE_DIR="$CACHEDIR/pip_cache"
|
||||
|
||||
. "$CONTRIB"/build_tools_util.sh
|
||||
|
||||
info "Clearing $here/build and $here/dist..."
|
||||
rm "$here"/build/* -rf
|
||||
rm "$here"/dist/* -rf
|
||||
|
||||
mkdir -p /tmp/electrum-build
|
||||
mkdir -p /tmp/electrum-build/pip-cache
|
||||
export PIP_CACHE_DIR="/tmp/electrum-build/pip-cache"
|
||||
mkdir -p "$CACHEDIR" "$PIP_CACHE_DIR"
|
||||
|
||||
$here/build-secp256k1.sh || exit 1
|
||||
$here/build-secp256k1.sh || fail "build-secp256k1 failed"
|
||||
|
||||
$here/prepare-wine.sh || exit 1
|
||||
$here/prepare-wine.sh || fail "prepare-wine failed"
|
||||
|
||||
echo "Resetting modification time in C:\Python..."
|
||||
info "Resetting modification time in C:\Python..."
|
||||
# (Because of some bugs in pyinstaller)
|
||||
pushd /opt/wine64/drive_c/python*
|
||||
find -exec touch -d '2000-11-11T11:11:11+00:00' {} +
|
||||
popd
|
||||
ls -l /opt/wine64/drive_c/python*
|
||||
|
||||
$here/build-electrum-git.sh && \
|
||||
echo "Done."
|
||||
$here/build-electrum-git.sh || fail "build-electrum-git failed"
|
||||
|
||||
info "Done."
|
||||
|
||||
@@ -25,53 +25,57 @@ PYTHON="wine $PYHOME/python.exe -OO -B"
|
||||
|
||||
|
||||
# Let's begin!
|
||||
here="$(dirname "$(readlink -e "$0")")"
|
||||
set -e
|
||||
|
||||
. "$here"/../build_tools_util.sh
|
||||
here="$(dirname "$(readlink -e "$0")")"
|
||||
|
||||
. "$CONTRIB"/build_tools_util.sh
|
||||
|
||||
info "Booting wine."
|
||||
wine 'wineboot'
|
||||
|
||||
|
||||
cd /tmp/electrum-build
|
||||
cd "$CACHEDIR"
|
||||
|
||||
# Install Python
|
||||
info "Installing Python."
|
||||
# note: you might need "sudo apt-get install dirmngr" for the following
|
||||
# keys from https://www.python.org/downloads/#pubkeys
|
||||
KEYRING_PYTHON_DEV="keyring-electrum-build-python-dev.gpg"
|
||||
gpg --no-default-keyring --keyring $KEYRING_PYTHON_DEV --import "$here"/gpg_keys/7ED10B6531D7C8E1BC296021FC624643487034E5.asc
|
||||
PYTHON_DOWNLOADS="$CACHEDIR/python$PYTHON_VERSION"
|
||||
mkdir -p "$PYTHON_DOWNLOADS"
|
||||
for msifile in core dev exe lib pip tools; do
|
||||
echo "Installing $msifile..."
|
||||
wget -N -c "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi"
|
||||
wget -N -c "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi.asc"
|
||||
verify_signature "${msifile}.msi.asc" $KEYRING_PYTHON_DEV
|
||||
wine msiexec /i "${msifile}.msi" /qb TARGETDIR=$PYHOME
|
||||
download_if_not_exist "$PYTHON_DOWNLOADS/${msifile}.msi" "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi"
|
||||
download_if_not_exist "$PYTHON_DOWNLOADS/${msifile}.msi.asc" "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi.asc"
|
||||
verify_signature "$PYTHON_DOWNLOADS/${msifile}.msi.asc" $KEYRING_PYTHON_DEV
|
||||
wine msiexec /i "$PYTHON_DOWNLOADS/${msifile}.msi" /qb TARGETDIR=$PYHOME
|
||||
done
|
||||
|
||||
# Install dependencies specific to binaries
|
||||
info "Installing dependencies specific to binaries."
|
||||
# note that this also installs pinned versions of both pip and setuptools
|
||||
$PYTHON -m pip install -r "$here"/../deterministic-build/requirements-binaries.txt
|
||||
$PYTHON -m pip install -r "$CONTRIB"/deterministic-build/requirements-binaries.txt
|
||||
|
||||
# Install PyInstaller
|
||||
info "Installing PyInstaller."
|
||||
$PYTHON -m pip install pyinstaller==3.4 --no-use-pep517
|
||||
|
||||
# Install ZBar
|
||||
download_if_not_exist $ZBAR_FILENAME "$ZBAR_URL"
|
||||
verify_hash $ZBAR_FILENAME "$ZBAR_SHA256"
|
||||
wine "$PWD/$ZBAR_FILENAME" /S
|
||||
info "Installing ZBar."
|
||||
download_if_not_exist "$CACHEDIR/$ZBAR_FILENAME" "$ZBAR_URL"
|
||||
verify_hash "$CACHEDIR/$ZBAR_FILENAME" "$ZBAR_SHA256"
|
||||
wine "$CACHEDIR/$ZBAR_FILENAME" /S
|
||||
|
||||
# Install NSIS installer
|
||||
download_if_not_exist $NSIS_FILENAME "$NSIS_URL"
|
||||
verify_hash $NSIS_FILENAME "$NSIS_SHA256"
|
||||
wine "$PWD/$NSIS_FILENAME" /S
|
||||
|
||||
download_if_not_exist $LIBUSB_FILENAME "$LIBUSB_URL"
|
||||
verify_hash $LIBUSB_FILENAME "$LIBUSB_SHA256"
|
||||
7z x -olibusb $LIBUSB_FILENAME -aoa
|
||||
info "Installing NSIS."
|
||||
download_if_not_exist "$CACHEDIR/$NSIS_FILENAME" "$NSIS_URL"
|
||||
verify_hash "$CACHEDIR/$NSIS_FILENAME" "$NSIS_SHA256"
|
||||
wine "$CACHEDIR/$NSIS_FILENAME" /S
|
||||
|
||||
info "Installing libusb."
|
||||
download_if_not_exist "$CACHEDIR/$LIBUSB_FILENAME" "$LIBUSB_URL"
|
||||
verify_hash "$CACHEDIR/$LIBUSB_FILENAME" "$LIBUSB_SHA256"
|
||||
7z x -olibusb "$CACHEDIR/$LIBUSB_FILENAME" -aoa
|
||||
cp libusb/MS32/dll/libusb-1.0.dll $WINEPREFIX/drive_c/$PYTHON_FOLDER/
|
||||
|
||||
mkdir -p $WINEPREFIX/drive_c/tmp
|
||||
cp secp256k1/libsecp256k1.dll $WINEPREFIX/drive_c/tmp/
|
||||
cp "$CACHEDIR/secp256k1/libsecp256k1.dll" $WINEPREFIX/drive_c/tmp/
|
||||
|
||||
echo "Wine is configured."
|
||||
info "Wine is configured."
|
||||
|
||||
Reference in New Issue
Block a user