Skip to content

Commit d0ed06d

Browse files
user0-07161github-actions[bot]
authored andcommitted
build: haiku os support #36639
Initial support for compiling on haiku os. Some deps can be pulled from haiku repos, some need to be compiled with nvim's dep build system: cmake -DUSE_BUNDLED_LIBUV=OFF -DUSE_BUNDLED_UNIBILIUM=OFF -DUSE_BUNDLED_LUAJIT=OFF -B .deps ./cmake.deps make -C .deps (cherry picked from commit 10c11c4)
1 parent 9978b1b commit d0ed06d

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

cmake.config/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int main(void)
9191
}
9292
" HAVE_BITSCANFORWARD64)
9393

94-
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
94+
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR CMAKE_SYSTEM_NAME STREQUAL "Haiku")
9595
check_c_source_compiles("
9696
#include <termios.h>
9797
int

src/nvim/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ if(NOT MSVC)
9393
endif()
9494

9595
# -fstack-protector breaks Mingw-w64 builds
96-
if(NOT MINGW)
96+
if(NOT MINGW AND NOT CMAKE_SYSTEM_NAME STREQUAL "Haiku")
9797
check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG)
9898
if(HAS_FSTACK_PROTECTOR_STRONG_FLAG)
9999
target_compile_options(main_lib INTERFACE -fstack-protector-strong)
@@ -145,7 +145,10 @@ endif()
145145
# Platform specific options
146146
if(UNIX)
147147
target_link_libraries(main_lib INTERFACE m)
148-
if (NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS")
148+
if (CMAKE_SYSTEM_NAME STREQUAL "Haiku")
149+
target_link_libraries(main_lib INTERFACE bsd)
150+
target_link_libraries(nvim_bin PRIVATE -lnetwork)
151+
elseif (NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS")
149152
target_link_libraries(main_lib INTERFACE util)
150153
endif()
151154
endif()

src/nvim/os/pty_proc_unix.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@
4646
# include "os/pty_proc_unix.c.generated.h"
4747
#endif
4848

49-
#if defined(__sun) && !defined(HAVE_FORKPTY)
49+
#if !defined(HAVE_FORKPTY) && !defined(__APPLE__)
5050

5151
// this header defines STR, just as nvim.h, but it is defined as ('S'<<8),
5252
// to avoid #undef STR, #undef STR, #define STR ('S'<<8) just delay the
5353
// inclusion of the header even though it gets include out of order.
54-
# include <sys/stropts.h>
54+
55+
# if !defined(__HAIKU__)
56+
# include <sys/stropts.h>
57+
# else
58+
# define I_PUSH 0 // XXX: find the actual value
59+
# endif
5560

5661
static int openpty(int *amaster, int *aslave, char *name, struct termios *termp,
5762
struct winsize *winp)
@@ -343,9 +348,11 @@ static void init_termios(struct termios *termios) FUNC_ATTR_NONNULL_ALL
343348
termios->c_cc[VSTART] = 0x1f & 'Q';
344349
termios->c_cc[VSTOP] = 0x1f & 'S';
345350
termios->c_cc[VSUSP] = 0x1f & 'Z';
351+
#if !defined(__HAIKU__)
346352
termios->c_cc[VREPRINT] = 0x1f & 'R';
347353
termios->c_cc[VWERASE] = 0x1f & 'W';
348354
termios->c_cc[VLNEXT] = 0x1f & 'V';
355+
#endif
349356
termios->c_cc[VMIN] = 1;
350357
termios->c_cc[VTIME] = 0;
351358
}

0 commit comments

Comments
 (0)