From 4aae789db3b92b0caa10586256b971c644c94d0a Mon Sep 17 00:00:00 2001 From: deathwombat <81913236+deathwombat@users.noreply.github.com> Date: Wed, 18 Mar 2026 14:22:54 -0400 Subject: [PATCH 1/3] Add haiku-amd64 target and fix haiku-x86 target Code won't compile for haiku-x86 with TARGET_LDFLAGS -static. --- configure | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 639165625..7379c1773 100755 --- a/configure +++ b/configure @@ -2996,6 +2996,18 @@ case "$1" in add_sources "dynix" "x86" ;; + *haiku-x86) + TARGET_AS="gcc -c" + TARGET_CC="gcc" + TARGET_NASM="nasm" + generate_gcc_opts "x86" "haiku" + TARGET_CCFLAGS="$OPTS_GCC -fno-pic -O3 -Wno-multichar" + TARGET_LIBS="-lnetwork" + TARGET_TARBALL="haiku-x86" + TARGET_DOCFILES="docs/readme.haiku" #platform specific docfile + add_sources "haiku" "x86" + ;; + ###### AMD 64 *linux-amd64) # generic. works everywhere @@ -3052,6 +3064,19 @@ case "$1" in add_sources "macosx" "amd64" ;; + *haiku-amd64) # HAVE_OGR must be set to 0 + TARGET_AS="gcc -c" + TARGET_CC="gcc" + generate_gcc_opts "amd64" "haiku" + TARGET_NASM="nasm" + TARGET_NASM_FMT="elf64" + TARGET_CCFLAGS="$OPTS_GCC -O3 -Wno-multichar" + TARGET_LIBS="-lnetwork" + TARGET_TARBALL="haiku-amd64" + TARGET_DOCFILES="docs/readme.haiku" #platform specific docfile + add_sources "haiku" "amd64" + ;; + ###### NeXT (x86, m68k, sparc, hppa) *next-x86) @@ -3257,19 +3282,6 @@ case "$1" in add_sources "beos" "ppc" ;; - *haiku-x86) - TARGET_AS="gcc -c" - TARGET_CC="gcc" - TARGET_NASM="nasm" - generate_gcc_opts "x86" "haiku" - TARGET_CCFLAGS="$OPTS_GCC -fno-pic -O3 -Wno-multichar" - TARGET_LDFLAGS="-static" - TARGET_LIBS="-lnetwork" - TARGET_TARBALL="haiku-x86" - TARGET_DOCFILES="docs/readme.haiku" #platform specific docfile - add_sources "haiku" "x86" - ;; - ####### OS/2 (x86, emx) *os2-x86) # [pfeffi] From 69cc7db146dc6198dc5985250f75ecc4f04f57fc Mon Sep 17 00:00:00 2001 From: deathwombat <81913236+deathwombat@users.noreply.github.com> Date: Wed, 18 Mar 2026 14:29:38 -0400 Subject: [PATCH 2/3] Add CPU_AMD64 for OS_HAIKU Haiku can be CPU_X86 or CPU_AMD64. --- common/cputypes.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/cputypes.h b/common/cputypes.h index 8839f24ec..794b6e171 100644 --- a/common/cputypes.h +++ b/common/cputypes.h @@ -484,8 +484,10 @@ #define CLIENT_OS OS_HAIKU #if defined(__POWERPC__) || defined(__PPC__) #define CLIENT_CPU CPU_POWERPC - #elif defined(__INTEL__) - #define CLIENT_CPU CPU_X86 + #elif defined(__i386__) || defined(ASM_X86) + #define CLIENT_CPU CPU_X86 + #elif defined(ASM_AMD64) || defined(__x86_64__) || defined(__amd64__) + #define CLIENT_CPU CPU_AMD64 #endif #elif defined(__MORPHOS__) #define CLIENT_OS_NAME "MorphOS" From 4f4159b1be0f2ec7b490a061a89fc15c5276308d Mon Sep 17 00:00:00 2001 From: deathwombat <81913236+deathwombat@users.noreply.github.com> Date: Wed, 18 Mar 2026 14:31:46 -0400 Subject: [PATCH 3/3] Spawn threads under 64-bit Haiku Use thread_func so that code works under 32- or 64-bit Haiku. --- common/clirun.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/clirun.cpp b/common/clirun.cpp index 41293e483..a3a2713ef 100644 --- a/common/clirun.cpp +++ b/common/clirun.cpp @@ -1151,7 +1151,7 @@ static struct thread_param_block *__StartThread( unsigned int thread_i, // Be OS priority should be adjustable from 1 to 10 // 1 is lowest, 10 is higest for non-realtime and non-system tasks sprintf(thread_name, "%s crunch#%d", utilGetAppName(), thread_i + 1); - thrparams->threadID = spawn_thread((long (*)(void *)) Go_mt, + thrparams->threadID = spawn_thread((thread_func)Go_mt, thread_name, be_priority, (void *)thrparams ); if ( ((thrparams->threadID) >= B_NO_ERROR) && (resume_thread(thrparams->threadID) == B_NO_ERROR) )