From 4876a0ea3b87abfe7c404f4bc5fbb43c44577820 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 15 Apr 2018 13:41:52 +0200 Subject: [PATCH] Multiple improvements to build process Restructure and document retroshare.pri variables and helper functions Link sqlite statically like other libraries on Android qmake has multiple win32-* specs match them correctly Move a buch of generic thing to retroshare.pri instead of having them replocated accross project specific .pro Fix retroshare-gui too many symbols exported on windows liking error by adding QMAKE_LFLAGS+=-Wl,--exclude-libs,ALL Rename retroshare-gui/src/util/win32.h because the name is too prone to confusion and build conflicts libreasapi avoid usage of cretar_prl link_prl that seems unreliable on some platforms libreasapi rename LIBRESAPI_QT to more understendable LIBRESAPI_SETTINGS Use use_*.pri instead of copy pasting error prone qmake snippets around Expose bitdht option to retroshare.pri Add RS_THREAD_LIB qmake variable for better crossplatform support Move debug and profiling generic options to retroshare.pri (avoid copy/pasting) Remove Qt script module in qmake as it is not available anymore --- RetroShare.pro | 3 +- android-prepare-toolchain.sh | 4 +- libbitdht/src/libbitdht.pro | 17 +- libbitdht/src/use_libbitdht.pri | 5 + libresapi/src/api/ApiServer.cpp | 8 +- libresapi/src/libresapi.pro | 60 +-- libresapi/src/use_libresapi.pri | 27 + libretroshare/src/libretroshare.pro | 77 +-- libretroshare/src/use_libretroshare.pri | 33 ++ openpgpsdk/src/openpgpsdk.pro | 27 +- openpgpsdk/src/use_openpgpsdk.pri | 20 + .../src/retroshare-android-service.pro | 39 +- .../src/gui/settings/rsharesettings.cpp | 2 +- retroshare-gui/src/retroshare-gui.pro | 98 +--- retroshare-gui/src/rshare.h | 2 +- .../util/{win32.cpp => retroshareWin32.cpp} | 2 +- .../src/util/{win32.h => retroshareWin32.h} | 14 +- retroshare-nogui/src/retroshare-nogui.pro | 63 +-- retroshare-qml-app/src/retroshare-qml-app.pro | 1 - retroshare.pri | 464 ++++++++++++------ tests/unittests/unittests.pro | 2 +- 21 files changed, 502 insertions(+), 466 deletions(-) create mode 100644 libbitdht/src/use_libbitdht.pri create mode 100644 libresapi/src/use_libresapi.pri create mode 100644 libretroshare/src/use_libretroshare.pri create mode 100644 openpgpsdk/src/use_openpgpsdk.pri rename retroshare-gui/src/util/{win32.cpp => retroshareWin32.cpp} (99%) rename retroshare-gui/src/util/{win32.h => retroshareWin32.h} (97%) diff --git a/RetroShare.pro b/RetroShare.pro index 9a6f24d5f..d124ce94d 100644 --- a/RetroShare.pro +++ b/RetroShare.pro @@ -1,13 +1,12 @@ !include("retroshare.pri"): error("Could not include file retroshare.pri") TEMPLATE = subdirs -#CONFIG += tests SUBDIRS += openpgpsdk openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro retrotor { - libretroshare.depends = openpgpsdk + libretroshare.depends = openpgpsdk } else { SUBDIRS += libbitdht libbitdht.file = libbitdht/src/libbitdht.pro diff --git a/android-prepare-toolchain.sh b/android-prepare-toolchain.sh index 7d8337add..da01cc8dc 100755 --- a/android-prepare-toolchain.sh +++ b/android-prepare-toolchain.sh @@ -248,8 +248,8 @@ build_sqlite() make -j${HOST_NUM_CPU} make install rm -f ${SYSROOT}/usr/lib/libsqlite3.so* - ${CC} -shared -o libsqlite3.so -fPIC sqlite3.o -ldl - cp libsqlite3.so "${SYSROOT}/usr/lib" +# ${CC} -shared -o libsqlite3.so -fPIC sqlite3.o -ldl +# cp libsqlite3.so "${SYSROOT}/usr/lib" cd .. } diff --git a/libbitdht/src/libbitdht.pro b/libbitdht/src/libbitdht.pro index ad6986f32..d9e5816c4 100644 --- a/libbitdht/src/libbitdht.pro +++ b/libbitdht/src/libbitdht.pro @@ -6,23 +6,10 @@ CONFIG -= qt TARGET = bitdht DESTDIR = lib +!include("use_libbitdht.pri"):error("Including") + QMAKE_CXXFLAGS *= -Wall -DBE_DEBUG -profiling { - QMAKE_CXXFLAGS -= -fomit-frame-pointer - QMAKE_CXXFLAGS *= -pg -g -fno-omit-frame-pointer -} - -release { - # not much here yet. -} - -#CONFIG += debug -debug { - QMAKE_CXXFLAGS -= -O2 -fomit-frame-pointer - QMAKE_CXXFLAGS *= -g -fno-omit-frame-pointer -} - # treat warnings as error for better removing #QMAKE_CFLAGS += -Werror #QMAKE_CXXFLAGS += -Werror diff --git a/libbitdht/src/use_libbitdht.pri b/libbitdht/src/use_libbitdht.pri new file mode 100644 index 000000000..bbaf1d4d5 --- /dev/null +++ b/libbitdht/src/use_libbitdht.pri @@ -0,0 +1,5 @@ +DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../libbitdht/src)) +INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libbitdht/src)) +LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libbitdht/src/lib/)) -lbitdht + +!equals(TARGET, bitdht):PRE_TARGETDEPS *= $$system_path($$clean_path($${OUT_PWD}/../../libbitdht/src/lib/libbitdht.a)) diff --git a/libresapi/src/api/ApiServer.cpp b/libresapi/src/api/ApiServer.cpp index db8b75d16..f08671114 100644 --- a/libresapi/src/api/ApiServer.cpp +++ b/libresapi/src/api/ApiServer.cpp @@ -17,7 +17,7 @@ #include "ChannelsHandler.h" #include "StatsHandler.h" -#ifdef LIBRESAPI_QT +#ifdef LIBRESAPI_SETTINGS #include "SettingsHandler.h" #endif @@ -242,7 +242,7 @@ public: mApiPluginHandler(sts, ifaces), mChannelsHandler(ifaces.mGxsChannels), mStatsHandler() -#ifdef LIBRESAPI_QT +#ifdef LIBRESAPI_SETTINGS ,mSettingsHandler(sts) #endif { @@ -272,7 +272,7 @@ public: &ChannelsHandler::handleRequest); router.addResourceHandler("stats", dynamic_cast(&mStatsHandler), &StatsHandler::handleRequest); -#ifdef LIBRESAPI_QT +#ifdef LIBRESAPI_SETTINGS router.addResourceHandler("settings", dynamic_cast(&mSettingsHandler), &SettingsHandler::handleRequest); #endif @@ -290,7 +290,7 @@ public: ChannelsHandler mChannelsHandler; StatsHandler mStatsHandler; -#ifdef LIBRESAPI_QT +#ifdef LIBRESAPI_SETTINGS SettingsHandler mSettingsHandler; #endif }; diff --git a/libresapi/src/libresapi.pro b/libresapi/src/libresapi.pro index ea2daa082..f3124dc77 100644 --- a/libresapi/src/libresapi.pro +++ b/libresapi/src/libresapi.pro @@ -2,50 +2,29 @@ TEMPLATE = lib CONFIG += staticlib -CONFIG += create_prl CONFIG -= qt TARGET = resapi TARGET_PRL = libresapi DESTDIR = lib -DEPENDPATH += ../../libretroshare/src/ -INCLUDEPATH += ../../libretroshare/src +!include(use_libresapi.pri):error("Including") +libresapilocalserver { + CONFIG *= qt + QT *= network + SOURCES *= api/ApiServerLocal.cpp + HEADERS *= api/ApiServerLocal.h +} -retroshare_android_service { - win32 { - OBJECTS_DIR = temp/obj +libresapi_settings { + CONFIG *= qt + QT *= core - LIBS_DIR = $$PWD/../../libs/lib - LIBS += $$OUT_PWD/../../libretroshare/src/lib/libretroshare.a - LIBS += $$OUT_PWD/../../openpgpsdk/src/lib/libops.a - - for(lib, LIB_DIR):LIBS += -L"$$lib" - for(bin, BIN_DIR):LIBS += -L"$$bin" - - - LIBS += -lssl -lcrypto -lpthread -lminiupnpc -lz -lws2_32 - LIBS += -luuid -lole32 -liphlpapi -lcrypt32 -lgdi32 - LIBS += -lwinmm - - DEFINES *= WINDOWS_SYS WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T - - DEPENDPATH += . $$INC_DIR - INCLUDEPATH += . $$INC_DIR - - greaterThan(QT_MAJOR_VERSION, 4) { - # Qt 5 - RC_INCLUDEPATH += $$_PRO_FILE_PWD_/../../libretroshare/src - } else { - # Qt 4 - QMAKE_RC += --include-dir=$$_PRO_FILE_PWD_/../../libretroshare/src - } - } + SOURCES += api/SettingsHandler.cpp + HEADERS += api/SettingsHandler.h } libresapihttpserver { - CONFIG += libmicrohttpd - unix { webui_files.path = "$${DATA_DIR}/webui" @@ -211,18 +190,3 @@ HEADERS += \ api/ChannelsHandler.h \ api/StatsHandler.h \ api/FileSharingHandler.h - -libresapilocalserver { - CONFIG *= qt - QT *= network - SOURCES *= api/ApiServerLocal.cpp - HEADERS *= api/ApiServerLocal.h -} - -qt_dependencies { - CONFIG *= qt - QT *= core - - SOURCES += api/SettingsHandler.cpp - HEADERS += api/SettingsHandler.h -} diff --git a/libresapi/src/use_libresapi.pri b/libresapi/src/use_libresapi.pri new file mode 100644 index 000000000..e9b1753a2 --- /dev/null +++ b/libresapi/src/use_libresapi.pri @@ -0,0 +1,27 @@ +DEPENDPATH *= $$system_path($$clean_path($$PWD/../../libresapi/src)) +INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libresapi/src)) +LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libresapi/src/lib/)) -lresapi + +!equals(TARGET, resapi):PRE_TARGETDEPS *= $$system_path($$clean_path($${OUT_PWD}/../../libresapi/src/lib/libresapi.a)) + +!include("../../libretroshare/src/use_libretroshare.pri"):error("Including") + +sLibs = +mLibs = +dLibs = + +libresapihttpserver { + mLibs *= microhttpd +} + +static { + sLibs *= $$mLibs +} else { + dLibs *= $$mLibs +} + +LIBS += $$linkStaticLibs(sLibs) +PRE_TARGETDEPS += $$pretargetStaticLibs(sLibs) + +LIBS += $$linkDynamicLibs(dLibs) + diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index c2604fa4a..fa9491c63 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -2,30 +2,17 @@ TEMPLATE = lib CONFIG += staticlib -CONFIG += create_prl CONFIG -= qt TARGET = retroshare TARGET_PRL = libretroshare DESTDIR = lib -#CONFIG += dsdv - -retrotor { - DEFINES *= RETROTOR - CONFIG -= bitdht -} else { - CONFIG += bitdht -} +!include("use_libretroshare.pri"):error("Including") # the dht stunner is used to obtain RS external ip addr. when it is natted # this system is unreliable and rs supports a newer and better one (asking connected peers) # CONFIG += useDhtStunner -profiling { - QMAKE_CXXFLAGS -= -fomit-frame-pointer - QMAKE_CXXFLAGS *= -pg -g -fno-omit-frame-pointer -} - # treat warnings as error for better removing #QMAKE_CFLAGS += -Werror #QMAKE_CXXFLAGS += -Werror @@ -203,21 +190,11 @@ linux-* { PKGCONFIG *= libssl libupnp PKGCONFIG *= libcrypto zlib - LIBS *= -lpthread -ldl -} + no_sqlcipher:PKGCONFIG *= sqlite3 + LIBS *= -ldl -linux-* { DEFINES *= PLUGIN_DIR=\"\\\"$${PLUGIN_DIR}\\\"\" DEFINES *= DATA_DIR=\"\\\"$${DATA_DIR}\\\"\" - - ## where to put the librarys interface - #include_rsiface.path = "$${INC_DIR}" - #include_rsiface.files = $$PUBLIC_HEADERS - #INSTALLS += include_rsiface - - ## where to put the shared library itself - #target.path = "$$LIB_DIR" - #INSTALLS *= target } linux-g++ { @@ -234,7 +211,7 @@ version_detail_bash_script { PRE_TARGETDEPS = write_version_detail write_version_detail.commands = $$PWD/version_detail.sh } - win32 { + win32-* { QMAKE_EXTRA_TARGETS += write_version_detail PRE_TARGETDEPS = write_version_detail write_version_detail.commands = $$PWD/version_detail.bat @@ -263,13 +240,11 @@ win32-x-g++ { } ################################# Windows ########################################## -win32 { +win32-g++ { QMAKE_CC = $${QMAKE_CXX} OBJECTS_DIR = temp/obj MOC_DIR = temp/moc - DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T - # This defines the platform to be WinXP or later and is needed for getaddrinfo (_WIN32_WINNT_WINXP) - DEFINES *= WINVER=0x0501 + DEFINES *= STATICLIB # Switch on extra warnings QMAKE_CFLAGS += -Wextra @@ -289,15 +264,8 @@ win32 { CONFIG += upnp_miniupnpc - no_sqlcipher { - PKGCONFIG *= sqlite3 - LIBS += -lsqlite3 - } else { - LIBS += -lsqlcipher - } - - DEPENDPATH += . $$INC_DIR - INCLUDEPATH += . $$INC_DIR + wLibs = ws2_32 gdi32 uuid iphlpapi crypt32 ole32 winmm + LIBS += $$linkDynamicLibs(wLibs) } ################################# MacOSX ########################################## @@ -697,13 +665,16 @@ SOURCES += util/folderiterator.cc \ util/rsrecogn.cc \ util/rstime.cc - -upnp_miniupnpc { - HEADERS += upnp/upnputil.h upnp/upnphandler_miniupnp.h - SOURCES += upnp/upnputil.c upnp/upnphandler_miniupnp.cc +## Added for retrocompatibility remove ASAP +isEmpty(RS_UPNP_LIB) { + upnp_miniupnpc:RS_UPNP_LIB=miniupnpc + upnp_libupnp:RS_UPNP_LIB="upnp ixml threadutil" } -upnp_libupnp { +equals(RS_UPNP_LIB, miniupnpc) { + HEADERS += upnp/upnputil.h upnp/upnphandler_miniupnp.h + SOURCES += upnp/upnputil.c upnp/upnphandler_miniupnp.cc +} else { HEADERS += upnp/UPnPBase.h upnp/upnphandler_linux.h SOURCES += upnp/UPnPBase.cpp upnp/upnphandler_linux.cc DEFINES *= RS_USE_LIBUPNP @@ -934,19 +905,13 @@ android-* { DEFINES *= "fopen64=fopen" DEFINES *= "fseeko64=fseeko" DEFINES *= "ftello64=ftello" - LIBS *= -lbz2 -lupnp -lixml -lthreadutil -lsqlite3 -## Static library are verysensible to order in command line, has to be in the -## end of file for this reason +## Static library are very susceptible to order in command line + sLibs = bz2 $$RS_UPNP_LIB $$RS_SQL_LIB ssl crypto - LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lsqlcipher - PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libsqlcipher.a - - LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lssl - PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libssl.a - - LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lcrypto - PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libcrypto.a + LIBS += $$linkStaticLibs(sLibs) + PRE_TARGETDEPS += $$pretargetStaticLibs(sLibs) HEADERS += util/androiddebug.h } + diff --git a/libretroshare/src/use_libretroshare.pri b/libretroshare/src/use_libretroshare.pri new file mode 100644 index 000000000..d17e36739 --- /dev/null +++ b/libretroshare/src/use_libretroshare.pri @@ -0,0 +1,33 @@ +DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../libretroshare/src/)) +INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libretroshare/src)) +LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libretroshare/src/lib/)) -lretroshare + +equals(TARGET, retroshare):equals(TEMPLATE, lib){ +} else { + PRE_TARGETDEPS *= $$system_path($$clean_path($$OUT_PWD/../../libretroshare/src/lib/libretroshare.a)) +} + +!include("../../openpgpsdk/src/use_openpgpsdk.pri"):error("Including") + +bitdht { + !include("../../libbitdht/src/use_libbitdht.pri"):error("Including") +} + +sLibs = +mLibs = $$RS_SQL_LIB ssl crypto $$RS_THREAD_LIB $$RS_UPNP_LIB +dLibs = + +linux-* { + mLibs += dl +} + +static { + sLibs *= $$mLibs +} else { + dLibs *= $$mLibs +} + +LIBS += $$linkStaticLibs(sLibs) +PRE_TARGETDEPS += $$pretargetStaticLibs(sLibs) + +LIBS += $$linkDynamicLibs(dLibs) diff --git a/openpgpsdk/src/openpgpsdk.pro b/openpgpsdk/src/openpgpsdk.pro index eaf4ef2e6..f667a0d23 100644 --- a/openpgpsdk/src/openpgpsdk.pro +++ b/openpgpsdk/src/openpgpsdk.pro @@ -9,8 +9,8 @@ QMAKE_CXXFLAGS *= -Wall -Werror -W TARGET = ops DESTDIR = lib -DEPENDPATH += . $$INC_DIR -INCLUDEPATH += . $$INC_DIR + +!include(use_openpgpsdk.pri):error("Including") #################################### Windows ##################################### @@ -18,7 +18,11 @@ linux-* { OBJECTS_DIR = temp/linux/obj } -win32 { +win32-g++ { + + HEADERS += openpgpsdk/opsstring.h + SOURCES += openpgpsdk/opsstring.c + DEFINES *= WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T # Switch off optimization for release version @@ -27,9 +31,13 @@ win32 { QMAKE_CFLAGS_RELEASE -= -O2 QMAKE_CFLAGS_RELEASE += -O0 - # Switch on optimization for debug version - #QMAKE_CXXFLAGS_DEBUG += -O2 - #QMAKE_CFLAGS_DEBUG += -O2 + mLibs = bz2 z ssl crypto + static { + LIBS += $$linkStaticLibs(mLibs) + PRE_TARGETDEPS += $$pretargetStaticLibs(mLibs) + } else { + LIBS += $$linkDynamicLibs(mLibs) + } } @@ -74,9 +82,6 @@ HEADERS += openpgpsdk/writer.h \ openpgpsdk/parse_local.h \ openpgpsdk/keyring_local.h \ openpgpsdk/opsdir.h -win32{ -HEADERS += openpgpsdk/opsstring.h -} SOURCES += openpgpsdk/accumulate.c \ openpgpsdk/compress.c \ @@ -116,9 +121,7 @@ SOURCES += openpgpsdk/accumulate.c \ openpgpsdk/writer_skey_checksum.c \ openpgpsdk/writer_stream_encrypt_se_ip.c \ openpgpsdk/opsdir.c -win32{ -SOURCES += openpgpsdk/opsstring.c -} + ################################# Android ##################################### diff --git a/openpgpsdk/src/use_openpgpsdk.pri b/openpgpsdk/src/use_openpgpsdk.pri new file mode 100644 index 000000000..adf10f1ca --- /dev/null +++ b/openpgpsdk/src/use_openpgpsdk.pri @@ -0,0 +1,20 @@ +DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../openpgpsdk/src)) +INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../openpgpsdk/src)) +LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../openpgpsdk/src/lib/)) -lops + +!equals(TARGET, ops):PRE_TARGETDEPS *= $$system_path($$clean_path($${OUT_PWD}/../../openpgpsdk/src/lib/libops.a)) + +sLibs = +mLibs = ssl crypto z bz2 +dLibs = + +static { + sLibs *= $$mLibs +} else { + dLibs *= $$mLibs +} + +LIBS += $$linkStaticLibs(sLibs) +PRE_TARGETDEPS += $$pretargetStaticLibs(sLibs) + +LIBS += $$linkDynamicLibs(dLibs) diff --git a/retroshare-android-service/src/retroshare-android-service.pro b/retroshare-android-service/src/retroshare-android-service.pro index bcafa7725..f83392456 100644 --- a/retroshare-android-service/src/retroshare-android-service.pro +++ b/retroshare-android-service/src/retroshare-android-service.pro @@ -11,43 +11,8 @@ android-*:CONFIG += dll android-*:TEMPLATE = lib !android-*:TEMPLATE = app -DEPENDPATH *= ../../libresapi/src -INCLUDEPATH *= ../../libresapi/src -PRE_TARGETDEPS *= ../../libresapi/src/lib/libresapi.a -LIBS *= ../../libresapi/src/lib/libresapi.a +!include("../../libresapi/src/use_libresapi.pri"):error("Including") -DEPENDPATH *= ../../libretroshare/src -INCLUDEPATH *= ../../libretroshare/src -PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a -LIBS *= ../../libretroshare/src/lib/libretroshare.a - -win32 { - OBJECTS_DIR = temp/obj - - LIBS_DIR = $$PWD/../../libs/lib - LIBS += $$OUT_PWD/../../libretroshare/src/lib/libretroshare.a - LIBS += $$OUT_PWD/../../openpgpsdk/src/lib/libops.a - - for(lib, LIB_DIR):LIBS += -L"$$lib" - for(bin, BIN_DIR):LIBS += -L"$$bin" - - - LIBS += -lssl -lcrypto -lpthread -lminiupnpc -lz -lws2_32 - LIBS += -luuid -lole32 -liphlpapi -lcrypt32 -lgdi32 - LIBS += -lwinmm - - DEFINES *= WINDOWS_SYS WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T - - DEPENDPATH += . $$INC_DIR - INCLUDEPATH += . $$INC_DIR - - greaterThan(QT_MAJOR_VERSION, 4) { - # Qt 5 - RC_INCLUDEPATH += $$_PRO_FILE_PWD_/../../libretroshare/src - } else { - # Qt 4 - QMAKE_RC += --include-dir=$$_PRO_FILE_PWD_/../../libretroshare/src - } -} +!include("../../libretroshare/src/use_libretroshare.pri"):error("Including") SOURCES += service.cpp diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp index 5955cd421..91b306cc0 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.cpp +++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp @@ -35,7 +35,7 @@ #include #if defined(Q_OS_WIN) -#include +#include #endif /* Retroshare's Settings */ diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 7a6d8d2a9..9cf15c4f1 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -2,28 +2,24 @@ TEMPLATE = app QT += network xml -CONFIG += qt gui uic qrc resources idle bitdht -CONFIG += link_prl +CONFIG += qt gui uic qrc resources idle CONFIG += console TARGET = retroshare DEFINES += TARGET=\\\"$${TARGET}\\\" -# Plz never commit the .pro with these flags enabled. -# Use this flag when developping new features only. -# -#CONFIG += unfinished -#CONFIG += debug -#DEFINES *= SIGFPE_DEBUG +DEPENDPATH *= $${PWD} $${RS_INCLUDE_DIR} retroshare-gui +INCLUDEPATH *= $${PWD} $${RS_INCLUDE_DIR} retroshare-gui -profiling { - QMAKE_CXXFLAGS -= -fomit-frame-pointer - QMAKE_CXXFLAGS *= -pg -g -fno-omit-frame-pointer - QMAKE_LFLAGS *= -pg +libresapihttpserver { + !include("../../libresapi/src/use_libresapi.pri"):error("Including") + HEADERS *= gui/settings/WebuiPage.h + SOURCES *= gui/settings/WebuiPage.cpp + FORMS *= gui/settings/WebuiPage.ui } -retrotor { - DEFINES *= RETROTOR +!include("../../libretroshare/src/use_libretroshare.pri"):error("Including") +retrotor { FORMS += TorControl/TorControlWindow.ui SOURCES += TorControl/TorControlWindow.cpp HEADERS += TorControl/TorControlWindow.h @@ -59,22 +55,6 @@ RCC_DIR = temp/qrc UI_DIR = temp/ui MOC_DIR = temp/moc -#CONFIG += debug -debug { - QMAKE_CFLAGS += -g - QMAKE_CXXFLAGS -= -O2 - QMAKE_CXXFLAGS += -O0 - QMAKE_CFLAGS -= -O2 - QMAKE_CFLAGS += -O0 -} - -DEPENDPATH *= retroshare-gui -INCLUDEPATH *= retroshare-gui - -# treat warnings as error for better removing -#QMAKE_CFLAGS += -Werror -#QMAKE_CXXFLAGS += -Werror - ################################# Linux ########################################## # Put lib dir in QMAKE_LFLAGS so it appears before -L/usr/lib linux-* { @@ -133,7 +113,7 @@ version_detail_bash_script { PRE_TARGETDEPS = write_version_detail write_version_detail.commands = $$PWD/version_detail.sh } - win32 { + win32-* { QMAKE_EXTRA_TARGETS += write_version_detail PRE_TARGETDEPS = write_version_detail write_version_detail.commands = $$PWD/version_detail.bat @@ -165,7 +145,7 @@ win32-x-g++ { #################################### Windows ##################################### -win32 { +win32-g++ { CONFIG(debug, debug|release) { # show console output CONFIG += console @@ -185,8 +165,9 @@ win32 { QMAKE_LFLAGS += -Wl,-nxcompat } - # solve linker warnings because of the order of the libraries - QMAKE_LFLAGS += -Wl,--start-group + # Fix linking error (ld.exe: Error: export ordinal too large) due to too + # many exported symbols. + QMAKE_LFLAGS+=-Wl,--exclude-libs,ALL # Switch off optimization for release version QMAKE_CXXFLAGS_RELEASE -= -O2 @@ -199,15 +180,10 @@ win32 { #QMAKE_CFLAGS_DEBUG += -O2 OBJECTS_DIR = temp/obj - #LIBS += -L"D/Qt/2009.03/qt/plugins/imageformats" - #QTPLUGIN += qjpeg - for(lib, LIB_DIR):LIBS += -L"$$lib" - for(bin, BIN_DIR):LIBS += -L"$$bin" + dLib = ws2_32 gdi32 uuid ole32 iphlpapi crypt32 winmm + LIBS *= $$linkDynamicLibs(dLib) - LIBS += -lssl -lcrypto -lpthread -lminiupnpc -lz -lws2_32 - LIBS += -luuid -lole32 -liphlpapi -lcrypt32 -lgdi32 - LIBS += -lwinmm RC_FILE = gui/images/retroshare_win.rc # export symbols for the plugins @@ -220,11 +196,6 @@ win32 { QMAKE_PRE_LINK = $(CHK_DIR_EXISTS) lib || $(MKDIR) lib } - DEFINES *= WINDOWS_SYS WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T - - DEPENDPATH += . $$INC_DIR - INCLUDEPATH += . $$INC_DIR - greaterThan(QT_MAJOR_VERSION, 4) { # Qt 5 RC_INCLUDEPATH += $$_PRO_FILE_PWD_/../../libretroshare/src @@ -309,32 +280,11 @@ openbsd-* { LIBS *= -rdynamic } - - -############################## Common stuff ###################################### - -# On Linux systems that alredy have libssl and libcrypto it is advisable -# to rename the patched version of SSL to something like libsslxpgp.a and libcryptoxpg.a - -# ########################################### - -DEPENDPATH += . $$PWD/../../libretroshare/src/ -INCLUDEPATH += $$PWD/../../libretroshare/src/ - -PRE_TARGETDEPS *= $$OUT_PWD/../../libretroshare/src/lib/libretroshare.a -LIBS *= $$OUT_PWD/../../libretroshare/src/lib/libretroshare.a - wikipoos { PRE_TARGETDEPS *= $$OUT_PWD/../../supportlibs/pegmarkdown/lib/libpegmarkdown.a LIBS *= $$OUT_PWD/../../supportlibs/pegmarkdown/lib/libpegmarkdown.a } -# webinterface -DEPENDPATH += $$PWD/../../libresapi/src -INCLUDEPATH += $$PWD/../../libresapi/src -PRE_TARGETDEPS *= $$OUT_PWD/../../libresapi/src/lib/libresapi.a -LIBS += $$OUT_PWD/../../libresapi/src/lib/libresapi.a - retrotor { HEADERS += TorControl/AddOnionCommand.h \ TorControl/AuthenticateCommand.h \ @@ -439,7 +389,6 @@ HEADERS += rshare.h \ util/stringutil.h \ util/RsNetUtil.h \ util/DateTime.h \ - util/win32.h \ util/RetroStyleLabel.h \ util/dllexport.h \ util/NonCopyable.h \ @@ -619,7 +568,8 @@ HEADERS += rshare.h \ util/imageutil.h \ gui/NetworkDialog/pgpid_item_model.h \ gui/NetworkDialog/pgpid_item_proxy.h \ - gui/common/RsCollection.h + gui/common/RsCollection.h \ + util/retroshareWin32.h # gui/ForumsDialog.h \ # gui/forums/ForumDetails.h \ # gui/forums/EditForumDetails.h \ @@ -803,7 +753,6 @@ SOURCES += main.cpp \ util/stringutil.cpp \ util/RsNetUtil.cpp \ util/DateTime.cpp \ - util/win32.cpp \ util/RetroStyleLabel.cpp \ util/WidgetBackgroundImage.cpp \ util/NonCopyable.cpp \ @@ -981,7 +930,8 @@ SOURCES += main.cpp \ util/imageutil.cpp \ gui/NetworkDialog/pgpid_item_model.cpp \ gui/NetworkDialog/pgpid_item_proxy.cpp \ - gui/common/RsCollection.cpp + gui/common/RsCollection.cpp \ + util/retroshareWin32.cpp # gui/ForumsDialog.cpp \ # gui/forums/ForumDetails.cpp \ # gui/forums/EditForumDetails.cpp \ @@ -1419,9 +1369,3 @@ gxsgui { } - -libresapihttpserver { - HEADERS *= gui/settings/WebuiPage.h - SOURCES *= gui/settings/WebuiPage.cpp - FORMS *= gui/settings/WebuiPage.ui -} diff --git a/retroshare-gui/src/rshare.h b/retroshare-gui/src/rshare.h index fd17b0f13..2d154a361 100644 --- a/retroshare-gui/src/rshare.h +++ b/retroshare-gui/src/rshare.h @@ -27,7 +27,7 @@ #if defined(Q_OS_WIN) #include -#include +#include "util/retroshareWin32.h" #endif #include diff --git a/retroshare-gui/src/util/win32.cpp b/retroshare-gui/src/util/retroshareWin32.cpp similarity index 99% rename from retroshare-gui/src/util/win32.cpp rename to retroshare-gui/src/util/retroshareWin32.cpp index b928653fb..5a7f66b8c 100644 --- a/retroshare-gui/src/util/win32.cpp +++ b/retroshare-gui/src/util/retroshareWin32.cpp @@ -33,7 +33,7 @@ #endif #include -#include "win32.h" +#include "retroshareWin32.h" /** Finds the location of the "special" Windows folder using the given CSIDL diff --git a/retroshare-gui/src/util/win32.h b/retroshare-gui/src/util/retroshareWin32.h similarity index 97% rename from retroshare-gui/src/util/win32.h rename to retroshare-gui/src/util/retroshareWin32.h index 5b0dcdca3..8dbb351f3 100644 --- a/retroshare-gui/src/util/win32.h +++ b/retroshare-gui/src/util/retroshareWin32.h @@ -1,7 +1,8 @@ +#pragma once /**************************************************************** - * This file is distributed under the following license: - * - * Copyright (c) 2006-2007, crypton + * This file is distributed under the following license: + * + * Copyright (c) 2006-2007, crypton * Copyright (c) 2006, Matt Edman, Justin Hipple * * This program is free software; you can redistribute it and/or @@ -20,10 +21,6 @@ * Boston, MA 02110-1301, USA. ****************************************************************/ - -#ifndef _WIN32_H -#define _WIN32_H - #include #include @@ -41,6 +38,3 @@ void win32_registry_set_key_value(QString keyLocation, QString keyName, QString /** Removes the key from the registry if it exists */ void win32_registry_remove_key(QString keyLocation, QString keyName); - -#endif - diff --git a/retroshare-nogui/src/retroshare-nogui.pro b/retroshare-nogui/src/retroshare-nogui.pro index 1fdb27b71..8e731a9d1 100644 --- a/retroshare-nogui/src/retroshare-nogui.pro +++ b/retroshare-nogui/src/retroshare-nogui.pro @@ -2,22 +2,20 @@ TEMPLATE = app TARGET = retroshare-nogui -CONFIG += bitdht -#CONFIG += introserver CONFIG -= qt xml gui -CONFIG += link_prl -#CONFIG += debug -debug { - QMAKE_CFLAGS -= -O2 - QMAKE_CFLAGS += -O0 - QMAKE_CFLAGS += -g +DEPENDPATH *= $${PWD} $${RS_INCLUDE_DIR} +INCLUDEPATH *= $${PWD} $${RS_INCLUDE_DIR} - QMAKE_CXXFLAGS -= -O2 - QMAKE_CXXFLAGS += -O0 - QMAKE_CXXFLAGS += -g +libresapihttpserver { + !include("../../libresapi/src/use_libresapi.pri"):error("Including") + + HEADERS += TerminalApiClient.h + SOURCES += TerminalApiClient.cpp } +!include("../../libretroshare/src/use_libretroshare.pri"):error("Including") + ################################# Linux ########################################## linux-* { #CONFIG += version_detail_bash_script @@ -53,42 +51,32 @@ win32-x-g++ { LIBS += -lole32 -lwinmm RC_FILE = gui/images/retroshare_win.rc - - DEFINES *= WIN32 } #################################### Windows ##################################### -win32 { +win32-g++ { CONFIG += console OBJECTS_DIR = temp/obj RCC_DIR = temp/qrc UI_DIR = temp/ui MOC_DIR = temp/moc - # solve linker warnings because of the order of the libraries - QMAKE_LFLAGS += -Wl,--start-group + ## solve linker warnings because of the order of the libraries + #QMAKE_LFLAGS += -Wl,--start-group - CONFIG(debug, debug|release) { - } else { + CONFIG(debug, debug|release) { + } else { # Tell linker to use ASLR protection QMAKE_LFLAGS += -Wl,-dynamicbase # Tell linker to use DEP protection QMAKE_LFLAGS += -Wl,-nxcompat } - for(lib, LIB_DIR):LIBS += -L"$$lib" - LIBS += -lssl -lcrypto -lpthread -lminiupnpc -lz - LIBS += -lcrypto -lws2_32 -lgdi32 - LIBS += -luuid -lole32 -liphlpapi -lcrypt32 - LIBS += -lole32 -lwinmm + dLib = ws2_32 gdi32 uuid ole32 iphlpapi crypt32 winmm + LIBS *= $$linkDynamicLibs(dLib) RC_FILE = resources/retroshare_win.rc - - DEFINES *= WINDOWS_SYS _USE_32BIT_TIME_T - - DEPENDPATH += . $$INC_DIR - INCLUDEPATH += . $$INC_DIR } ##################################### MacOS ###################################### @@ -156,11 +144,6 @@ haiku-* { ############################## Common stuff ###################################### -DEPENDPATH += . $$PWD/../../libretroshare/src -INCLUDEPATH += . $$PWD/../../libretroshare/src - -PRE_TARGETDEPS *= $$OUT_PWD/../../libretroshare/src/lib/libretroshare.a -LIBS *= $$OUT_PWD/../../libretroshare/src/lib/libretroshare.a # Input HEADERS += notifytxt.h @@ -168,19 +151,9 @@ SOURCES += notifytxt.cc \ retroshare.cc introserver { +## Introserver is broken (doesn't compile) should be either fixed or removed + HEADERS += introserver.h SOURCES += introserver.cc DEFINES *= RS_INTRO_SERVER } - -libresapihttpserver { - DEFINES *= ENABLE_WEBUI - PRE_TARGETDEPS *= $$OUT_PWD/../../libresapi/src/lib/libresapi.a - LIBS += $$OUT_PWD/../../libresapi/src/lib/libresapi.a - DEPENDPATH += $$PWD/../../libresapi/src - INCLUDEPATH += $$PWD/../../libresapi/src - HEADERS += \ - TerminalApiClient.h - SOURCES += \ - TerminalApiClient.cpp -} diff --git a/retroshare-qml-app/src/retroshare-qml-app.pro b/retroshare-qml-app/src/retroshare-qml-app.pro index 15054102c..04b8d12ec 100644 --- a/retroshare-qml-app/src/retroshare-qml-app.pro +++ b/retroshare-qml-app/src/retroshare-qml-app.pro @@ -22,7 +22,6 @@ android-* { HEADERS += NativeCalls.h androidplatforminteracions.h SOURCES += NativeCalls.cpp androidplatforminteracions.cpp - ANDROID_EXTRA_LIBS *= $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libsqlite3.so ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android diff --git a/retroshare.pri b/retroshare.pri index 446c1bd61..b1eccbb09 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -1,14 +1,15 @@ +################################################################################ +## Documented build options (CONFIG) goes here as all the rest depend on them ## +## CONFIG must not be edited in other .pro files, aka if CONFIG need do be ##### +## programatically modified depending on platform or from CONFIG itself it ##### +## can be done ONLY inside this file (retroshare.pri) ########################## +################################################################################ + # To disable RetroShare-gui append the following # assignation to qmake command line "CONFIG+=no_retroshare_gui" CONFIG *= retroshare_gui no_retroshare_gui:CONFIG -= retroshare_gui -# To build the RetroTor executable, just uncomment the following option. -# RetroTor is a version of RS that automatically configures Tor for its own usage -# using only hidden nodes. It will not start if Tor is not working. - -# CONFIG *= retrotor - # To disable RetroShare-nogui append the following # assignation to qmake command line "CONFIG+=no_retroshare_nogui" CONFIG *= retroshare_nogui @@ -41,10 +42,10 @@ retroshare_qml_app:CONFIG -= no_retroshare_qml_app CONFIG *= no_libresapilocalserver libresapilocalserver:CONFIG -= no_libresapilocalserver -# To enable Qt dependencies in libresapi append the following -# assignation to qmake command line "CONFIG+=qt_dependencies" -CONFIG *= no_qt_dependencies -qt_dependencies:CONFIG -= no_qt_dependencies +# To enable libresapi settings handler in libresapi append the following +# assignation to qmake command line "CONFIG+=libresapi_settings" +CONFIG *= no_libresapi_settings +libresapi_settings:CONFIG -= no_libresapi_settings # To disable libresapi via HTTP (based on libmicrohttpd) append the following # assignation to qmake command line "CONFIG+=no_libresapihttpserver" @@ -62,6 +63,15 @@ no_sqlcipher:CONFIG -= sqlcipher CONFIG *= no_rs_autologin rs_autologin:CONFIG -= no_rs_autologin +# To build RetroShare Tor only version with automatic hidden node setup append +# the following assignation to qmake command line "CONFIG+=retrotor" +CONFIG *= no_retrotor +retrotor { + CONFIG -= no_retrotor + CONFIG *= rs_onlyhiddennode + DEFINES *= RETROTOR +} + # To have only hidden node generation append the following assignation # to qmake command line "CONFIG+=rs_onlyhiddennode" CONFIG *= no_rs_onlyhiddennode @@ -92,6 +102,11 @@ CONFIG *= rs_gxs_trans CONFIG *= no_rs_async_chat rs_async_chat:CONFIG -= no_rs_async_chat +# To disable bitdht append the following assignation to qmake command line +# "CONFIG+=no_bitdht" +CONFIG *= bitdht +no_bitdht:CONFIG -= bitdht + # To select your MacOsX version append the following assignation to qmake # command line "CONFIG+=rs_macos10.11" where 10.11 depends your version macx:CONFIG *= rs_macos10.11 @@ -100,20 +115,242 @@ rs_macos10.9:CONFIG -= rs_macos10.11 rs_macos10.10:CONFIG -= rs_macos10.11 rs_macos10.12:CONFIG -= rs_macos10.11 +########################################################################################################################################################### +# +# V07_NON_BACKWARD_COMPATIBLE_CHANGE_001: +# +# What: Computes the node id by performing a sha256 hash of the certificate's PGP signature, instead of simply picking up the last 20 bytes of it. +# +# Why: There is no real risk in forging a certificate with the same ID as the authentication is performed over the PGP signature of the certificate +# which hashes the full SSL certificate (i.e. the full serialized CERT_INFO structure). However the possibility to +# create two certificates with the same IDs is a problem, as it can be used to cause disturbance in the software. +# +# Backward compat: connexions impossible with non patched peers older than Nov 2017, probably because the SSL id that is computed is not the same on both side, +# and in particular unpatched peers see a cerficate with ID different (because computed with the old method) than the ID that was +# submitted when making friends. +# +# Note: the advantage of basing the ID on the signature rather than the public key is not very clear, given that the signature is based on a hash +# of the public key (and the rest of the certificate info). +# +# V07_NON_BACKWARD_COMPATIBLE_CHANGE_002: +# +# What: Use RSA+SHA256 instead of RSA+SHA1 for PGP certificate signatures +# +# Why: Sha1 is likely to be prone to primary collisions anytime soon, so it is urgent to turn to a more secure solution. +# +# Backward compat: unpatched peers after Nov 2017 are able to verify signatures since openpgp-sdk already handle it. +# +# V07_NON_BACKWARD_COMPATIBLE_CHANGE_003: +# +# What: Do not hash PGP certificate twice when signing +# +# Why: hasing twice is not per se a security issue, but it makes it harder to change the settings for hashing. +# +# Backward compat: patched peers cannot connect to non patched peers older than Nov 2017. +########################################################################################################################################################### + +#CONFIG += rs_v07_changes +rs_v07_changes { + DEFINES += V07_NON_BACKWARD_COMPATIBLE_CHANGE_001 + DEFINES += V07_NON_BACKWARD_COMPATIBLE_CHANGE_002 + DEFINES += V07_NON_BACKWARD_COMPATIBLE_CHANGE_003 +} + +################################################################################ +## RetroShare qmake functions goes here as all the rest may use them ########### +################################################################################ + +## This function is useful to look for the location of a file in a list of paths +## like the which command on linux, first paramether is the file name, +## second parameter is the name of a variable containing the list of folders +## where to look for. First match is returned. +defineReplace(findFileInPath) { + fileName=$$1 + pathList=$$2 + + for(mDir, $$pathList) { + attempt = $$clean_path($$mDir/$$fileName) + exists($$attempt) { + return($$system_path($$attempt)) + } + } + return() +} + +## This function return linker option to link statically the libraries contained +## in the variable given as paramether. +## Be carefull static library are very susceptible to order +defineReplace(linkStaticLibs) { + libsVarName = $$1 + retSlib = + + for(mLib, $$libsVarName) { + attemptPath=$$findFileInPath(lib$${mLib}.a, QMAKE_LIBDIR) + isEmpty(attemptPath):error(lib$${mLib}.a not found in [$${QMAKE_LIBDIR}]) + + retSlib += -L$$dirname(attemptPath) -l$$mLib + } + + return($$retSlib) +} + +## This function return pretarget deps for the static the libraries contained in +## the variable given as paramether. +defineReplace(pretargetStaticLibs) { + libsVarName = $$1 + + retPreTarget = + + for(mLib, $$libsVarName) { + attemptPath=$$findFileInPath(lib$${mLib}.a, QMAKE_LIBDIR) + isEmpty(attemptPath):error(lib$${mLib}.a not found in [$${QMAKE_LIBDIR}]) + + retPreTarget += $$attemptPath + } + + return($$retPreTarget) +} + +## This function return linker option to link dynamically the libraries +## contained in the variable given as paramether. +defineReplace(linkDynamicLibs) { + libsVarName = $$1 + retDlib = + + for(mLib, $$libsVarName) { + retDlib += -l$$mLib + } + + return($$retDlib) +} + + +################################################################################ +## Statements and variables that depends on build options (CONFIG)goes here #### +################################################################################ +## +## Defining the following variables may be needed depending on platform and +## build options (CONFIG) +## +## PREFIX String variable containing the directory considered as prefix set +## with = operator. +## QMAKE_LIBDIR, INCLUDEPATH Lists variables where qmake will look for includes +## and libraries. Add values using *= operator. +## RS_BIN_DIR, RS_LIB_DIR, RS_INCLUDE_DIR, RS_DATA_DIR, RS_PLUGIN_DIR String +## variables of directories where RetroShare components will be installed, on +## most platforms they are automatically calculated from PREFIX or in other +## ways. +## RS_SQL_LIB String viariable containing the name of the SQL library to use +## ("sqlcipher sqlite3", sqlite3) it is usually precalculated depending on +## CONFIG. +## RS_UPNP_LIB String viariable containing the name of the UPNP library to use +## (miniupnpc, "upnp ixml threadutil") it usually depend on platform. +## RS_THREAD_LIB String viariable containing the name of the multi threading +## library to use (pthread, "") it usually depend on platform. + +wikipoos:DEFINES *= RS_USE_WIKI +rs_gxs:DEFINES *= RS_ENABLE_GXS +libresapilocalserver:DEFINES *= LIBRESAPI_LOCAL_SERVER +libresapi_settings:DEFINES *= LIBRESAPI_SETTINGS +libresapihttpserver:DEFINES *= ENABLE_WEBUI +RS_THREAD_LIB=pthread +RS_UPNP_LIB = upnp ixml threadutil + +sqlcipher { + DEFINES -= NO_SQLCIPHER + RS_SQL_LIB = sqlcipher sqlite3 +} +no_sqlcipher { + DEFINES *= NO_SQLCIPHER + RS_SQL_LIB = sqlite3 +} + +rs_autologin { + DEFINES *= RS_AUTOLOGIN + warning("You have enabled RetroShare auto-login, this is discouraged. The usage of auto-login on some linux distributions may allow someone having access to your session to steal the SSL keys of your node location and therefore compromise your security") +} + +rs_onlyhiddennode { + DEFINES *= RS_ONLYHIDDENNODE + CONFIG -= bitdht + CONFIG *= no_bitdht + message("QMAKE: You have enabled only hidden node.") +} + +no_rs_deprecatedwarning { + QMAKE_CXXFLAGS += -Wno-deprecated + QMAKE_CXXFLAGS += -Wno-deprecated-declarations + DEFINES *= RS_NO_WARN_DEPRECATED + message("QMAKE: You have disabled deprecated warnings.") +} + +no_rs_cppwarning { + QMAKE_CXXFLAGS += -Wno-cpp + DEFINES *= RS_NO_WARN_CPP + message("QMAKE: You have disabled C preprocessor warnings.") +} + +rs_gxs_trans { + DEFINES *= RS_GXS_TRANS + greaterThan(QT_MAJOR_VERSION, 4) { + CONFIG += c++11 + } else { + QMAKE_CXXFLAGS += -std=c++0x + } +} + +rs_async_chat { + DEFINES *= RS_ASYNC_CHAT +} + +rs_chatserver { + DEFINES *= RS_CHATSERVER +} + +debug { + QMAKE_CXXFLAGS -= -O2 -fomit-frame-pointer + QMAKE_CFLAGS -= -O2 -fomit-frame-pointer + + QMAKE_CXXFLAGS *= -O0 -g -fno-omit-frame-pointer + QMAKE_CFLAGS *= -O0 -g -fno-omit-frame-pointer +} + +profiling { + QMAKE_CXXFLAGS -= -fomit-frame-pointer + QMAKE_CFLAGS -= -fomit-frame-pointer + + QMAKE_CXXFLAGS *= -pg -g -fno-omit-frame-pointer + QMAKE_CFLAGS *= -pg -g -fno-omit-frame-pointer + + QMAKE_LFLAGS *= -pg +} + +## Retrocompatibility assignations, get rid of this ASAP +isEmpty(BIN_DIR) : BIN_DIR = $${RS_BIN_DIR} +isEmpty(INC_DIR) : INC_DIR = $${RS_INCLUDE_DIR} +isEmpty(LIBDIR) : LIBDIR = $${QMAKE_LIBDIR} +isEmpty(DATA_DIR) : DATA_DIR = $${RS_DATA_DIR} +isEmpty(PLUGIN_DIR): PLUGIN_DIR= $${RS_PLUGIN_DIR} + + +################################################################################ +## Last goes platform specific statements common to all RetroShare subprojects # +################################################################################ linux-* { - isEmpty(PREFIX) { PREFIX = "/usr" } - isEmpty(BIN_DIR) { BIN_DIR = "$${PREFIX}/bin" } - isEmpty(INC_DIR) { INC_DIR = "$${PREFIX}/include/retroshare" } - isEmpty(LIB_DIR) { LIB_DIR = "$${PREFIX}/lib" } - isEmpty(DATA_DIR) { DATA_DIR = "$${PREFIX}/share/retroshare" } - isEmpty(PLUGIN_DIR) { PLUGIN_DIR = "$${LIB_DIR}/retroshare/extensions6" } + isEmpty(PREFIX) : PREFIX = "/usr" + isEmpty(RS_BIN_DIR) : RS_BIN_DIR = "$${PREFIX}/bin" + isEmpty(RS_INCLUDE_DIR): RS_INCLUDE_DIR = "$${PREFIX}/include" + isEmpty(RS_LIB_DIR) : RS_LIB_DIR = "$${PREFIX}/lib" + isEmpty(RS_DATA_DIR) : RS_DATA_DIR = "$${PREFIX}/share/retroshare" + isEmpty(RS_PLUGIN_DIR) : RS_PLUGIN_DIR = "$${RS_LIB_DIR}/retroshare/extensions6" + + INCLUDEPATH *= "$$RS_INCLUDE_DIR" + QMAKE_LIBDIR *= "$$RS_LIB_DIR" rs_autologin { - !macx { - DEFINES *= HAS_GNOME_KEYRING - PKGCONFIG *= gnome-keyring-1 - } + DEFINES *= HAS_GNOME_KEYRING + PKGCONFIG *= gnome-keyring-1 } } @@ -125,46 +362,66 @@ android-* { CONFIG -= no_retroshare_android_notify_service CONFIG *= retroshare_android_notify_service } - CONFIG *= no_libresapihttpserver upnp_libupnp - CONFIG -= libresapihttpserver upnp_miniupnpc + CONFIG *= no_libresapihttpserver + CONFIG -= libresapihttpserver QT *= androidextras - INCLUDEPATH += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/include - LIBS *= -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ + INCLUDEPATH *= $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/include + QMAKE_LIBDIR *= "$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/" + + # The android libc, bionic, provides built-in support for pthreads, + # additional linking (-lpthreads) break linking. + # See https://stackoverflow.com/a/31277163 + RS_THREAD_LIB = } -win32 { - message(***retroshare.pri:Win32) - exists($$PWD/../libs) { - message(Get pre-compiled libraries.) - isEmpty(PREFIX) { PREFIX = "$$PWD/../libs" } - isEmpty(BIN_DIR) { BIN_DIR = "$${PREFIX}/bin" } - isEmpty(INC_DIR) { INC_DIR = "$${PREFIX}/include" } - isEmpty(LIB_DIR) { LIB_DIR = "$${PREFIX}/lib" } - } +win32-g++ { + PREFIX_MSYS2 = $$(MINGW_PREFIX) + isEmpty(PREFIX_MSYS2) { + message("MINGW_PREFIX is not set, attempting MSYS2 autodiscovery.") - # Check for msys2 - PREFIX_MSYS2 = $$(MINGW_PREFIX) - isEmpty(PREFIX_MSYS2) { - exists(C:/msys32/mingw32/include) { - message(MINGW_PREFIX is empty. Set it in your environment variables.) - message(Found it here:C:\msys32\mingw32) - PREFIX_MSYS2 = "C:\msys32\mingw32" - } - exists(C:/msys64/mingw32/include) { - message(MINGW_PREFIX is empty. Set it in your environment variables.) - message(Found it here:C:\msys64\mingw32) - PREFIX_MSYS2 = "C:\msys64\mingw32" - } - } - !isEmpty(PREFIX_MSYS2) { - message(msys2 is installed.) - BIN_DIR += "$${PREFIX_MSYS2}/bin" - INC_DIR += "$${PREFIX_MSYS2}/include" - LIB_DIR += "$${PREFIX_MSYS2}/lib" - } + TEMPTATIVE_MSYS2=$$system_path(C:\\msys32\\mingw32) + exists($$clean_path($${TEMPTATIVE_MSYS2}/include)) { + PREFIX_MSYS2=$${TEMPTATIVE_MSYS2} + } + + TEMPTATIVE_MSYS2=$$system_path(C:\\msys64\\mingw32) + exists($$clean_path($${TEMPTATIVE_MSYS2}/include)) { + PREFIX_MSYS2=$${TEMPTATIVE_MSYS2} + } + + isEmpty(PREFIX_MSYS2) { + error(Cannot find MSYS2 please set MINGW_PREFIX) + } else { + message(Found MSYS2: $${PREFIX_MSYS2}) + } + } + + isEmpty(PREFIX) { + PREFIX = $$system_path($${PREFIX_MSYS2}) + } + + INCLUDEPATH *= $$system_path($${PREFIX}/include) + INCLUDEPATH *= $$system_path($${PREFIX_MSYS2}/include) + + QMAKE_LIBDIR *= $$system_path($${PREFIX}/lib) + QMAKE_LIBDIR *= $$system_path($${PREFIX_MSYS2}/lib) + + RS_BIN_DIR = $$system_path($${PREFIX}/bin) + RS_INCLUDE_DIR = $$system_path($${PREFIX}/include) + RS_LIB_DIR = $$system_path($${PREFIX}/lib) + + RS_UPNP_LIB = miniupnpc + + DEFINES *= NOGDI WIN32 WIN32_LEAN_AND_MEAN WINDOWS_SYS _USE_32BIT_TIME_T + + # This defines the platform to be WinXP or later and is needed for + # getaddrinfo (_WIN32_WINNT_WINXP) + DEFINES *= WINVER=0x0501 + + message(***retroshare.pri:Win32 PREFIX $$PREFIX INCLUDEPATH $$INCLUDEPATH QMAKE_LIBDIR $$QMAKE_LIBDIR DEFINES $$DEFINES) } -macx { +macx-* { rs_macos10.8 { message(***retroshare.pri: Set Target and SDK to MacOS 10.8 ) QMAKE_MACOSX_DEPLOYMENT_TARGET=10.8 @@ -206,102 +463,3 @@ macx { LIB_DIR += "/opt/local/lib" CONFIG += c++11 } - -unfinished { - CONFIG += gxscircles - CONFIG += gxsthewire - CONFIG += gxsphotoshare - CONFIG += wikipoos -} - -wikipoos:DEFINES *= RS_USE_WIKI -rs_gxs:DEFINES *= RS_ENABLE_GXS -libresapilocalserver:DEFINES *= LIBRESAPI_LOCAL_SERVER -qt_dependencies:DEFINES *= LIBRESAPI_QT -libresapihttpserver:DEFINES *= ENABLE_WEBUI -sqlcipher:DEFINES -= NO_SQLCIPHER -no_sqlcipher:DEFINES *= NO_SQLCIPHER -rs_autologin { - DEFINES *= RS_AUTOLOGIN - warning("You have enabled RetroShare auto-login, this is discouraged. The usage of auto-login on some linux distributions may allow someone having access to your session to steal the SSL keys of your node location and therefore compromise your security") -} - -retrotor { - CONFIG *= rs_onlyhiddennode -} - -rs_onlyhiddennode { - DEFINES *= RS_ONLYHIDDENNODE - warning("QMAKE: You have enabled only hidden node.") -} - -no_rs_deprecatedwarning { - QMAKE_CXXFLAGS += -Wno-deprecated - QMAKE_CXXFLAGS += -Wno-deprecated-declarations - DEFINES *= RS_NO_WARN_DEPRECATED - warning("QMAKE: You have disabled deprecated warnings.") -} - -no_rs_cppwarning { - QMAKE_CXXFLAGS += -Wno-cpp - DEFINES *= RS_NO_WARN_CPP - warning("QMAKE: You have disabled C preprocessor warnings.") -} - -rs_gxs_trans { - DEFINES *= RS_GXS_TRANS - greaterThan(QT_MAJOR_VERSION, 4) { - CONFIG += c++11 - } else { - QMAKE_CXXFLAGS += -std=c++0x - } -} - -rs_async_chat { - DEFINES *= RS_ASYNC_CHAT -} - -rs_chatserver { - DEFINES *= RS_CHATSERVER -} - -########################################################################################################################################################### -# -# V07_NON_BACKWARD_COMPATIBLE_CHANGE_001: -# -# What: Computes the node id by performing a sha256 hash of the certificate's PGP signature, instead of simply picking up the last 20 bytes of it. -# -# Why: There is no real risk in forging a certificate with the same ID as the authentication is performed over the PGP signature of the certificate -# which hashes the full SSL certificate (i.e. the full serialized CERT_INFO structure). However the possibility to -# create two certificates with the same IDs is a problem, as it can be used to cause disturbance in the software. -# -# Backward compat: connexions impossible with non patched peers older than Nov 2017, probably because the SSL id that is computed is not the same on both side, -# and in particular unpatched peers see a cerficate with ID different (because computed with the old method) than the ID that was -# submitted when making friends. -# -# Note: the advantage of basing the ID on the signature rather than the public key is not very clear, given that the signature is based on a hash -# of the public key (and the rest of the certificate info). -# -# V07_NON_BACKWARD_COMPATIBLE_CHANGE_002: -# -# What: Use RSA+SHA256 instead of RSA+SHA1 for PGP certificate signatures -# -# Why: Sha1 is likely to be prone to primary collisions anytime soon, so it is urgent to turn to a more secure solution. -# -# Backward compat: unpatched peers after Nov 2017 are able to verify signatures since openpgp-sdk already handle it. -# -# V07_NON_BACKWARD_COMPATIBLE_CHANGE_003: -# -# What: Do not hash PGP certificate twice when signing -# -# Why: hasing twice is not per se a security issue, but it makes it harder to change the settings for hashing. -# -# Backward compat: patched peers cannot connect to non patched peers older than Nov 2017. -########################################################################################################################################################### - -#CONFIG += rs_v07_changes -rs_v07_changes { - DEFINES += V07_NON_BACKWARD_COMPATIBLE_CHANGE_001 - DEFINES += V07_NON_BACKWARD_COMPATIBLE_CHANGE_002 - DEFINES += V07_NON_BACKWARD_COMPATIBLE_CHANGE_003 -} diff --git a/tests/unittests/unittests.pro b/tests/unittests/unittests.pro index 790ab1c6d..c17be5b77 100644 --- a/tests/unittests/unittests.pro +++ b/tests/unittests/unittests.pro @@ -1,6 +1,6 @@ !include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri") -QT += network xml script +QT += network xml CONFIG += bitdht CONFIG += gxs debug