Wine build cleanup and XP fix

- spec file was cleaned up
- 32bit build runs on XP (downgrade of PyInstaller needed)
This commit is contained in:
Peter Šurda 2020-02-16 00:20:40 +08:00
parent 3fb34370a7
commit 73ecf07dec
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
2 changed files with 48 additions and 40 deletions

View File

@ -19,8 +19,6 @@ function download_sources_32 {
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/pyopencl-2015.1-cp27-none-win32.whl?raw=true
#wget -P ${SRCPATH} -nc http://www.dll-found.com/zip/m/msvcr120.dll.zip
#wget -P ${SRCPATH} -nc http://www.dll-found.com/zip/m/msvcr100.dll.zip
}
function download_sources_64 {
@ -61,24 +59,19 @@ function install_python(){
wine msiexec -i python-${PYTHON_VERSION}.amd64.msi /q /norestart
echo "Installing vcredist for 64 bit"
wine vcredist_x64.exe /q /norestart
echo "Upgrading pip"
wine python -m pip install --upgrade pip
else
echo "Installing Python ${PYTHON_VERSION} 32b"
wine msiexec -i python-${PYTHON_VERSION}.msi /q /norestart
echo "Installing vc_redist for 32 bit "
wine vcredist_x86.exe /q /norestart
#echo "Unpacking MSVCR120.DLL"
#unzip msvcr120.dll.zip -o -d $HOME/.wine32/drive_c/windows/system32/
#unzip msvcr100.dll.zip -o -d $HOME/.wine32/drive_c/windows/system32/
# MSVCR 2008 required for Windows XP
cd ${SRCPATH}
echo "Installing vc_redist (2008) for 32 bit "
wine vcredist_x86.exe /Q
fi
echo "Upgrading pip"
wine python -m pip install --upgrade pip
fi
}
function install_pyqt(){
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
echo "Installing PyQt-${PYQT_VERSION} 64b"
wine PyQt${PYQT_VERSION}-x64.exe /S /WX
@ -100,19 +93,27 @@ function install_openssl(){
function install_pyinstaller()
{
cd ${BASE_DIR}
echo "Installing PyInstaller"
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
wine python -m pip install pyinstaller
else
# 3.2.1 is the last version to work on XP
# see https://github.com/pyinstaller/pyinstaller/issues/2931
wine python -m pip install -I pyinstaller==3.2.1
fi
}
function install_msgpack()
{
cd ${BASE_DIR}
echo "Installing msgpack"
wine python -m pip install msgpack-python
}
function install_pyopencl()
{
cd $SRCPATH
cd ${SRCPATH}
echo "Installing PyOpenCL"
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
wine python -m pip install pyopencl-2015.1-cp27-none-win_amd64.whl
@ -123,7 +124,7 @@ function install_pyopencl()
function build_dll(){
cd $BASE_DIR
cd ${BASE_DIR}
cd src/bitmsghash
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
echo "Create dll"
@ -137,7 +138,7 @@ function build_dll(){
}
function build_exe(){
cd $BASE_DIR
cd ${BASE_DIR}
cd packages/pyinstaller
wine pyinstaller bitmessagemain.spec
}

View File

@ -11,13 +11,13 @@ else:
sslName = 'OpenSSL-Win%s' % ("32" if arch == 32 else "64")
site_root = os.path.abspath(HOMEPATH)
spec_root = os.path.abspath(SPECPATH)
cdrivePath= site_root[0:3]
srcPath = spec_root[:-20]+"src\\"
qtPath = site_root+"\\PyQt4\\"
openSSLPath = cdrivePath+sslName+"\\"
msvcrDllPath = cdrivePath+"windows\\system32\\"
pythonDllPath = cdrivePath+"Python27\\"
outPath = spec_root+"\\bitmessagemain"
cdrivePath = site_root[0:3]
srcPath = os.path.join(spec_root[:-20], "src")
qtBase = "PyQt4"
openSSLPath = os.path.join(cdrivePath, sslName)
msvcrDllPath = os.path.join(cdrivePath, "windows", "system32")
pythonDllPath = os.path.join(cdrivePath, "Python27")
outPath = os.path.join(spec_root, "bitmessagemain")
importPath = srcPath
sys.path.insert(0,importPath)
@ -31,7 +31,7 @@ os.rename(os.path.join(srcPath, '__init__.py'), os.path.join(srcPath, '__init__.
# -*- mode: python -*-
a = Analysis(
[srcPath + 'bitmessagemain.py'],
[os.path.join(srcPath, 'bitmessagemain.py')],
pathex=[outPath],
hiddenimports=['bitmessageqt.languagebox', 'pyopencl','numpy', 'win32com' , 'setuptools.msvc' ,'_cffi_backend'],
hookspath=None,
@ -43,23 +43,32 @@ os.rename(os.path.join(srcPath, '__init__.py.backup'), os.path.join(srcPath, '__
def addTranslations():
import os
extraDatas = []
for file in os.listdir(srcPath + 'translations'):
if file[-3:] != ".qm":
for file_ in os.listdir(os.path.join(srcPath, 'translations')):
if file_[-3:] != ".qm":
continue
extraDatas.append((os.path.join('translations', file), os.path.join(srcPath, 'translations', file), 'DATA'))
for file in os.listdir(qtPath + 'translations'):
if file[0:3] != "qt_" or file[5:8] != ".qm":
extraDatas.append((os.path.join('translations', file_),
os.path.join(srcPath, 'translations', file_), 'DATA'))
for libdir in sys.path:
qtdir = os.path.join(libdir, qtBase, 'translations')
if os.path.isdir(qtdir):
break
if not os.path.isdir(qtdir):
return extraDatas
for file_ in os.listdir(qtdir):
if file_[0:3] != "qt_" or file_[5:8] != ".qm":
continue
extraDatas.append((os.path.join('translations', file), os.path.join(qtPath, 'translations', file), 'DATA'))
extraDatas.append((os.path.join('translations', file_),
os.path.join(qtdir, file_), 'DATA'))
return extraDatas
def addUIs():
import os
extraDatas = []
for file in os.listdir(srcPath + 'bitmessageqt'):
if file[-3:] != ".ui":
for file_ in os.listdir(os.path.join(srcPath, 'bitmessageqt')):
if file_[-3:] != ".ui":
continue
extraDatas.append((os.path.join('ui', file), os.path.join(srcPath, 'bitmessageqt', file), 'DATA'))
extraDatas.append((os.path.join('ui', file_), os.path.join(srcPath,
'bitmessageqt', file_), 'DATA'))
return extraDatas
# append the translations directory
@ -67,10 +76,8 @@ a.datas += addTranslations()
a.datas += addUIs()
a.binaries += [('libeay32.dll', openSSLPath + 'libeay32.dll', 'BINARY'),
('python27.dll', pythonDllPath + 'python27.dll', 'BINARY'),
('msvcr120.dll', msvcrDllPath + 'msvcr120.dll','BINARY'),
a.binaries += [('libeay32.dll', os.path.join(openSSLPath, 'libeay32.dll'), 'BINARY'),
('python27.dll', os.path.join(pythonDllPath, 'python27.dll'), 'BINARY'),
(os.path.join('bitmsghash', 'bitmsghash%i.dll' % (arch)), os.path.join(srcPath, 'bitmsghash', 'bitmsghash%i.dll' % (arch)), 'BINARY'),
(os.path.join('bitmsghash', 'bitmsghash.cl'), os.path.join(srcPath, 'bitmsghash', 'bitmsghash.cl'), 'BINARY'),
(os.path.join('sslkeys', 'cert.pem'), os.path.join(srcPath, 'sslkeys', 'cert.pem'), 'BINARY'),
@ -93,7 +100,7 @@ exe = EXE(pyz,
name=fname,
debug=False,
strip=None,
upx=True,
upx=False,
console=False, icon= os.path.join(srcPath, 'images', 'can-icon.ico'))
coll = COLLECT(exe,
@ -101,6 +108,6 @@ coll = COLLECT(exe,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx=False,
name='main')