diff --git a/.gitignore b/.gitignore index e0292b19..fcf9a284 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,11 @@ *.o *.a +*.so +pCloudCC/CMakeCache.txt +pCloudCC/CMakeFiles/ +pCloudCC/Makefile +pCloudCC/cmake_install.cmake +pCloudCC/install_manifest.txt +pCloudCC/lib/mbedtls/Makefile +pCloudCC/lib/mbedtls/library/Makefile +pCloudCC/pcloudcc diff --git a/install_debian.sh b/install_debian.sh new file mode 100755 index 00000000..5e94e261 --- /dev/null +++ b/install_debian.sh @@ -0,0 +1,17 @@ +#!/bin/sh +sudo apt-get install cmake zlib1g-dev libboost-system-dev libboost-program-options-dev libpthread-stubs0-dev libfuse-dev libudev-dev git +mkdir console-client +git clone https://github.com/pcloudcom/console-client.git ./console-client/ +cd ./console-client/pCloudCC/ +cd lib/pclsync/ +make clean +make fs +cd ../mbedtls/ +cmake . +make clean +make +cd ../.. +cmake . +make +sudo make install +ldconfig diff --git a/pCloudCC/lib/mbedtls/CMakeLists.txt b/pCloudCC/lib/mbedtls/CMakeLists.txt index eafe3017..420dff41 100644 --- a/pCloudCC/lib/mbedtls/CMakeLists.txt +++ b/pCloudCC/lib/mbedtls/CMakeLists.txt @@ -4,7 +4,7 @@ project(MBEDTLS C) string(REGEX MATCH "Clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER_ID}") set (CMAKE_INSTALL_LOCAL_ONLY ON) if(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -W -Wdeclaration-after-statement -Wwrite-strings -Wlogical-op -fPIC") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -Wall -Wextra -W -Wdeclaration-after-statement -Wwrite-strings -Wlogical-op -fPIC") set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage") @@ -15,7 +15,7 @@ if(CMAKE_COMPILER_IS_GNUCC) endif(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_CLANG) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -W -Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -Wall -Wextra -W -Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith") set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage") diff --git a/pCloudCC/lib/pclsync/Makefile b/pCloudCC/lib/pclsync/Makefile index ffb86385..ede5d878 100644 --- a/pCloudCC/lib/pclsync/Makefile +++ b/pCloudCC/lib/pclsync/Makefile @@ -4,16 +4,16 @@ RANLIB=ranlib #USESSL=openssl USESSL=mbed -#CFLAGS=-Wall -Wpointer-arith -O2 -g -mtune=core2 -CFLAGS=-Wall -Wpointer-arith -O2 -g -fno-stack-protector -fomit-frame-pointer -mtune=core2 -I../sqlite -DP_ELECTRON -fPIC - -#CFLAGS=-Wall -Wpointer-arith -O2 -g -fsanitize=address -mtune=core2 -#CFLAGS=-Wall -Wpointer-arith -O2 -g -fsanitize=address -mtune=core2 -I../sqlite -#CFLAGS=-Wall -Wpointer-arith -Os -g -mtune=core2 -I../sqlite -pg -#CFLAGS=-Wall -Wpointer-arith -O2 -g -fno-stack-protector -fomit-frame-pointer -mtune=core2 -I../sqlite/ -fPIC -#CFLAGS=-Wall -Wpointer-arith -O2 -g -mtune=core2 -I../sqlite -pg -m32 -D_FILE_OFFSET_BITS=64 +#CFLAGS=-Wall -Wpointer-arith -O2 -g +CFLAGS=-Wall -Wpointer-arith -O2 -g -fno-stack-protector -fomit-frame-pointer -I../sqlite -DP_ELECTRON -fPIC + +#CFLAGS=-Wall -Wpointer-arith -O2 -g -fsanitize=address +#CFLAGS=-Wall -Wpointer-arith -O2 -g -fsanitize=address -I../sqlite +#CFLAGS=-Wall -Wpointer-arith -Os -g -I../sqlite -pg +#CFLAGS=-Wall -Wpointer-arith -O2 -g -fno-stack-protector -fomit-frame-pointer -I../sqlite/ -fPIC +#CFLAGS=-Wall -Wpointer-arith -O2 -g -I../sqlite -pg -m32 -D_FILE_OFFSET_BITS=64 #CFLAGS=-O2 -g -pg -#CFLAGS=-Wall -Wpointer-arith -O2 -g -mtune=core2 -I../../psync32/zlib -I../../psync32/sqlite -m32 -D_FILE_OFFSET_BITS=64 +#CFLAGS=-Wall -Wpointer-arith -O2 -g -I../../psync32/zlib -I../../psync32/sqlite -m32 -D_FILE_OFFSET_BITS=64 LIB_A=psynclib.a #LIB_A=libpsynclib.a diff --git a/pCloudCC/lib/pclsync/pcompat.h b/pCloudCC/lib/pclsync/pcompat.h index ef7b6ceb..ddd215ce 100644 --- a/pCloudCC/lib/pclsync/pcompat.h +++ b/pCloudCC/lib/pclsync/pcompat.h @@ -92,7 +92,9 @@ #define P_OS_ID 7 +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #else diff --git a/pCloudCC/lib/pclsync/pcompiler.h b/pCloudCC/lib/pclsync/pcompiler.h index 61c68055..ffe55820 100644 --- a/pCloudCC/lib/pclsync/pcompiler.h +++ b/pCloudCC/lib/pclsync/pcompiler.h @@ -45,15 +45,15 @@ #endif #endif -#ifndef __has_builtin +#ifndef PSYNC_HAS_BUILTIN #if defined(__GNUC__) -#define __has_builtin(x) 1 +#define PSYNC_HAS_BUILTIN(x) 1 #else -#define __has_builtin(x) 0 +#define PSYNC_HAS_BUILTIN(x) 0 #endif #endif -#if __has_builtin(__builtin_expect) +#if PSYNC_HAS_BUILTIN(__builtin_expect) #define likely(expr) __builtin_expect(!!(expr), 1) #define unlikely(expr) __builtin_expect(!!(expr), 0) #else @@ -61,7 +61,7 @@ #define unlikely(expr) (expr) #endif -#if __has_builtin(__builtin_prefetch) +#if PSYNC_HAS_BUILTIN(__builtin_prefetch) #define psync_prefetch(expr) __builtin_prefetch(expr) #elif defined(_MSC_VER) #define psync_prefetch(expr) _mm_prefetch((char *)(expr), _MM_HINT_T0) diff --git a/pCloudCC/lib/pclsync/pfs.c b/pCloudCC/lib/pclsync/pfs.c index 165c0856..814adfc9 100644 --- a/pCloudCC/lib/pclsync/pfs.c +++ b/pCloudCC/lib/pclsync/pfs.c @@ -3415,6 +3415,7 @@ static int psync_fs_do_start(){ #if defined(P_OS_LINUX) fuse_opt_add_arg(&args, "argv"); fuse_opt_add_arg(&args, "-oauto_unmount"); + fuse_opt_add_arg(&args, "-oallow_others"); // Hack allow all users // fuse_opt_add_arg(&args, "-ouse_ino"); fuse_opt_add_arg(&args, "-ofsname="DEFAULT_FUSE_MOUNT_POINT".fs"); if (!is_fuse3_installed_on_system()) { diff --git a/pCloudCC/lib/pclsync/psettings.h b/pCloudCC/lib/pclsync/psettings.h index 38ccb346..22fb82ab 100644 --- a/pCloudCC/lib/pclsync/psettings.h +++ b/pCloudCC/lib/pclsync/psettings.h @@ -237,7 +237,7 @@ #define PSYNC_FS_MAX_READAHEAD (16*1024*1024) #define PSYNC_FS_MAX_READAHEAD_IF_SEC (64*1024*1024) #define PSYNC_FS_MAX_READAHEAD_SEC 16 -#define PSYNC_FS_DEFAULT_CACHE_SIZE ((uint64_t)5*1024*1024*1024) +#define PSYNC_FS_DEFAULT_CACHE_SIZE ((uint64_t)64*1024*1024) #define PSYNC_FS_DIRECT_UPLOAD_LIMIT (256*1024) #define PSYNC_FS_FILESIZE_FOR_2CONN (4*1024*1024) #define PSYNC_FS_FILE_LOC_HIST_SEC 30