Merge branch 'windows-binary' into ci-testing-windows
This commit is contained in:
commit
9f6b051c48
|
@ -18,7 +18,8 @@ function download_sources_32 {
|
||||||
https://download.microsoft.com/download/1/1/1/1116b75a-9ec3-481a-a3c8-1777b5381140/vcredist_x86.exe \
|
https://download.microsoft.com/download/1/1/1/1116b75a-9ec3-481a-a3c8-1777b5381140/vcredist_x86.exe \
|
||||||
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/PyQt${PYQT_VERSION}-x32.exe?raw=true \
|
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/PyQt${PYQT_VERSION}-x32.exe?raw=true \
|
||||||
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/Win32OpenSSL-${OPENSSL_VERSION}.exe?raw=true \
|
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/Win32OpenSSL-${OPENSSL_VERSION}.exe?raw=true \
|
||||||
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/pyopencl-2015.1-cp27-none-win32.whl?raw=true
|
https://github.com/Bitmessage/ThirdPartyLibraries/blob/master/pyopencl-2015.1-cp27-none-win32.whl?raw=true \
|
||||||
|
https://web.archive.org/web/20190720195601/https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi
|
||||||
}
|
}
|
||||||
|
|
||||||
function download_sources_64 {
|
function download_sources_64 {
|
||||||
|
@ -64,8 +65,10 @@ function install_python(){
|
||||||
wine msiexec -i python-${PYTHON_VERSION}.msi /q /norestart
|
wine msiexec -i python-${PYTHON_VERSION}.msi /q /norestart
|
||||||
# MSVCR 2008 required for Windows XP
|
# MSVCR 2008 required for Windows XP
|
||||||
cd ${SRCPATH} || exit 1
|
cd ${SRCPATH} || exit 1
|
||||||
echo "Installing vc_redist (2008) for 32 bit "
|
echo "Installing vc_redist (2008) for 32 bit"
|
||||||
wine vcredist_x86.exe /Q
|
wine vcredist_x86.exe /Q
|
||||||
|
echo "Installing vcpython27"
|
||||||
|
wine msiexec -i VCForPython27.msi /qn /norestart
|
||||||
fi
|
fi
|
||||||
echo "Installing pytools 2020.2"
|
echo "Installing pytools 2020.2"
|
||||||
# last version compatible with python 2
|
# last version compatible with python 2
|
||||||
|
@ -88,9 +91,11 @@ function install_openssl(){
|
||||||
if [ "${MACHINE_TYPE}" == 'x86_64' ]; then
|
if [ "${MACHINE_TYPE}" == 'x86_64' ]; then
|
||||||
echo "Installing OpenSSL ${OPENSSL_VERSION} 64b"
|
echo "Installing OpenSSL ${OPENSSL_VERSION} 64b"
|
||||||
wine Win64OpenSSL-${OPENSSL_VERSION}.exe /q /norestart /silent /verysilent /sp- /suppressmsgboxes
|
wine Win64OpenSSL-${OPENSSL_VERSION}.exe /q /norestart /silent /verysilent /sp- /suppressmsgboxes
|
||||||
|
export OPENSSL_DIR="$HOME/.wine64/drive_c/OpenSSL-Win64"
|
||||||
else
|
else
|
||||||
echo "Installing OpenSSL ${OPENSSL_VERSION} 32b"
|
echo "Installing OpenSSL ${OPENSSL_VERSION} 32b"
|
||||||
wine Win32OpenSSL-${OPENSSL_VERSION}.exe /q /norestart /silent /verysilent /sp- /suppressmsgboxes
|
wine Win32OpenSSL-${OPENSSL_VERSION}.exe /q /norestart /silent /verysilent /sp- /suppressmsgboxes
|
||||||
|
export OPENSSL_DIR="C:\\OpenSSL-Win32"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,8 +135,8 @@ function install_pyopencl()
|
||||||
|
|
||||||
function build_dll(){
|
function build_dll(){
|
||||||
cd "${BASE_DIR}" || exit 1
|
cd "${BASE_DIR}" || exit 1
|
||||||
cd src/bitmsghash || exit 1
|
|
||||||
if [ "${MACHINE_TYPE}" == 'x86_64' ]; then
|
if [ "${MACHINE_TYPE}" == 'x86_64' ]; then
|
||||||
|
cd src/bitmsghash || exit 1
|
||||||
echo "Create dll"
|
echo "Create dll"
|
||||||
x86_64-w64-mingw32-g++ -D_WIN32 -Wall -O3 -march=native \
|
x86_64-w64-mingw32-g++ -D_WIN32 -Wall -O3 -march=native \
|
||||||
"-I$HOME/.wine64/drive_c/OpenSSL-Win64/include" \
|
"-I$HOME/.wine64/drive_c/OpenSSL-Win64/include" \
|
||||||
|
@ -146,18 +151,20 @@ function build_dll(){
|
||||||
-fPIC -shared -lcrypt32 -leay32 -lwsock32 \
|
-fPIC -shared -lcrypt32 -leay32 -lwsock32 \
|
||||||
-o bitmsghash64.dll -Wl,--out-implib,bitmsghash.a
|
-o bitmsghash64.dll -Wl,--out-implib,bitmsghash.a
|
||||||
else
|
else
|
||||||
echo "Create dll"
|
echo "Create pyd"
|
||||||
i686-w64-mingw32-g++ -D_WIN32 -Wall -m32 -O3 -march=native \
|
# FIXME: check for VCPython and build dll if not found
|
||||||
"-I$HOME/.wine32/drive_c/OpenSSL-Win32/include" \
|
wine python setup.py build_ext --inplace
|
||||||
-I/usr/i686-w64-mingw32/include \
|
# i686-w64-mingw32-g++ -D_WIN32 -Wall -m32 -O3 -march=native \
|
||||||
"-L$HOME/.wine32/drive_c/OpenSSL-Win32/lib" \
|
# "-I$HOME/.wine32/drive_c/OpenSSL-Win32/include" \
|
||||||
-c bitmsghash.cpp
|
# -I/usr/i686-w64-mingw32/include \
|
||||||
i686-w64-mingw32-g++ -static-libgcc -shared bitmsghash.o \
|
# "-L$HOME/.wine32/drive_c/OpenSSL-Win32/lib" \
|
||||||
-D_WIN32 -O3 -march=native \
|
# -c bitmsghash.cpp
|
||||||
"-I$HOME/.wine32/drive_c/OpenSSL-Win32/include" \
|
# i686-w64-mingw32-g++ -static-libgcc -shared bitmsghash.o \
|
||||||
"-L$HOME/.wine32/drive_c/OpenSSL-Win32/lib/MinGW" \
|
# -D_WIN32 -O3 -march=native \
|
||||||
-fPIC -shared -lcrypt32 -leay32 -lwsock32 \
|
# "-I$HOME/.wine32/drive_c/OpenSSL-Win32/include" \
|
||||||
-o bitmsghash32.dll -Wl,--out-implib,bitmsghash.a
|
# "-L$HOME/.wine32/drive_c/OpenSSL-Win32/lib/MinGW" \
|
||||||
|
# -fPIC -shared -lcrypt32 -leay32 -lwsock32 \
|
||||||
|
# -o bitmsghash32.dll -Wl,--out-implib,bitmsghash.a
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ arch = 32 if ctypes.sizeof(ctypes.c_voidp) == 4 else 64
|
||||||
cdrivePath = site_root[0:3]
|
cdrivePath = site_root[0:3]
|
||||||
srcPath = os.path.join(spec_root[:-20], "src")
|
srcPath = os.path.join(spec_root[:-20], "src")
|
||||||
sslName = 'OpenSSL-Win%i' % arch
|
sslName = 'OpenSSL-Win%i' % arch
|
||||||
openSSLPath = os.path.join(cdrivePath, sslName)
|
openSSLPath = os.getenv('OPENSSL_DIR') or os.path.join(cdrivePath, sslName)
|
||||||
msvcrDllPath = os.path.join(cdrivePath, "windows", "system32")
|
msvcrDllPath = os.path.join(cdrivePath, "windows", "system32")
|
||||||
outPath = os.path.join(spec_root, "bitmessagemain")
|
outPath = os.path.join(spec_root, "bitmessagemain")
|
||||||
qtBase = "PyQt4"
|
qtBase = "PyQt4"
|
||||||
|
@ -83,12 +83,19 @@ excluded_binaries = [
|
||||||
]
|
]
|
||||||
a.binaries = TOC([x for x in a.binaries if x[0] not in excluded_binaries])
|
a.binaries = TOC([x for x in a.binaries if x[0] not in excluded_binaries])
|
||||||
|
|
||||||
|
ext_lib = os.path.join('bitmsghash', 'bitmsghash%i.dll' % arch)
|
||||||
|
|
||||||
|
if os.path.isfile(ext_lib):
|
||||||
|
ext_lib = (ext_lib, os.path.join(srcPath, ext_lib), 'BINARY')
|
||||||
|
else:
|
||||||
|
ext_lib = (
|
||||||
|
os.path.join('bitmsghash', 'bitmsghash.pyd'),
|
||||||
|
os.path.join(srcPath, 'bitmsghash', 'bitmsghash.pyd'), 'EXTENSION')
|
||||||
|
|
||||||
a.binaries += [
|
a.binaries += [
|
||||||
# No effect: libeay32.dll will be taken from PyQt if installed
|
# No effect: libeay32.dll will be taken from PyQt if installed
|
||||||
('libeay32.dll', os.path.join(openSSLPath, 'libeay32.dll'), 'BINARY'),
|
('libeay32.dll', os.path.join(openSSLPath, 'libeay32.dll'), 'BINARY'),
|
||||||
(os.path.join('bitmsghash', 'bitmsghash%i.dll' % arch),
|
ext_lib,
|
||||||
os.path.join(srcPath, 'bitmsghash', 'bitmsghash%i.dll' % arch),
|
|
||||||
'BINARY'),
|
|
||||||
(os.path.join('bitmsghash', 'bitmsghash.cl'),
|
(os.path.join('bitmsghash', 'bitmsghash.cl'),
|
||||||
os.path.join(srcPath, 'bitmsghash', 'bitmsghash.cl'), 'BINARY'),
|
os.path.join(srcPath, 'bitmsghash', 'bitmsghash.cl'), 'BINARY'),
|
||||||
(os.path.join('sslkeys', 'cert.pem'),
|
(os.path.join('sslkeys', 'cert.pem'),
|
||||||
|
|
13
setup.py
13
setup.py
|
@ -59,6 +59,13 @@ if __name__ == "__main__":
|
||||||
libraries=['pthread', 'crypto'],
|
libraries=['pthread', 'crypto'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if sys.platform[:3] == 'win':
|
||||||
|
bitmsghash.libraries = ['libeay32', 'ws2_32']
|
||||||
|
openssl_dir = os.getenv('OPENSSL_DIR')
|
||||||
|
if openssl_dir:
|
||||||
|
bitmsghash.library_dirs = [os.path.join(openssl_dir, 'lib')]
|
||||||
|
bitmsghash.include_dirs = [os.path.join(openssl_dir, 'include')]
|
||||||
|
|
||||||
installRequires = ['six']
|
installRequires = ['six']
|
||||||
packages = [
|
packages = [
|
||||||
'pybitmessage',
|
'pybitmessage',
|
||||||
|
@ -87,11 +94,11 @@ if __name__ == "__main__":
|
||||||
packages += ['pybitmessage.fallback.umsgpack']
|
packages += ['pybitmessage.fallback.umsgpack']
|
||||||
|
|
||||||
data_files = [
|
data_files = [
|
||||||
('share/applications/',
|
('share/applications',
|
||||||
['desktop/pybitmessage.desktop']),
|
['desktop/pybitmessage.desktop']),
|
||||||
('share/icons/hicolor/scalable/apps/',
|
('share/icons/hicolor/scalable/apps',
|
||||||
['desktop/icons/scalable/pybitmessage.svg']),
|
['desktop/icons/scalable/pybitmessage.svg']),
|
||||||
('share/icons/hicolor/24x24/apps/',
|
('share/icons/hicolor/24x24/apps',
|
||||||
['desktop/icons/24x24/pybitmessage.png'])
|
['desktop/icons/24x24/pybitmessage.png'])
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -163,3 +163,8 @@ extern "C" EXPORT unsigned long long BitmessagePOW(unsigned char * starthash, un
|
||||||
free(threaddata);
|
free(threaddata);
|
||||||
return successval;
|
return successval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// workaround for building setuptools ext on Windows
|
||||||
|
// https://stackoverflow.com/questions/34689210
|
||||||
|
void initbitmsghash() {} //Python 2.7
|
||||||
|
void PyInit_bitmsghash() {} //Python 3.5
|
||||||
|
|
|
@ -298,7 +298,13 @@ def init():
|
||||||
bitmsglib = 'bitmsghash64.dll'
|
bitmsglib = 'bitmsghash64.dll'
|
||||||
try:
|
try:
|
||||||
# MSVS
|
# MSVS
|
||||||
bso = ctypes.WinDLL(os.path.join(paths.codePath(), "bitmsghash", bitmsglib))
|
libfile = os.path.join(paths.codePath(), "bitmsghash", bitmsglib)
|
||||||
|
if os.path.isfile(libfile):
|
||||||
|
bso = ctypes.WinDLL(libfile)
|
||||||
|
else:
|
||||||
|
bitmsglib = 'bitmsghash.pyd'
|
||||||
|
libfile = os.path.join(paths.codePath(), "bitmsghash", bitmsglib)
|
||||||
|
bso = ctypes.PyDLL(libfile)
|
||||||
logger.info("Loaded C PoW DLL (stdcall) %s", bitmsglib)
|
logger.info("Loaded C PoW DLL (stdcall) %s", bitmsglib)
|
||||||
bmpow = bso.BitmessagePOW
|
bmpow = bso.BitmessagePOW
|
||||||
bmpow.restype = ctypes.c_ulonglong
|
bmpow.restype = ctypes.c_ulonglong
|
||||||
|
|
Reference in New Issue
Block a user