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

View File

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