mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 14:12:43 -04:00
Initial work on a RetroShare cross-platform service
This doesn't need any interacion of the user at startup, unlike retroshare-nogui which requires the user to login on the shell this doesn't even need a TTY. At startup this just parse command line, read the PGP keyring, look for available locations, and start listening for JSON API requests. Another difference with retroshare-nogui is that this is capable to generate/import PGP identities, generate locations, and in general anything possible through the RetroShare API. retroshare-service is suitable also to run it as a system service, even in very constrained systems such as Android ot a Docker container. retroshare-service drop support for libresapi so only the new JSON API is exposed, it will completely obsolete retroshare-android-service once retroshare-qml-app is ported to the new JSON API.
This commit is contained in:
parent
359e11433b
commit
0078501dba
18 changed files with 894 additions and 17 deletions
|
@ -23,7 +23,7 @@ TEMPLATE = subdirs
|
||||||
SUBDIRS += openpgpsdk
|
SUBDIRS += openpgpsdk
|
||||||
openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro
|
openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro
|
||||||
|
|
||||||
rs_jsonapi {
|
rs_jsonapi:isEmpty(JSONAPI_GENERATOR_EXE) {
|
||||||
SUBDIRS += jsonapi-generator
|
SUBDIRS += jsonapi-generator
|
||||||
jsonapi-generator.file = jsonapi-generator/src/jsonapi-generator.pro
|
jsonapi-generator.file = jsonapi-generator/src/jsonapi-generator.pro
|
||||||
libretroshare.depends += jsonapi-generator
|
libretroshare.depends += jsonapi-generator
|
||||||
|
@ -36,9 +36,11 @@ libretroshare.depends = openpgpsdk libbitdht
|
||||||
SUBDIRS += libretroshare
|
SUBDIRS += libretroshare
|
||||||
libretroshare.file = libretroshare/src/libretroshare.pro
|
libretroshare.file = libretroshare/src/libretroshare.pro
|
||||||
|
|
||||||
SUBDIRS += libresapi
|
libresapi {
|
||||||
libresapi.file = libresapi/src/libresapi.pro
|
SUBDIRS += libresapi
|
||||||
libresapi.depends = libretroshare
|
libresapi.file = libresapi/src/libresapi.pro
|
||||||
|
libresapi.depends = libretroshare
|
||||||
|
}
|
||||||
|
|
||||||
retroshare_gui {
|
retroshare_gui {
|
||||||
SUBDIRS += retroshare_gui
|
SUBDIRS += retroshare_gui
|
||||||
|
@ -79,6 +81,13 @@ retroshare_qml_app {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retroshare_service {
|
||||||
|
SUBDIRS += retroshare_service
|
||||||
|
retroshare_service.file = retroshare-service/src/retroshare-service.pro
|
||||||
|
retroshare_service.depends = libretroshare
|
||||||
|
retroshare_service.target = retroshare_service
|
||||||
|
}
|
||||||
|
|
||||||
retroshare_plugins {
|
retroshare_plugins {
|
||||||
SUBDIRS += plugins
|
SUBDIRS += plugins
|
||||||
plugins.file = plugins/plugins.pro
|
plugins.file = plugins/plugins.pro
|
||||||
|
|
334
build_scripts/Android/prepare-toolchain-clang.sh
Executable file
334
build_scripts/Android/prepare-toolchain-clang.sh
Executable file
|
@ -0,0 +1,334 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
## Define default value for variable, take two arguments, $1 variable name,
|
||||||
|
## $2 default variable value, if the variable is not already define define it
|
||||||
|
## with default value.
|
||||||
|
function define_default_value()
|
||||||
|
{
|
||||||
|
VAR_NAME="${1}"
|
||||||
|
DEFAULT_VALUE="${2}"
|
||||||
|
|
||||||
|
[ -z "${!VAR_NAME}" ] && export ${VAR_NAME}="${DEFAULT_VALUE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
## You are supposed to provide the following variables according to your system setup
|
||||||
|
define_default_value ANDROID_NDK_PATH "/opt/android-ndk/"
|
||||||
|
define_default_value ANDROID_NDK_ARCH "arm"
|
||||||
|
define_default_value ANDROID_PLATFORM_VER "21"
|
||||||
|
define_default_value NATIVE_LIBS_TOOLCHAIN_PATH "${HOME}/Builds/android-toolchains/retroshare-android-${ANDROID_PLATFORM_VER}-${ANDROID_NDK_ARCH}/"
|
||||||
|
define_default_value HOST_NUM_CPU $(nproc)
|
||||||
|
|
||||||
|
define_default_value BZIP2_SOURCE_VERSION "1.0.6"
|
||||||
|
define_default_value BZIP2_SOURCE_SHA256 a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd
|
||||||
|
|
||||||
|
define_default_value OPENSSL_SOURCE_VERSION "1.1.1"
|
||||||
|
define_default_value OPENSSL_SOURCE_SHA256 2836875a0f89c03d0fdf483941512613a50cfb421d6fd94b9f41d7279d586a3d
|
||||||
|
|
||||||
|
define_default_value SQLITE_SOURCE_YEAR "2018"
|
||||||
|
define_default_value SQLITE_SOURCE_VERSION "3250200"
|
||||||
|
define_default_value SQLITE_SOURCE_SHA256 da9a1484423d524d3ac793af518cdf870c8255d209e369bd6a193e9f9d0e3181
|
||||||
|
|
||||||
|
define_default_value SQLCIPHER_SOURCE_VERSION "3.4.2"
|
||||||
|
define_default_value SQLCIPHER_SOURCE_SHA256 69897a5167f34e8a84c7069f1b283aba88cdfa8ec183165c4a5da2c816cfaadb
|
||||||
|
|
||||||
|
define_default_value LIBUPNP_SOURCE_VERSION "1.6.25"
|
||||||
|
define_default_value LIBUPNP_SOURCE_SHA256 c5a300b86775435c076d58a79cc0d5a977d76027d2a7d721590729b7f369fa43
|
||||||
|
|
||||||
|
define_default_value INSTALL_QT_ANDROID "false"
|
||||||
|
define_default_value QT_VERSION "5.9.6"
|
||||||
|
define_default_value QT_ANDROID_INSTALLER_SHA256 a214084e2295c9a9f8727e8a0131c37255bf724bfc69e80f7012ba3abeb1f763
|
||||||
|
|
||||||
|
define_default_value RESTBED_SOURCE_VERSION "4.6"
|
||||||
|
|
||||||
|
## $1 filename, $2 sha256 hash
|
||||||
|
function check_sha256()
|
||||||
|
{
|
||||||
|
echo ${2} "${1}" | sha256sum -c &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
## $1 filename, $2 sha256 hash, $3 url
|
||||||
|
function verified_download()
|
||||||
|
{
|
||||||
|
FILENAME="$1"
|
||||||
|
SHA256="$2"
|
||||||
|
URL="$3"
|
||||||
|
|
||||||
|
check_sha256 "${FILENAME}" "${SHA256}" ||
|
||||||
|
{
|
||||||
|
rm -rf "${FILENAME}"
|
||||||
|
|
||||||
|
wget -O "${FILENAME}" "$URL" ||
|
||||||
|
{
|
||||||
|
echo "Failed downloading ${FILENAME} from $URL"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
check_sha256 "${FILENAME}" "${SHA256}" ||
|
||||||
|
{
|
||||||
|
echo "SHA256 mismatch for ${FILENAME} from ${URL} expected sha256 ${SHA256} got $(sha256sum ${FILENAME} | awk '{print $1}')"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "${ANDROID_NDK_ARCH}" == "x86" ]; then
|
||||||
|
cArch="i686"
|
||||||
|
eABI=""
|
||||||
|
else
|
||||||
|
cArch="${ANDROID_NDK_ARCH}"
|
||||||
|
eABI="eabi"
|
||||||
|
fi
|
||||||
|
export SYSROOT="${NATIVE_LIBS_TOOLCHAIN_PATH}/sysroot/"
|
||||||
|
export PREFIX="${SYSROOT}/usr/"
|
||||||
|
export CC="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-clang"
|
||||||
|
export CXX="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-clang++"
|
||||||
|
export AR="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ar"
|
||||||
|
export RANLIB="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ranlib"
|
||||||
|
|
||||||
|
|
||||||
|
## More information available at https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
|
||||||
|
build_toolchain()
|
||||||
|
{
|
||||||
|
rm -rf ${NATIVE_LIBS_TOOLCHAIN_PATH}
|
||||||
|
${ANDROID_NDK_PATH}/build/tools/make_standalone_toolchain.py --verbose \
|
||||||
|
--arch ${ANDROID_NDK_ARCH} --install-dir ${NATIVE_LIBS_TOOLCHAIN_PATH} \
|
||||||
|
--api ${ANDROID_PLATFORM_VER}
|
||||||
|
}
|
||||||
|
|
||||||
|
## More information available at https://gitlab.com/relan/provisioners/merge_requests/1 and http://stackoverflow.com/a/34032216
|
||||||
|
install_qt_android()
|
||||||
|
{
|
||||||
|
QT_VERSION_CODE=$(echo $QT_VERSION | tr -d .)
|
||||||
|
QT_INSTALL_PATH=${NATIVE_LIBS_TOOLCHAIN_PATH}/Qt
|
||||||
|
QT_INSTALLER="qt-unified-linux-x64-3.0.2-online.run"
|
||||||
|
|
||||||
|
verified_download $QT_INSTALLER $QT_ANDROID_INSTALLER_SHA256 \
|
||||||
|
http://master.qt.io/archive/online_installers/3.0/${QT_INSTALLER}
|
||||||
|
|
||||||
|
chmod a+x ${QT_INSTALLER}
|
||||||
|
|
||||||
|
QT_INSTALLER_SCRIPT="qt_installer_script.js"
|
||||||
|
cat << EOF > "${QT_INSTALLER_SCRIPT}"
|
||||||
|
function Controller() {
|
||||||
|
installer.autoRejectMessageBoxes();
|
||||||
|
installer.installationFinished.connect(function() {
|
||||||
|
gui.clickButton(buttons.NextButton);
|
||||||
|
});
|
||||||
|
|
||||||
|
var welcomePage = gui.pageWidgetByObjectName("WelcomePage");
|
||||||
|
welcomePage.completeChanged.connect(function() {
|
||||||
|
if (gui.currentPageWidget().objectName == welcomePage.objectName)
|
||||||
|
gui.clickButton(buttons.NextButton);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.prototype.WelcomePageCallback = function() {
|
||||||
|
gui.clickButton(buttons.NextButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.prototype.CredentialsPageCallback = function() {
|
||||||
|
gui.clickButton(buttons.NextButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.prototype.IntroductionPageCallback = function() {
|
||||||
|
gui.clickButton(buttons.NextButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.prototype.TargetDirectoryPageCallback = function() {
|
||||||
|
gui.currentPageWidget().TargetDirectoryLineEdit.setText("$QT_INSTALL_PATH");
|
||||||
|
gui.clickButton(buttons.NextButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.prototype.ComponentSelectionPageCallback = function() {
|
||||||
|
var widget = gui.currentPageWidget();
|
||||||
|
|
||||||
|
// You can get these component names by running the installer with the
|
||||||
|
// --verbose flag. It will then print out a resource tree.
|
||||||
|
|
||||||
|
widget.deselectComponent("qt.tools.qtcreator");
|
||||||
|
widget.deselectComponent("qt.tools.doc");
|
||||||
|
widget.deselectComponent("qt.tools.examples");
|
||||||
|
|
||||||
|
widget.selectComponent("qt.$QT_VERSION_CODE.android_armv7");
|
||||||
|
|
||||||
|
gui.clickButton(buttons.NextButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.prototype.LicenseAgreementPageCallback = function() {
|
||||||
|
gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
|
||||||
|
gui.clickButton(buttons.NextButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.prototype.StartMenuDirectoryPageCallback = function() {
|
||||||
|
gui.clickButton(buttons.NextButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.prototype.ReadyForInstallationPageCallback = function() {
|
||||||
|
gui.clickButton(buttons.NextButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.prototype.FinishedPageCallback = function() {
|
||||||
|
var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm;
|
||||||
|
if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox)
|
||||||
|
checkBoxForm.launchQtCreatorCheckBox.checked = false;
|
||||||
|
gui.clickButton(buttons.FinishButton);
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
QT_QPA_PLATFORM=minimal ./${QT_INSTALLER} --script ${QT_INSTALLER_SCRIPT}
|
||||||
|
}
|
||||||
|
|
||||||
|
## More information available at retroshare://file?name=Android%20Native%20Development%20Kit%20Cookbook.pdf&size=29214468&hash=0123361c1b14366ce36118e82b90faf7c7b1b136
|
||||||
|
build_bzlib()
|
||||||
|
{
|
||||||
|
B_dir="bzip2-${BZIP2_SOURCE_VERSION}"
|
||||||
|
rm -rf $B_dir
|
||||||
|
|
||||||
|
verified_download $B_dir.tar.gz $BZIP2_SOURCE_SHA256 \
|
||||||
|
http://trumpetti.atm.tut.fi/gentoo/distfiles/bzip2-${BZIP2_SOURCE_VERSION}.tar.gz
|
||||||
|
|
||||||
|
tar -xf $B_dir.tar.gz
|
||||||
|
cd $B_dir
|
||||||
|
sed -i "/^CC=.*/d" Makefile
|
||||||
|
sed -i "/^AR=.*/d" Makefile
|
||||||
|
sed -i "/^RANLIB=.*/d" Makefile
|
||||||
|
sed -i "/^LDFLAGS=.*/d" Makefile
|
||||||
|
sed -i "s/^all: libbz2.a bzip2 bzip2recover test/all: libbz2.a bzip2 bzip2recover/" Makefile
|
||||||
|
make -j${HOST_NUM_CPU}
|
||||||
|
make install PREFIX=${PREFIX}
|
||||||
|
# sed -i "/^CC=.*/d" Makefile-libbz2_so
|
||||||
|
# make -f Makefile-libbz2_so -j${HOST_NUM_CPU}
|
||||||
|
# cp libbz2.so.1.0.6 ${SYSROOT}/usr/lib/libbz2.so
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
|
||||||
|
## More information available at http://doc.qt.io/qt-5/opensslsupport.html
|
||||||
|
build_openssl()
|
||||||
|
{
|
||||||
|
B_dir="openssl-${OPENSSL_SOURCE_VERSION}"
|
||||||
|
rm -rf $B_dir
|
||||||
|
|
||||||
|
verified_download $B_dir.tar.gz $OPENSSL_SOURCE_SHA256 \
|
||||||
|
https://www.openssl.org/source/$B_dir.tar.gz
|
||||||
|
|
||||||
|
tar -xf $B_dir.tar.gz
|
||||||
|
cd $B_dir
|
||||||
|
## We link openssl statically to avoid android silently sneaking in his own
|
||||||
|
## version of libssl.so (we noticed this because it had some missing symbol
|
||||||
|
## that made RS crash), the crash in some android version is only one of the
|
||||||
|
## possible problems the fact that android insert his own binary libssl.so pose
|
||||||
|
## non neglegible security concerns.
|
||||||
|
oBits="32"
|
||||||
|
[[ ${ANDROID_NDK_ARCH} =~ .*64.* ]] && oBits=64
|
||||||
|
|
||||||
|
ANDROID_NDK="${ANDROID_NDK_PATH}" PATH="${SYSROOT}/bin/:${PATH}" \
|
||||||
|
./Configure linux-generic${oBits} --prefix="${PREFIX}" \
|
||||||
|
--openssldir="${SYSROOT}/etc/ssl"
|
||||||
|
# sed -i 's/LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \\/LIBNAME=$$i \\/g' Makefile
|
||||||
|
# sed -i '/LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \\/d' Makefile
|
||||||
|
make -j${HOST_NUM_CPU}
|
||||||
|
make install
|
||||||
|
# cp *.so "${SYSROOT}/usr/lib"
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
|
||||||
|
build_sqlite()
|
||||||
|
{
|
||||||
|
B_dir="sqlite-autoconf-${SQLITE_SOURCE_VERSION}"
|
||||||
|
|
||||||
|
verified_download $B_dir.tar.gz $SQLITE_SOURCE_SHA256 \
|
||||||
|
https://www.sqlite.org/${SQLITE_SOURCE_YEAR}/$B_dir.tar.gz
|
||||||
|
|
||||||
|
tar -xf $B_dir.tar.gz
|
||||||
|
cd $B_dir
|
||||||
|
./configure --prefix="${PREFIX}" --host=${ANDROID_NDK_ARCH}-linux
|
||||||
|
make -j${HOST_NUM_CPU}
|
||||||
|
make install
|
||||||
|
rm -f ${PREFIX}/lib/libsqlite3.so*
|
||||||
|
# ${CC} -shared -o libsqlite3.so -fPIC sqlite3.o -ldl
|
||||||
|
# cp libsqlite3.so "${SYSROOT}/usr/lib"
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
|
||||||
|
build_sqlcipher()
|
||||||
|
{
|
||||||
|
B_dir="sqlcipher-${SQLCIPHER_SOURCE_VERSION}"
|
||||||
|
rm -rf $B_dir
|
||||||
|
|
||||||
|
T_file="${B_dir}.tar.gz"
|
||||||
|
|
||||||
|
verified_download $T_file $SQLCIPHER_SOURCE_SHA256 \
|
||||||
|
https://github.com/sqlcipher/sqlcipher/archive/v${SQLCIPHER_SOURCE_VERSION}.tar.gz
|
||||||
|
|
||||||
|
tar -xf $T_file
|
||||||
|
cd $B_dir
|
||||||
|
./configure --build=$(sh ./config.guess) \
|
||||||
|
--host=${ANDROID_NDK_ARCH}-linux \
|
||||||
|
--prefix="${PREFIX}" --with-sysroot="${SYSROOT}" \
|
||||||
|
--enable-tempstore=yes \
|
||||||
|
--disable-tcl --disable-shared \
|
||||||
|
CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="${PREFIX}/lib/libcrypto.a"
|
||||||
|
make -j${HOST_NUM_CPU}
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
|
||||||
|
build_libupnp()
|
||||||
|
{
|
||||||
|
B_dir="libupnp-${LIBUPNP_SOURCE_VERSION}"
|
||||||
|
rm -rf $B_dir
|
||||||
|
|
||||||
|
verified_download $B_dir.tar.bz2 $LIBUPNP_SOURCE_SHA256 \
|
||||||
|
https://sourceforge.net/projects/pupnp/files/pupnp/libUPnP%20${LIBUPNP_SOURCE_VERSION}/$B_dir.tar.bz2
|
||||||
|
|
||||||
|
tar -xf $B_dir.tar.bz2
|
||||||
|
cd $B_dir
|
||||||
|
## liupnp must be configured as static library because if not the linker will
|
||||||
|
## look for libthreadutils.so.6 at runtime that cannot be packaged on android
|
||||||
|
## as it supports only libname.so format for libraries, thus resulting in a
|
||||||
|
## crash at startup.
|
||||||
|
./configure --enable-static --disable-shared --disable-samples --prefix="${PREFIX}" --host=${ANDROID_NDK_ARCH}-linux
|
||||||
|
make -j${HOST_NUM_CPU}
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
|
||||||
|
build_rapidjson()
|
||||||
|
{
|
||||||
|
B_dir="rapidjson-1.1.0"
|
||||||
|
[ -f $B_dir.tar.gz ] || wget -O $B_dir.tar.gz https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz
|
||||||
|
tar -xf $B_dir.tar.gz
|
||||||
|
cp -r rapidjson-1.1.0/include/rapidjson/ "${PREFIX}/include/rapidjson"
|
||||||
|
}
|
||||||
|
|
||||||
|
build_restbed()
|
||||||
|
{
|
||||||
|
[ -d restbed ] || git clone --depth=2000 https://github.com/Corvusoft/restbed.git
|
||||||
|
cd restbed
|
||||||
|
git fetch --tags
|
||||||
|
git checkout tags/${RESTBED_SOURCE_VERSION}
|
||||||
|
git submodule update --init dependency/asio
|
||||||
|
git submodule update --init dependency/catch
|
||||||
|
git submodule update --init dependency/kashmir
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
rm -rf restbed-build; mkdir restbed-build ; cd restbed-build
|
||||||
|
cmake -DBUILD_SSL=OFF -DCMAKE_INSTALL_PREFIX=${PREFIX} -B. -H../restbed
|
||||||
|
make -j${HOST_NUM_CPU}
|
||||||
|
make install
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
|
||||||
|
build_toolchain
|
||||||
|
[ "${INSTALL_QT_ANDROID}X" != "trueX" ] || install_qt_android
|
||||||
|
build_bzlib
|
||||||
|
build_openssl
|
||||||
|
build_sqlite
|
||||||
|
build_sqlcipher
|
||||||
|
build_libupnp
|
||||||
|
build_rapidjson
|
||||||
|
build_restbed
|
||||||
|
|
||||||
|
echo NATIVE_LIBS_TOOLCHAIN_PATH=${NATIVE_LIBS_TOOLCHAIN_PATH}
|
|
@ -862,16 +862,19 @@ rs_gxs_trans {
|
||||||
rs_jsonapi {
|
rs_jsonapi {
|
||||||
JSONAPI_GENERATOR_SRC=$$clean_path($${RS_SRC_PATH}/jsonapi-generator/src/)
|
JSONAPI_GENERATOR_SRC=$$clean_path($${RS_SRC_PATH}/jsonapi-generator/src/)
|
||||||
JSONAPI_GENERATOR_OUT=$$clean_path($${RS_BUILD_PATH}/jsonapi-generator/src/)
|
JSONAPI_GENERATOR_OUT=$$clean_path($${RS_BUILD_PATH}/jsonapi-generator/src/)
|
||||||
win32 {
|
isEmpty(JSONAPI_GENERATOR_EXE) {
|
||||||
CONFIG(release, debug|release) {
|
win32 {
|
||||||
JSONAPI_GENERATOR_EXE=$$clean_path($${JSONAPI_GENERATOR_OUT}/release/jsonapi-generator.exe)
|
CONFIG(release, debug|release) {
|
||||||
|
JSONAPI_GENERATOR_EXE=$$clean_path($${JSONAPI_GENERATOR_OUT}/release/jsonapi-generator.exe)
|
||||||
|
}
|
||||||
|
CONFIG(debug, debug|release) {
|
||||||
|
JSONAPI_GENERATOR_EXE=$$clean_path($${JSONAPI_GENERATOR_OUT}/debug/jsonapi-generator.exe)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
JSONAPI_GENERATOR_EXE=$$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-generator)
|
||||||
}
|
}
|
||||||
CONFIG(debug, debug|release) {
|
|
||||||
JSONAPI_GENERATOR_EXE=$$clean_path($${JSONAPI_GENERATOR_OUT}/debug/jsonapi-generator.exe)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
JSONAPI_GENERATOR_EXE=$$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-generator)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DOXIGEN_INPUT_DIRECTORY=$$clean_path($${PWD})
|
DOXIGEN_INPUT_DIRECTORY=$$clean_path($${PWD})
|
||||||
DOXIGEN_CONFIG_SRC=$$clean_path($${RS_SRC_PATH}/jsonapi-generator/src/jsonapi-generator-doxygen.conf)
|
DOXIGEN_CONFIG_SRC=$$clean_path($${RS_SRC_PATH}/jsonapi-generator/src/jsonapi-generator-doxygen.conf)
|
||||||
DOXIGEN_CONFIG_OUT=$$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-generator-doxygen-final.conf)
|
DOXIGEN_CONFIG_OUT=$$clean_path($${JSONAPI_GENERATOR_OUT}/jsonapi-generator-doxygen-final.conf)
|
||||||
|
@ -899,6 +902,7 @@ rs_jsonapi {
|
||||||
|
|
||||||
jsonwrappersincl.target = $${WRAPPERS_INCL_FILE}
|
jsonwrappersincl.target = $${WRAPPERS_INCL_FILE}
|
||||||
jsonwrappersincl.commands = \
|
jsonwrappersincl.commands = \
|
||||||
|
mkdir -p $${JSONAPI_GENERATOR_OUT}; \
|
||||||
cp $${DOXIGEN_CONFIG_SRC} $${DOXIGEN_CONFIG_OUT}; \
|
cp $${DOXIGEN_CONFIG_SRC} $${DOXIGEN_CONFIG_OUT}; \
|
||||||
echo OUTPUT_DIRECTORY=$$shell_path($${JSONAPI_GENERATOR_OUT}) >> $${DOXIGEN_CONFIG_OUT};\
|
echo OUTPUT_DIRECTORY=$$shell_path($${JSONAPI_GENERATOR_OUT}) >> $${DOXIGEN_CONFIG_OUT};\
|
||||||
echo INPUT=$$shell_path($${DOXIGEN_INPUT_DIRECTORY}) >> $${DOXIGEN_CONFIG_OUT}; \
|
echo INPUT=$$shell_path($${DOXIGEN_INPUT_DIRECTORY}) >> $${DOXIGEN_CONFIG_OUT}; \
|
||||||
|
|
|
@ -57,9 +57,7 @@ rs_jsonapi {
|
||||||
QMAKE_LIBDIR *= $$clean_path($${RESTBED_BUILD_PATH}/library/)
|
QMAKE_LIBDIR *= $$clean_path($${RESTBED_BUILD_PATH}/library/)
|
||||||
# Using sLibs would fail as librestbed.a is generated at compile-time
|
# Using sLibs would fail as librestbed.a is generated at compile-time
|
||||||
LIBS *= -L$$clean_path($${RESTBED_BUILD_PATH}/library/) -lrestbed
|
LIBS *= -L$$clean_path($${RESTBED_BUILD_PATH}/library/) -lrestbed
|
||||||
win32-g++ {
|
win32-g++:LIBS += -lwsock32
|
||||||
LIBS += -lwsock32
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
linux-* {
|
linux-* {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#include "util/rsurl.h"
|
|
||||||
#include "rsurl.h"
|
#include "rsurl.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
@ -245,7 +245,7 @@ RsUrl& RsUrl::setFragment(const std::string& fragment)
|
||||||
|
|
||||||
if(str[i] == '%' && i < boundary)
|
if(str[i] == '%' && i < boundary)
|
||||||
{
|
{
|
||||||
decoded << static_cast<char>(stoi(str.substr(++i, 2), 0, 16));
|
decoded << static_cast<char>(std::stoi(str.substr(++i, 2), 0, 16));
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
else decoded << str[i];
|
else decoded << str[i];
|
||||||
|
|
3
retroshare-service/src/android/.gitignore
vendored
Normal file
3
retroshare-service/src/android/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
*~
|
||||||
|
gradle.properties
|
||||||
|
local.properties
|
54
retroshare-service/src/android/AndroidManifest.xml
Normal file
54
retroshare-service/src/android/AndroidManifest.xml
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<manifest package="org.retroshare.android.qml_app" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.6.4" android:versionCode="1" android:installLocation="auto">
|
||||||
|
<application android:name="org.qtproject.qt5.android.bindings.QtApplication" android:hardwareAccelerated="true" android:label="RetroShare" android:icon="@drawable/retroshare_128x128">
|
||||||
|
<activity android:label="">
|
||||||
|
<meta-data android:name="android.app.lib_name" android:value=""/>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<!-- For adding service(s) please check:
|
||||||
|
++ https://wiki.qt.io/AndroidServices -->
|
||||||
|
<service android:name=".RetroShareService" android:process=":rs" android:label="RetroShare Service" android:exported="true">
|
||||||
|
<!-- android:exported="true" Added to be able to run the service
|
||||||
|
++ from adb shell
|
||||||
|
++ android:process=":rs" is needed to force the service to run on
|
||||||
|
++ a separate process than the Activity -->
|
||||||
|
|
||||||
|
<!-- Qt Application to launch -->
|
||||||
|
<meta-data android:name="android.app.lib_name" android:value="retroshare-service"/>
|
||||||
|
|
||||||
|
<!-- Deploy Qt libs as part of package -->
|
||||||
|
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
||||||
|
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
||||||
|
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
||||||
|
|
||||||
|
<!-- Messages maps BEGIN -->
|
||||||
|
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
|
||||||
|
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
|
||||||
|
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||||
|
<!-- Messages maps END -->
|
||||||
|
|
||||||
|
<!-- Background running -->
|
||||||
|
<meta-data android:name="android.app.background_running" android:value="true"/>
|
||||||
|
<!-- Background running -->
|
||||||
|
</service>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21"/>
|
||||||
|
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||||
|
|
||||||
|
<!-- The following comment will be replaced upon deployment with default
|
||||||
|
++ permissions based on the dependencies of the application.
|
||||||
|
++ Remove the comment if you do not require these default permissions. -->
|
||||||
|
<!-- %%INSERT_PERMISSIONS -->
|
||||||
|
|
||||||
|
<!-- The following comment will be replaced upon deployment with default
|
||||||
|
++ features based on the dependencies of the application.
|
||||||
|
++ Remove the comment if you do not require these default features. -->
|
||||||
|
<!-- %%INSERT_FEATURES -->
|
||||||
|
|
||||||
|
<!-- Added by G10h4ck: Needed permission for autostart at boot -->
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||||
|
<!-- Added by Angesoc: used to access files shared by other apps -->
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
|
</manifest>
|
57
retroshare-service/src/android/build.gradle
Normal file
57
retroshare-service/src/android/build.gradle
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
/*******************************************************
|
||||||
|
* The following variables:
|
||||||
|
* - androidBuildToolsVersion,
|
||||||
|
* - androidCompileSdkVersion
|
||||||
|
* - qt5AndroidDir - holds the path to qt android files
|
||||||
|
* needed to build any Qt application
|
||||||
|
* on Android.
|
||||||
|
*
|
||||||
|
* are defined in gradle.properties file. This file is
|
||||||
|
* updated by QtCreator and androiddeployqt tools.
|
||||||
|
* Changing them manually might break the compilation!
|
||||||
|
*******************************************************/
|
||||||
|
|
||||||
|
compileSdkVersion androidCompileSdkVersion.toInteger()
|
||||||
|
|
||||||
|
buildToolsVersion androidBuildToolsVersion
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
manifest.srcFile 'AndroidManifest.xml'
|
||||||
|
java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
|
||||||
|
aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
|
||||||
|
res.srcDirs = [qt5AndroidDir + '/res', 'res']
|
||||||
|
resources.srcDirs = ['src']
|
||||||
|
renderscript.srcDirs = ['src']
|
||||||
|
assets.srcDirs = ['assets']
|
||||||
|
jniLibs.srcDirs = ['libs']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
}
|
BIN
retroshare-service/src/android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
retroshare-service/src/android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
retroshare-service/src/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
retroshare-service/src/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
172
retroshare-service/src/android/gradlew
vendored
Executable file
172
retroshare-service/src/android/gradlew
vendored
Executable file
|
@ -0,0 +1,172 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
84
retroshare-service/src/android/gradlew.bat
vendored
Normal file
84
retroshare-service/src/android/gradlew.bat
vendored
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../../data/128x128/apps/retroshare.png
|
1
retroshare-service/src/android/res/drawable/retroshare_48x48.png
Symbolic link
1
retroshare-service/src/android/res/drawable/retroshare_48x48.png
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../../../../data/48x48/apps/retroshare.png
|
25
retroshare-service/src/android/res/values/libs.xml
Normal file
25
retroshare-service/src/android/res/values/libs.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<resources>
|
||||||
|
<array name="qt_sources">
|
||||||
|
<item>https://download.qt.io/ministro/android/qt5/qt-5.9</item>
|
||||||
|
</array>
|
||||||
|
|
||||||
|
<!-- The following is handled automatically by the deployment tool. It should
|
||||||
|
not be edited manually. -->
|
||||||
|
|
||||||
|
<array name="bundled_libs">
|
||||||
|
<!-- %%INSERT_EXTRA_LIBS%% -->
|
||||||
|
</array>
|
||||||
|
|
||||||
|
<array name="qt_libs">
|
||||||
|
<!-- %%INSERT_QT_LIBS%% -->
|
||||||
|
</array>
|
||||||
|
|
||||||
|
<array name="bundled_in_lib">
|
||||||
|
<!-- %%INSERT_BUNDLED_IN_LIB%% -->
|
||||||
|
</array>
|
||||||
|
<array name="bundled_in_assets">
|
||||||
|
<!-- %%INSERT_BUNDLED_IN_ASSETS%% -->
|
||||||
|
</array>
|
||||||
|
|
||||||
|
</resources>
|
73
retroshare-service/src/retroshare-service.cc
Normal file
73
retroshare-service/src/retroshare-service.cc
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
* RetroShare Service
|
||||||
|
* Copyright (C) 2016-2018 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <csignal>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
#include "retroshare/rsinit.h"
|
||||||
|
#include "retroshare/rsiface.h"
|
||||||
|
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
# include "util/androiddebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef RS_JSONAPI
|
||||||
|
# error Inconsistent build configuration retroshare_service needs rs_jsonapi
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
AndroidStdIOCatcher dbg; (void) dbg;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QCoreApplication app(argc, argv);
|
||||||
|
|
||||||
|
signal(SIGINT, QCoreApplication::exit);
|
||||||
|
signal(SIGTERM, QCoreApplication::exit);
|
||||||
|
#ifdef SIGBREAK
|
||||||
|
signal(SIGBREAK, QCoreApplication::exit);
|
||||||
|
#endif // ifdef SIGBREAK
|
||||||
|
|
||||||
|
RsInit::InitRsConfig();
|
||||||
|
|
||||||
|
// clumsy way to enable JSON API by default
|
||||||
|
if(!QCoreApplication::arguments().contains("--jsonApiPort"))
|
||||||
|
{
|
||||||
|
int argc2 = argc + 2;
|
||||||
|
char* argv2[argc2]; for (int i = 0; i < argc; ++i ) argv2[i] = argv[i];
|
||||||
|
char opt[] = "--jsonApiPort";
|
||||||
|
char val[] = "9092";
|
||||||
|
argv2[argc] = opt;
|
||||||
|
argv2[argc+1] = val;
|
||||||
|
RsInit::InitRetroShare(argc2, argv2, true);
|
||||||
|
}
|
||||||
|
else RsInit::InitRetroShare(argc, argv, true);
|
||||||
|
|
||||||
|
RsControl::earlyInitNotificationSystem();
|
||||||
|
rsControl->setShutdownCallback(QCoreApplication::exit);
|
||||||
|
QObject::connect(
|
||||||
|
&app, &QCoreApplication::aboutToQuit,
|
||||||
|
[](){
|
||||||
|
if(RsControl::instance()->isReady())
|
||||||
|
RsControl::instance()->rsGlobalShutDown(); } );
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
|
}
|
27
retroshare-service/src/retroshare-service.pro
Normal file
27
retroshare-service/src/retroshare-service.pro
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
!include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri")
|
||||||
|
|
||||||
|
TARGET = retroshare-service
|
||||||
|
|
||||||
|
QT += core
|
||||||
|
QT -= gui
|
||||||
|
|
||||||
|
!include("../../libretroshare/src/use_libretroshare.pri"):error("Including")
|
||||||
|
|
||||||
|
SOURCES += retroshare-service.cc
|
||||||
|
|
||||||
|
android-* {
|
||||||
|
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
|
||||||
|
|
||||||
|
DISTFILES += android/AndroidManifest.xml \
|
||||||
|
android/res/drawable/retroshare_128x128.png \
|
||||||
|
android/res/drawable/retroshare_retroshare_48x48.png
|
||||||
|
}
|
||||||
|
|
||||||
|
DISTFILES += \
|
||||||
|
android/AndroidManifest.xml \
|
||||||
|
android/gradle/wrapper/gradle-wrapper.jar \
|
||||||
|
android/gradlew \
|
||||||
|
android/res/values/libs.xml \
|
||||||
|
android/build.gradle \
|
||||||
|
android/gradle/wrapper/gradle-wrapper.properties \
|
||||||
|
android/gradlew.bat
|
|
@ -64,6 +64,16 @@ retroshare_android_notify_service:CONFIG -= no_retroshare_android_notify_service
|
||||||
CONFIG *= no_retroshare_qml_app
|
CONFIG *= no_retroshare_qml_app
|
||||||
retroshare_qml_app:CONFIG -= no_retroshare_qml_app
|
retroshare_qml_app:CONFIG -= no_retroshare_qml_app
|
||||||
|
|
||||||
|
# To enable RetroShare service append the following assignation to
|
||||||
|
# qmake command line "CONFIG+=retroshare_service"
|
||||||
|
CONFIG *= no_retroshare_service
|
||||||
|
retroshare_service:CONFIG -= no_retroshare_service
|
||||||
|
|
||||||
|
# To disable libresapi append the following assignation to qmake command line
|
||||||
|
#"CONFIG+=no_libresapi"
|
||||||
|
CONFIG *= libresapi
|
||||||
|
no_libresapi:CONFIG -= libresapi
|
||||||
|
|
||||||
# To enable libresapi via local socket (unix domain socket or windows named
|
# To enable libresapi via local socket (unix domain socket or windows named
|
||||||
# pipes) append the following assignation to qmake command line
|
# pipes) append the following assignation to qmake command line
|
||||||
#"CONFIG+=libresapilocalserver"
|
#"CONFIG+=libresapilocalserver"
|
||||||
|
@ -144,6 +154,12 @@ CONFIG+=no_rs_deep_search
|
||||||
CONFIG *= rs_deep_search
|
CONFIG *= rs_deep_search
|
||||||
no_rs_deep_search:CONFIG -= rs_deep_search
|
no_rs_deep_search:CONFIG -= rs_deep_search
|
||||||
|
|
||||||
|
# Specify host precompiled jsonapi-generator path, appending the following
|
||||||
|
# assignation to qmake command line
|
||||||
|
# 'JSONAPI_GENERATOR_EXE=/myBuildDir/jsonapi-generator'. Required for JSON API
|
||||||
|
# cross-compiling
|
||||||
|
#JSONAPI_GENERATOR_EXE=/myBuildDir/jsonapi-generator
|
||||||
|
|
||||||
# Specify RetroShare major version appending the following assignation to qmake
|
# Specify RetroShare major version appending the following assignation to qmake
|
||||||
# command line 'RS_MAJOR_VERSION=0'
|
# command line 'RS_MAJOR_VERSION=0'
|
||||||
#RS_MAJOR_VERSION=0
|
#RS_MAJOR_VERSION=0
|
||||||
|
@ -299,6 +315,16 @@ defineReplace(linkDynamicLibs) {
|
||||||
## RS_THREAD_LIB String viariable containing the name of the multi threading
|
## RS_THREAD_LIB String viariable containing the name of the multi threading
|
||||||
## library to use (pthread, "") it usually depend on platform.
|
## library to use (pthread, "") it usually depend on platform.
|
||||||
|
|
||||||
|
isEmpty(QMAKE_HOST_SPEC):QMAKE_HOST_SPEC=$$[QMAKE_SPEC]
|
||||||
|
isEmpty(QMAKE_TARGET_SPEC):QMAKE_TARGET_SPEC=$$[QMAKE_XSPEC]
|
||||||
|
equals(QMAKE_HOST_SPEC, $$QMAKE_TARGET_SPEC) {
|
||||||
|
CONFIG *= no_rs_cross_compiling
|
||||||
|
CONFIG -= rs_cross_compiling
|
||||||
|
} else {
|
||||||
|
CONFIG *= rs_cross_compiling
|
||||||
|
CONFIG -= no_rs_cross_compiling
|
||||||
|
}
|
||||||
|
|
||||||
defined(RS_MAJOR_VERSION,var):\
|
defined(RS_MAJOR_VERSION,var):\
|
||||||
defined(RS_MINOR_VERSION,var):\
|
defined(RS_MINOR_VERSION,var):\
|
||||||
defined(RS_MINI_VERSION,var):\
|
defined(RS_MINI_VERSION,var):\
|
||||||
|
@ -408,6 +434,10 @@ rs_chatserver {
|
||||||
}
|
}
|
||||||
|
|
||||||
rs_jsonapi {
|
rs_jsonapi {
|
||||||
|
rs_cross_compiling:!exists($$JSONAPI_GENERATOR_EXE):error("Inconsistent \
|
||||||
|
build configuration, cross-compiling JSON API requires JSONAPI_GENERATOR_EXE \
|
||||||
|
to contain the path to an host executable jsonapi-generator")
|
||||||
|
|
||||||
DEFINES *= RS_JSONAPI
|
DEFINES *= RS_JSONAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue