init haiku

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 {
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("stb-truetype", 0);
} else {
@ -264,6 +264,9 @@ foreach my $l (@library_targets) {
if ($l =~ /cocoa/) {
$s =~ s/$o$/.m/;
}
elsif ($l =~ /haiku/) {
$s =~ s/$o$/.cxx/;
}
else {
$s =~ s/$o$/.c/;
}

View file

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

View file

@ -57,7 +57,7 @@
#include <limits.h>
#endif
#if defined(__unix__) || defined(__APPLE__)
#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
#include <dirent.h>
#include <dlfcn.h>
#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";
}
if (grep(/^haiku$/, @backends)) {
new_object("src/backend/haiku.cxx");
}
if (param_get("stb-image")) {
add_cflags("-DUSE_STB_IMAGE");
if (param_get("tiny")) {

View file

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

View file

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

View file

@ -55,7 +55,7 @@ void MwTimeSleep(int ms) {
// DisposeTimerUPP(tm.tmAddr);
}
#elif defined(__unix__)
#elif defined(__unix__) || defined(__HAIKU__)
long MwTimeGetTick(void) {
struct timespec ts;
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);