diff --git a/sprouts.pro b/sprouts.pro index d836adb3347..0bebabcdb0e 100644 --- a/sprouts.pro +++ b/sprouts.pro @@ -25,18 +25,36 @@ contains(RELEASE, 1) { # Mac: compile for maximum compatibility (10.6, 64-bit) macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.6 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk - !windows:!macx { + !win32:!macx { # Linux: static link LIBS += -Wl,-Bstatic } } +!win32 { + # for extra security against potential buffer overflows: enable GCCs Stack Smashing Protection + QMAKE_CXXFLAGS *= -fstack-protector-all + QMAKE_LFLAGS *= -fstack-protector-all + # Exclude on Windows cross compile with MinGW 4.2.x, as it will result in a non-working executable! + # This can be enabled for Windows, when we switch to MinGW >= 4.4.x. +} + +# for extra security (see: https://wiki.debian.org/Hardening): this flag is GCC compiler-specific +QMAKE_CXXFLAGS *= -D_FORTIFY_SOURCE=2 +# for extra security on Windows: enable ASLR and DEP via GCC linker flags +win32:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat +# on Windows: enable GCC large address aware linker flag +win32:QMAKE_LFLAGS *= -Wl,--large-address-aware -static +# i686-w64-mingw32 +win32:QMAKE_LFLAGS *= -static-libgcc -static-libstdc++ + # use: qmake "USE_QRCODE=1" # libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support contains(USE_QRCODE, 1) { message(Building with QRCode support) DEFINES += USE_QRCODE - LIBS += -lqrencode + INCLUDEPATH += $$QRCODE_INCLUDE_PATH + LIBS += $$join(QRCODE_LIB_PATH,,-L) -lqrencode } # use: qmake "USE_UPNP=1" ( enabled by default; default) @@ -50,7 +68,7 @@ contains(USE_UPNP, -) { count(USE_UPNP, 0) { USE_UPNP=1 } - DEFINES += USE_UPNP=$$USE_UPNP STATICLIB + DEFINES += USE_UPNP=$$USE_UPNP MINIUPNP_STATICLIB INCLUDEPATH += $$MINIUPNPC_INCLUDE_PATH LIBS += $$join(MINIUPNPC_LIB_PATH,,-L,) -lminiupnpc win32:LIBS += -liphlpapi @@ -74,7 +92,7 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) { QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets } -!windows { +!win32 { # for extra security against potential buffer overflows QMAKE_CXXFLAGS += -fstack-protector QMAKE_LFLAGS += -fstack-protector @@ -82,7 +100,7 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) { } # regenerate src/build.h -!windows || contains(USE_BUILD_INFO, 1) { +!win32 | contains(USE_BUILD_INFO, 1) { genbuild.depends = FORCE genbuild.commands = cd $$PWD; /bin/sh share/genbuild.sh $$OUT_PWD/build/build.h genbuild.target = genbuildhook @@ -348,7 +366,7 @@ windows:!contains(MINGW_THREAD_BUGFIX, 0) { QMAKE_LIBS_QT_ENTRY = -lmingwthrd $$QMAKE_LIBS_QT_ENTRY } -!windows:!mac { +!win32:!mac { DEFINES += LINUX LIBS += -lrt } @@ -369,7 +387,7 @@ windows:LIBS += -lole32 -luuid -lgdi32 LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX contains(RELEASE, 1) { - !windows:!macx { + !win32:!macx { # Linux: turn dynamic linking back on for c/c++ runtime libraries LIBS += -Wl,-Bdynamic } diff --git a/src/net.cpp b/src/net.cpp index 07b78310ce9..1ea641b8cd5 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1714,8 +1714,12 @@ bool BindListenPort(const CService &addrBind, string& strError) // and enable it by default or not. Try to enable it, if possible. if (addrBind.IsIPv6()) { #ifdef IPV6_V6ONLY +#ifdef WIN32 + setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&nOne, sizeof(int)); +#else setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&nOne, sizeof(int)); #endif +#endif #ifdef WIN32 int nProtLevel = 10 /* PROTECTION_LEVEL_UNRESTRICTED */; int nParameterId = 23 /* IPV6_PROTECTION_LEVEl */; diff --git a/src/version.h b/src/version.h index 135f80d9703..1fc74701e01 100644 --- a/src/version.h +++ b/src/version.h @@ -17,7 +17,7 @@ #define PEERUNITY_VERSION_MAJOR 0 #define PEERUNITY_VERSION_MINOR 1 #define PEERUNITY_VERSION_REVISION 2 -#define PEERUNITY_VERSION_BUILD 2 +#define PEERUNITY_VERSION_BUILD 3 static const int PEERUNITY_VERSION = 1000000 * PEERUNITY_VERSION_MAJOR