Merge pull request #2551 from G10h4ck/cmake_build

More work to ship libretroshare as standalone lib
This commit is contained in:
G10h4ck 2022-01-10 15:53:24 +01:00 committed by GitHub
commit bbff7c73c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 690 additions and 63 deletions

6
libretroshare/.gitattributes vendored Normal file
View File

@ -0,0 +1,6 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf

8
libretroshare/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Ignore Gradle project-specific cache directory
.gradle
# Ignore Gradle build output directory
build
# Ignore Gradle local options
local.properties

View File

@ -126,6 +126,11 @@ set(
CACHE STRING
"Path where to install RetroShare system wide data" )
option(
RS_EXPORT_JNI_ONLOAD
"Export libretroshare JNI_OnLoad. See src/rs_android/rsjni.cpp for details"
ON )
################################################################################
find_package(Git REQUIRED)
@ -163,6 +168,9 @@ target_include_directories(
${PROJECT_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src )
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
# TODO: install public headers
find_package(OpenSSL REQUIRED)
target_include_directories(${PROJECT_NAME} PRIVATE ${OPENSSL_INCLUDE_DIR})
@ -199,6 +207,7 @@ if(RS_BITDHT)
CHECK_PASS
"BitDHT submodule found at ${BITDHT_DEVEL_DIR} using it" )
add_subdirectory(${BITDHT_DEVEL_DIR} ${CMAKE_BINARY_DIR}/bitdht)
set(RS_BITDHT_DIR "${BITDHT_DEVEL_DIR}")
else()
FetchContent_Declare(
bitdht
@ -209,6 +218,8 @@ if(RS_BITDHT)
TIMEOUT 10
)
FetchContent_MakeAvailable(bitdht)
set(RS_BITDHT_DIR "${bitdht_SOURCE_DIR}")
endif()
add_compile_definitions(RS_USE_BITDHT)
@ -230,9 +241,6 @@ if(RS_JSON_API)
find_package(Doxygen REQUIRED)
find_package(Python3 REQUIRED)
## TODO: execute at build time instead that at cofiguration time see
## add_custom_command or add_custom_target
set(
JSON_API_GENERATOR_WORK_DIR
"${CMAKE_BINARY_DIR}/jsonapi-generator.workdir/" )
@ -379,7 +387,7 @@ if(RS_BRODCAST_DISCOVERY)
)
FetchContent_MakeAvailable(udp-discovery-cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE udp-discovery-cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE udp-discovery)
## TODO: Temporary work around target_include_directories should be added
## upstream
@ -407,5 +415,43 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_compile_definitions(RS_DATA_DIR="${RS_DATA_DIR}")
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
################################################################################
if(RS_EXPORT_JNI_ONLOAD)
add_compile_definitions(RS_LIBRETROSHARE_EXPORT_JNI_ONLOAD)
endif(RS_EXPORT_JNI_ONLOAD)
################################################################################
#if(CMAKE_SYSTEM_NAME STREQUAL "Android")
if(RS_ANDROID)
FetchContent_Declare(
jni-hpp
GIT_REPOSITORY "https://gitlab.com/RetroShare/jni-hpp.git"
GIT_TAG "origin/master"
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
TIMEOUT 10
)
FetchContent_MakeAvailable(jni-hpp)
include_directories(${jni-hpp_SOURCE_DIR}/include)
if(RS_BITDHT)
set(RS_ANDROID_ASSETS_DIR "${CMAKE_BINARY_DIR}/android-assets")
set(RS_ANDROID_VALUES_DIR "${RS_ANDROID_ASSETS_DIR}/values")
file(MAKE_DIRECTORY "${RS_ANDROID_VALUES_DIR}")
file(
COPY "${RS_BITDHT_DIR}/src/bitdht/bdboot.txt"
DESTINATION "${RS_ANDROID_VALUES_DIR}" )
set(
ANDROID_ASSETS_DIRECTORIES
"${RS_ANDROID_ASSETS_DIR};${ANDROID_ASSETS_DIRECTORIES}" )
endif(RS_BITDHT)
endif(RS_ANDROID)
#endif(CMAKE_SYSTEM_NAME STREQUAL "Android")
################################################################################
## Useful to debug CMake
#set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

226
libretroshare/build.gradle Normal file
View File

@ -0,0 +1,226 @@
/*
* libretroshare Android AAR library gradle builder
*
* Copyright (C) 2022 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2022 Asociación Civil Altermundi <info@altermundi.net>
*
* SPDX-License-Identifier: CC0-1.0
*/
buildscript
{
repositories
{
// The order in which you list these repositories matter.
google()
mavenCentral()
}
dependencies
{
classpath 'com.android.tools.build:gradle:7.1.+'
}
}
allprojects
{
repositories
{
// The order in which you list these repositories matter.
google()
mavenCentral()
}
}
ext.buildLibretroshareNativeLib =
{
pApiLevel, /* Android API level */
pAbi, /* Arch name as seen in AAR native libraries directories */
pNdkPath, /* Android NDK path */
pReuseToolchain = true /* If true reuse previously built toochain */ ->
/* Convert pAbi into corresponding prepare toolchain ANDROID_NDK_ARCH */
def toolchainArch = "unsupported"
def libcxxsharedTriple = "unsupported"
switch(pAbi)
{
case "armeabi-v7a":
toolchainArch = "arm";
libcxxsharedTriple = "arm-linux-androideabi";
break;
case "arm64-v8a":
toolchainArch = "arm64";
libcxxsharedTriple = "aarch64-linux-android";
break;
default:
throw new GradleException(
"buildLibretroshareNativeLib unsupported pAbi: $pAbi" );
break;
}
def toolchainsWorkdir = "${buildDir}/native_toolchains/"
mkdir toolchainsWorkdir
def currToolchainPath = "$toolchainsWorkdir/$pApiLevel-$toolchainArch/"
// Todo: use proper way to resolve the script path
def toolChainScriptPath = "${projectDir}/../build_scripts/Android/prepare-toolchain-clang.sh"
if(!pReuseToolchain || !file(currToolchainPath).exists())
{
exec
{
workingDir toolchainsWorkdir
environment "ANDROID_NDK_PATH", pNdkPath
environment "NATIVE_LIBS_TOOLCHAIN_PATH", currToolchainPath
environment "ANDROID_PLATFORM_VER", pApiLevel
environment "ANDROID_NDK_ARCH", toolchainArch
commandLine toolChainScriptPath /*, 'build_libretroshare'*/
}
}
else
{/*
exec
{
workingDir toolchainsWorkdir
environment "ANDROID_NDK_PATH", pNdkPath
environment "NATIVE_LIBS_TOOLCHAIN_PATH", currToolchainPath
environment "ANDROID_PLATFORM_VER", pApiLevel
environment "ANDROID_NDK_ARCH", toolchainArch
commandLine toolChainScriptPath, 'build_libretroshare'
}*/
}
def nativeLibsDir = "${buildDir}/native_libs-$pApiLevel/"
mkdir nativeLibsDir
def currAbiLibDir = "${nativeLibsDir}/$pAbi/"
mkdir currAbiLibDir
copy
{
from "${currToolchainPath}/sysroot/usr/lib/libretroshare.so"
into currAbiLibDir
}
copy
{
from "${currToolchainPath}/sysroot/usr/lib/${libcxxsharedTriple}/libc++_shared.so"
into currAbiLibDir
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
android
{
// see https://stackoverflow.com/questions/27301867/what-is-compilesdkversion
compileSdkVersion 21
sourceSets
{
main
{
java.srcDirs = [ 'src/rs_android/' ]
manifest.srcFile 'src/rs_android/AndroidManifest.xml'
assets.srcDirs = [ "${buildDir}/libretroshare-build/android-assets/" ]
jniLibs.srcDirs = [ "${buildDir}/native_libs-16" ]
}
minApi16
{
jniLibs.srcDirs = [ "${buildDir}/native_libs-16" ]
}
minApi21
{
jniLibs.srcDirs = [ "${buildDir}/native_libs-21" ]
}
minApi24
{
jniLibs.srcDirs = [ "${buildDir}/native_libs-24" ]
}
}
lintOptions
{
disable 'LongLogTag'
}
flavorDimensions 'api'
def currNdk = android.getNdkDirectory().getAbsolutePath()
productFlavors
{
minApi16
{
minSdkVersion '16'
targetSdkVersion '16'
def currApi = minSdkVersion.mApiLevel
versionNameSuffix "-API_${currApi}"
buildLibretroshareNativeLib(currApi, "armeabi-v7a", currNdk)
}
minApi21
{
minSdkVersion '21'
targetSdkVersion '21'
def currApi = minSdkVersion.mApiLevel
versionNameSuffix "-API_${currApi}"
buildLibretroshareNativeLib(currApi, "arm64-v8a", currNdk)
buildLibretroshareNativeLib(currApi, "armeabi-v7a", currNdk)
}
minApi24
{
minSdkVersion '24'
targetSdkVersion '28'
def currApi = minSdkVersion.mApiLevel
versionNameSuffix "-API_${currApi}"
buildLibretroshareNativeLib(currApi, "arm64-v8a", currNdk)
buildLibretroshareNativeLib(currApi, "armeabi-v7a", currNdk)
}
}
publishing
{
multipleVariants
{
allVariants()
}
}
}
afterEvaluate
{
publishing
{
// see https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/LibraryPublishing
publications
{
android.libraryVariants.each
{
variant ->
publishing.publications.create(variant.name, MavenPublication)
{
from components.findByName(variant.name)
groupId = 'org.retroshare.service'
// -${variant.flavorName}
artifactId "${rootProject.name}-${variant.name}"
version "0.6.6"
artifacts = [ "${buildDir}/outputs/aar/${rootProject.name}-${variant.flavorName}-${variant.buildType.name}.aar" ]
}
}
}
}
}

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
libretroshare/gradlew vendored Executable file
View File

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## 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='"-Xmx64m" "-Xms64m"'
# 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
;;
MSYS* | 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 or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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"
exec "$JAVACMD" "$@"

89
libretroshare/gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@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 Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@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="-Xmx64m" "-Xms64m"
@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 execute
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 execute
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
: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 %*
: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

View File

@ -855,6 +855,28 @@ build_mvptree()
popd
}
task_register build_libretroshare
build_libretroshare()
{
S_dir="/home/gio/Development/rs-develop/libretroshare"
B_dir="libretroshare-build"
# -DCMAKE_SYSTEM_NAME="Android" \
# -DCMAKE_ANDROID_NDK="$ANDROID_NDK_PATH" \
# -DCMAKE_SYSTEM_VERSION=$ANDROID_PLATFORM_VER \
# -D RS_FORUM_DEEP_INDEX=ON -D RS_JSON_API=ON \
rm -rf $B_dir; mkdir $B_dir ; pushd $B_dir
andro_cmake -B. -H${S_dir} -DCMAKE_BUILD_TYPE=Release \
-D RS_ANDROID=ON -D RS_WARN_DEPRECATED=OFF -D RS_WARN_LESS=ON \
-D RS_LIBRETROSHARE_STATIC=OFF -D RS_LIBRETROSHARE_SHARED=ON \
-D RS_BRODCAST_DISCOVERY=ON -D RS_EXPORT_JNI_ONLOAD=ON
make -j${HOST_NUM_CPU}
make install
popd
}
task_register get_native_libs_toolchain_path
get_native_libs_toolchain_path()
{
@ -869,13 +891,14 @@ build_default_toolchain()
task_run build_openssl || return $?
task_run build_sqlcipher || return $?
task_run build_rapidjson || return $?
task_run build_restbed || return $?
task_run build_udp-discovery-cpp || return $?
# task_run build_restbed || return $?
# task_run build_udp-discovery-cpp || return $?
task_run build_xapian || return $?
task_run build_miniupnpc || return $?
task_run build_phash || return $?
task_run fetch_jni_hpp || return $?
task_run deduplicate_includes || return $?
# task_run fetch_jni_hpp || return $?
task_run build_libretroshare || return $?
# task_run deduplicate_includes || return $?
task_run get_native_libs_toolchain_path || return $?
}

View File

@ -0,0 +1,10 @@
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user manual at https://docs.gradle.org/7.1.1/userguide/multi_project_builds.html
*/
rootProject.name = 'libretroshare'

View File

@ -391,19 +391,11 @@ endif(RS_MINIUPNPC)
#./rs_upnp/upnptest.cc
#./rs_upnp/upnputil.cc
#./rs_android/LocalArray.h
#./rs_android/README-ifaddrs-android.adoc
#./rs_android/ScopedFd.h
#./rs_android/androidcoutcerrcatcher.hpp
#./rs_android/errorconditionwrap.cpp
#./rs_android/ifaddrs-android.h
#./rs_android/org
#./rs_android/org/retroshare
#./rs_android/org/retroshare/service
#./rs_android/org/retroshare/service/AssetHelper.java
#./rs_android/org/retroshare/service/ErrorConditionWrap.java
#./rs_android/org/retroshare/service/RetroShareServiceAndroid.java
#./rs_android/retroshareserviceandroid.cpp
#./rs_android/retroshareserviceandroid.hpp
#./rs_android/rsjni.cpp
#./rs_android/rsjni.hpp
#if(CMAKE_SYSTEM_NAME STREQUAL "Android")
if(RS_ANDROID)
list(
APPEND RS_SOURCES
rs_android/errorconditionwrap.cpp
rs_android/retroshareserviceandroid.cpp
rs_android/rsjni.cpp )
endif()

View File

@ -33,8 +33,10 @@
#include "ft/ftsearch.h"
#include "util/rsdir.h"
#include "util/rsmemory.h"
#include <retroshare/rsturtle.h>
#include "retroshare/rsturtle.h"
#include "util/rstime.h"
#include "rs_android/largefile_retrocompat.hpp"
/* For Thread Behaviour */
const uint32_t DMULTIPLEX_MIN = 10; /* 10 msec sleep */

View File

@ -19,18 +19,21 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifdef WINDOWS_SYS
#include "util/rsstring.h"
#include "util/rswin.h"
#endif
#include <cerrno>
#include <cstdio>
#include <sys/stat.h>
#include "ftfilecreator.h"
#include <errno.h>
#include <stdio.h>
#include "util/rstime.h"
#include <sys/stat.h>
#include <util/rsdiscspace.h>
#include <util/rsdir.h>
#include "util/rsdiscspace.h"
#include "util/rsdir.h"
#include "rs_android/largefile_retrocompat.hpp"
#ifdef WINDOWS_SYS
# include "util/rsstring.h"
# include "util/rswin.h"
#endif
/*******
* #define FILE_DEBUG 1

View File

@ -19,17 +19,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifdef WINDOWS_SYS
#include "util/rswin.h"
#endif // WINDOWS_SYS
#include <cstdlib>
#include <cstdio>
#include "ftfileprovider.h"
#include "ftchunkmap.h"
#include "util/rsdir.h"
#include <stdlib.h>
#include <stdio.h>
#include "util/rstime.h"
#include "util/rsdir.h"
#include "rs_android/largefile_retrocompat.hpp"
#ifdef WINDOWS_SYS
# include "util/rswin.h"
#endif // WINDOWS_SYS
/********
* #define DEBUG_FT_FILE_PROVIDER 1

View File

@ -1131,14 +1131,6 @@ test_bitdht {
android-* {
lessThan(ANDROID_API_VERSION, 24) {
## TODO: This probably disable largefile support and maybe is not necessary with
## __ANDROID_API__ >= 24 hence should be made conditional or moved to a
## compatibility header
DEFINES *= "fopen64=fopen"
DEFINES *= "fseeko64=fseeko"
DEFINES *= "ftello64=ftello"
## @See: rs_android/README-ifaddrs-android.adoc
HEADERS += \
rs_android/ifaddrs-android.h \
@ -1153,6 +1145,7 @@ android-* {
PRE_TARGETDEPS += $$pretargetStaticLibs(sLibs)
HEADERS += \
rs_android/largefile_retrocompat.hpp \
rs_android/androidcoutcerrcatcher.hpp \
rs_android/retroshareserviceandroid.hpp \
rs_android/rsjni.hpp

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.retroshare.service" />

View File

@ -0,0 +1,31 @@
/*******************************************************************************
* *
* libretroshare: retroshare core library *
* *
* Copyright (C) 2016-2021 Gioacchino Mazzurco <gio@eigenlab.org> *
* Copyright (C) 2021 Asociación Civil Altermundi <info@altermundi.net> *
* *
* 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 <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#pragma once
#ifdef __ANDROID__
# include <android/api-level.h>
# if __ANDROID_API__ < 24
# define fopen64 fopen
# define fseeko64 fseeko
# define ftello64 ftello
# endif
#endif

View File

@ -1,7 +1,8 @@
/*
* RetroShare
* Copyright (C) 2016-2021 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2021 Asociación Civil Altermundi <info@altermundi.net>
*
* Copyright (C) 2016-2022 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2021-2022 Asociación Civil Altermundi <info@altermundi.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@ -36,7 +37,7 @@ public class RetroShareServiceAndroid extends Service
public static final int DEFAULT_JSON_API_PORT = 9092;
public static final String DEFAULT_JSON_API_BINDING_ADDRESS = "127.0.0.1";
static { System.loadLibrary("retroshare-service"); }
static { System.loadLibrary("retroshare"); }
public static void start(
Context ctx, int jsonApiPort, String jsonApiBindAddress )

View File

@ -27,6 +27,15 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <dirent.h>
#include <openssl/sha.h>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdexcept>
#include "util/rsdir.h"
#include "util/rsstring.h"
@ -37,16 +46,8 @@
#include "retroshare/rstypes.h"
#include "retroshare/rsnotify.h"
#include "rsthreads.h"
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <dirent.h>
#include <openssl/sha.h>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdexcept>
#include "rs_android/largefile_retrocompat.hpp"
#if defined(WIN32) || defined(__CYGWIN__)
#include "util/rsstring.h"
@ -66,6 +67,7 @@
#define FIND_OF_DIRECTORY_SEPARATOR '/'
#endif
/****
* #define RSDIR_DEBUG 1
****/
@ -605,7 +607,7 @@ bool RsDirUtil::checkCreateDirectory(const std::string& dir)
std::string RsDirUtil::removeSymLinks(const std::string& path)
{
#if defined(WINDOWS_SYS) || defined(__APPLE__) || defined(__ANDROID__)
#if defined(WINDOWS_SYS) || defined(__APPLE__) //|| defined(__ANDROID__)
#warning (Mr.Alice): I don't know how to do this on windows/MacOS/Android. See https://msdn.microsoft.com/en-us/library/windows/desktop/hh707084(v=vs.85).aspx'
//if(!S_OK == PathCchCanonicalizeEx(tmp,...) ;
return path ;