Skip to content

Commit

Permalink
Update libraries and fix openssl 1.1 qt4 build.
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshilliard committed Dec 17, 2019
1 parent 1d02a66 commit 3bb6aee
Show file tree
Hide file tree
Showing 4 changed files with 771 additions and 18 deletions.
44 changes: 29 additions & 15 deletions osxbuild/build-app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@

# Set some constants up front
minOSXVer = '10.8'
pythonVer = '2.7.15' # NB: ArmoryMac.pro must also be kept up to date!!!
pythonVer = '2.7.17' # NB: ArmoryMac.pro must also be kept up to date!!!
pyMajorVer = '2.7'
setToolVer = '40.1.0'
setToolSubdir = '5a/df/b2e3d9693bb0dcbeac516a73dd7a9eb82b126ae52e4a74605a9b01beddd5'
pipVer = '18.0'
pipSubdir = '69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579'
psutilVer = '5.4.7'
psutilSubdir = '7d/9a/1e93d41708f8ed2b564395edfa3389f0fd6d567597401c2e5e2775118d8b'
libpngVer = '1.6.35'
psutilVer = '5.6.7'
psutilSubdir = '73/93/4f8213fbe66fc20cb904f35e6e04e20b47b85bee39845cc66a0bcf5ccdcb'
libpngVer = '1.6.37'
qtVer = '4.8.7' # NB: ArmoryMac.pro must also be kept up to date!!!
# Possibly "sipFlags" below too.
sipVer = '4.19.12' # NB: ArmoryMac.pro must also be kept up to date!!!
pyQtVer = '4.12.1' # NB: When I'm upgraded, SIP might be upgraded too.
sipVer = '4.19.13' # NB: ArmoryMac.pro must also be kept up to date!!!
pyQtVer = '4.12.3' # NB: When I'm upgraded, SIP might be upgraded too.
# 4.12.2 is final version & changes build method.
# Just ignore it.

# Used only if compiling a version that supports armoryd
twistedVer = '18.7.0'
twistedSubdir = '90/50/4c315ce5d119f67189d1819629cae7908ca0b0a6c572980df5cc6942bc22'
twistedVer = '19.10.0'
twistedSubdir = '0b/95/5fff90cd4093c79759d736e5f7c921c8eb7e5057a70d753cdb4e8e5895d7'

# Various paths and build materials related to Armory.
LOGFILE = 'build-app.log.txt'
Expand Down Expand Up @@ -339,7 +339,7 @@ def downloadPkg(pkgname, fname, url, ID, toDir=WORKDLDIR):
distfiles.append( [ 'Python', \
"Python-%s.tar.xz" % pythonVer, \
"https://python.org/ftp/python/%s/Python-%s.tar.xz" % (pythonVer, pythonVer), \
"f99348a095ec4a6411c84c0d15343d11920c9724" ] )
"dc5784d11d09c29fbf3fc155e2f242b3d3309454" ] )

distfiles.append( [ 'setuptools', \
"setuptools-%s.zip" % setToolVer, \
Expand All @@ -354,12 +354,12 @@ def downloadPkg(pkgname, fname, url, ID, toDir=WORKDLDIR):
distfiles.append( [ "psutil", \
"psutil-%s.tar.gz" % psutilVer, \
"https://pypi.python.org/packages/%s/psutil-%s.tar.gz" % (psutilSubdir, psutilVer), \
"4c7c8cb5a4915eb7148a1080030f9097be87d3e4" ] )
"96b5d98ec385b6ab08d703f8b75a8d371261437f" ] )

distfiles.append( [ 'libpng', \
"libpng-%s.tar.xz" % libpngVer, \
"https://sourceforge.net/projects/libpng/files/libpng16/%s/libpng-%s.tar.xz" % (libpngVer, libpngVer), \
"0df1561aa1da610e892239348970d574b14deed0" ] )
"3ab93fabbf4c27e1c4724371df408d9a1bd3f656" ] )

# When we upgrade to Qt5....
#distfiles.append( [ "Qt", \
Expand All @@ -375,7 +375,7 @@ def downloadPkg(pkgname, fname, url, ID, toDir=WORKDLDIR):
distfiles.append( [ "sip", \
"sip-%s.tar.gz" % sipVer, \
"https://sourceforge.net/projects/pyqt/files/sip/sip-%s/sip-%s.tar.gz" % (sipVer, sipVer), \
'9f4d0f05ab814ddcde767669cfb6bc184bba931d' ] )
'acb826ca1a49742d17686cef246cceabcc87e3b9' ] )

# When we upgrade to Qt5....
#distfiles.append( [ "pyqt", \
Expand All @@ -386,12 +386,12 @@ def downloadPkg(pkgname, fname, url, ID, toDir=WORKDLDIR):
distfiles.append( [ "pyqt", \
"PyQt4_gpl_mac-%s.tar.gz" % pyQtVer, \
"https://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-%s/PyQt4_gpl_mac-%s.tar.gz" % (pyQtVer, pyQtVer), \
'028f3fc979428687e8e8fd78288b41f1b5735a7c' ] )
'5d4bb6eeb1a6fe6ba37b55c41d04dc2b5e5ebfba' ] )

distfiles.append( [ 'Twisted', \
"Twisted-%s.tar.bz2" % twistedVer, \
"https://files.pythonhosted.org/packages/%s/Twisted-%s.tar.bz2" % (twistedSubdir, twistedVer), \
"949c75da0426ca139a3128fecb484eeb7513087e" ] )
"38a7f1b9c63ba0d2db553e2d210af2fd01b3ed21" ] )

# Now repack the information in distfiles
tarfilesToDL = {}
Expand Down Expand Up @@ -520,6 +520,10 @@ def compile_qt():
execAndWait('patch -p1 < %s' % path.join(os.getcwd(), 'qt_cocoa_helpers_mac.patch'), cwd=qtBuildDir)
# Xcode 9.3 (clang 9.1) breaks Qt4.
execAndWait('patch -p1 < %s' % path.join(os.getcwd(), 'qt_clang9.1_fix.patch'), cwd=qtBuildDir)
# Disable SSLv3.
execAndWait('patch -p1 < %s' % path.join(os.getcwd(), 'qt4-no-ssl3.patch'), cwd=qtBuildDir)
# Homebrew only provides openssl 1.1 as 1.0 is deprecated.
execAndWait('patch -p1 < %s' % path.join(os.getcwd(), 'qt4-openssl-1.1.patch'), cwd=qtBuildDir)

# Configure Qt. http://wiki.phisys.com/index.php/Compiling_Phi has an example
# that can be checked for ideas.
Expand All @@ -533,6 +537,9 @@ def compile_qt():
command += ' -opensource -nomake demos -nomake examples -nomake docs -cocoa '
command += '-fast -release -no-webkit -no-javascript-jit -nomake tools '
command += '-nomake tests -no-qt3support -arch x86_64 -no-3dnow -no-phonon '
command += '-no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc '
command += '-no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-sqlite_symbian '
command += '-no-sql-symsql -no-sql-tds '
command += '-I %s/include -L %s/lib -platform unsupported/macx-clang-libc++'
execAndWait(command % (qtInstDir, opensslPath, opensslPath), cwd=qtBuildDir)

Expand Down Expand Up @@ -667,7 +674,14 @@ def compile_objc_library():
# For some reason, qmake mangles LFLAGS when LFLAGS is built. The exact cause
# is unknown but probably has to do with a conf file included in
# mkspecs/unsupported/macx-clang-libc++/qmake.conf. Patch the output for now.
execAndWait('patch -p0 < %s' % path.join(os.getcwd(), 'qmake_LFLAGS.patch'), cwd=OBJCDIR)
qmakeMakeile = path.join(OBJCDIR, 'Makefile')
with open(qmakeMakeile) as origFile:
makefileText = origFile.read()
makefileText = makefileText.replace("CFLAGS = -pipe -mmacosx-version-min=10.7 -O2 -arch x86_64 -Wall -W -fPIC $(DEFINES)", "CFLAGS = -pipe -mmacosx-version-min=10.8 -O2 -arch x86_64 -Wall -W -fPIC $(DEFINES)", 1)
makefileText = makefileText.replace("CXXFLAGS = -pipe -stdlib=libc++ -mmacosx-version-min=10.7 -fno-exceptions -pipe -std=c++11 -Xarch_x86_64 -mmacosx-version-min=10.8 -O2 -arch x86_64 -mssse3 -Wall -W -fPIC -O2 -arch x86_64 -Wall -W -fPIC $(DEFINES)", "CXXFLAGS = -pipe -fno-exceptions -pipe -std=c++11 -stdlib=libc++ -Xarch_x86_64 -mmacosx-version-min=10.8 -O2 -arch x86_64 -mssse3 -Wall -W -fPIC -O2 -arch x86_64 -Wall -W -fPIC $(DEFINES)", 1)
makefileText = makefileText.replace("LFLAGS = -headerpad_max_install_names -stdlib=libc++ -mmacosx-version-min=10.7 -lc++ -undefined dynamic_lookup -arch x86_64 -single_module -dynamiclib", "LFLAGS = -headerpad_max_install_names -stdlib=libc++ -Xarch_x86_64 -mmacosx-version-min=10.8 -lc++ -undefined dynamic_lookup -single_module -dynamiclib -arch x86_64", 1)
with open(qmakeMakeile, "w") as origFile:
origFile.write(makefileText)
execAndWait('make %s' % MAKEFLAGS, cwd=OBJCDIR)


Expand Down
6 changes: 3 additions & 3 deletions osxbuild/objc_armory/ArmoryMac.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
# macx-clang-libc++ option like Qt. (macx-g++ is all it can muster for now.)
# NB: The "version" values must be updated alongside build-app.py!!!
QTVER = 4.8.7
SIPVER = 4.19.12
PYVER = 2.7.15
SIPVER = 4.19.13
PYVER = 2.7.17
QT_UNPACK_BASE = ../workspace/unpackandbuild/qt-everywhere-opensource-src-$${QTVER}
SIP_UNPACK_BASE = ../workspace/unpackandbuild/sip-$${SIPVER}
PYTHON_UNPACK_BASE = ../workspace/unpackandbuild/Python-$${PYVER}
Expand Down Expand Up @@ -57,7 +57,7 @@ QMAKE_LFLAGS += "-undefined dynamic_lookup"
# Source: http://el-tramo.be/blog/mixing-cocoa-and-qt
# Source: http://stackoverflow.com/questions/18768219/sdl-framework-include-on-macos-qt
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
QMAKE_OBJECTIVE_CFLAGS += -std=c++11 -Xarch_x86_64 -mmacosx-version-min=$${QMAKE_MACOSX_DEPLOYMENT_TARGET} -O2 -arch x86_64 -mssse3 -Wall -W -fPIC
QMAKE_OBJECTIVE_CFLAGS += -std=c++11 -stdlib=libc++ -Xarch_x86_64 -mmacosx-version-min=$${QMAKE_MACOSX_DEPLOYMENT_TARGET} -O2 -arch x86_64 -mssse3 -Wall -W -fPIC
OBJECTIVE_SOURCES += macdockiconhandler.mm macnotificationhandler.mm macutils.mm
HEADERS += ./ArmoryMac.h
LIBS += -framework Foundation
Expand Down
66 changes: 66 additions & 0 deletions osxbuild/qt4-no-ssl3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Description: Do not use SSLv3 methods in Qt4
This patch makes the use of SSLv3 methods optional at compile time.
On Debian this means they will not be used and will return a null ctx
if the SSLv3 method is deliberately selected.
Author: Jon DeVree <[email protected]>
Origin: other, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806505
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806505
Forwarded: not-needed
Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <[email protected]>
Last-Update: 2015-11-30
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
diff -Nru qt4-x11-4.8.7+dfsg.orig/src/network/ssl/qsslsocket_openssl.cpp qt4-x11-4.8.7+dfsg/src/network/ssl/qsslsocket_openssl.cpp
--- qt4-x11-4.8.7+dfsg.orig/src/network/ssl/qsslsocket_openssl.cpp 2015-05-07 10:14:44.000000000 -0400
+++ qt4-x11-4.8.7+dfsg/src/network/ssl/qsslsocket_openssl.cpp 2015-11-27 20:49:36.768826857 -0500
@@ -267,7 +267,11 @@
#endif
break;
case QSsl::SslV3:
+#ifndef OPENSSL_NO_SSL3_METHOD
ctx = q_SSL_CTX_new(client ? q_SSLv3_client_method() : q_SSLv3_server_method());
+#else
+ ctx = 0; // SSL 3 not supported by the system, but chosen deliberately -> error
+#endif
break;
case QSsl::SecureProtocols: // SslV2 will be disabled below
case QSsl::TlsV1SslV3: // SslV2 will be disabled below
diff -Nru qt4-x11-4.8.7+dfsg.orig/src/network/ssl/qsslsocket_openssl_symbols.cpp qt4-x11-4.8.7+dfsg/src/network/ssl/qsslsocket_openssl_symbols.cpp
--- qt4-x11-4.8.7+dfsg.orig/src/network/ssl/qsslsocket_openssl_symbols.cpp 2015-05-07 10:14:44.000000000 -0400
+++ qt4-x11-4.8.7+dfsg/src/network/ssl/qsslsocket_openssl_symbols.cpp 2015-11-27 20:49:48.061023402 -0500
@@ -228,13 +228,17 @@
#ifndef OPENSSL_NO_SSL2
DEFINEFUNC(const SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return)
#endif
+#ifndef OPENSSL_NO_SSL3_METHOD
DEFINEFUNC(const SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return)
+#endif
DEFINEFUNC(const SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(const SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return)
#ifndef OPENSSL_NO_SSL2
DEFINEFUNC(const SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return)
#endif
+#ifndef OPENSSL_NO_SSL3_METHOD
DEFINEFUNC(const SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return)
+#endif
DEFINEFUNC(const SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(const SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return)
#else
@@ -822,13 +826,17 @@
#ifndef OPENSSL_NO_SSL2
RESOLVEFUNC(SSLv2_client_method)
#endif
+#ifndef OPENSSL_NO_SSL3_METHOD
RESOLVEFUNC(SSLv3_client_method)
+#endif
RESOLVEFUNC(SSLv23_client_method)
RESOLVEFUNC(TLSv1_client_method)
#ifndef OPENSSL_NO_SSL2
RESOLVEFUNC(SSLv2_server_method)
#endif
+#ifndef OPENSSL_NO_SSL3_METHOD
RESOLVEFUNC(SSLv3_server_method)
+#endif
RESOLVEFUNC(SSLv23_server_method)
RESOLVEFUNC(TLSv1_server_method)
RESOLVEFUNC(X509_NAME_entry_count)
Loading

0 comments on commit 3bb6aee

Please sign in to comment.