In order to have a live programming environment on Haiku, I tried to port opensmalltalk-vm.
Here are the changes made so far:
diff --git a/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c b/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c
index df8a1eec0..22f3cae87 100644
--- a/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c
+++ b/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c
@@ -57,6 +57,10 @@
#endif
#endif
+#ifdef __HAIKU__
+#define IFF_RUNNING IFF_LINK
+#endif
+
#ifdef ACORN
# include <time.h>
# define __time_t
diff --git a/platforms/unix/vm/aio.c b/platforms/unix/vm/aio.c
index 1f7153fbc..cac95691d 100644
--- a/platforms/unix/vm/aio.c
+++ b/platforms/unix/vm/aio.c
@@ -88,6 +88,10 @@
# define signal(a, b) sigset(a, b)
# endif
+# if __HAIKU__
+ # define SIGIO SIGPOLL
+# endif
+
#else /* !HAVE_CONFIG_H -- assume lowest common demoninator */
# include <errno.h>
diff --git a/platforms/unix/vm/include_ucontext.h b/platforms/unix/vm/include_ucontext.h
index 3fb578445..63521f942 100644
--- a/platforms/unix/vm/include_ucontext.h
+++ b/platforms/unix/vm/include_ucontext.h
@@ -16,6 +16,8 @@
#endif
#ifdef __OpenBSD__
# include <sys/signal.h>
+#elif __HAIKU__
+# include <signal.h>
#elif __sun
/* Single UNIX Specification (SUS), Version 2 specifies <ucontext.h> */
# include <ucontext.h>
@@ -63,6 +65,14 @@
# define _PC_IN_UCONTEXT uc_mcontext.gregs[EIP]
# define _FP_IN_UCONTEXT uc_mcontext.gregs[REG_FP]
# define _SP_IN_UCONTEXT uc_mcontext.gregs[REG_SP]
+#elif __HAIKU__ && __i386__
+# define _PC_IN_UCONTEXT uc_mcontext.eip
+# define _FP_IN_UCONTEXT uc_mcontext.ebp
+# define _SP_IN_UCONTEXT uc_mcontext.esp
+#elif __HAIKU__ && __amd64__
+# define _PC_IN_UCONTEXT uc_mcontext.rip
+# define _FP_IN_UCONTEXT uc_mcontext.rbp
+# define _SP_IN_UCONTEXT uc_mcontext.rsp
#elif __linux__ && __i386__
# define _PC_IN_UCONTEXT uc_mcontext.gregs[REG_EIP]
# define _FP_IN_UCONTEXT uc_mcontext.gregs[REG_EBP]
This changes allow to build the bare VM. But in order to display graphics, it requires a display plugin, which uses X11 and OpenGL. I tried to build it using xlibe, but the display plugin requires X11/extensions/Xrandr.h
which xlibe lacks.
There are two ways to solve this problem:
- Either one needs to add Xrandr to xlibe
- Or to implement a display plugin which uses native Haiku API
But I have no experience with neither X11 nor Be API. So I would appreciate some help or at least suggestions.