diff --git a/.travis.yml b/.travis.yml index cc75af004..14de55fd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ language: cpp matrix: include: - os: linux - dist: trusty + dist: bionic sudo: required compiler: gcc - os: osx @@ -16,21 +16,24 @@ matrix: before_install: - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update; fi - - 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 == linux ]; then + sudo apt-get install -y + build-essential libssl-dev libsqlcipher-dev libbz2-dev libsqlite3-dev + libupnp-dev pkg-config qt5-default libxss-dev qtmultimedia5-dev + libqt5x11extras5-dev libqt5designer5 libxapian-dev qttools5-dev + rapidjson-dev ; + fi - if [ $TRAVIS_OS_NAME == osx ]; then brew update ; 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 cmark; fi + - > + if [ $TRAVIS_OS_NAME == osx ]; then + brew install openssl miniupnpc rapidjson sqlcipher xapian cmark; + 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 - - if [ $TRAVIS_OS_NAME == osx ]; then cp -r rapidjson-1.1.0/include/rapidjson/ /usr/local/include/rapidjson ; fi - - if [ $TRAVIS_OS_NAME == linux ]; then sudo cp -r rapidjson-1.1.0/include/rapidjson/ /usr/include/rapidjson ; fi - env: global: # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created @@ -49,13 +52,23 @@ addons: before_script: - env - if [ $TRAVIS_OS_NAME == linux ]; then qmake; fi - - if [ $TRAVIS_OS_NAME == osx ]; then qmake CONFIG+=rs_macos10.14 INCLUDEPATH+=/usr/local/opt/openssl/include/ INCLUDEPATH+=$(find /usr/local/Cellar/sqlcipher/*/include | headn -n 1) INCLUDEPATH+=$(find /usr/local/Cellar/libmicrohttpd/*/include | head -n 1) QMAKE_LIBDIR+=/usr/local/opt/openssl/lib/ QMAKE_LIBDIR+=$(find /usr/local/Cellar/libmicrohttpd/*/lib | head -n 1) QMAKE_LIBDIR+=$(find /usr/local/Cellar/sqlcipher/*/lib | head -n 1); fi + - > + if [ $TRAVIS_OS_NAME == osx ]; then + qmake CONFIG+=rs_macos10.14 + INCLUDEPATH+=$(find /usr/local/Cellar/miniupnpc/*/include | head -n 1) + QMAKE_LIBDIR+=$(find /usr/local/Cellar/miniupnpc/*/lib/ | head -n 1) + INCLUDEPATH+=$(find /usr/local/Cellar/openssl*/*/include/ | head -n 1) + QMAKE_LIBDIR+=$(find /usr/local/Cellar/openssl*/*/lib/ | head -n 1) + INCLUDEPATH+=$(find /usr/local/Cellar/rapidjson/*/include | head -n 1) + INCLUDEPATH+=$(find /usr/local/Cellar/sqlcipher/*/include | head -n 1) + QMAKE_LIBDIR+=$(find /usr/local/Cellar/sqlcipher/*/lib | head -n 1); + fi script: - - if [ $TRAVIS_OS_NAME == osx ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make -j4; fi + - if [ "${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 == osx ]; then build_scripts/OSX/travis_makeOSXPackage.sh ; fi - if [ $TRAVIS_OS_NAME == linux ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make -j2; fi diff --git a/README.asciidoc b/README.asciidoc index 2086c1bd5..c2aad3e7f 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -2,8 +2,7 @@ RetroShare is a decentralized, private, secure, cross-platform, communication toolkit. -RetroShare provides filesharing, chat, messages, forums, channels and -more. +RetroShare provides filesharing, chat, messages, forums, channels and more. .Build Status |=============================================================================== @@ -15,10 +14,14 @@ more. == Compilation It is very difficult to keep a comprehensive (we support many platforms) and -updated documentation on how to build retroshare, instead we provide scripts and -receipts that are used to create the packages for the supported platforms and +updated documentation on how to build RetroShare, instead we provide scripts and +recipes that are used to create the packages for the supported platforms and more in the `build_scripts` directory of this repository. +Those packaging receipts together with the continuous integration files +`.travis.yml` and `appveyor.yml` are a good source of knowledge on how to +compile RetroShare on different platforms. + == Using RetroShare on a headless computer with WebUI diff --git a/RetroShare.pro b/RetroShare.pro index 845cdd3a6..2e9b0a17f 100644 --- a/RetroShare.pro +++ b/RetroShare.pro @@ -16,6 +16,8 @@ # along with this program. If not, see . # ################################################################################ +CONFIG += c++11 + !include("retroshare.pri"): error("Could not include file retroshare.pri") TEMPLATE = subdirs @@ -29,12 +31,6 @@ rs_jsonapi:isEmpty(JSONAPI_GENERATOR_EXE) { libretroshare.depends += jsonapi-generator } -rs_webui { - !rs_jsonapi { - error("rs_webui requires rs_jsonapi") - } -} - SUBDIRS += libbitdht libbitdht.file = libbitdht/src/libbitdht.pro libretroshare.depends += openpgpsdk libbitdht diff --git a/appveyor.yml b/appveyor.yml index 98686b717..d74e82c77 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -90,8 +90,10 @@ install: # Configuring MSys2 - set PATH=C:\msys64\usr\bin;%PATH% - set PATH=C:\msys64\mingw32\bin;%PATH% - - pacman --noconfirm -S mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd mingw-w64-i686-xapian-core mingw-w64-i686-cmark - #- pacman --noconfirm -S mingw-w64-i686-qt5-static mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd + - > + pacman --noconfirm -S + mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-rapidjson + mingw-w64-i686-sqlcipher mingw-w64-i686-xapian-core mingw-w64-i686-cmark #- set PATH=C:\msys64\mingw32\qt5-static\bin\;%PATH% # Configuring Qt @@ -138,6 +140,10 @@ configuration: Release # scripts to run before build before_build: - cd C:\projects\RetroShare + - git submodule update --init + - cd C:\projects\ + - mkdir RetroShare-build + - cd RetroShare-build # - find C:\ > filelist.txt # scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services) @@ -146,15 +152,18 @@ before_package: # to run your custom scripts instead of automatic MSBuild build_script: - env - - git submodule update --init - - qmake -Wall -spec win32-g++ "CONFIG=debug" + - qmake ../RetroShare -spec win32-g++ "CONFIG+=debug" - mingw32-make -j3 # scripts to run after build after_build: + - find . + - mkdir %RS_DEPLOY% - - copy retroshare-service\src\retroshare-service.exe %RS_DEPLOY%\ - - copy retroshare-gui\src\retroshare.exe %RS_DEPLOY%\ + - copy retroshare-gui\src\debug\retroshare.exe %RS_DEPLOY%\ + - copy retroshare-service\src\debug\retroshare-service.exe %RS_DEPLOY%\ +# - copy retroshare-service\src\retroshare-service.exe %RS_DEPLOY%\ +# - copy retroshare-gui\src\retroshare.exe %RS_DEPLOY%\ ## In Debug build winedeplyqt forget the non debug Qt libs - copy C:\msys64\mingw32\bin\Qt5Svg.dll %RS_DEPLOY%\ @@ -234,24 +243,10 @@ after_build: - copy C:\msys64\mingw32\bin\libwebpdemux*.dll %RS_DEPLOY%\ - copy C:\msys64\mingw32\bin\liblzma*.dll %RS_DEPLOY%\ -## Needed for libresapi http - - copy C:\msys64\mingw32\bin\libmicrohttpd*.dll %RS_DEPLOY%\ - - copy C:\msys64\mingw32\bin\libgnutls*.dll %RS_DEPLOY%\ - - copy C:\msys64\mingw32\bin\libgmp*.dll %RS_DEPLOY%\ - - copy C:\msys64\mingw32\bin\libhogweed*.dll %RS_DEPLOY%\ - - copy C:\msys64\mingw32\bin\libidn2*.dll %RS_DEPLOY%\ - - copy C:\msys64\mingw32\bin\libnettle*.dll %RS_DEPLOY%\ - - copy C:\msys64\mingw32\bin\libp11-kit*.dll %RS_DEPLOY%\ - - copy C:\msys64\mingw32\bin\libtasn1*.dll %RS_DEPLOY%\ - - copy C:\msys64\mingw32\bin\libunistring*.dll %RS_DEPLOY%\ - - copy C:\msys64\mingw32\bin\libffi*.dll %RS_DEPLOY%\ - ## Needed for cmark - copy C:\msys64\mingw32\bin\libcmark*.dll %RS_DEPLOY%\ - copy C:\msys64\mingw32\bin\libdouble-conversion*.dll %RS_DEPLOY%\ - - find C:\projects\RetroShare >> filelist.txt - # to disable automatic builds #build: off diff --git a/build_scripts/OSX/travis_makeOSXPackage.sh b/build_scripts/OSX/travis_makeOSXPackage.sh old mode 100644 new mode 100755 diff --git a/libretroshare/src/jsonapi/jsonapi.cpp b/libretroshare/src/jsonapi/jsonapi.cpp index 3884775da..b15dbefb5 100644 --- a/libretroshare/src/jsonapi/jsonapi.cpp +++ b/libretroshare/src/jsonapi/jsonapi.cpp @@ -17,8 +17,6 @@ * * *******************************************************************************/ -#include "jsonapi.h" - #include #include #include @@ -26,6 +24,9 @@ #include #include + +#include "jsonapi.h" + #include "util/rsjson.h" #include "retroshare/rsfiles.h" #include "util/radix64.h" @@ -36,6 +37,7 @@ #include "util/rsurl.h" #include "util/rstime.h" #include "retroshare/rsevents.h" +#include "retroshare/rsversion.h" // Generated at compile time #include "jsonapi-includes.inl" @@ -644,3 +646,14 @@ void JsonApiServer::runloop() RsInfo() << __PRETTY_FUNCTION__ << " finished!" << std::endl; } + +/*static*/ void RsJsonApi::version( + uint32_t& major, uint32_t& minor, uint32_t& mini, std::string& extra, + std::string& human ) +{ + major = RS_MAJOR_VERSION; + minor = RS_MINOR_VERSION; + mini = RS_MINI_VERSION; + extra = RS_EXTRA_VERSION; + human = RS_HUMAN_READABLE_VERSION; +} diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 0a9c75322..369f8075f 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -172,8 +172,6 @@ HEADERS += plugins/pluginmanager.h \ HEADERS += $$PUBLIC_HEADERS -SOURCES *= services/rsversion.cxx - ################################# Linux ########################################## linux-* { CONFIG += link_pkgconfig diff --git a/libretroshare/src/retroshare/rsjsonapi.h b/libretroshare/src/retroshare/rsjsonapi.h index e5c59c496..07a18c6b9 100644 --- a/libretroshare/src/retroshare/rsjsonapi.h +++ b/libretroshare/src/retroshare/rsjsonapi.h @@ -158,5 +158,17 @@ public: */ virtual bool isAuthTokenValid(const std::string& token) = 0; + /** + * @brief Write version information to given paramethers + * @jsonapi{development,unauthenticated} + * @param[out] major storage + * @param[out] minor storage + * @param[out] mini storage + * @param[out] extra storage + * @param[out] human storage + */ + static void version( uint32_t& major, uint32_t& minor, uint32_t& mini, + std::string& extra, std::string& human ); + virtual ~RsJsonApi() = default; }; diff --git a/libretroshare/src/retroshare/rsversion.h b/libretroshare/src/retroshare/rsversion.h index dde4fde89..b28aef021 100644 --- a/libretroshare/src/retroshare/rsversion.h +++ b/libretroshare/src/retroshare/rsversion.h @@ -80,34 +80,6 @@ constexpr auto RS_HUMAN_READABLE_VERSION = RS_PRIVATE_STRINGIFY(RS_MINOR_VERSION) "." \ RS_PRIVATE_STRINGIFY(RS_MINI_VERSION) RS_EXTRA_VERSION; - -#include -#include - -/** - * Helper to expose version information to JSON API. - * From C++ you should use directly the macro and constants defined upstair - * @jsonapi{development} - */ -class RsVersion -{ -public: - /** - * @brief Write version information to given paramethers - * @jsonapi{development,unauthenticated} - * @param[out] major storage - * @param[out] minor storage - * @param[out] mini storage - * @param[out] extra storage - * @param[out] human storage - */ - static void version( uint32_t& major, uint32_t& minor, uint32_t& mini, - std::string& extra, std::string& human ); -}; - -/** - * Pointer to global instance of RsVersion, for the sake of JSON API, from C++ - * you can use directly the macro and constants defined upstair - * @jsonapi{development} - */ -extern RsVersion* rsVersion; +/* Because RetroShare-gui include this file in gui/images/retroshare_win.rc + * including any C++ things like `#include ` will break compilation of + * RetroShare-gui on Windows. Therefore this file must be kept minimal. */ diff --git a/libretroshare/src/serialiser/rstypeserializer.cc b/libretroshare/src/serialiser/rstypeserializer.cc index c166ce39c..47fd99e45 100644 --- a/libretroshare/src/serialiser/rstypeserializer.cc +++ b/libretroshare/src/serialiser/rstypeserializer.cc @@ -32,12 +32,7 @@ #include #include #include // for typeid - -#ifdef HAS_RAPIDJSON #include -#else -#include -#endif // HAS_RAPIDJSON static constexpr uint32_t MAX_SERIALIZED_CHUNK_SIZE = 10*1024*1024 ; // 10 MB. diff --git a/libretroshare/src/services/rsversion.cxx b/libretroshare/src/services/rsversion.cxx deleted file mode 100644 index b4a06f7f7..000000000 --- a/libretroshare/src/services/rsversion.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * * - * libretroshare: retroshare core library * - * * - * Copyright (C) 2019 Gioacchino Mazzurco * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Lesser General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ - -#include "retroshare/rsversion.h" - -/*extern*/ RsVersion* rsVersion = new RsVersion; - -/*static*/ void RsVersion::version( - uint32_t& major, uint32_t& minor, uint32_t& mini, std::string& extra, - std::string& human ) -{ - major = RS_MAJOR_VERSION; - minor = RS_MINOR_VERSION; - mini = RS_MINI_VERSION; - extra = RS_EXTRA_VERSION; - human = RS_HUMAN_READABLE_VERSION; -} diff --git a/libretroshare/src/use_libretroshare.pri b/libretroshare/src/use_libretroshare.pri index 9b9622574..11a9801d8 100644 --- a/libretroshare/src/use_libretroshare.pri +++ b/libretroshare/src/use_libretroshare.pri @@ -38,11 +38,10 @@ bitdht { # always possible to find them RAPIDJSON_AVAILABLE = $$system(pkg-config --atleast-version 1.1 RapidJSON && echo yes) isEmpty(RAPIDJSON_AVAILABLE) { - message("using built-in rapidjson") + message("using rapidjson from submodule") INCLUDEPATH *= $$clean_path($${PWD}/../../supportlibs/rapidjson/include) } else { message("using system rapidjson") - DEFINES *= HAS_RAPIDJSON } diff --git a/libretroshare/src/util/rsjson.cc b/libretroshare/src/util/rsjson.cc index 37f6282e4..8af1cf942 100644 --- a/libretroshare/src/util/rsjson.cc +++ b/libretroshare/src/util/rsjson.cc @@ -19,19 +19,12 @@ * * *******************************************************************************/ +#include +#include +#include + #include "util/rsjson.h" -#ifdef HAS_RAPIDJSON -# include -# include -# include -#else -# include -# include -# include -#endif // HAS_RAPIDJSON - - inline int getJsonManipulatorStatePosition() { static int p = std::ios_base::xalloc(); diff --git a/libretroshare/src/util/rsjson.h b/libretroshare/src/util/rsjson.h index 8bbb2a992..db864a73f 100644 --- a/libretroshare/src/util/rsjson.h +++ b/libretroshare/src/util/rsjson.h @@ -21,12 +21,7 @@ #pragma once #include - -#ifdef HAS_RAPIDJSON -# include -#else -# include -#endif // HAS_RAPIDJSON +#include /** * Use this type for JSON documents representations in RetroShare code diff --git a/retroshare.pri b/retroshare.pri index 0158b2957..f74fc7aa4 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -164,13 +164,14 @@ no_rs_broadcast_discovery:CONFIG -= rs_broadcast_discovery CONFIG *= rs_no_webui rs_webui:CONFIG -= rs_no_webui -# To enable webui append the following assignation to qmake -# command line "CONFIG+=rs_service_webui_terminal_password" +# To disable retroshare-service option to set webui password from the terminal +# append the following assignation to qmake command line +# "CONFIG+=no_rs_service_webui_terminal_password" CONFIG *= rs_service_webui_terminal_password no_rs_service_webui_terminal_password:CONFIG -= rs_service_webui_terminal_password -# To enable retroshare-service terminal login append the following assignation -# to qmake command line "CONFIG+=rs_service_terminal_login" +# To disable retroshare-service terminal login append the following assignation +# to qmake command line "CONFIG+=no_rs_service_terminal_login" CONFIG *= rs_service_terminal_login no_rs_service_terminal_login:CONFIG -= rs_service_terminal_login @@ -479,11 +480,6 @@ no_rs_cppwarning { rs_gxs_trans { DEFINES *= RS_GXS_TRANS - greaterThan(QT_MAJOR_VERSION, 4) { - CONFIG += c++11 - } else { - QMAKE_CXXFLAGS += -std=c++0x - } } bitdht { @@ -707,21 +703,7 @@ macx-* { 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 += "/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.1.0/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.1.0/lib" - LIB_DIR += "/usr/local/Cellar/miniupnpc/2.1/lib" - CONFIG += c++11 INCLUDEPATH += "/usr/local/include" RS_UPNP_LIB = miniupnpc QT += macextras