diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6affa82634..da2d60e1a8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,36 @@ The license applies to all entries newer than 2009-04-28. */ +2010-10-29 10:22 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * include/hb_io.h + * include/hbthread.h + * include/hbsetup.h + * src/vm/thread.c + * src/vm/dynlibhb.c + * src/common/hbgete.c + * src/common/hbprintf.c + * src/rtl/gttrm/Makefile + * src/rtl/hbsocket.c + * src/rtl/filesys.c + * src/rtl/hbcom.c + * config/global.mk + - config/win/cygwin.mk + + config/cygwin + + config/cygwin/libs.mk + + config/cygwin/gcc.mk + + config/cygwin/global.mk + + Applied cygwin patch from Tamas Tevesz. + The goal is to migrate win/cygwin to cygwin/gcc, IOW to make cygwin + a distinct platform (which is primarily unixy with option to access + winapi) as it should be. + Changes made by me compared to original patch: + - Fixed to HB_HOST_PLAT stay 'win'. Cygwin is not a host platform. + - Fixed to set HB_COMPILER to gcc and HB_PLATFORM to cygwin when cygwin + is detected on win platform. + - Consequently some changes in global.mk could be dropped. + - Deleted hbcom patches not related to cygwin. + - Removed hbmk2 patch until we solve the 'plat $ 'cygwin' problem. + 2010-10-29 09:37 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/qtcore/hbqt_misc.prg * Changed to not RTE when connecting to an already connected event. diff --git a/harbour/config/win/cygwin.mk b/harbour/config/cygwin/gcc.mk similarity index 89% rename from harbour/config/win/cygwin.mk rename to harbour/config/cygwin/gcc.mk index ac985c328d..37e3c1b607 100644 --- a/harbour/config/win/cygwin.mk +++ b/harbour/config/cygwin/gcc.mk @@ -33,9 +33,9 @@ ifeq ($(HB_BUILD_DEBUG),yes) CFLAGS += -g endif -RC := $(HB_CCPATH)$(HB_CCPREFIX)windres -RC_OUT := -o$(subst x,x, ) -RCFLAGS += -O coff +#RC := $(HB_CCPATH)$(HB_CCPREFIX)windres +#RC_OUT := -o$(subst x,x, ) +#RCFLAGS += -O coff ifneq ($(filter $(HB_BUILD_STRIP),all lib),) ARSTRIP = && ${HB_CCPATH}${HB_CCPREFIX}strip -S $(LIB_DIR)/$@ @@ -48,15 +48,6 @@ endif LD := $(CC) LD_OUT := -o -ifneq ($(HB_HAS_PCRE),) - ifeq ($(HB_HAS_PCRE_LOCAL),) - SYSLIBS += pcre - endif -endif -ifeq ($(HB_HAS_ZLIB_LOCAL),) - SYSLIBS += z -endif - LIBPATHS := -L$(LIB_DIR) LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib)) diff --git a/harbour/config/cygwin/global.mk b/harbour/config/cygwin/global.mk new file mode 100644 index 0000000000..971bef08d5 --- /dev/null +++ b/harbour/config/cygwin/global.mk @@ -0,0 +1,18 @@ +# +# $Id$ +# + +all : first + +BIN_EXT := .exe +DYN_EXT := .dll + +HB_GT_LIBS += gttrm + +ifneq ($(filter $(HB_BUILD_STRIP),all lib),) + ARSTRIP = && strip -S $(LIB_DIR)/$@ +endif +ifneq ($(filter $(HB_BUILD_STRIP),all bin),) + LDSTRIP := -s + DYSTRIP := -s +endif diff --git a/harbour/config/cygwin/libs.mk b/harbour/config/cygwin/libs.mk new file mode 100644 index 0000000000..90646899ed --- /dev/null +++ b/harbour/config/cygwin/libs.mk @@ -0,0 +1,35 @@ +# +# $Id$ +# + +SYSLIBPATHS := + +ifneq ($(HB_LINKING_RTL),) + ifeq ($(HB_LIBNAME_CURSES),) + HB_LIBNAME_CURSES := ncurses + endif + ifneq ($(HB_HAS_CURSES),) + SYSLIBS += $(HB_LIBNAME_CURSES) + endif + ifneq ($(HB_HAS_SLANG),) + SYSLIBS += slang + endif + ifneq ($(HB_HAS_X11),) + SYSLIBS += X11 + endif + ifneq ($(HB_HAS_PCRE),) + ifeq ($(HB_HAS_PCRE_LOCAL),) + SYSLIBS += pcre + endif + endif + ifeq ($(HB_HAS_ZLIB_LOCAL),) + SYSLIBS += z + endif + SYSLIBS += rt dl + # Don't seem to be needed here, but added it for reference to move/copy it to *nix platforms where this is required + ifneq ($(HB_LINKING_VMMT),) + SYSLIBS += pthread + endif +endif + +SYSLIBS += m diff --git a/harbour/config/global.mk b/harbour/config/global.mk index 16c3372c7a..6e58388eb7 100644 --- a/harbour/config/global.mk +++ b/harbour/config/global.mk @@ -774,7 +774,8 @@ ifeq ($(HB_COMPILER),) endif endif ifneq ($(HB_COMP_PATH),) - HB_COMPILER := cygwin + HB_COMPILER := gcc + HB_PLATFORM := cygwin ifneq ($(wildcard $(dir $(HB_COMP_PATH))i686-pc-cygwin-gcc-3.4*),) HB_COMPILER_VER := 34 endif @@ -993,7 +994,7 @@ ifeq ($(HB_COMPILER),) endif endif else - ifneq ($(filter $(HB_PLATFORM),hpux bsd beos qnx),) + ifneq ($(filter $(HB_PLATFORM),hpux bsd beos qnx cygwin),) HB_COMP_PATH := $(call find_in_path,gcc) ifneq ($(HB_COMP_PATH),) HB_COMPILER := gcc @@ -1131,17 +1132,22 @@ ifeq ($(HB_PLATFORM_UNIX),) DYN_DIR := $(BIN_DIR) IMP_DIR := $(LIB_DIR) else - DYN_DIR := $(LIB_DIR) - IMP_DIR := - ifeq ($(HB_LD_PATH_SET),) - ifneq ($(HB_SRC_ROOTPATH),) - export LD_LIBRARY_PATH := $(HB_SRC_ROOTPATH)lib/$(PLAT_COMP):$(LD_LIBRARY_PATH) - else - export LD_LIBRARY_PATH := $(abspath $(DYN_DIR)):$(LD_LIBRARY_PATH) - endif - export HB_LD_PATH_SET := yes - ifneq ($(LD_LIBRARY_PATH),) - $(info ! LD_LIBRARY_PATH: $(LD_LIBRARY_PATH)) + ifeq ($(HB_PLATFORM),cygwin) + DYN_DIR := $(BIN_DIR) + IMP_DIR := $(LIB_DIR) + else + DYN_DIR := $(LIB_DIR) + IMP_DIR := + ifeq ($(HB_LD_PATH_SET),) + ifneq ($(HB_SRC_ROOTPATH),) + export LD_LIBRARY_PATH := $(HB_SRC_ROOTPATH)lib/$(PLAT_COMP):$(LD_LIBRARY_PATH) + else + export LD_LIBRARY_PATH := $(abspath $(DYN_DIR)):$(LD_LIBRARY_PATH) + endif + export HB_LD_PATH_SET := yes + ifneq ($(LD_LIBRARY_PATH),) + $(info ! LD_LIBRARY_PATH: $(LD_LIBRARY_PATH)) + endif endif endif endif @@ -1650,7 +1656,11 @@ ifneq ($(HB_INSTALL_PREFIX),) ifeq ($(HB_PLATFORM_UNIX),) export HB_INSTALL_DYN := $(HB_INSTALL_BIN) else - export HB_INSTALL_DYN := $(HB_INSTALL_LIB) + ifeq ($(HB_PLATFORM),cygwin) + export HB_INSTALL_DYN := $(HB_INSTALL_BIN) + else + export HB_INSTALL_DYN := $(HB_INSTALL_LIB) + endif endif endif # Standard name: INCLUDEDIR diff --git a/harbour/include/hb_io.h b/harbour/include/hb_io.h index 33e42825ed..27d1f7df87 100644 --- a/harbour/include/hb_io.h +++ b/harbour/include/hb_io.h @@ -56,7 +56,7 @@ #if defined( HB_OS_UNIX ) || \ ( defined( __GNUC__ ) && ! defined( __MINGW32__ ) ) #include - #if defined( __DJGPP__ ) || defined( __CYGWIN__ ) || defined( __EMX__ ) + #if defined( __DJGPP__ ) || defined( __EMX__ ) #include #endif #elif !defined( HB_OS_WIN_CE ) diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index 41ebb89b2b..75c62c737d 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -328,7 +328,7 @@ #endif #ifndef HB_OS_WIN - #if defined( WINNT ) || defined( _Windows ) || defined( __NT__ ) || defined( _WIN32 ) || defined( _WINDOWS_ ) || defined( __WINDOWS_386__ ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) + #if defined( WINNT ) || defined( _Windows ) || defined( __NT__ ) || defined( _WIN32 ) || defined( _WINDOWS_ ) || defined( __WINDOWS_386__ ) || defined( __WIN32__ ) #define HB_OS_WIN #endif #endif @@ -410,6 +410,12 @@ #endif #endif +#ifndef HB_OS_CYGWIN + #if defined( __CYGWIN__ ) + #define HB_OS_CYGWIN + #endif +#endif + #ifndef HB_OS_UNIX #if defined( HB_OS_LINUX ) || \ defined( HB_OS_DARWIN ) || \ @@ -419,7 +425,8 @@ defined( HB_OS_QNX ) || \ defined( HB_OS_VXWORKS ) || \ defined( HB_OS_BEOS ) || \ - defined( HB_OS_SYMBIAN ) + defined( HB_OS_SYMBIAN ) || \ + defined( HB_OS_CYGWIN ) #define HB_OS_UNIX #endif #endif @@ -455,7 +462,7 @@ #define HB_OS_PATH_DELIM_CHR_LIST "\\/:" #define HB_OS_ALLFILE_MASK "*.*" #define HB_OS_DRIVE_DELIM_CHR ':' - #if defined( HB_OS_WIN_CE ) || defined( __CYGWIN__ ) + #if defined( HB_OS_WIN_CE ) #undef HB_OS_HAS_DRIVE_LETTER #else #define HB_OS_HAS_DRIVE_LETTER diff --git a/harbour/include/hbthread.h b/harbour/include/hbthread.h index 0708c80177..6bffff515d 100644 --- a/harbour/include/hbthread.h +++ b/harbour/include/hbthread.h @@ -65,7 +65,7 @@ defined( HB_OS_SUNOS ) || defined( HB_OS_HPUX ) || \ defined( HB_OS_BSD ) || defined( HB_OS_BEOS ) || \ defined( HB_OS_QNX ) || defined( HB_OS_VXWORKS ) || \ - defined( HB_OS_SYMBIAN ) + defined( HB_OS_SYMBIAN ) || defined( HB_OS_CYGWIN ) # include # define HB_PTHREAD_API # if defined( HB_OS_VXWORKS ) @@ -185,11 +185,10 @@ HB_EXTERN_BEGIN typedef CRITICAL_SECTION HB_RAWCRITICAL_T; typedef HANDLE HB_OSCOND_T; -# if ( defined( HB_OS_WIN_CE ) && \ - ( ( defined( __MINGW32CE__ ) && !defined( __MSVCRT__ ) ) || \ - defined( __POCC__ ) ) || \ - ( defined( _MSC_VER ) && ( _MSC_VER <= 1500 ) ) ) || \ - defined( __CYGWIN__ ) +# if defined( HB_OS_WIN_CE ) && \ + ( ( defined( __MINGW32CE__ ) && !defined( __MSVCRT__ ) ) || \ + defined( __POCC__ ) ) || \ + ( defined( _MSC_VER ) && ( _MSC_VER <= 1500 ) ) # define HB_THREAD_RAWWINAPI # endif diff --git a/harbour/src/common/hbgete.c b/harbour/src/common/hbgete.c index f00a1e01f5..be65a001bb 100644 --- a/harbour/src/common/hbgete.c +++ b/harbour/src/common/hbgete.c @@ -216,7 +216,8 @@ HB_BOOL hb_setenv( const char * szName, const char * szValue ) defined( __WATCOMC__ ) || defined( __DJGPP__ ) || \ defined( HB_OS_SUNOS ) || defined( HB_OS_BSD ) || \ defined( HB_OS_DARWIN ) || defined( HB_OS_BEOS ) || \ - defined( HB_OS_QNX ) || defined( HB_OS_VXWORKS ) + defined( HB_OS_QNX ) || defined( HB_OS_VXWORKS ) || \ + defined( HB_OS_CYGWIN ) if( szValue ) return setenv( szName, szValue, 1 ) == 0; diff --git a/harbour/src/common/hbprintf.c b/harbour/src/common/hbprintf.c index 8f830cebaf..f17306ba8d 100644 --- a/harbour/src/common/hbprintf.c +++ b/harbour/src/common/hbprintf.c @@ -163,7 +163,7 @@ optimized. # define _MODFD( x, p ) modf( x, p ) # else # define _x_long_dbl long double -# if defined( __WATCOMC__ ) || defined( __MINGW32CE__ ) || defined( __CYGWIN__ ) || \ +# if defined( __WATCOMC__ ) || defined( __MINGW32CE__ ) || defined( HB_OS_CYGWIN ) || \ defined( HB_OS_BEOS ) || defined( HB_OS_IPHONE ) || defined( HB_OS_SYMBIAN ) || \ defined( __OpenBSD__ ) || defined( __NetBSD__ ) || defined( __DragonFly__ ) || \ ( defined( HB_OS_WIN_CE ) && defined( __POCC__ ) ) diff --git a/harbour/src/rtl/filesys.c b/harbour/src/rtl/filesys.c index 89f641b502..de33572f2a 100644 --- a/harbour/src/rtl/filesys.c +++ b/harbour/src/rtl/filesys.c @@ -155,9 +155,7 @@ #include #include #include - #if defined( __CYGWIN__ ) - #include - #elif defined( __DJGPP__ ) + #if defined( __DJGPP__ ) #include #include #include @@ -899,7 +897,7 @@ int hb_fsSetDevMode( HB_FHANDLE hFileHandle, int iDevMode ) HB_TRACE(HB_TR_DEBUG, ("hb_fsSetDevMode(%p, %d)", ( void * ) ( HB_PTRDIFF ) hFileHandle, iDevMode)); #if defined( __BORLANDC__ ) || defined( __IBMCPP__ ) || defined( __DJGPP__ ) || \ - defined( __CYGWIN__ ) || defined( __WATCOMC__ ) || defined( HB_OS_OS2 ) + defined( __WATCOMC__ ) || defined( HB_OS_OS2 ) { int iRet = -1; diff --git a/harbour/src/rtl/gttrm/Makefile b/harbour/src/rtl/gttrm/Makefile index 6e5307ed41..0527a8b851 100644 --- a/harbour/src/rtl/gttrm/Makefile +++ b/harbour/src/rtl/gttrm/Makefile @@ -24,9 +24,6 @@ endif ifeq ($(HB_PLATFORM),os2) HB_SUPPORTED := no endif -ifeq ($(HB_COMPILER),cygwin) - HB_SUPPORTED := yes -endif ifeq ($(HB_COMPILER),djgpp) HB_SUPPORTED := yes endif diff --git a/harbour/src/rtl/hbcom.c b/harbour/src/rtl/hbcom.c index 5ba722deb8..97c1bd2790 100644 --- a/harbour/src/rtl/hbcom.c +++ b/harbour/src/rtl/hbcom.c @@ -189,7 +189,7 @@ static const char * hb_comGetName( PHB_COM pCom, char * buffer, int size ) hb_snprintf( buffer, size, "/dev/tty%02d", pCom->port ); # elif defined( HB_OS_DARWIN ) hb_snprintf( buffer, size, "/dev/cuaa%d", pCom->port - 1 ); -# else /* defined( HB_OS_LINUX ) || ... */ +# else /* defined( HB_OS_LINUX ) || defined( HB_OS_CYGWIN ) || ... */ hb_snprintf( buffer, size, "/dev/ttyS%d", pCom->port - 1 ); # endif /* other OS-es: diff --git a/harbour/src/rtl/hbsocket.c b/harbour/src/rtl/hbsocket.c index 2729a507e1..81809be738 100644 --- a/harbour/src/rtl/hbsocket.c +++ b/harbour/src/rtl/hbsocket.c @@ -114,7 +114,7 @@ # define _XOPEN_SOURCE_EXTENDED #endif -#if defined( HB_OS_UNIX ) && ! defined( __CYGWIN__ ) +#if defined( HB_OS_UNIX ) # define HB_HAS_UNIX # if !defined( __WATCOMC__ ) # define HB_HAS_INET_ATON @@ -186,7 +186,7 @@ #endif -#if defined( HB_OS_WIN ) && ! defined( __CYGWIN__ ) +#if defined( HB_OS_WIN ) # include # include #else @@ -236,10 +236,6 @@ # endif #endif -#if defined( __CYGWIN__ ) - #undef HB_OS_WIN -#endif - #if defined( HB_OS_OS2 ) || defined( HB_OS_WIN ) || defined( HB_OS_DOS ) || \ defined( HB_OS_VXWORKS ) # define socklen_t int diff --git a/harbour/src/vm/dynlibhb.c b/harbour/src/vm/dynlibhb.c index 1834ae85f1..080fd0cc9c 100644 --- a/harbour/src/vm/dynlibhb.c +++ b/harbour/src/vm/dynlibhb.c @@ -82,7 +82,7 @@ ( ( defined( HB_OS_LINUX ) && !defined( __WATCOMC__ ) ) || \ defined( HB_OS_SUNOS ) || defined( HB_OS_DARWIN ) || \ defined( HB_OS_BSD ) || defined( HB_OS_BEOS ) || \ - defined( HB_OS_QNX ) || \ + defined( HB_OS_QNX ) || defined( HB_OS_CYGWIN ) || \ ( defined( __DJGPP__ ) && \ ( __DJGPP__ > 2 || ( __DJGPP__ == 2 && __DJGPP_MINOR__ >= 4 ) ) ) ) # define HB_HAS_DLFCN diff --git a/harbour/src/vm/thread.c b/harbour/src/vm/thread.c index 977e26a768..66c034032d 100644 --- a/harbour/src/vm/thread.c +++ b/harbour/src/vm/thread.c @@ -252,7 +252,7 @@ void hb_threadReleaseCPU( void ) hb_taskSleep( 20 ); -#elif defined( HB_OS_WIN ) || defined( __CYGWIN__ ) +#elif defined( HB_OS_WIN ) /* Forfeit the remainder of the current time slice. */ Sleep( 20 );