From 47af69b7d9a2ca5074f9b3576e31afc205b50baa Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 14 Sep 2009 22:06:18 +0000 Subject: [PATCH] 2009-09-15 00:02 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * include/hbthread.h * include/hbdefs.h * include/hbsetup.h * include/hbinit.h * source/common/hbprintf.c * source/rtl/hbsocket.c + config/haiku + config/haiku/libs.mk + config/haiku/gcc.mk + config/haiku/global.mk * config/global.mk * config/detect.mk + Applied patch adding Haiku OS port to Harbour. By Tamas Tevesz. * INSTALL + Added haiku to supported OS list (in 'experimental' status) --- harbour/ChangeLog | 19 +++++++++++ harbour/INSTALL | 6 ++++ harbour/config/detect.mk | 4 +-- harbour/config/global.mk | 8 +++++ harbour/config/haiku/gcc.mk | 56 ++++++++++++++++++++++++++++++++ harbour/config/haiku/global.mk | 11 +++++++ harbour/config/haiku/libs.mk | 36 ++++++++++++++++++++ harbour/include/hbdefs.h | 2 +- harbour/include/hbinit.h | 3 +- harbour/include/hbsetup.h | 9 ++++- harbour/include/hbthread.h | 3 +- harbour/source/common/hbprintf.c | 5 +-- harbour/source/rtl/hbsocket.c | 6 +++- 13 files changed, 159 insertions(+), 9 deletions(-) create mode 100644 harbour/config/haiku/gcc.mk create mode 100644 harbour/config/haiku/global.mk create mode 100644 harbour/config/haiku/libs.mk diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1c24a44a0c..04126fdb43 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,25 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-09-15 00:02 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * include/hbthread.h + * include/hbdefs.h + * include/hbsetup.h + * include/hbinit.h + * source/common/hbprintf.c + * source/rtl/hbsocket.c + + config/haiku + + config/haiku/libs.mk + + config/haiku/gcc.mk + + config/haiku/global.mk + * config/global.mk + * config/detect.mk + + Applied patch adding Haiku OS port to Harbour. + By Tamas Tevesz. + + * INSTALL + + Added haiku to supported OS list (in 'experimental' status) + 2009-09-14 12:43 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg % Deleted UTF-8 hack. Now using the built-in UTF-8 conversion diff --git a/harbour/INSTALL b/harbour/INSTALL index 9b96f512e9..db0e3af975 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -321,6 +321,7 @@ SUPPORTED PLATFORMS AND C COMPILERS linux - Linux darwin - Mac OS X bsd - FreeBSD / OpenBSD / NetBSD / *BSD + haiku - Haiku (experimental) hpux - HP-UX sunos - Sun Solaris / OpenSolaris win - MS Windows (all flavors) @@ -352,6 +353,10 @@ SUPPORTED PLATFORMS AND C COMPILERS ---- gcc - GNU C + haiku + ----- + gcc - GNU C + sunos ----- gcc - GNU C @@ -981,6 +986,7 @@ BUILD HOST-PLATFORM/SHELL - TARGET-PLATFORM/COMPILER COMPATIBILITY MATRIX x darwin -> win/mingw x86 x darwin -> dos/djgpp x86 hpux -> hpux/gcc (CPU cross-builds possible) + haiku -> haiku/gcc x86 x hpux -> wce/mingwarm arm x hpux -> wce/mingw x86 x hpux -> win/mingw x86 diff --git a/harbour/config/detect.mk b/harbour/config/detect.mk index 1355efe571..2b59118dd9 100644 --- a/harbour/config/detect.mk +++ b/harbour/config/detect.mk @@ -47,7 +47,7 @@ _DET_VAR_INC_ := HB_INC_ZLIB _DET_VAR_HAS_ := HB_HAS_ZLIB _DET_FLT_PLAT := _DET_FLT_COMP := -_DET_INC_DEFP := /usr/include +_DET_INC_DEFP := /usr/include /boot/develop/headers/3rdparty _DET_INC_LOCL := $(realpath $(TOP)$(ROOT)external/zlib) _DET_INC_HEAD := /zlib.h @@ -118,7 +118,7 @@ _DET_VAR_INC_ := HB_INC_CURSES _DET_VAR_HAS_ := HB_HAS_CURSES _DET_FLT_PLAT := !os2 _DET_FLT_COMP := -_DET_INC_DEFP := +_DET_INC_DEFP := /boot/develop/headers/3rdparty _DET_INC_HEAD := /curses.h ifeq ($(HB_NCURSES_194),yes) diff --git a/harbour/config/global.mk b/harbour/config/global.mk index 350d58f526..0fbb7bff93 100644 --- a/harbour/config/global.mk +++ b/harbour/config/global.mk @@ -108,6 +108,8 @@ define check_host HB_HOST_PLAT := dos else ifneq ($(findstring msdos,$(1)),) HB_HOST_PLAT := dos + else ifneq ($(findstring Haiku,$(1)),) + HB_HOST_PLAT := haiku endif endef @@ -816,6 +818,12 @@ ifeq ($(HB_COMPILER),) endif endif else + ifeq ($(HB_PLATFORM),haiku) + HB_COMP_PATH := $(call find_in_path,gcc) + ifneq ($(HB_COMP_PATH),) + HB_COMPILER := gcc + endif + endif # add other platforms here endif endif diff --git a/harbour/config/haiku/gcc.mk b/harbour/config/haiku/gcc.mk new file mode 100644 index 0000000000..50b320448c --- /dev/null +++ b/harbour/config/haiku/gcc.mk @@ -0,0 +1,56 @@ +# +# $Id$ +# + +ifeq ($(HB_BUILD_MODE),cpp) + HB_CMP := g++ +else + HB_CMP := gcc +endif + +OBJ_EXT := .o +LIB_PREF := lib +LIB_EXT := .a + +HB_DYN_COPT := -DHB_DYNLIB -fpic + +CC := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX) +CC_IN := -c +CC_OUT := -o + +CPPFLAGS := -I. -I$(HB_INC_COMPILE) +CFLAGS := +LDFLAGS := + +ifneq ($(HB_BUILD_WARN),no) + CFLAGS += -Wall -W +endif + +ifneq ($(HB_BUILD_OPTIM),no) + CFLAGS += -O3 +endif + +ifeq ($(HB_BUILD_DEBUG),yes) + CFLAGS += -g +endif + +LD := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCPOSTFIX) +LD_OUT := -o + +LIBPATHS := $(foreach dir,$(LIB_DIR) $(SYSLIBPATHS),-L$(dir)) +LDLIBS := $(foreach lib,$(LIBS) $(SYSLIBS),-l$(lib)) + +LDFLAGS += $(LIBPATHS) + +AR := $(HB_CCPREFIX)ar +ARFLAGS := +AR_RULE = $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) rcs $(LIB_DIR)/$@ $(^F) || ( $(RM) $(LIB_DIR)/$@ && false ) + +DY := $(CC) +DFLAGS := -shared $(LIBPATHS) +DY_OUT := -o$(subst x,x, ) +DLIBS := $(foreach lib,$(SYSLIBS),-l$(lib)) + +DY_RULE = $(DY) $(DFLAGS) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) + +include $(TOP)$(ROOT)config/rules.mk diff --git a/harbour/config/haiku/global.mk b/harbour/config/haiku/global.mk new file mode 100644 index 0000000000..7ddbb3215e --- /dev/null +++ b/harbour/config/haiku/global.mk @@ -0,0 +1,11 @@ +# +# $Id$ +# + +all : first + +BIN_EXT := +DYN_EXT := .so +DYN_PREF := lib + +HB_GT_LIBS += gttrm diff --git a/harbour/config/haiku/libs.mk b/harbour/config/haiku/libs.mk new file mode 100644 index 0000000000..63c182746b --- /dev/null +++ b/harbour/config/haiku/libs.mk @@ -0,0 +1,36 @@ +# +# $Id$ +# + +SYSLIBS := +SYSLIBPATHS := /system/lib /boot/develop/abi/x86/gcc2/lib + +ifneq ($(HB_LINKING_RTL),) + ifeq ($(HB_CRS_LIB),) + HB_CRS_LIB := ncurses + endif + ifneq ($(HB_HAS_CURSES),) + SYSLIBS += $(HB_CRS_LIB) + endif + ifneq ($(HB_HAS_SLANG),) + SYSLIBS += slang + endif + ifneq ($(HB_HAS_X11),) + SYSLIBS += X11 + # add 64-bit lib dir needed for some distros (red hat) + #ifneq ($(findstring 64,$(shell uname -m)),) + # SYSLIBPATHS += /usr/X11R6/lib64 + #endif + #SYSLIBPATHS += /usr/X11R6/lib + endif + ifneq ($(HB_HAS_PCRE),) + ifeq ($(HB_HAS_PCRE_LOCAL),) + SYSLIBS += pcre + endif + endif + ifeq ($(HB_HAS_ZLIB_LOCAL),) + SYSLIBS += z + endif + SYSLIBS += root socket +endif + diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index 1ca693bbd0..de784fb18d 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -78,7 +78,7 @@ ( defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L ) || \ ( defined( __DJGPP__ ) && \ ( __DJGPP__ > 2 || ( __DJGPP__ == 2 && __DJGPP_MINOR__ >= 4 ) ) ) || \ - defined( HB_OS_LINUX ) || defined( HB_OS_DARWIN ) || defined( HB_OS_SUNOS ) ) ) + defined( HB_OS_LINUX ) || defined( HB_OS_DARWIN ) || defined( HB_OS_SUNOS ) || defined( HB_OS_HAIKU ) ) ) #include /* workaround for BCC 5.8 bug */ #if ( defined( __BORLANDC__ ) && __BORLANDC__ >= 1410 ) diff --git a/harbour/include/hbinit.h b/harbour/include/hbinit.h index 2744459da6..df31fac7cd 100644 --- a/harbour/include/hbinit.h +++ b/harbour/include/hbinit.h @@ -112,7 +112,8 @@ extern HB_EXPORT PHB_SYMB hb_vmProcessSymbols( PHB_SYMB pSymbols, USHORT uiSymbo #define HB_CALL_ON_STARTUP_END( func ) \ } -#elif defined( __GNUC__ ) || defined( __SUNPRO_C ) || defined( __SUNPRO_CC ) +#elif defined( __GNUC__ ) || defined( __SUNPRO_C ) || defined( __SUNPRO_CC ) || \ + defined( __HAIKU__ ) #if defined( HB_PRAGMA_STARTUP ) || defined( HB_MSC_STARTUP ) #error Wrong macros set for startup code - clean your make/env settings. diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index 42f33b67c2..5eb50c84f4 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -279,12 +279,19 @@ #endif #endif +#ifndef HB_OS_HAIKU + #if defined( __HAIKU__ ) + #define HB_OS_HAIKU + #endif +#endif + #ifndef HB_OS_UNIX #if defined( HB_OS_LINUX ) || \ defined( HB_OS_DARWIN ) || \ defined( HB_OS_BSD ) || \ defined( HB_OS_SUNOS ) || \ - defined( HB_OS_HPUX ) + defined( HB_OS_HPUX ) || \ + defined( HB_OS_HAIKU ) #define HB_OS_UNIX /* Compatibility. Do not use this. */ #ifdef HB_LEGACY_LEVEL2 diff --git a/harbour/include/hbthread.h b/harbour/include/hbthread.h index 13039bf0e8..38b8a97070 100644 --- a/harbour/include/hbthread.h +++ b/harbour/include/hbthread.h @@ -62,7 +62,8 @@ defined( HB_OS_DOS ) # define HB_TASK_THREAD #elif defined( HB_OS_LINUX ) || defined( HB_OS_DARWIN ) || \ - defined( HB_OS_SUNOS ) || defined( HB_OS_HPUX ) + defined( HB_OS_SUNOS ) || defined( HB_OS_HPUX ) || \ + defined( HB_OS_HAIKU ) # include # define HB_PTHREAD_API #elif defined( HB_OS_WIN ) diff --git a/harbour/source/common/hbprintf.c b/harbour/source/common/hbprintf.c index 73e0cff79f..c2c781785d 100644 --- a/harbour/source/common/hbprintf.c +++ b/harbour/source/common/hbprintf.c @@ -160,7 +160,8 @@ optimized. ( defined( __DJGPP__ ) && \ ( __DJGPP__ < 2 || ( __DJGPP__ == 2 && __DJGPP_MINOR__ <= 3 ) ) ) || \ ( defined( _MSC_VER ) && \ - !( defined( __LCC__ ) || defined( __POCC__ ) || defined( __XCC__ ) ) ) + !( defined( __LCC__ ) || defined( __POCC__ ) || defined( __XCC__ ) ) ) || \ + ( defined( __GNUC__ ) && __GNUC__ < 3 ) /* TODO: add other C compilers which does not support [u]intmax_t * definitions (check C compiler version number). * If compiler supports stdint.h then it should be added @@ -283,7 +284,7 @@ optimized. # else # define _x_long_dbl long double # if defined( __WATCOMC__ ) || defined( __MINGW32CE__ ) || defined( __CYGWIN__ ) || \ - ( defined( HB_OS_WIN_CE ) && defined( __POCC__ ) ) + ( defined( HB_OS_WIN_CE ) && defined( __POCC__ ) ) || defined( __HAIKU__ ) # define _HB_WRAP_MODFL_ # define _MODFD( x, p ) _hb_modfl( x, p ) # else diff --git a/harbour/source/rtl/hbsocket.c b/harbour/source/rtl/hbsocket.c index 2375c5dcb8..293623c555 100644 --- a/harbour/source/rtl/hbsocket.c +++ b/harbour/source/rtl/hbsocket.c @@ -113,7 +113,7 @@ #if defined( HB_OS_UNIX ) && ! defined( __CYGWIN__ ) # define HB_HAS_UNIX -# if !defined( __WATCOMC__ ) +# if !defined( __WATCOMC__ ) && !defined( __HAIKU__ ) # define HB_HAS_INET_ATON # define HB_HAS_INET_PTON # define HB_HAS_INET_NTOP @@ -1044,7 +1044,9 @@ static void hb_socketSetOsError( int err ) uiErr = HB_SOCKET_ERR_PROTOTYPE; break; case EOPNOTSUPP: +#if defined( SOCKTNOSUPPORT ) case ESOCKTNOSUPPORT: +#endif uiErr = HB_SOCKET_ERR_NOSUPPORT; break; case EMFILE: @@ -1094,9 +1096,11 @@ static void hb_socketSetOsError( int err ) case ESHUTDOWN: uiErr = HB_SOCKET_ERR_SHUTDOWN; break; +#if defined( ETOOMANYREFS ) case ETOOMANYREFS: uiErr = HB_SOCKET_ERR_TOOMANYREFS; break; +#endif case EHOSTDOWN: uiErr = HB_SOCKET_ERR_HOSTDOWN; break;