Permalink
Browse files

Minor changes to build process for HaikuOS (POSIX binding, of course)

  • Loading branch information...
hostilefork committed Dec 26, 2012
1 parent 32752b8 commit 45a37e3678aefaef42ab86eabe62ab25f8b2b99a
Showing with 58 additions and 13 deletions.
  1. +13 −0 src/include/reb-config.h
  2. +29 −0 src/os/posix/dev-file.c
  3. +1 −1 src/tools/make-make.r
  4. +15 −12 src/tools/systems.r
View
@@ -136,7 +136,14 @@ These are now obsolete (as of A107) and should be removed:
#define AGG_FREETYPE //use freetype2 library for fonts by default
#define FINITE finite
#define INLINE
+
+#ifndef TO_HAIKU
+// Unsupported by gcc 2.95.3-haiku-121101
#define API_EXPORT __attribute__((visibility("default")))
+#else
+#define API_EXPORT
+#endif
+
#define API_IMPORT
#endif
@@ -162,6 +169,12 @@ These are now obsolete (as of A107) and should be removed:
#define HAS_LONG_DOUBLE
#endif
+#ifdef TO_HAIKU // same as Linux/Intel seems to work
+#define ENDIAN_LITTLE
+#define HAS_LONG_DOUBLE
+#define HAS_LOG10L
+#endif
+
#ifdef TO_OSXI // OSX/Intel
#define ENDIAN_LITTLE
#define HAS_ECVT
View
@@ -46,6 +46,31 @@
#include <dirent.h>
#include <errno.h>
+// dirent.d_type is a BSD extension, actually not part of POSIX
+// alternate from: http://ports.haiku-files.org/wiki/CommonProblems
+#ifndef DT_DIR
+static int
+is_dir (const char *path, const char *name)
+{
+ int len1 = strlen(path);
+ int len2 = strlen(name);
+ struct stat st;
+
+ char pathname[len1 + 1 + len2 + 1 + 13];
+ strcpy (pathname, path);
+
+ /* Avoid UNC-path "//name" on Cygwin. */
+ if (len1 > 0 && pathname[len1 - 1] != '/')
+ strcat (pathname, "/");
+
+ strcat (pathname, name);
+
+ if (stat (pathname, &st))
+ return 0;
+ return S_ISDIR (st.st_mode);
+}
+#endif
+
#include "reb-host.h"
#include "host-lib.h"
@@ -197,12 +222,16 @@ static int Get_File_Info(REBREQ *file)
file->modes = 0;
COPY_BYTES(file->file.path, cp, MAX_FILE_NAME);
+#ifdef DT_DIR
// NOTE: not all posix filesystems support this (mainly
// the Linux and BSD support it.) If this fails to build, a
// different mechanism must be used. However, this is the
// most efficient, because it does not require a separate
// file system call for determining directories.
if (d->d_type == DT_DIR) SET_FLAG(file->modes, RFM_DIR);
+#else
+ if (is_dir (dir->file.path, file->file.path)) SET_FLAG(file->modes, RFM_DIR);
+#endif
// Line below DOES NOT WORK -- because we need full path.
//Get_File_Info(file); // updates modes, size, time
View
@@ -72,7 +72,7 @@ RLIB_FLAGS=
# Flags for core and for host:
RFLAGS= -c -D$(TO_OS) -DREB_API $(RAPI_FLAGS) $I
HFLAGS= -c -D$(TO_OS) -DREB_CORE $(HOST_FLAGS) $I
-CLIB= -lm
+CLIB=
# REBOL builds various include files:
REBOL= $(CD)r3-make -qs
View
@@ -20,18 +20,19 @@ REBOL [
systems: [
[plat os-name os-base build-flags]
- [0.1.03 "amiga" posix [HID NPS +SC CMT COP -SP]]
- [0.2.04 "osx" posix [+OS NCM]] ; no shared lib possible
- [0.2.05 "osxi" posix [ARC +O1 NPS PIC NCM HID STX]]
- [0.3.01 "win32" win32 [+O2 UNI W32 WIN S4M EXE DIR]]
- [0.4.02 "linux" posix [+O2 LDL ST1]] ; libc 2.3
- [0.4.03 "linux" posix [+O2 HID LDL ST1]] ; libc 2.5
- [0.4.04 "linux" posix [+O2 HID LDL ST1 M32]] ; libc 2.11
- [0.4.10 "linux_ppc" posix [+O1 HID LDL ST1]]
- [0.4.20 "linux_arm" posix [+O2 HID LDL ST1]]
- [0.4.30 "linux_mips" posix [+O2 HID LDL ST1]] ; glibc does not need C++
- [0.7.02 "freebsd" posix [+O1 C++ ST1]]
- [0.9.04 "openbsd" posix [+O1 C++ ST1]]
+ [0.1.03 "amiga" posix [HID NPS +SC CMT COP -SP -LM]]
+ [0.2.04 "osx" posix [+OS NCM -LM]] ; no shared lib possible
+ [0.2.05 "osxi" posix [ARC +O1 NPS PIC NCM HID STX -LM]]
+ [0.3.01 "win32" win32 [+O2 UNI W32 WIN S4M EXE DIR -LM]]
+ [0.4.02 "linux" posix [+O2 LDL ST1 -LM]] ; libc 2.3
+ [0.4.03 "linux" posix [+O2 HID LDL ST1 -LM]] ; libc 2.5
+ [0.4.04 "linux" posix [+O2 HID LDL ST1 M32 -LM]] ; libc 2.11
+ [0.4.10 "linux_ppc" posix [+O1 HID LDL ST1 -LM]]
+ [0.4.20 "linux_arm" posix [+O2 HID LDL ST1 -LM]]
+ [0.4.30 "linux_mips" posix [+O2 HID LDL ST1 -LM]] ; glibc does not need C++
+ [0.5.75 "haiku" posix [+O2 ST1 NWK]]
+ [0.7.02 "freebsd" posix [+O1 C++ ST1 -LM]]
+ [0.9.04 "openbsd" posix [+O1 C++ ST1 -LM]]
]
compile-flags: [
@@ -61,6 +62,8 @@ linker-flags: [
W32: "-lwsock32 -lcomdlg32"
WIN: "-mwindows"; build as Windows GUI binary
S4M: "-Wl,--stack=4194300"
+ -LM: "-lm" ; HaikuOS has math in libroot, for instance
+ NWK: "-lnetwork" ; Needed by HaikuOS
]
other-flags: [

0 comments on commit 45a37e3

Please sign in to comment.