Initial support for Haiku (#27793)

* Detect Haiku in core/lib/iomgr

* Detect Haiku in include/grpc/impl/codegen

* CMake: Haiku doesn't need additional libraries

* CMake: Haiku doesn't need additional libraries

* Sanitize: word wrap

Co-authored-by: AJ Heller <hork@google.com>
pull/29762/head^2
Jérôme Duval 3 years ago committed by GitHub
parent cdb87a7791
commit 7251dd566d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CMakeLists.txt
  2. 26
      include/grpc/impl/codegen/port_platform.h
  3. 10
      src/core/lib/iomgr/port.h
  4. 2
      templates/CMakeLists.txt.template

2
CMakeLists.txt generated

@ -298,7 +298,7 @@ if (gRPC_XDS_USER_AGENT_IS_CSHARP)
add_definitions("-DGRPC_XDS_USER_AGENT_NAME_SUFFIX=\"csharp\"" "-DGRPC_XDS_USER_AGENT_VERSION_SUFFIX=\"2.47.0-dev\"")
endif()
if(UNIX)
if(UNIX AND NOT HAIKU)
# -pthread does more than -lpthread
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)

@ -431,6 +431,32 @@
#define GPR_HAS_PTHREAD_H 1
#define GPR_GETPID_IN_UNISTD_H 1
#define GRPC_ROOT_PEM_PATH "/config/ssl/cert.pem"
#elif defined(__HAIKU__)
#define GPR_PLATFORM_STRING "haiku"
// Haiku is a community-supported platform.
// Please contact Jerome Duval <jerome.duval@gmail.com> for support.
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif
#define GPR_HAIKU 1
#define GPR_CPU_POSIX 1
#define GPR_GCC_ATOMIC 1
#define GPR_POSIX_LOG 1
#define GPR_POSIX_ENV 1
#define GPR_POSIX_TMPFILE 1
#define GPR_POSIX_STAT 1
#define GPR_POSIX_STRING 1
#define GPR_POSIX_SUBPROCESS 1
#define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1
#define GPR_HAS_PTHREAD_H 1
#define GPR_GETPID_IN_UNISTD_H 1
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
#ifdef _LP64
#define GPR_ARCH_64 1
#else /* _LP64 */
#define GPR_ARCH_32 1
#endif /* _LP64 */
#else
#error "Could not auto-detect platform"
#endif

@ -186,6 +186,16 @@
// TODO(rudominer) Check this does something we want.
#define GRPC_POSIX_SOCKETUTILS 1
#define GRPC_TIMER_USE_GENERIC 1
#elif defined(GPR_HAIKU)
#define GRPC_HAVE_ARPA_NAMESER 1
#define GRPC_HAVE_IFADDRS 1
#define GRPC_HAVE_IPV6_RECVPKTINFO 1
#define GRPC_HAVE_UNIX_SOCKET 1
#define GRPC_POSIX_FORK 1
#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
#define GRPC_POSIX_SOCKET 1
#define GRPC_POSIX_SOCKETUTILS 1
#define GRPC_POSIX_WAKEUP_FD 1
#elif !defined(GPR_NO_AUTODETECT_PLATFORM)
#error "Platform not recognized"
#endif

@ -342,7 +342,7 @@
add_definitions("-DGRPC_XDS_USER_AGENT_NAME_SUFFIX=\"csharp\"" "-DGRPC_XDS_USER_AGENT_VERSION_SUFFIX=\"${settings.csharp_version}\"")
endif()
if(UNIX)
if(UNIX AND NOT HAIKU)
# -pthread does more than -lpthread
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)

Loading…
Cancel
Save