Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for FreeBSD #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pCloudCC/lib/mbedtls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 6 additions & 2 deletions pCloudCC/lib/pclsync/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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\
Expand Down
2 changes: 1 addition & 1 deletion pCloudCC/lib/pclsync/pcallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion pCloudCC/lib/pclsync/pcompat.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include <sys/wait.h>
#include <sys/mman.h>
#include <netinet/tcp.h>
#include <netinet/in.h>
#include <net/if.h>
#include <utime.h>
#include <limits.h>
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pCloudCC/lib/pclsync/pdevice_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <libudev.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
4 changes: 2 additions & 2 deletions pCloudCC/lib/pclsync/pfsxattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sys/xattr.h>
#else
// No xattr in win.
// No xattr in win and freebsd (freebsd has extattr. though).
// Value get from standard xattr.h
enum
{
Expand Down
1 change: 1 addition & 0 deletions pCloudCC/lib/pclsync/pp2p.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "pcrypto.h"
#include "pfolder.h"
#include <string.h>
#include <netinet/in.h>

#define P2P_ENCTYPE_RSA_AES 0

Expand Down
4 changes: 2 additions & 2 deletions pCloudCC/lib/pclsync/psettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
9 changes: 2 additions & 7 deletions pCloudCC/lib/pclsync/ptools.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);
/**********************************************************************************************************/
/**********************************************************************************************************/