From 23a8090a7337ce75ee01baf4df586d0409cd1ba4 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 21 Feb 2016 17:45:07 +0300 Subject: [PATCH] static linked openssl in Qt, gobject dynamic linked, moved gtk/appindicator init after Qt Application creation, trying to enable rdynamic flag --- QTCREATOR.md | 13 +++++++++- Telegram/Build.sh | 4 +-- Telegram/FixMake.sh | 9 ++++--- Telegram/SourceFiles/pspecific.h | 5 ++++ Telegram/SourceFiles/pspecific_linux.cpp | 31 ++++++++++++++---------- Telegram/SourceFiles/pspecific_mac.cpp | 8 ++++++ Telegram/SourceFiles/pspecific_wnd.cpp | 8 ++++++ Telegram/SourceFiles/types.cpp | 4 +++ Telegram/Telegram.pro | 6 ++--- 9 files changed, 65 insertions(+), 23 deletions(-) diff --git a/QTCREATOR.md b/QTCREATOR.md index 9576e30dd5..28184888b9 100644 --- a/QTCREATOR.md +++ b/QTCREATOR.md @@ -101,6 +101,17 @@ then go to **/home/user/TBuild/Libraries/openal-soft/build** and run make sudo make install +####OpenSSL + +In Terminal go to **/home/user/TBuild/Libraries** and run + + git clone https://github.com/openssl/openssl + cd openssl + git checkout OpenSSL_1_0_1-stable + ./config + make + sudo make install + ####libxkbcommon (required for Fcitx Qt plugin) In Terminal go to **/home/user/TBuild/Libraries** and run @@ -136,7 +147,7 @@ Install some packages for Qt (see **/home/user/TBuild/Libraries/QtStatic/qtbase/ In Terminal go to **/home/user/TBuild/Libraries/QtStatic** and there run - ./configure -release -opensource -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb -qt-xkbcommon-x11 -no-opengl -static -nomake examples -nomake tests + OPENSSL_LIBS='/usr/local/ssl/lib/libssl.a /usr/local/ssl/lib/libcrypto.a' ./configure -release -opensource -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb -qt-xkbcommon-x11 -no-opengl -static -openssl-linked -nomake examples -nomake tests make -j4 sudo make -j4 install diff --git a/Telegram/Build.sh b/Telegram/Build.sh index f7a64597ff..615639257f 100755 --- a/Telegram/Build.sh +++ b/Telegram/Build.sh @@ -111,14 +111,14 @@ if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ]; then mkdir -p "$WorkPath/ReleaseIntermediateUpdater" cd "$WorkPath/ReleaseIntermediateUpdater" - /usr/local/Qt-5.5.1/bin/qmake "$HomePath/Updater.pro" + /usr/local/Qt-5.5.1/bin/qmake "$HomePath/Updater.pro" -r -spec linux-g++ make echo "Updater build complete!" cd "$HomePath" mkdir -p "$WorkPath/ReleaseIntermediate" cd "$WorkPath/ReleaseIntermediate" - /usr/local/Qt-5.5.1/bin/qmake "$HomePath/Telegram.pro" + /usr/local/Qt-5.5.1/bin/qmake "$HomePath/Telegram.pro" -r -spec linux-g++ eval "$FixScript" make echo "Telegram build complete!" diff --git a/Telegram/FixMake.sh b/Telegram/FixMake.sh index e03c47d215..a92840e7c1 100755 --- a/Telegram/FixMake.sh +++ b/Telegram/FixMake.sh @@ -11,10 +11,10 @@ Replace () { } Replace '\-llzma' '\/usr\/lib\/x86_64\-linux\-gnu\/liblzma\.a' -Replace '\-lssl' '\/usr\/lib\/x86_64\-linux\-gnu\/libssl\.a' -Replace '\-lcrypto' '\/usr\/lib\/x86_64\-linux\-gnu\/libcrypto\.a' -Replace '\-lgobject\-2\.0' '\/usr\/lib\/x86_64\-linux\-gnu\/libgobject\-2\.0\.a \/usr\/lib\/x86_64\-linux\-gnu\/libffi\.a' -Replace '\-lXi' '\/usr\/lib\/x86_64\-linux\-gnu\/libXi\.a' +#Replace '\-lssl' '\/usr\/lib\/x86_64\-linux\-gnu\/libssl\.a' +#Replace '\-lcrypto' '\/usr\/lib\/x86_64\-linux\-gnu\/libcrypto\.a' +#Replace '\-lgobject\-2\.0' '\/usr\/lib\/x86_64\-linux\-gnu\/libgobject\-2\.0\.a \/usr\/lib\/x86_64\-linux\-gnu\/libffi\.a' +Replace '\-lXi' '\/usr\/lib\/x86_64\-linux\-gnu\/libXi\.a \/usr\/lib\/x86_64\-linux\-gnu\/libXext\.a' Replace '\-lSM' '\/usr\/lib\/x86_64\-linux\-gnu\/libSM\.a' Replace '\-lICE' '\/usr\/lib\/x86_64\-linux\-gnu\/libICE\.a' Replace '\-lfontconfig' '\/usr\/lib\/x86_64\-linux\-gnu\/libfontconfig\.a \/usr\/lib\/x86_64\-linux\-gnu\/libexpat\.a' @@ -28,3 +28,4 @@ Replace '\-lswresample' '\/usr\/local\/lib\/libswresample\.a' Replace '\-lswscale' '\/usr\/local\/lib\/libswscale\.a' Replace '\-lavutil' '\/usr\/local\/lib\/libavutil\.a' Replace '\-lva' '\/usr\/local\/lib\/libva\.a' +Replace '\-lQt5Network' '\/usr\/local\/Qt-5.5.1\/lib\/libQt5Network.a \/usr\/local\/ssl\/lib\/libssl.a \/usr\/local\/ssl\/lib\/libcrypto.a' diff --git a/Telegram/SourceFiles/pspecific.h b/Telegram/SourceFiles/pspecific.h index 98c8411466..7362f15da0 100644 --- a/Telegram/SourceFiles/pspecific.h +++ b/Telegram/SourceFiles/pspecific.h @@ -43,4 +43,9 @@ namespace PlatformSpecific { ~Initializer(); }; + namespace ThirdParty { + void start(); + void finish(); + } + } diff --git a/Telegram/SourceFiles/pspecific_linux.cpp b/Telegram/SourceFiles/pspecific_linux.cpp index 6b1e982da9..3ee28e7741 100644 --- a/Telegram/SourceFiles/pspecific_linux.cpp +++ b/Telegram/SourceFiles/pspecific_linux.cpp @@ -752,9 +752,6 @@ void PsMainWindow::psUpdatedPosition() { void PsMainWindow::psCreateTrayIcon() { if (!noQtTrayIcon) { cSetSupportTray(QSystemTrayIcon::isSystemTrayAvailable()); - if (!noTryUnity) { - useUnityCount = false; - } return; } @@ -1241,16 +1238,6 @@ void psShowInFolder(const QString &name) { namespace PlatformSpecific { Initializer::Initializer() { - QString cdesktop = QString(getenv("XDG_CURRENT_DESKTOP")).toLower(); - noQtTrayIcon = (cdesktop == qstr("pantheon")) || (cdesktop == qstr("gnome")); - tryAppIndicator = (cdesktop == qstr("xfce")); - noTryUnity = (cdesktop != qstr("unity")); - - if (noQtTrayIcon) cSetSupportTray(false); - - DEBUG_LOG(("Loading libraries")); - setupGtk(); - setupUnity(); } Initializer::~Initializer() { @@ -1258,6 +1245,24 @@ namespace PlatformSpecific { _psEventFilter = 0; } + namespace ThirdParty { + void start() { + QString cdesktop = QString(getenv("XDG_CURRENT_DESKTOP")).toLower(); + noQtTrayIcon = (cdesktop == qstr("pantheon")) || (cdesktop == qstr("gnome")); + tryAppIndicator = (cdesktop == qstr("xfce")); + noTryUnity = (cdesktop != qstr("unity")); + + if (noQtTrayIcon) cSetSupportTray(false); + + DEBUG_LOG(("Loading libraries")); + setupGtk(); + setupUnity(); + } + + void finish() { + } + } + } namespace { diff --git a/Telegram/SourceFiles/pspecific_mac.cpp b/Telegram/SourceFiles/pspecific_mac.cpp index 84349d6160..9d9c66cc03 100644 --- a/Telegram/SourceFiles/pspecific_mac.cpp +++ b/Telegram/SourceFiles/pspecific_mac.cpp @@ -861,6 +861,14 @@ namespace PlatformSpecific { objc_finish(); } + namespace ThirdParty { + void start() { + } + + void finish() { + } + } + } void psNewVersion() { diff --git a/Telegram/SourceFiles/pspecific_wnd.cpp b/Telegram/SourceFiles/pspecific_wnd.cpp index 044827de67..dc8b32d603 100644 --- a/Telegram/SourceFiles/pspecific_wnd.cpp +++ b/Telegram/SourceFiles/pspecific_wnd.cpp @@ -2170,6 +2170,14 @@ namespace PlatformSpecific { } } + namespace ThirdParty { + void start() { + } + + void finish() { + } + } + } namespace { diff --git a/Telegram/SourceFiles/types.cpp b/Telegram/SourceFiles/types.cpp index 706cae9c47..ce77262ae4 100644 --- a/Telegram/SourceFiles/types.cpp +++ b/Telegram/SourceFiles/types.cpp @@ -267,6 +267,8 @@ namespace { namespace ThirdParty { void start() { + PlatformSpecific::ThirdParty::start(); + if (!RAND_status()) { // should be always inited in all modern OS char buf[16]; memcpy(buf, &_msStart, 8); @@ -303,6 +305,8 @@ namespace ThirdParty { delete[] _sslLocks; _sslLocks = 0; + + PlatformSpecific::ThirdParty::finish(); } } diff --git a/Telegram/Telegram.pro b/Telegram/Telegram.pro index 408bd81904..4ff476e8b3 100644 --- a/Telegram/Telegram.pro +++ b/Telegram/Telegram.pro @@ -288,10 +288,10 @@ CONFIG(release, debug|release) { QMAKE_CXXFLAGS_RELEASE -= -O2 QMAKE_CXXFLAGS_RELEASE += -Ofast -flto -fno-strict-aliasing -g QMAKE_LFLAGS_RELEASE -= -O1 - QMAKE_LFLAGS_RELEASE += -Ofast -flto -g + QMAKE_LFLAGS_RELEASE += -Ofast -flto -g -rdynamic } CONFIG(debug, debug|release) { - QMAKE_LFLAGS_DEBUG += -g + QMAKE_LFLAGS_DEBUG += -g -rdynamic } INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.5.1/QtGui\ @@ -319,7 +319,7 @@ INCLUDEPATH += "/usr/include/atk-1.0" INCLUDEPATH += "/usr/include/dee-1.0" INCLUDEPATH += "/usr/include/libdbusmenu-glib-0.4" -LIBS += -lcrypto -lssl -ldl -llzma -lopenal -lavformat -lavcodec -lswresample -lswscale -lavutil -lopus -lva +LIBS += -ldl -llzma -lopenal -lavformat -lavcodec -lswresample -lswscale -lavutil -lopus -lva LIBS += ./../../../Libraries/QtStatic/qtbase/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.a \ ./../../../Libraries/QtStatic/qtbase/plugins/platforminputcontexts/libibusplatforminputcontextplugin.a \ ./../../../Libraries/QtStatic/qtbase/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.a