From 55c44bf238b26805a74a16038c8738ca8ccfb612 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 16 Oct 2012 15:07:16 +0200 Subject: SSH: Link Botan objects into libQtcSsh. Using Botan as a shared library is dangerous due to the use of dynamic_cast and exceptions, which both reproducibly fail to work on MacOs. Since there are no other users of Botan, we just add its objects to the SSH library. Change-Id: Ic79f081d2e1231a52feef02ef5b68761692f1110 Reviewed-by: Eike Ziller --- src/libs/3rdparty/3rdparty.pro | 4 -- src/libs/3rdparty/botan/botan.pri | 46 ++++++++++++++- src/libs/3rdparty/botan/botan.pro | 53 ----------------- src/libs/3rdparty/botan/botan.qbs | 70 ----------------------- src/libs/3rdparty/precompiled_headers/botan_pch.h | 49 ---------------- src/libs/libs.pro | 1 - src/libs/ssh/ssh.pro | 2 + src/libs/ssh/ssh.qbs | 49 ++++++++++++++-- src/libs/ssh/ssh_dependencies.pri | 1 - 9 files changed, 92 insertions(+), 183 deletions(-) delete mode 100644 src/libs/3rdparty/3rdparty.pro delete mode 100644 src/libs/3rdparty/botan/botan.pro delete mode 100644 src/libs/3rdparty/botan/botan.qbs delete mode 100644 src/libs/3rdparty/precompiled_headers/botan_pch.h (limited to 'src/libs') diff --git a/src/libs/3rdparty/3rdparty.pro b/src/libs/3rdparty/3rdparty.pro deleted file mode 100644 index c7babdde2c..0000000000 --- a/src/libs/3rdparty/3rdparty.pro +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE = subdirs -CONFIG += ordered - -SUBDIRS += botan diff --git a/src/libs/3rdparty/botan/botan.pri b/src/libs/3rdparty/botan/botan.pri index 20832c1a7a..7845d6081e 100644 --- a/src/libs/3rdparty/botan/botan.pri +++ b/src/libs/3rdparty/botan/botan.pri @@ -1,2 +1,46 @@ INCLUDEPATH *= $$PWD/.. -LIBS *= -l$$qtLibraryName(Botan) +HEADERS += $$PWD/botan.h +SOURCES += $$PWD/botan.cpp + +CONFIG += exceptions + +DEPENDPATH += . + +DEFINES += BOTAN_DLL="\"\"" +unix:DEFINES += BOTAN_TARGET_OS_HAS_GETTIMEOFDAY BOTAN_HAS_ALLOC_MMAP \ + BOTAN_HAS_ENTROPY_SRC_DEV_RANDOM BOTAN_HAS_ENTROPY_SRC_EGD BOTAN_HAS_ENTROPY_SRC_FTW \ + BOTAN_HAS_ENTROPY_SRC_UNIX BOTAN_HAS_MUTEX_PTHREAD BOTAN_HAS_PIPE_UNIXFD_IO +*linux*:DEFINES += BOTAN_TARGET_OS_IS_LINUX BOTAN_TARGET_OS_HAS_CLOCK_GETTIME \ + BOTAN_TARGET_OS_HAS_DLOPEN BOTAN_TARGET_OS_HAS_GMTIME_R BOTAN_TARGET_OS_HAS_POSIX_MLOCK \ + BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE BOTAN_HAS_DYNAMIC_LOADER +macx:DEFINES += BOTAN_TARGET_OS_IS_DARWIN +*g++*:DEFINES += BOTAN_BUILD_COMPILER_IS_GCC +*clang*:DEFINES += BOTAN_BUILD_COMPILER_IS_CLANG +*icc*:DEFINES += BOTAN_BUILD_COMPILER_IS_INTEL + +win32 { + DEFINES += BOTAN_TARGET_OS_IS_WINDOWS \ + BOTAN_TARGET_OS_HAS_LOADLIBRARY BOTAN_TARGET_OS_HAS_WIN32_GET_SYSTEMTIME \ + BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE \ + BOTAN_HAS_DYNAMIC_LOADER BOTAN_HAS_ENTROPY_SRC_CAPI BOTAN_HAS_ENTROPY_SRC_WIN32 \ + BOTAN_HAS_MUTEX_WIN32 + + win32-msvc* { + QMAKE_CXXFLAGS += -wd4251 -wd4290 -wd4250 + DEFINES += BOTAN_BUILD_COMPILER_IS_MSVC BOTAN_TARGET_OS_HAS_GMTIME_S + } else { + QMAKE_CFLAGS += -fpermissive -finline-functions -Wno-long-long + QMAKE_CXXFLAGS += -fpermissive -finline-functions -Wno-long-long + } + LIBS += -ladvapi32 -luser32 +} + +unix:*-g++* { + QMAKE_CFLAGS += -fPIC -ansi -fpermissive -finline-functions -Wno-long-long + QMAKE_CXXFLAGS += -fPIC -ansi -fpermissive -finline-functions -Wno-long-long + QMAKE_CXXFLAGS_HIDESYMS -= -fvisibility-inlines-hidden # for ubuntu 7.04 +} + +linux*|freebsd* { + LIBS += -lrt +} diff --git a/src/libs/3rdparty/botan/botan.pro b/src/libs/3rdparty/botan/botan.pro deleted file mode 100644 index 92f2bd0f6a..0000000000 --- a/src/libs/3rdparty/botan/botan.pro +++ /dev/null @@ -1,53 +0,0 @@ -TEMPLATE = lib -TARGET = Botan - -PRECOMPILED_HEADER = ../precompiled_headers/botan_pch.h - -CONFIG += exceptions - -include(../../../qtcreatorlibrary.pri) - -DEPENDPATH += . -INCLUDEPATH += . - -DEFINES += BOTAN_DLL=Q_DECL_EXPORT -unix:DEFINES += BOTAN_TARGET_OS_HAS_GETTIMEOFDAY BOTAN_HAS_ALLOC_MMAP \ - BOTAN_HAS_ENTROPY_SRC_DEV_RANDOM BOTAN_HAS_ENTROPY_SRC_EGD BOTAN_HAS_ENTROPY_SRC_FTW \ - BOTAN_HAS_ENTROPY_SRC_UNIX BOTAN_HAS_MUTEX_PTHREAD BOTAN_HAS_PIPE_UNIXFD_IO -*linux*:DEFINES += BOTAN_TARGET_OS_IS_LINUX BOTAN_TARGET_OS_HAS_CLOCK_GETTIME \ - BOTAN_TARGET_OS_HAS_DLOPEN BOTAN_TARGET_OS_HAS_GMTIME_R BOTAN_TARGET_OS_HAS_POSIX_MLOCK \ - BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE BOTAN_HAS_DYNAMIC_LOADER -macx:DEFINES += BOTAN_TARGET_OS_IS_DARWIN -*g++*:DEFINES += BOTAN_BUILD_COMPILER_IS_GCC -*clang*:DEFINES += BOTAN_BUILD_COMPILER_IS_CLANG -*icc*:DEFINES += BOTAN_BUILD_COMPILER_IS_INTEL - -win32 { - DEFINES += BOTAN_TARGET_OS_IS_WINDOWS \ - BOTAN_TARGET_OS_HAS_LOADLIBRARY BOTAN_TARGET_OS_HAS_WIN32_GET_SYSTEMTIME \ - BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE \ - BOTAN_HAS_DYNAMIC_LOADER BOTAN_HAS_ENTROPY_SRC_CAPI BOTAN_HAS_ENTROPY_SRC_WIN32 \ - BOTAN_HAS_MUTEX_WIN32 - - win32-msvc* { - QMAKE_CXXFLAGS += -wd4251 -wd4290 -wd4250 - DEFINES += BOTAN_BUILD_COMPILER_IS_MSVC BOTAN_TARGET_OS_HAS_GMTIME_S - } else { - QMAKE_CFLAGS += -fpermissive -finline-functions -Wno-long-long - QMAKE_CXXFLAGS += -fpermissive -finline-functions -Wno-long-long - } - LIBS += -ladvapi32 -luser32 -} - -unix:*-g++* { - QMAKE_CFLAGS += -fPIC -ansi -fpermissive -finline-functions -Wno-long-long - QMAKE_CXXFLAGS += -fPIC -ansi -fpermissive -finline-functions -Wno-long-long - QMAKE_CXXFLAGS_HIDESYMS -= -fvisibility-inlines-hidden # for ubuntu 7.04 -} - -HEADERS += botan.h -SOURCES += botan.cpp - -linux*|freebsd* { - LIBS += -lrt -} diff --git a/src/libs/3rdparty/botan/botan.qbs b/src/libs/3rdparty/botan/botan.qbs deleted file mode 100644 index ee8afc1d03..0000000000 --- a/src/libs/3rdparty/botan/botan.qbs +++ /dev/null @@ -1,70 +0,0 @@ -import qbs.base 1.0 -import "../../QtcLibrary.qbs" as QtcLibrary - -QtcLibrary { - name: "Botan" - - Depends { name: "cpp" } - Depends { name: "Qt.core" } - - cpp.includePaths: '.' - cpp.dynamicLibraries: { - if (qbs.targetOS == "windows") { - return [ - "advapi32", - "user32" - ] - } else { - return ["rt", "dl"] - } - } - - cpp.defines: { - var result = ["BOTAN_DLL=Q_DECL_EXPORT"] - if (qbs.toolchain == "msvc") - result.push("BOTAN_BUILD_COMPILER_IS_MSVC", "BOTAN_TARGET_OS_HAS_GMTIME_S") - if (qbs.toolchain == "gcc" || qbs.toolchain == "mingw") - result.push("BOTAN_BUILD_COMPILER_IS_GCC") - if (qbs.targetOS == "linux") - result.push("BOTAN_TARGET_OS_IS_LINUX", "BOTAN_TARGET_OS_HAS_CLOCK_GETTIME", - "BOTAN_TARGET_OS_HAS_DLOPEN", " BOTAN_TARGET_OS_HAS_GMTIME_R", - "BOTAN_TARGET_OS_HAS_POSIX_MLOCK", "BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE", - "BOTAN_HAS_DYNAMIC_LOADER", "BOTAN_TARGET_OS_HAS_GETTIMEOFDAY", - "BOTAN_HAS_ALLOC_MMAP", "BOTAN_HAS_ENTROPY_SRC_DEV_RANDOM", - "BOTAN_HAS_ENTROPY_SRC_EGD", "BOTAN_HAS_ENTROPY_SRC_FTW", - "BOTAN_HAS_ENTROPY_SRC_UNIX", "BOTAN_HAS_MUTEX_PTHREAD", "BOTAN_HAS_PIPE_UNIXFD_IO") - if (qbs.targetOS == "mac") - result.push("BOTAN_TARGET_OS_IS_DARWIN", "BOTAN_TARGET_OS_HAS_GETTIMEOFDAY", - "BOTAN_HAS_ALLOC_MMAP", "BOTAN_HAS_ENTROPY_SRC_DEV_RANDOM", - "BOTAN_HAS_ENTROPY_SRC_EGD", "BOTAN_HAS_ENTROPY_SRC_FTW", - "BOTAN_HAS_ENTROPY_SRC_UNIX", "BOTAN_HAS_MUTEX_PTHREAD", "BOTAN_HAS_PIPE_UNIXFD_IO") - if (qbs.targetOS == "windows") - result.push("BOTAN_TARGET_OS_IS_WINDOWS", - "BOTAN_TARGET_OS_HAS_LOADLIBRARY", "BOTAN_TARGET_OS_HAS_WIN32_GET_SYSTEMTIME", - "BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK", "BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE", - "BOTAN_HAS_DYNAMIC_LOADER", "BOTAN_HAS_ENTROPY_SRC_CAPI", - "BOTAN_HAS_ENTROPY_SRC_WIN32", "BOTAN_HAS_MUTEX_WIN32") - return base.concat(result) - } - - Properties { - condition: qbs.toolchain == "mingw" - cpp.cxxFlags: [ - "-fpermissive", - "-finline-functions", - "-Wno-long-long" - ] - } - - files: [ "botan.h", "botan.cpp" ] - - ProductModule { - Depends { name: "cpp" } - cpp.linkerFlags: { - if (qbs.toolchain == "mingw") { - return ["-Wl,--enable-auto-import"] - } - } - cpp.includePaths: '..' - } -} diff --git a/src/libs/3rdparty/precompiled_headers/botan_pch.h b/src/libs/3rdparty/precompiled_headers/botan_pch.h deleted file mode 100644 index 44b36326bf..0000000000 --- a/src/libs/3rdparty/precompiled_headers/botan_pch.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#if defined __cplusplus -#include - -#ifdef Q_WS_WIN -# define _POSIX_ -# include -# undef _POSIX_ -#endif - -#include "../botan/botan.h" - -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/src/libs/libs.pro b/src/libs/libs.pro index 5eaf471585..9a1da2d4eb 100644 --- a/src/libs/libs.pro +++ b/src/libs/libs.pro @@ -5,7 +5,6 @@ QT += core gui # aggregation and extensionsystem are directly in src.pro # because of dependencies of app SUBDIRS = \ - 3rdparty \ utils \ utils/process_stub.pro \ languageutils \ diff --git a/src/libs/ssh/ssh.pro b/src/libs/ssh/ssh.pro index 2df5b0430b..d0b90af988 100644 --- a/src/libs/ssh/ssh.pro +++ b/src/libs/ssh/ssh.pro @@ -65,3 +65,5 @@ HEADERS = $$PWD/sshsendfacility_p.h \ $$PWD/ssh_global.h FORMS = $$PWD/sshkeycreationdialog.ui + +include(../3rdparty/botan/botan.pri) diff --git a/src/libs/ssh/ssh.qbs b/src/libs/ssh/ssh.qbs index 755bb221b3..8589cd2b4f 100644 --- a/src/libs/ssh/ssh.qbs +++ b/src/libs/ssh/ssh.qbs @@ -4,17 +4,17 @@ import "../QtcLibrary.qbs" as QtcLibrary QtcLibrary { name: "QtcSsh" - cpp.defines: base.concat(["QSSH_LIBRARY"]) + cpp.defines: base.concat(["QSSH_LIBRARY"]).concat(botanDefines) + cpp.dynamicLibraries: botanLibs cpp.includePaths: [ ".", "..", "../..", buildDirectory - ] + ].concat(botanIncludes) Depends { name: "cpp" } Depends { name: "Qt"; submodules: ["widgets", "network" ] } - Depends { name: "Botan" } files: [ "sftpchannel.h", "sftpchannel_p.h", "sftpchannel.cpp", @@ -46,7 +46,48 @@ QtcLibrary { "sshexception_p.h", "sshpseudoterminal.h", "sshbotanconversions_p.h" - ] + ].concat(botanFiles) + + property var botanIncludes: ["../3rdparty"] + property var botanLibs: qbs.targetOS === "windows" ? ["advapi32", "user32"] : ["rt", "dl"] + property var botanDefines: { + var result = ['BOTAN_DLL=""'] + if (qbs.toolchain === "msvc") + result.push("BOTAN_BUILD_COMPILER_IS_MSVC", "BOTAN_TARGET_OS_HAS_GMTIME_S") + if (qbs.toolchain === "gcc" || qbs.toolchain === "mingw") + result.push("BOTAN_BUILD_COMPILER_IS_GCC") + if (qbs.targetOS === "linux") + result.push("BOTAN_TARGET_OS_IS_LINUX", "BOTAN_TARGET_OS_HAS_CLOCK_GETTIME", + "BOTAN_TARGET_OS_HAS_DLOPEN", " BOTAN_TARGET_OS_HAS_GMTIME_R", + "BOTAN_TARGET_OS_HAS_POSIX_MLOCK", "BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE", + "BOTAN_HAS_DYNAMIC_LOADER", "BOTAN_TARGET_OS_HAS_GETTIMEOFDAY", + "BOTAN_HAS_ALLOC_MMAP", "BOTAN_HAS_ENTROPY_SRC_DEV_RANDOM", + "BOTAN_HAS_ENTROPY_SRC_EGD", "BOTAN_HAS_ENTROPY_SRC_FTW", + "BOTAN_HAS_ENTROPY_SRC_UNIX", "BOTAN_HAS_MUTEX_PTHREAD", "BOTAN_HAS_PIPE_UNIXFD_IO") + if (qbs.targetOS === "mac") + result.push("BOTAN_TARGET_OS_IS_DARWIN", "BOTAN_TARGET_OS_HAS_GETTIMEOFDAY", + "BOTAN_HAS_ALLOC_MMAP", "BOTAN_HAS_ENTROPY_SRC_DEV_RANDOM", + "BOTAN_HAS_ENTROPY_SRC_EGD", "BOTAN_HAS_ENTROPY_SRC_FTW", + "BOTAN_HAS_ENTROPY_SRC_UNIX", "BOTAN_HAS_MUTEX_PTHREAD", "BOTAN_HAS_PIPE_UNIXFD_IO") + if (qbs.targetOS === "windows") + result.push("BOTAN_TARGET_OS_IS_WINDOWS", + "BOTAN_TARGET_OS_HAS_LOADLIBRARY", "BOTAN_TARGET_OS_HAS_WIN32_GET_SYSTEMTIME", + "BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK", "BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE", + "BOTAN_HAS_DYNAMIC_LOADER", "BOTAN_HAS_ENTROPY_SRC_CAPI", + "BOTAN_HAS_ENTROPY_SRC_WIN32", "BOTAN_HAS_MUTEX_WIN32") + return result + } + property var botanFiles: [ "../3rdparty/botan/botan.h", "../3rdparty/botan/botan.cpp" ] + + // For Botan. + Properties { + condition: qbs.toolchain === "mingw" + cpp.cxxFlags: [ + "-fpermissive", + "-finline-functions", + "-Wno-long-long" + ] + } ProductModule { Depends { name: "cpp" } diff --git a/src/libs/ssh/ssh_dependencies.pri b/src/libs/ssh/ssh_dependencies.pri index e2a3c96f45..e69de29bb2 100644 --- a/src/libs/ssh/ssh_dependencies.pri +++ b/src/libs/ssh/ssh_dependencies.pri @@ -1 +0,0 @@ -include(../3rdparty/botan/botan.pri) -- cgit v1.2.3