diff --git a/pCloudCC/lib/mbedtls/CMakeLists.txt b/pCloudCC/lib/mbedtls/CMakeLists.txt index eafe3017..6a05a3ef 100644 --- a/pCloudCC/lib/mbedtls/CMakeLists.txt +++ b/pCloudCC/lib/mbedtls/CMakeLists.txt @@ -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} -Wall -Wextra -W -Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith -fPIC") 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..44cc9a0f 100644 --- a/pCloudCC/lib/pclsync/Makefile +++ b/pCloudCC/lib/pclsync/Makefile @@ -33,14 +33,18 @@ else ifneq (,$(findstring Debian,$(UNAME_V))) CFLAGS += -DP_OS_DEBIAN endif - LDFLAGS += -lssl -lcrypto -lfuse -lpthread -lsqlite3 -lzlib + LDFLAGS += -lssl -lcrypto -lfuse -lpthread -lsqlite3 -lzlib endif ifeq ($(UNAME_S),Darwin) CFLAGS += -DP_OS_MACOSX -I/usr/local/ssl/include/ CFLAGS += -DP_OS_MACOSX -I/usr/local/include/osxfuse/ - LDFLAGS += -lssl -lcrypto -losxfuse -lsqlite3 -framework Cocoa -L/usr/local/ssl/lib + LDFLAGS += -lssl -lcrypto -losxfuse -lsqlite3 -framework Cocoa -L/usr/local/ssl/lib #USESSL=securetransport endif + ifeq ($(UNAME_S),FreeBSD) + CFLAGS += -DP_OS_BSD + LDFLAGS += -lssl -lcrypto -lfuse -lpthread -lsqlite3 -lzlib + endif endif OBJ=pcompat.o psynclib.o plocks.o plibs.o pcallbacks.o pdiff.o pstatus.o papi.o ptimer.o pupload.o pdownload.o pfolder.o\ diff --git a/pCloudCC/lib/pclsync/pcallbacks.h b/pCloudCC/lib/pclsync/pcallbacks.h index fcf736be..96217d3d 100644 --- a/pCloudCC/lib/pclsync/pcallbacks.h +++ b/pCloudCC/lib/pclsync/pcallbacks.h @@ -30,7 +30,7 @@ #include "psynclib.h" -#if defined(P_OS_LINUX) +#if defined(P_OS_LINUX) || defined(P_OS_BSD) typedef void(/*_cdecl*/ *data_event_callback)(int eventId, char* str1, char* str2, uint64_t uint1, uint64_t uint2); #else typedef void(/*_cdecl*/__stdcall *data_event_callback)(int eventId, char* str1, char* str2, uint64_t uint1, uint64_t uint2); diff --git a/pCloudCC/lib/pclsync/pcompat.c b/pCloudCC/lib/pclsync/pcompat.c index 1aa1802d..dcfbb32e 100644 --- a/pCloudCC/lib/pclsync/pcompat.c +++ b/pCloudCC/lib/pclsync/pcompat.c @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -1401,9 +1402,12 @@ static psync_socket_t connect_socket_direct(const char *host, const char *port){ #elif defined(P_OS_WINDOWS) setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&sock_opt, sizeof(sock_opt)); setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&sock_opt, sizeof(sock_opt)); -#elif defined(P_OS_MACOSX) || defined(P_OS_BSD) +#elif defined(P_OS_MACOSX) setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&sock_opt, sizeof(sock_opt)); setsockopt(sock, IPPROTO_TCP, TCP_KEEPALIVE, (char*)&sock_opt, sizeof(sock_opt)); +#elif defined(P_OS_BSD) + setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&sock_opt, sizeof(sock_opt)); + setsockopt(sock, IPPROTO_TCP, SO_KEEPALIVE, (char*)&sock_opt, sizeof(sock_opt)); #endif #if defined(SOL_TCP) #if defined(TCP_KEEPCNT) diff --git a/pCloudCC/lib/pclsync/pdevice_monitor.c b/pCloudCC/lib/pclsync/pdevice_monitor.c index 31565533..d46450e6 100644 --- a/pCloudCC/lib/pclsync/pdevice_monitor.c +++ b/pCloudCC/lib/pclsync/pdevice_monitor.c @@ -263,7 +263,7 @@ void psync_devmon_init(){ } #endif //P_OS_MACOSX -#ifdef P_OS_LINUX +#if defined (P_OS_LINUX) || defined (P_OS_BSD) #include #include #include diff --git a/pCloudCC/lib/pclsync/pfsxattr.c b/pCloudCC/lib/pclsync/pfsxattr.c index 87871bef..6ef74a0d 100644 --- a/pCloudCC/lib/pclsync/pfsxattr.c +++ b/pCloudCC/lib/pclsync/pfsxattr.c @@ -16,10 +16,10 @@ #endif // Do we have this in Win? -#if !defined(P_OS_WINDOWS) +#if !defined(P_OS_WINDOWS) && !defined(P_OS_BSD) #include #else -// No xattr in win. +// No xattr in win and freebsd (freebsd has extattr. though). // Value get from standard xattr.h enum { diff --git a/pCloudCC/lib/pclsync/pp2p.c b/pCloudCC/lib/pclsync/pp2p.c index 14b2d5f1..40ab2f32 100644 --- a/pCloudCC/lib/pclsync/pp2p.c +++ b/pCloudCC/lib/pclsync/pp2p.c @@ -38,6 +38,7 @@ #include "pcrypto.h" #include "pfolder.h" #include +#include #define P2P_ENCTYPE_RSA_AES 0 diff --git a/pCloudCC/lib/pclsync/psettings.h b/pCloudCC/lib/pclsync/psettings.h index 38ccb346..aa52bcf9 100644 --- a/pCloudCC/lib/pclsync/psettings.h +++ b/pCloudCC/lib/pclsync/psettings.h @@ -279,8 +279,8 @@ pagefile.sys;\ #define PSYNC_IGNORE_PATHS_DEFAULT "/Applications;/Library;/private;/System;/bin;/etc;/sbin;/usr;" #endif -#if defined (P_OS_LINUX) -#define PSYNC_IGNORE_PATHS_DEFAULT "/Applications;/Library;/private;/System;/bin;/dev;/etc;/net;/sbin;/usr;/Developer;" +#if defined (P_OS_LINUX) || defined (P_OS_BSD) +#define PSYNC_IGNORE_PATHS_DEFAULT "/bin;/dev;/etc;/net;/sbin;/usr;" #endif /* Defaults for business account settings */ diff --git a/pCloudCC/lib/pclsync/ptools.h b/pCloudCC/lib/pclsync/ptools.h index c4b0eddd..8a6ccf1b 100644 --- a/pCloudCC/lib/pclsync/ptools.h +++ b/pCloudCC/lib/pclsync/ptools.h @@ -43,13 +43,8 @@ #if defined(P_OS_WINDOWS) #define DELIM_DIR '\\' -#endif -#if defined(P_OS_LINUX) -#define DELIM_DIR '/' -#endif - -#if defined(P_OS_MACOSX) +#elif defined(P_OS_LINUX) || defined(P_OS_MACOSX) || defined(P_OS_BSD) #define DELIM_DIR '/' #endif @@ -98,4 +93,4 @@ int set_be_file_dates(uint64_t fileid, time_t ctime, time_t mtime); char* get_sync_folder_by_syncid(uint64_t syncId); /**********************************************************************************************************/ char* get_folder_name_from_path(char* path); - /**********************************************************************************************************/ \ No newline at end of file + /**********************************************************************************************************/