[libcxx-commits] [libcxx] [libc++] Port to Haiku (PR #196271)
Elaine Gibson via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 13 15:51:09 PDT 2026
https://github.com/ypsvlq updated https://github.com/llvm/llvm-project/pull/196271
>From 81318913e142d3f068e5cfc48bf894736d0123fe Mon Sep 17 00:00:00 2001
From: Elaine Gibson <ypsvlq at gmail.com>
Date: Thu, 13 Aug 2026 23:50:43 +0100
Subject: [PATCH] [libc++] Port to Haiku
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Jérôme Duval <jerome.duval at gmail.com>
---
libcxx/cmake/config-ix.cmake | 4 ++++
libcxx/include/CMakeLists.txt | 1 +
libcxx/include/__config | 3 ++-
libcxx/include/__locale_dir/ctype_base.h | 13 +++++++++++++
libcxx/include/__locale_dir/locale_base_api.h | 2 ++
libcxx/include/module.modulemap.in | 1 +
libcxx/src/include/config_elast.h | 2 ++
7 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/libcxx/cmake/config-ix.cmake b/libcxx/cmake/config-ix.cmake
index 270d80575adcf..e6f114979e9de 100644
--- a/libcxx/cmake/config-ix.cmake
+++ b/libcxx/cmake/config-ix.cmake
@@ -122,6 +122,10 @@ elseif(ANDROID)
set(LIBCXX_HAS_PTHREAD_LIB NO)
set(LIBCXX_HAS_RT_LIB NO)
set(LIBCXX_HAS_ATOMIC_LIB NO)
+elseif(HAIKU)
+ set(LIBCXX_HAS_PTHREAD_LIB NO)
+ set(LIBCXX_HAS_RT_LIB NO)
+ set(LIBCXX_HAS_ATOMIC_LIB NO)
elseif(PICOLIBC)
set(LIBCXX_HAS_PTHREAD_LIB NO)
set(LIBCXX_HAS_RT_LIB NO)
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index a1d6a09aa6b20..f615ce92b0727 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -556,6 +556,7 @@ set(files
__locale_dir/support/bsd_like.h
__locale_dir/support/freebsd.h
__locale_dir/support/fuchsia.h
+ __locale_dir/support/haiku.h
__locale_dir/support/linux.h
__locale_dir/support/llvm_libc.h
__locale_dir/support/netbsd.h
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 8c2b0abfb450f..4fb9be889dd24 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -214,7 +214,8 @@ typedef __char32_t char32_t;
defined(__APPLE__) || \
defined(__MVS__) || \
defined(_AIX) || \
- defined(__EMSCRIPTEN__)
+ defined(__EMSCRIPTEN__) || \
+ defined(__HAIKU__)
// clang-format on
# undef _LIBCPP_HAS_THREAD_API_PTHREAD
# define _LIBCPP_HAS_THREAD_API_PTHREAD 1
diff --git a/libcxx/include/__locale_dir/ctype_base.h b/libcxx/include/__locale_dir/ctype_base.h
index 1188928d78611..ae2f476611089 100644
--- a/libcxx/include/__locale_dir/ctype_base.h
+++ b/libcxx/include/__locale_dir/ctype_base.h
@@ -168,6 +168,19 @@ class _LIBCPP_EXPORTED_FROM_ABI ctype_base {
static const mask blank = __ISBLANK;
# endif
static const mask __regex_word = 0x8000;
+# elif defined(__HAIKU__)
+ typedef unsigned short mask;
+ static const mask space = _ISspace;
+ static const mask print = _ISprint;
+ static const mask cntrl = _IScntrl;
+ static const mask upper = _ISupper;
+ static const mask lower = _ISlower;
+ static const mask alpha = _ISalpha;
+ static const mask digit = _ISdigit;
+ static const mask punct = _ISpunct;
+ static const mask xdigit = _ISxdigit;
+ static const mask blank = _ISblank;
+ static const mask __regex_word = 0x80;
# else
# error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
# endif
diff --git a/libcxx/include/__locale_dir/locale_base_api.h b/libcxx/include/__locale_dir/locale_base_api.h
index 017d971ec72ba..c35c0bd33f3c1 100644
--- a/libcxx/include/__locale_dir/locale_base_api.h
+++ b/libcxx/include/__locale_dir/locale_base_api.h
@@ -128,6 +128,8 @@
# include <__locale_dir/support/newlib.h>
# elif defined(_AIX)
# include <__locale_dir/support/aix.h>
+# elif defined(__HAIKU__)
+# include <__locale_dir/support/haiku.h>
# else
// TODO: This is a temporary definition to bridge between the old way we defined the locale base API
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 4512cc71153ca..da82525b48899 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -1620,6 +1620,7 @@ module std {
textual header "__locale_dir/support/bsd_like.h"
textual header "__locale_dir/support/freebsd.h"
textual header "__locale_dir/support/fuchsia.h"
+ textual header "__locale_dir/support/haiku.h"
textual header "__locale_dir/support/linux.h"
textual header "__locale_dir/support/llvm_libc.h"
textual header "__locale_dir/support/netbsd.h"
diff --git a/libcxx/src/include/config_elast.h b/libcxx/src/include/config_elast.h
index 8aa9355c4e7f3..cb571f1a8bcf6 100644
--- a/libcxx/src/include/config_elast.h
+++ b/libcxx/src/include/config_elast.h
@@ -33,6 +33,8 @@
// No _LIBCPP_ELAST needed on WASI
#elif defined(__EMSCRIPTEN__)
// No _LIBCPP_ELAST needed on Emscripten
+#elif defined(__HAIKU__)
+// No _LIBCPP_ELAST needed on Haiku
#elif defined(__linux__) || _LIBCPP_HAS_MUSL_LIBC
# define _LIBCPP_ELAST 4095
#elif defined(__APPLE__)
More information about the libcxx-commits
mailing list