From 245c8d20e1aa47c09f4e89e0ca3c81eaadf45c33 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Thu, 27 Aug 2020 15:59:04 +0200 Subject: [PATCH 1/3] Cert removal and pytools compatibility - remove SSL certificate from winebuild.sh (was causing too many problems, not worth the effort) - set pytools version to 2020.2 in winebuild.sh, as that's the last one to support python2 - fixes #1658 --- buildscripts/winbuild.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/buildscripts/winbuild.sh b/buildscripts/winbuild.sh index da5997bd..edb441ed 100755 --- a/buildscripts/winbuild.sh +++ b/buildscripts/winbuild.sh @@ -67,10 +67,9 @@ function install_python(){ echo "Installing vc_redist (2008) for 32 bit " wine vcredist_x86.exe /Q fi - # add cert - if [ -f /usr/local/share/ca-certificates/bitmessage-proxy.crt ]; then - wine python -m pip config set global.cert 'z:\usr\local\share\ca-certificates\bitmessage-proxy.crt' - fi + echo "Installing pytools 2020.2" + # last version compatible with python 2 + wine python -m pip install pytools==2020.2 echo "Upgrading pip" wine python -m pip install --upgrade pip } -- 2.45.1 From 2c5d15e6495e5569814fa0af3c6e05181782747f Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Thu, 27 Aug 2020 16:48:02 +0200 Subject: [PATCH 2/3] winebuid.sh code quality - code quality only changes --- buildscripts/winbuild.sh | 68 ++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/buildscripts/winbuild.sh b/buildscripts/winbuild.sh index edb441ed..66beea65 100755 --- a/buildscripts/winbuild.sh +++ b/buildscripts/winbuild.sh @@ -1,7 +1,7 @@ #!/bin/bash # INIT -MACHINE_TYPE=`uname -m` +MACHINE_TYPE=$(uname -m) BASE_DIR=$(pwd) PYTHON_VERSION=2.7.17 PYQT_VERSION=4-4.11.4-gpl-Py2.7-Qt4.8.7 @@ -34,7 +34,7 @@ function download_sources_64 { } function download_sources { - if [ ${MACHINE_TYPE} == 'x86_64' ]; then + if [ "${MACHINE_TYPE}" == 'x86_64' ]; then download_sources_64 else download_sources_32 @@ -43,18 +43,18 @@ function download_sources { function install_wine { echo "Setting up wine" - if [ ${MACHINE_TYPE} == 'x86_64' ]; then + if [ "${MACHINE_TYPE}" == 'x86_64' ]; then export WINEPREFIX=${HOME}/.wine64 WINEARCH=win64 else export WINEPREFIX=${HOME}/.wine32 WINEARCH=win32 fi - rm -rf ${WINEPREFIX} + rm -rf "${WINEPREFIX}" rm -rf packages/pyinstaller/{build,dist} } function install_python(){ - cd ${SRCPATH} - if [ ${MACHINE_TYPE} == 'x86_64' ]; then + cd ${SRCPATH} || exit 1 + if [ "${MACHINE_TYPE}" == 'x86_64' ]; then echo "Installing Python ${PYTHON_VERSION} 64b" wine msiexec -i python-${PYTHON_VERSION}.amd64.msi /q /norestart echo "Installing vcredist for 64 bit" @@ -63,7 +63,7 @@ function install_python(){ echo "Installing Python ${PYTHON_VERSION} 32b" wine msiexec -i python-${PYTHON_VERSION}.msi /q /norestart # MSVCR 2008 required for Windows XP - cd ${SRCPATH} + cd ${SRCPATH} || exit 1 echo "Installing vc_redist (2008) for 32 bit " wine vcredist_x86.exe /Q fi @@ -75,7 +75,7 @@ function install_python(){ } function install_pyqt(){ - if [ ${MACHINE_TYPE} == 'x86_64' ]; then + if [ "${MACHINE_TYPE}" == 'x86_64' ]; then echo "Installing PyQt-${PYQT_VERSION} 64b" wine PyQt${PYQT_VERSION}-x64.exe /S /WX else @@ -85,7 +85,7 @@ function install_pyqt(){ } function install_openssl(){ - if [ ${MACHINE_TYPE} == 'x86_64' ]; then + if [ "${MACHINE_TYPE}" == 'x86_64' ]; then echo "Installing OpenSSL ${OPENSSL_VERSION} 64b" wine Win64OpenSSL-${OPENSSL_VERSION}.exe /q /norestart /silent /verysilent /sp- /suppressmsgboxes else @@ -96,9 +96,9 @@ function install_openssl(){ function install_pyinstaller() { - cd ${BASE_DIR} + cd "${BASE_DIR}" || exit 1 echo "Installing PyInstaller" - if [ ${MACHINE_TYPE} == 'x86_64' ]; then + if [ "${MACHINE_TYPE}" == 'x86_64' ]; then wine python -m pip install pyinstaller else # 3.2.1 is the last version to work on XP @@ -109,40 +109,60 @@ function install_pyinstaller() function install_msgpack() { - cd ${BASE_DIR} + cd "${BASE_DIR}" || exit 1 echo "Installing msgpack" wine python -m pip install msgpack-python } function install_pyopencl() { - cd ${SRCPATH} + cd "${SRCPATH}" || exit 1 echo "Installing PyOpenCL" - if [ ${MACHINE_TYPE} == 'x86_64' ]; then + if [ "${MACHINE_TYPE}" == 'x86_64' ]; then wine python -m pip install pyopencl-2015.1-cp27-none-win_amd64.whl else wine python -m pip install pyopencl-2015.1-cp27-none-win32.whl fi - sed -Ei 's/_DEFAULT_INCLUDE_OPTIONS = .*/_DEFAULT_INCLUDE_OPTIONS = [] /' $WINEPREFIX/drive_c/Python27/Lib/site-packages/pyopencl/__init__.py + sed -Ei 's/_DEFAULT_INCLUDE_OPTIONS = .*/_DEFAULT_INCLUDE_OPTIONS = [] /' \ + "$WINEPREFIX/drive_c/Python27/Lib/site-packages/pyopencl/__init__.py" } function build_dll(){ - cd ${BASE_DIR} - cd src/bitmsghash - if [ ${MACHINE_TYPE} == 'x86_64' ]; then + cd "${BASE_DIR}" || exit 1 + cd src/bitmsghash || exit 1 + if [ "${MACHINE_TYPE}" == 'x86_64' ]; then echo "Create dll" - x86_64-w64-mingw32-g++ -D_WIN32 -Wall -O3 -march=native -I$HOME/.wine64/drive_c/OpenSSL-Win64/include -I/usr/x86_64-w64-mingw32/include -L$HOME/.wine64/drive_c/OpenSSL-Win64/lib -c bitmsghash.cpp - x86_64-w64-mingw32-g++ -static-libgcc -shared bitmsghash.o -D_WIN32 -O3 -march=native -I$HOME/.wine64/drive_c/OpenSSL-Win64/include -L$HOME/.wine64/drive_c/OpenSSL-Win64 -L/usr/lib/x86_64-linux-gnu/wine -fPIC -shared -lcrypt32 -leay32 -lwsock32 -o bitmsghash64.dll -Wl,--out-implib,bitmsghash.a + x86_64-w64-mingw32-g++ -D_WIN32 -Wall -O3 -march=native \ + "-I$HOME/.wine64/drive_c/OpenSSL-Win64/include" \ + -I/usr/x86_64-w64-mingw32/include \ + "-L$HOME/.wine64/drive_c/OpenSSL-Win64/lib" \ + -c bitmsghash.cpp + x86_64-w64-mingw32-g++ -static-libgcc -shared bitmsghash.o \ + -D_WIN32 -O3 -march=native \ + "-I$HOME/.wine64/drive_c/OpenSSL-Win64/include" \ + "-L$HOME/.wine64/drive_c/OpenSSL-Win64" \ + -L/usr/lib/x86_64-linux-gnu/wine \ + -fPIC -shared -lcrypt32 -leay32 -lwsock32 \ + -o bitmsghash64.dll -Wl,--out-implib,bitmsghash.a else echo "Create dll" - i686-w64-mingw32-g++ -D_WIN32 -Wall -m32 -O3 -march=native -I$HOME/.wine32/drive_c/OpenSSL-Win32/include -I/usr/i686-w64-mingw32/include -L$HOME/.wine32/drive_c/OpenSSL-Win32/lib -c bitmsghash.cpp - i686-w64-mingw32-g++ -static-libgcc -shared bitmsghash.o -D_WIN32 -O3 -march=native -I$HOME/.wine32/drive_c/OpenSSL-Win32/include -L$HOME/.wine32/drive_c/OpenSSL-Win32/lib/MinGW -fPIC -shared -lcrypt32 -leay32 -lwsock32 -o bitmsghash32.dll -Wl,--out-implib,bitmsghash.a + i686-w64-mingw32-g++ -D_WIN32 -Wall -m32 -O3 -march=native \ + "-I$HOME/.wine32/drive_c/OpenSSL-Win32/include" \ + -I/usr/i686-w64-mingw32/include \ + "-L$HOME/.wine32/drive_c/OpenSSL-Win32/lib" \ + -c bitmsghash.cpp + i686-w64-mingw32-g++ -static-libgcc -shared bitmsghash.o \ + -D_WIN32 -O3 -march=native \ + "-I$HOME/.wine32/drive_c/OpenSSL-Win32/include" \ + "-L$HOME/.wine32/drive_c/OpenSSL-Win32/lib/MinGW" \ + -fPIC -shared -lcrypt32 -leay32 -lwsock32 \ + -o bitmsghash32.dll -Wl,--out-implib,bitmsghash.a fi } function build_exe(){ - cd ${BASE_DIR} - cd packages/pyinstaller + cd "${BASE_DIR}" || exit 1 + cd packages/pyinstaller || exit 1 wine pyinstaller bitmessagemain.spec } -- 2.45.1 From 39d28b9b0f2cbf936eaf94a6fe2323cf32fdf046 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Fri, 28 Aug 2020 13:52:31 +0200 Subject: [PATCH 3/3] Downgrade pyinstaller for python 2.7 compatibility - pyinstaller 3.6 is the last one supporting python 2.7 so we're forcing it for 64bit windows builds --- buildscripts/winbuild.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildscripts/winbuild.sh b/buildscripts/winbuild.sh index 66beea65..43d8cf34 100755 --- a/buildscripts/winbuild.sh +++ b/buildscripts/winbuild.sh @@ -99,7 +99,8 @@ function install_pyinstaller() cd "${BASE_DIR}" || exit 1 echo "Installing PyInstaller" if [ "${MACHINE_TYPE}" == 'x86_64' ]; then - wine python -m pip install pyinstaller + # 3.6 is the last version to support python 2.7 + wine python -m pip install -I pyinstaller==3.6 else # 3.2.1 is the last version to work on XP # see https://github.com/pyinstaller/pyinstaller/issues/2931 -- 2.45.1