diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bbbfcb322c..cb311d4245 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,16 @@ +2001-12-05 15:30 UTC-0500 David G. Holm + + + config/bsd + + config/bsd/dir.cf + + config/bsd/gcc.cf + + config/bsd/global.cf + + config/bsd/install.cf + * source/rtl/disksphb.c + * source/rtl/seconds.c + * source/rtl/gtstd/gtstd.c + + FreeBSD 4.4 port + + 2001-12-05 19:44 UTC+0100 Viktor Szakats * include/hbmath.h @@ -2630,6 +2643,7 @@ *fixes to the edit mode to be more compatible with linux *Now Setbuild() return the command line to gcc(Linux and Os/2) insted of an response file + * source/pp/pragma.c * contrib/dot/pp_harb.ch * tests/inline_c.prg diff --git a/harbour/config/bsd/dir.cf b/harbour/config/bsd/dir.cf new file mode 100644 index 0000000000..08f9ed936f --- /dev/null +++ b/harbour/config/bsd/dir.cf @@ -0,0 +1,14 @@ +# +# $Id$ +# + +ifeq ($(PM),) # Only traverse directories if not compiling a specific module + +DIR_RULE =\ + @for d in $(DIRS); do \ + if [ -d $$d ]; then \ + $(MAKE) -C $$d $@; \ + fi \ + done + +endif # ! compiling a specific program module \ No newline at end of file diff --git a/harbour/config/bsd/gcc.cf b/harbour/config/bsd/gcc.cf new file mode 100644 index 0000000000..7609e19b9f --- /dev/null +++ b/harbour/config/bsd/gcc.cf @@ -0,0 +1,75 @@ +# +# $Id$ +# + +include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf + +OBJ_EXT = .o +EXE_EXT = +LIB_PREF = lib +LIB_EXT = .a + +CC = gcc +CC_IN = -c +CC_OUT = -o +CPPFLAGS = -I. -I$(HB_INC_COMPILE) +ifeq ($(HB_LEX),SIMPLEX) +CFLAGS = -Wall -g -DHB_OS_BSD -DSIMPLEX +else +CFLAGS = -Wall -g -DHB_OS_BSD +endif + +LD = gcc +LD_OUT = -o + +# Add all libraries specified in CONTRIBS and LIBS. +ifeq ($(HB_LIB_COMPILE),) +LINKPATHS += $(foreach lib, $(CONTRIBS), -L$(TOP)$(ROOT)contrib/$(lib)/$(ARCH)) +LINKPATHS += $(foreach lib, $(LIBS), -L$(TOP)$(ROOT)source/$(lib)/$(ARCH)) +else +LINKPATHS += -L$(HB_LIB_COMPILE) +endif +LINKLIBS += -Wl,--start-group +LINKLIBS += $(foreach lib, $(CONTRIBS), -l$(lib)) +LINKLIBS += $(foreach lib, $(LIBS), -l$(lib)) + +# If LIBS specifies the rdd library, add all DB drivers. +ifeq ($(findstring rdd,$(LIBS)),rdd) +LINKPATHS += $(foreach drv, $(HB_DB_DRIVERS), -L$(TOP)$(ROOT)source/rdd/$(drv)/$(ARCH)) +LINKLIBS += $(foreach drv, $(HB_DB_DRIVERS), -l$(drv)) +endif + +# Add the specified GT driver library +ifeq ($(findstring rtl,$(LIBS)),rtl) +LINKPATHS += -L$(TOP)$(ROOT)source/rtl/$(HB_GT_LIB)/$(ARCH) +LINKLIBS += -l$(HB_GT_LIB) +endif + +# HB_SCREEN_LIB: empty, or one of ncurses, slang +ifeq ($(HB_GT_LIB),gtcrs) +HB_SCREEN_LIB:=ncurses +else +ifeq ($(HB_GT_LIB),gtsln) +HB_SCREEN_LIB:=slang +endif +endif + +ifneq ($(HB_SCREEN_LIB),) +LINKPATHS += -L/usr/local/lib +LINKLIBS += -l$(HB_SCREEN_LIB) +endif + +LINKLIBS += -lm -Wl,--end-group + +LDFLAGS += $(LINKPATHS) + +AR = ar +ARFLAGS = $(A_USR) +AR_RULE = $(AR) $(ARFLAGS) r $@ $^ || $(RM) $@ + +include $(TOP)$(ROOT)config/rules.cf + + + + + diff --git a/harbour/config/bsd/global.cf b/harbour/config/bsd/global.cf new file mode 100644 index 0000000000..de1bb410bf --- /dev/null +++ b/harbour/config/bsd/global.cf @@ -0,0 +1,38 @@ +# +# $Id$ +# + +all : first + +HB_GT_LIBS=\ + gtcgi \ + gtcrs \ + gtpca \ + gtsln \ + gtstd \ + +ifeq ($(HB_GT_LIB),) + HB_GT_LIB = gtstd +endif + +MAKE = gmake + +ARCH_DIR = $(ARCH)/ + +MK = $(MAKE) + +RM = rm -f +RD = rm -f -r +CP = cp -f +MV = mv -f +MD = mkdir + +dirbase:: + @[ -d $(HB_ARCHITECTURE) ] || $(MD) $(HB_ARCHITECTURE); \ + [ -d $(ARCH) ] || $(MD) $(ARCH) + +clean:: + -$(RD) $(ARCH_DIR) + + + diff --git a/harbour/config/bsd/install.cf b/harbour/config/bsd/install.cf new file mode 100644 index 0000000000..239603d970 --- /dev/null +++ b/harbour/config/bsd/install.cf @@ -0,0 +1,21 @@ +# +# $Id$ +# + +INSTALL_RULE =\ + @if [ ! -d $(INSTALL_DIR) ]; \ + then \ + echo "! Can't install, path not found:" $(INSTALL_DIR); \ + else \ + for i in $(INSTALL_OBJS); \ + do \ + if [ -r $$i ]; \ + then \ + echo "! Installing $$i on $(INSTALL_DIR)"; \ + $(CP) $$i $(INSTALL_DIR); \ + else \ + echo "! Can't install $$i, not found"; \ + fi \ + done \ + fi + diff --git a/harbour/source/rtl/disksphb.c b/harbour/source/rtl/disksphb.c index 0e0fa13f29..16e01f57dc 100644 --- a/harbour/source/rtl/disksphb.c +++ b/harbour/source/rtl/disksphb.c @@ -62,7 +62,10 @@ #include "hbapierr.h" #include "hbapifs.h" -#if defined( HB_OS_UNIX ) +#if defined( HB_OS_BSD ) + #include + #include +#elif defined( HB_OS_UNIX ) #include #endif @@ -342,3 +345,5 @@ HB_FUNC( HB_DISKSPACE ) } #endif + + diff --git a/harbour/source/rtl/gtstd/gtstd.c b/harbour/source/rtl/gtstd/gtstd.c index 453a455c80..6dd8832348 100644 --- a/harbour/source/rtl/gtstd/gtstd.c +++ b/harbour/source/rtl/gtstd/gtstd.c @@ -70,7 +70,9 @@ /* Add time function for BEL flood throttling.. */ #include -#if defined( OS_UNIX_COMPATIBLE ) +#if defined( HB_OS_BSD ) + #include +#elif defined( OS_UNIX_COMPATIBLE ) #include #else #include @@ -524,6 +526,12 @@ static int gtstd_get_seconds( void ) #define timeb _timeb #define ftime _ftime #endif +#if defined(HB_OS_BSD) + struct timeval oTime; + struct timezone oZone; + gettimeofday( &oTime, &oZone ); + return ( oTime.tv_sec ); +#else struct timeb tb; struct tm * oTime; @@ -531,6 +539,7 @@ static int gtstd_get_seconds( void ) oTime = localtime( &tb.time ); return ( (int) oTime->tm_sec ); +#endif } void hb_gt_Tone( double dFrequency, double dDuration ) @@ -767,3 +776,5 @@ BOOL hb_gt_Resume() { return TRUE; } + + diff --git a/harbour/source/rtl/seconds.c b/harbour/source/rtl/seconds.c index a4361ff8e3..b03ca6573a 100644 --- a/harbour/source/rtl/seconds.c +++ b/harbour/source/rtl/seconds.c @@ -53,7 +53,9 @@ #include "hbapi.h" #include -#if defined( OS_UNIX_COMPATIBLE ) +#if defined( HB_OS_BSD) + #include +#elif defined( OS_UNIX_COMPATIBLE ) #include #else #include @@ -65,11 +67,20 @@ double hb_dateSeconds( void ) #define timeb _timeb #define ftime _ftime #endif +#if defined(HB_OS_BSD) + struct timeval oTime; + struct timezone oZone; +#else struct timeb tb; struct tm * oTime; +#endif HB_TRACE(HB_TR_DEBUG, ("hb_dateSeconds()")); +#if defined(HB_OS_BSD) + gettimeofday( &oTime, &oZone ); + return ( ( double ) oTime.tv_sec + ( double ) oTime.tv_usec / 1000.0 ); +#else ftime( &tb ); oTime = localtime( &tb.time ); @@ -77,6 +88,7 @@ double hb_dateSeconds( void ) ( oTime->tm_min * 60 ) + oTime->tm_sec + ( ( double ) tb.millitm / 1000 ); +#endif } HB_FUNC( SECONDS ) @@ -92,3 +104,6 @@ HB_FUNC( HB_CLOCKS2SECS ) } #endif + + +