diff --git a/.travis.yml b/.travis.yml index b02445b39..aebcc220b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ matrix: sudo: required compiler: gcc - os: osx - osx_image: xcode6.2 + osx_image: xcode9.3 compiler: clang sudo: false @@ -19,8 +19,12 @@ before_install: - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y build-essential libssl-dev libsqlcipher-dev libbz2-dev libmicrohttpd-dev libsqlite3-dev libupnp-dev pkg-config qt5-default libxss-dev qtmultimedia5-dev libqt5x11extras5-dev libqt5designer5 libxapian-dev qttools5-dev; fi - if [ $TRAVIS_OS_NAME == osx ]; then brew update ; fi - - if [ $TRAVIS_OS_NAME == osx ]; then brew install qt openssl miniupnpc libmicrohttpd sqlcipher xapian; fi - - if [ $TRAVIS_OS_NAME == osx ]; then brew link --force qt ; fi + - if [ $TRAVIS_OS_NAME == osx ]; then brew install ccach; export PATH="/usr/local/opt/ccache/libexec:$PATH" ; fi + - if [ $TRAVIS_OS_NAME == osx ]; then brew install qt5; fi + - if [ $TRAVIS_OS_NAME == osx ]; then brew link --force qt5 ; fi + - if [ $TRAVIS_OS_NAME == osx ]; then brew install openssl miniupnpc libmicrohttpd sqlcipher xapian; fi + - if [ $TRAVIS_OS_NAME == osx ]; then brew install p7zip; fi + - if [ $TRAVIS_OS_NAME == osx ]; then npm install -g appdmg; fi - wget https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz - tar -xf v1.1.0.tar.gz @@ -44,36 +48,37 @@ addons: before_script: - if [ $TRAVIS_OS_NAME == linux ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX; fi - - if [ $TRAVIS_OS_NAME == osx ]; then echo TEMPORARILY DISABLED qmake QMAKE_CC=$CC QMAKE_CXX=$CXX CONFIG+=rs_macos10.12 INCLUDEPATH+=/usr/local/opt/openssl/include/ QMAKE_LIBDIR+=/usr/local/opt/openssl/lib/; fi + - if [ $TRAVIS_OS_NAME == osx ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX CONFIG+=rs_macos10.13 CONFIG+=no_retroshare_plugins INCLUDEPATH+=/usr/local/opt/openssl/include/ INCLUDEPATH+=/usr/local/Cellar/sqlcipher/4.0.1/include INCLUDEPATH+=/usr/local/Cellar/libmicrohttpd/0.9.62_1/include QMAKE_LIBDIR+=/usr/local/opt/openssl/lib/ QMAKE_LIBDIR+=/usr/local/Cellar/libmicrohttpd/0.9.62_1/lib QMAKE_LIBDIR+=/usr/local/Cellar/sqlcipher/4.0.1/lib; fi script: + - if [ $TRAVIS_OS_NAME == osx ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make -j4; fi + +after_success: + - if [ $TRAVIS_OS_NAME == osx ]; then chmod +x ./travis_makeOSXPackage.sh && ./travis_makeOSXPackage.sh ; fi - if [ $TRAVIS_OS_NAME == linux ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make -j2; fi - - if [ $TRAVIS_OS_NAME == osx ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then echo TEMPORARILY DISABLED make -j2; fi -#after_success: -# - if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then rake deploy; fi - -#branches: -# only: -# - master -# - travis +# branches: +# only: +# - v0.6-MacOS-Travis-Deploy2 notifications: email: false irc: - channels: - - "chat.freenode.net#retroshare" - template: - - "%{repository}/%{branch} (%{commit} - %{author}): %{build_url}: %{message}" - - "Message: %{commit_message}" - - "Commit details: %{compare_url}" -# webhooks: -# urls: -# - https://webhooks.gitter.im/e/9502afd22ca6c8e85fb3 -# on_success: change -# on_failure: always -# on_start: always + channels: + - "chat.freenode.net#retroshare" + template: + - "%{repository}/%{branch} (%{commit} - %{author}): %{build_url}: %{message}" + - "Message: %{commit_message}" + - "Commit details: %{compare_url}" + +deploy: + provider: releases + api_key: + secure: auwuhxelaMriNaXzT8I03xrh1s+STicNyNToOWFCAYKxkWWQ4WeaCO6kRDmQrejhizMUILGU+s4FrWTEhDsviftGAF86EgzxxbSBfsHHAP4t2C0pcXX8/WxEoh1IrUs7iGCIpl7O2cvWqGidc20ROeptSEd1uQgkHnn14D9A2YmXf8g52PzqivKkb6HKfkVTPdmNJkMBT5eDtEw6DIk+DvnvRo6b6uanvVAKS9CBwXOdA3rLzaD9bz0LrdL9X1CNoTkGROyez0Lsc4zTr70id2Xfp1MMmJAV6hgQy+iwE37wRyrxJf3dkh5SUAAMUC9Xnvh/iBKNQKdQGhj2WGcV7GZV9k6u9DA1w2H0kcrwt9KHUXdhEQ67yr6Boa9ZFwdDb5VIOtC6iHAoDZXharHhiuxi0K/bCtwNAajrMjBCm9mWhEKvtoxUUYxAJajhJkkO3ERaOU3zHE+06esDzGozd2YOEH8a74HhYy4xvhR05Yj00hAWLS2kIaUITiqmBf6Yuh5XwH7KCDcapxF59ROWqyicdwtbfWpvN8IvFuGKyxYuEfoT8WxZ4lZpo4Q9CrTB7gedJYJxYNfZE/okWoFBb4cpPI94PHo3DZPR7lVyQ60RNyeR0nOeqf8NW8cBT1G4jw3u1LEyAdyvup+54aALw0DCVyoDojSXB8s+AlQG2JE= + file: retroshare-gui/src/retroshare.dmg + skip_cleanup: true + on: + repo: retroshare/RetroShare + branch: v0.6-OSX-Deploy -#env: -# - RVM=2.0.0 LANG="en_US.UTF-8" diff --git a/libbitdht/src/util/bdthreads.cc b/libbitdht/src/util/bdthreads.cc index 942df305f..3fce7ff43 100644 --- a/libbitdht/src/util/bdthreads.cc +++ b/libbitdht/src/util/bdthreads.cc @@ -121,7 +121,7 @@ void bdThread::join() /* waits for the the mTid thread to stop */ mMutex.lock(); { -#if defined(_WIN32) || defined(__MINGW32__) +#if defined(_WIN32) || defined(__MINGW32__) || defined(__APPLE__) /* Its a struct in Windows compile and the member .p ist checked in the pthreads library */ #else if(mTid > 0) diff --git a/libresapi/src/api/json.cpp b/libresapi/src/api/json.cpp index 16f238f39..82c598341 100644 --- a/libresapi/src/api/json.cpp +++ b/libresapi/src/api/json.cpp @@ -19,7 +19,6 @@ * along with this program. If not, see . * * * *******************************************************************************/ -#define nullptr 0 #include "json.h" #include @@ -33,6 +32,7 @@ #include #include #include +#include "util/cxx11retrocompat.h" #ifndef WIN32 #define _stricmp strcasecmp diff --git a/libretroshare/src/retroshare/rstypes.h b/libretroshare/src/retroshare/rstypes.h index 1221f806c..71a8406a1 100644 --- a/libretroshare/src/retroshare/rstypes.h +++ b/libretroshare/src/retroshare/rstypes.h @@ -277,11 +277,27 @@ struct DirStub : RsSerializable { RS_SERIAL_PROCESS(type); RS_SERIAL_PROCESS(name); + #if defined(__GNUC__) && !defined(__clang__) # pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // defined(__GNUC__) && !defined(__clang__) - std::uintptr_t& handle(reinterpret_cast(ref)); - RS_SERIAL_PROCESS(handle); + // (Cyril) We have to do this because on some systems (MacOS) uintptr_t is unsigned long which is not well defined. It is always + // preferable to force type serialization to the correct size rather than letting the compiler choose for us. + // /!\ This structure cannot be sent over the network. The serialization would be inconsistent. + + if(sizeof(ref) == 4) + { + std::uint32_t& handle(reinterpret_cast(ref)); + RS_SERIAL_PROCESS(handle); + } + else if(sizeof(ref) == 8) + { + std::uint64_t& handle(reinterpret_cast(ref)); + RS_SERIAL_PROCESS(handle); + } + else + std::cerr << __PRETTY_FUNCTION__ << ": cannot serialize raw pointer of size " << sizeof(ref) << std::endl; + #if defined(__GNUC__) && !defined(__clang__) # pragma GCC diagnostic pop #endif // defined(__GNUC__) && !defined(__clang__) @@ -322,13 +338,32 @@ struct DirDetails : RsSerializable #if defined(__GNUC__) && !defined(__clang__) # pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // defined(__GNUC__) && !defined(__clang__) - std::uintptr_t& handle(reinterpret_cast(ref)); - RS_SERIAL_PROCESS(handle); - std::uintptr_t& parentHandle(reinterpret_cast(parent)); - RS_SERIAL_PROCESS(parentHandle); + + // (Cyril) We have to do this because on some systems (MacOS) uintptr_t is unsigned long which is not well defined. It is always + // preferable to force type serialization to the correct size rather than letting the compiler choose for us. + // /!\ This structure cannot be sent over the network. The serialization would be inconsistent. + + if(sizeof(ref) == 4) + { + std::uint32_t& handle(reinterpret_cast(ref)); + RS_SERIAL_PROCESS(handle); + std::uint32_t& parentHandle(reinterpret_cast(parent)); + RS_SERIAL_PROCESS(parentHandle); + } + else if(sizeof(ref) == 8) + { + std::uint64_t& handle(reinterpret_cast(ref)); + RS_SERIAL_PROCESS(handle); + std::uint64_t& parentHandle(reinterpret_cast(parent)); + RS_SERIAL_PROCESS(parentHandle); + } + else + std::cerr << __PRETTY_FUNCTION__ << ": cannot serialize raw pointer of size " << sizeof(ref) << std::endl; + #if defined(__GNUC__) && !defined(__clang__) # pragma GCC diagnostic pop #endif // defined(__GNUC__) && !defined(__clang__) + RS_SERIAL_PROCESS(prow); RS_SERIAL_PROCESS(type); RS_SERIAL_PROCESS(id); diff --git a/libretroshare/src/serialiser/rstypeserializer.h b/libretroshare/src/serialiser/rstypeserializer.h index da34e1baf..768194a06 100644 --- a/libretroshare/src/serialiser/rstypeserializer.h +++ b/libretroshare/src/serialiser/rstypeserializer.h @@ -131,7 +131,7 @@ struct RsTypeSerializer /// Generic types template - typename std::enable_if::value || !(std::is_base_of::value || std::is_enum::value || std::is_base_of::value)>::type + typename std::enable_if::value || !(std::is_base_of::value || std::is_enum::value || std::is_base_of::value )>::type static /*void*/ serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx, T& member, const std::string& member_name ) diff --git a/retroshare.pri b/retroshare.pri index d6b66d44c..13402cf3e 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -154,6 +154,7 @@ rs_macos10.8:CONFIG -= rs_macos10.11 rs_macos10.9:CONFIG -= rs_macos10.11 rs_macos10.10:CONFIG -= rs_macos10.11 rs_macos10.12:CONFIG -= rs_macos10.11 +rs_macos10.13:CONFIG -= rs_macos10.11 # To enable JSON API append the following assignation to qmake command line # "CONFIG+=rs_jsonapi" @@ -627,16 +628,34 @@ macx-* { QMAKE_CXXFLAGS += -Wno-nullability-completeness QMAKE_CFLAGS += -Wno-nullability-completeness } + rs_macos10.13 { + message(***retroshare.pri: Set Target and SDK to MacOS 10.13 ) + QMAKE_MACOSX_DEPLOYMENT_TARGET=10.13 + QMAKE_MAC_SDK = macosx10.13 + QMAKE_CXXFLAGS += -Wno-nullability-completeness + QMAKE_CFLAGS += -Wno-nullability-completeness + } + message(***retroshare.pri:MacOSX) - BIN_DIR += "/usr/bin" - INC_DIR += "/usr/include" - INC_DIR += "/usr/local/include" - INC_DIR += "/opt/local/include" - LIB_DIR += "/usr/local/lib" - LIB_DIR += "/opt/local/lib" + # BIN_DIR += "/usr/bin" + # INC_DIR += "/usr/include" + # INC_DIR += "/usr/local/include" + # INC_DIR += "/opt/local/include" + # LIB_DIR += "/usr/local/lib" + # LIB_DIR += "/opt/local/lib" + BIN_DIR += "/Applications/Xcode.app/Contents/Developer/usr/bin" + INC_DIR += "/usr/local/Cellar/miniupnpc/2.1/include" + INC_DIR += "/usr/local/Cellar/libmicrohttpd/0.9.62_1/include" + INC_DIR += "/usr/local/Cellar/sqlcipher/4.0.1/include" + LIB_DIR += "/usr/local/opt/openssl/lib/" + LIB_DIR += "/usr/local/Cellar/libmicrohttpd/0.9.62_1/lib" + LIB_DIR += "/usr/local/Cellar/sqlcipher/4.0.1/lib" + LIB_DIR += "/usr/local/Cellar/miniupnpc/2.1/lib" CONFIG += c++11 - RS_UPNP_LIB = miniupnpc + INCLUDEPATH += "/usr/local/include" + RS_UPNP_LIB = miniupnpc + QT += macextras } diff --git a/travis_makeOSXPackage.sh b/travis_makeOSXPackage.sh new file mode 100644 index 000000000..eb66c7ef3 --- /dev/null +++ b/travis_makeOSXPackage.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +# Install the 7z to create dmg archives. +brew install p7zip + +# Package your app +echo "Packaging retroshare..." +#cd ${project_dir}/build/macOS/clang/x86_64/release/ +cd retroshare-gui/src/ + +# Remove build directories that you don't want to deploy +rm -rf moc +rm -rf obj +rm -rf qrc + +# if test "${TAG_NAME}" = "" ; then +# TAG_NAME = "no_tag" ; +# echo No specific tag used. +# fi + +# This automatically creates retroshare.dmg + +echo "Creating dmg archive..." +macdeployqt retroshare.app -dmg + +#mv retroshare.dmg "retroshare_${TAG_NAME}.dmg" + +# You can use the appdmg command line app to create your dmg file if +# you want to use a custom background and icon arrangement. I'm still +# working on this for my apps, myself. If you want to do this, you'll +# remove the -dmg option above. +# appdmg json-path YourApp_${TRAVIS_TAG}.dmg + +# Copy other project files +# cp "${project_dir}/README.md" "README.md" +# cp "${project_dir}/LICENSE" "LICENSE" +# cp "${project_dir}/Qt License" "Qt License"