diff --git a/contrib/build-wine/prepare-wine.sh b/contrib/build-wine/prepare-wine.sh index 2d9c7e83..3413f20c 100755 --- a/contrib/build-wine/prepare-wine.sh +++ b/contrib/build-wine/prepare-wine.sh @@ -1,13 +1,16 @@ #!/bin/bash # Please update these carefully, some versions won't work under Wine -NSIS_URL=https://prdownloads.sourceforge.net/nsis/nsis-3.02.1-setup.exe?download +NSIS_FILENAME=nsis-3.02.1-setup.exe +NSIS_URL=https://prdownloads.sourceforge.net/nsis/$NSIS_FILENAME?download NSIS_SHA256=736c9062a02e297e335f82252e648a883171c98e0d5120439f538c81d429552e -ZBAR_URL=https://sourceforge.net/projects/zbarw/files/zbarw-20121031-setup.exe/download +ZBAR_FILENAME=zbarw-20121031-setup.exe +ZBAR_URL=https://sourceforge.net/projects/zbarw/files/$ZBAR_FILENAME/download ZBAR_SHA256=177e32b272fa76528a3af486b74e9cb356707be1c5ace4ed3fcee9723e2c2c02 -LIBUSB_URL=https://prdownloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.21/libusb-1.0.21.7z?download +LIBUSB_FILENAME=libusb-1.0.21.7z +LIBUSB_URL=https://prdownloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.21/$LIBUSB_FILENAME?download LIBUSB_SHA256=acdde63a40b1477898aee6153f9d91d1a2e8a5d93f832ca8ab876498f3a6d2b8 PYTHON_VERSION=3.5.4 @@ -35,7 +38,7 @@ verify_signature() { verify_hash() { local file=$1 expected_hash=$2 actual_hash=$(sha256sum $file | awk '{print $1}') - if [ "$actual_hash" == "$expected_hash" ]; then + if [ "$actual_hash" = "$expected_hash" ]; then return 0 else echo "$file $actual_hash (unexpected hash)" >&2 @@ -43,6 +46,13 @@ verify_hash() { fi } +download_if_not_exist() { + local file_name=$1 url=$2 + if [ ! -e $file_name ] ; then + wget -O $PWD/$file_name "$url" + fi +} + # Let's begin! cd `dirname $0` set -e @@ -55,7 +65,6 @@ echo "done" wine 'wineboot' echo "Cleaning tmp" -rm -rf tmp mkdir -p tmp echo "done" @@ -70,8 +79,8 @@ KEYSERVER_PYTHON_DEV="hkp://keys.gnupg.net" gpg --no-default-keyring --keyring $KEYRING_PYTHON_DEV --keyserver $KEYSERVER_PYTHON_DEV --recv-keys $KEYLIST_PYTHON_DEV for msifile in core dev exe lib pip tools; do echo "Installing $msifile..." - wget "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi" - wget "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi.asc" + wget -nc "https://www.python.org/ftp/python/$PYTHON_VERSION/win32/${msifile}.msi" + wget -nc "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=C:/python$PYTHON_VERSION done @@ -91,22 +100,22 @@ $PYTHON -m pip install -r ../../deterministic-build/requirements-binaries.txt $PYTHON -m pip install https://github.com/ecdsa/pyinstaller/archive/fix_2952.zip # Install ZBar -wget -q -O zbar.exe "$ZBAR_URL" -verify_hash zbar.exe $ZBAR_SHA256 -wine zbar.exe /S - +download_if_not_exist $ZBAR_FILENAME "$ZBAR_URL" +verify_hash $ZBAR_FILENAME "$ZBAR_SHA256" +wine "$PWD/$ZBAR_FILENAME" /S # Upgrade setuptools (so Electrum can be installed later) $PYTHON -m pip install setuptools --upgrade # Install NSIS installer -wget -q -O nsis.exe "$NSIS_URL" -verify_hash nsis.exe $NSIS_SHA256 -wine nsis.exe /S +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 -aos -wget -q -O libusb.7z "$LIBUSB_URL" -verify_hash libusb.7z "$LIBUSB_SHA256" -7z x -olibusb libusb.7z cp libusb/MS32/dll/libusb-1.0.dll $WINEPREFIX/drive_c/python$PYTHON_VERSION/ # Install UPX