Skip to content

Commit

Permalink
Subject: Haiku: initial platform support
Browse files Browse the repository at this point in the history
  • Loading branch information
kallisti5 authored and lws-team committed Sep 25, 2017
1 parent 39bb33a commit e36f0d3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,10 @@ if (LWS_WITHOUT_BUILTIN_SHA1)
set(LWS_SHA1_USE_OPENSSL_NAME 1)
endif()

if (HAIKU)
set(CMAKE_REQUIRED_LIBRARIES network)
endif()

CHECK_FUNCTION_EXISTS(bzero LWS_HAVE_BZERO)
CHECK_FUNCTION_EXISTS(fork LWS_HAVE_FORK)
CHECK_FUNCTION_EXISTS(getenv LWS_HAVE_GETENV)
Expand Down Expand Up @@ -1129,6 +1133,10 @@ if (UNIX)
list(APPEND LIB_LIST m)
endif()

if (HAIKU)
list(APPEND LIB_LIST network)
endif()

if (LWS_HAVE_LIBCAP)
list(APPEND LIB_LIST cap )
endif()
Expand Down
9 changes: 6 additions & 3 deletions lib/lws-plat-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
#if defined(__APPLE__) || \
defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || \
defined(__OpenBSD__)
defined(__OpenBSD__) || \
defined(__HAIKU__)
struct protoent *tcp_proto;
#endif

Expand All @@ -247,7 +248,8 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
#if defined(__APPLE__) || \
defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || \
defined(__CYGWIN__) || defined(__OpenBSD__) || defined (__sun)
defined(__CYGWIN__) || defined(__OpenBSD__) || defined (__sun) || \
defined(__HAIKU__)

/*
* didn't find a way to set these per-socket, need to
Expand Down Expand Up @@ -291,7 +293,8 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
#elif !defined(__APPLE__) && \
!defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && \
!defined(__NetBSD__) && \
!defined(__OpenBSD__)
!defined(__OpenBSD__) && \
!defined(__HAIKU__)
if (setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&optval, optlen) < 0)
return 1;
#else
Expand Down
5 changes: 4 additions & 1 deletion lib/private-libwebsockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,16 @@ int kill(int pid, int sig);
#include <getifaddrs.h>
#else
#if !defined(LWS_WITH_ESP8266) && !defined(LWS_WITH_ESP32)
#if defined(__HAIKU__)
#define _BSD_SOURCE
#endif
#include <ifaddrs.h>
#endif
#endif
#if defined (__ANDROID__)
#include <syslog.h>
#include <sys/resource.h>
#elif defined (__sun)
#elif defined (__sun) || defined(__HAIKU__)
#include <syslog.h>
#else
#if !defined(LWS_WITH_ESP8266) && !defined(LWS_WITH_ESP32)
Expand Down

0 comments on commit e36f0d3

Please sign in to comment.