init haiku
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-04-28 15:06:38 +00:00
commit 22b0891598
9 changed files with 34 additions and 5 deletions

5
configure vendored
View file

@ -77,7 +77,7 @@ my @features_keys = (
); );
sub def_platform { sub def_platform {
if($target ne "Darwin" and $target ne "ClassicMacOS" and $target ne "Windows") { if($target ne "Darwin" and $target ne "ClassicMacOS" and $target ne "Windows" and $target ne "Haiku") {
param_set("freetype2", 1); param_set("freetype2", 1);
param_set("stb-truetype", 0); param_set("stb-truetype", 0);
} else { } else {
@ -264,6 +264,9 @@ foreach my $l (@library_targets) {
if ($l =~ /cocoa/) { if ($l =~ /cocoa/) {
$s =~ s/$o$/.m/; $s =~ s/$o$/.m/;
} }
elsif ($l =~ /haiku/) {
$s =~ s/$o$/.cxx/;
}
else { else {
$s =~ s/$o$/.c/; $s =~ s/$o$/.c/;
} }

View file

@ -30,6 +30,7 @@ enum MwLLBackends {
MwLLBackendGDI, MwLLBackendGDI,
MwLLBackendWayland, MwLLBackendWayland,
MwLLBackendCocoa, MwLLBackendCocoa,
MwLLBackendHaiku
}; };
struct _MwLLCommon { struct _MwLLCommon {
@ -117,6 +118,9 @@ MWDECL void MwLLDBusFreeContext(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx);
#ifdef CLASSIC_MAC_OS #ifdef CLASSIC_MAC_OS
#include <Mw/LowLevel/ClassicMacOS.h> #include <Mw/LowLevel/ClassicMacOS.h>
#endif #endif
#ifdef USE_HAIKU
#include <Mw/LowLevel/Haiku.h>
#endif
union _MwLL { union _MwLL {
struct _MwLLCommon common; struct _MwLLCommon common;
@ -135,6 +139,9 @@ union _MwLL {
#ifdef CLASSIC_MAC_OS #ifdef CLASSIC_MAC_OS
struct _MwLLClassicMacOS cmacos; struct _MwLLClassicMacOS cmacos;
#endif #endif
#ifdef USE_HAIKU
struct _MwLLHaiku haiku;
#endif
}; };
union _MwLLColor { union _MwLLColor {
@ -151,6 +158,9 @@ union _MwLLColor {
#ifdef USE_COCOA #ifdef USE_COCOA
struct _MwLLCocoaColor cocoa; struct _MwLLCocoaColor cocoa;
#endif #endif
#ifdef USE_HAIKU
struct _MwLLHaikuColor haiku;
#endif
}; };
union _MwLLPixmap { union _MwLLPixmap {
@ -170,6 +180,9 @@ union _MwLLPixmap {
#ifdef CLASSIC_MAC_OS #ifdef CLASSIC_MAC_OS
struct _MwLLClassicMacOSPixmap cmacos; struct _MwLLClassicMacOSPixmap cmacos;
#endif #endif
#ifdef USE_HAIKU
struct _MwLLHaikuPixmap haiku;
#endif
}; };
#endif #endif
#include <Mw/TypeDefs.h> #include <Mw/TypeDefs.h>

View file

@ -57,7 +57,7 @@
#include <limits.h> #include <limits.h>
#endif #endif
#if defined(__unix__) || defined(__APPLE__) #if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
#include <dirent.h> #include <dirent.h>
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif

5
pl/ostype/Haiku.pl Normal file
View file

@ -0,0 +1,5 @@
$cc = "g++";
use_backend("haiku");
1;

View file

@ -95,6 +95,10 @@ if (grep(/^cocoa$/, @backends) || param_get("gnustep")) {
$gl_libs = "-framework OpenGL"; $gl_libs = "-framework OpenGL";
} }
if (grep(/^haiku$/, @backends)) {
new_object("src/backend/haiku.cxx");
}
if (param_get("stb-image")) { if (param_get("stb-image")) {
add_cflags("-DUSE_STB_IMAGE"); add_cflags("-DUSE_STB_IMAGE");
if (param_get("tiny")) { if (param_get("tiny")) {

View file

@ -54,7 +54,7 @@ sub set_shared_flag {
sub new_object { sub new_object {
my @l = glob($_[0]); my @l = glob($_[0]);
foreach my $e (@l) { foreach my $e (@l) {
$e =~ s/\.(c|m)$/$object_suffix/; $e =~ s/\.(cxx|c|m)$/$object_suffix/;
push(@library_targets, $e); push(@library_targets, $e);
} }
} }

View file

@ -48,7 +48,7 @@ void MwDynamicClose(void* handle) {
// CFragConnectionID connID = (CFragConnectionID)handle; // CFragConnectionID connID = (CFragConnectionID)handle;
// CloseConnection(&connID); // CloseConnection(&connID);
} }
#elif defined(__unix__) || defined(__APPLE__) #elif defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
void* MwDynamicOpen(const char* path) { void* MwDynamicOpen(const char* path) {
return dlopen(path, RTLD_LOCAL | RTLD_LAZY); return dlopen(path, RTLD_LOCAL | RTLD_LAZY);
} }

View file

@ -55,7 +55,7 @@ void MwTimeSleep(int ms) {
// DisposeTimerUPP(tm.tmAddr); // DisposeTimerUPP(tm.tmAddr);
} }
#elif defined(__unix__) #elif defined(__unix__) || defined(__HAIKU__)
long MwTimeGetTick(void) { long MwTimeGetTick(void) {
struct timespec ts; struct timespec ts;
long n = 0; long n = 0;

4
src/backend/haiku.cxx Normal file
View file

@ -0,0 +1,4 @@
#include <Mw/Milsko.h>
#include "call.c"
CALL(Haiku);