diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bcbf04e3a3..b157e2d565 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,67 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-11 15:38 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/config/os2/watcom.cf + * harbour/config/os2/dir.cf + * harbour/config/os2/install.cf + * small cleanup for builds with *nix like shells and cross builds + + * harbour/contrib/rddads/Makefile + ! disabld from OS2 builds - if ADS supports OS2 then please speak-up + + * harbour/include/hbthread.h + * added small hack as workaround for missing OS2 declarations + + * harbour/source/rtl/filesys.c + ! fixed typo in OS2 builds + + * harbour/source/rtl/hbproces.c + ! fixed non GCC OS2 builds + + * harbour/contrib/hbtpathy/tpos2.c + ! fixed casting in OS2 builds + + * harbour/contrib/xhb/hbserv.c + ! disabled from OS2 non GCC builds + + Now I can create OS2 OpenWatcom build in my Linux box using this simple + script: + + #!/bin/sh + if [ -z "${WATCOM}" ]; then + export WATCOM="/opt/lng/watcom" + export INCLUDE="${WATCOM}/h:${WATCOM}/h/os2" + export PATH="${WATCOM}/binl:$PATH" + fi + + export HB_ARCHITECTURE=os2 + export HB_COMPILER=watcom + export HB_INSTALL_PREFIX="$(pwd)/hb-os2/watcom" + + #cross build settings + # this should be fixed and we should use HB_PPGEN_PATH as direct + # reference to hbpp binaries and HB_COMP_PATH as direct reference + # to harbour binaries in all builds. Otherwise we have to create + # some hacks to create platform specific names for above binaries + # i.e. in *nixes links with .exe extension. + export HB_PPGEN_PATH="/tmp/cros-hb" + export HB_BIN_COMPILE="/tmp/cros-hb" + + export HB_USER_PRGFLAGS="${HB_USER_PRGFLAGS} -D__PLATFORM__OS2" + export HB_USER_PRGFLAGS="${HB_USER_PRGFLAGS} -undef:__PLATFORM__UNIX" + export HB_USER_PRGFLAGS="${HB_USER_PRGFLAGS} -undef:__PLATFORM__LINUX" + # eliminate libraries which scans for local host header files + export HB_XBUILD=yes + + ./make_gnu.sh "$@" + + It should work also in Windows with MSys. + This should resolve the problem with testing OS2 builds, at least + for OpenWatcom. I do not know if GCC for OS2 is available as cross + build environment. + I think that Viktor can quite easy adopt hbmk2 for OS2 cross compilation. + 2009-07-11 09:41 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * examples/hbwhat - hbwhat deleted as planned. It no longer builds without diff --git a/harbour/config/os2/dir.cf b/harbour/config/os2/dir.cf index 4caa159817..c1929231ef 100644 --- a/harbour/config/os2/dir.cf +++ b/harbour/config/os2/dir.cf @@ -4,16 +4,17 @@ ifeq ($(PM),) # Only traverse directories if not compiling a specific module +ifeq ($(DIRS),) # Empty directory list + +DIR_RULE = @echo Done + +else + ifeq ($(SHLVL),) # An OS/2 command shell -ifeq ($(DIRS),) # Empty directory list -DIR_RULE =\ - @echo Done -else DIR_MAKE = $(subst /,\,$(MK)) DIR_LIST = $(subst /,\,$(DIRS)) DIR_RULE = $(COMSPEC) /C FOR %d IN ($(DIR_LIST)) DO $(DIR_MAKE) -C %d $@ -endif else # bash @@ -24,6 +25,8 @@ DIR_RULE =\ fi \ done -endif # ! Windows +endif # ! OS/2 command shell + +endif # ! Empty directory list endif # ! compiling a specific program module diff --git a/harbour/config/os2/install.cf b/harbour/config/os2/install.cf index 0f2ead2198..a475ae6b87 100644 --- a/harbour/config/os2/install.cf +++ b/harbour/config/os2/install.cf @@ -2,15 +2,23 @@ # $Id$ # +ifeq ($(INSTALL_OBJS),) # Empty install list + +INSTALL_RULE = @echo Done + +else + ifeq ($(SHLVL),) # An OS/2 command shell +# We have to use script to overcome the max command size limit +# NOTE: The empty line directly before 'endef' HAVE TO exist! +# It causes that every commands will be separated by LF define inst_file -$(COMSPEC) /C $(CP) $(file) $(INSTALL_OS2_DIR) +$(COMSPEC) /C $(CP) $(file) $(subst /,\,$(INSTALL_DIR) endef INSTALL_LIST = $(subst /,\,$(INSTALL_OBJS)) -INSTALL_OS2_DIR = $(subst /,\,$(INSTALL_DIR)) INSTALL_RULE = $(foreach file, $(INSTALL_LIST), $(inst_file)) else # bash @@ -33,3 +41,5 @@ INSTALL_RULE =\ fi endif + +endif diff --git a/harbour/config/os2/watcom.cf b/harbour/config/os2/watcom.cf index 1685e550ce..973122aa86 100644 --- a/harbour/config/os2/watcom.cf +++ b/harbour/config/os2/watcom.cf @@ -76,6 +76,7 @@ endef define link_exe_file @echo $(LDFLAGS) NAME $@ > __link__.tmp $(foreach file, $(^F), $(link_file)) +$(foreach lib, $(HB_USER_LIBS), $(link_lib)) $(foreach lib, $(LINKLIBS), $(link_lib)) $(foreach lib, $(RDDLIBS), $(link_lib)) $(foreach lib, $(GTLIBS), $(link_lib)) @@ -83,7 +84,7 @@ $(foreach lib, $(GTLIBS), $(link_lib)) endef LD = wlink -LDFLAGS = +LDFLAGS = sys OS2V2 ifeq ($(HB_BUILD_DEBUG),yes) LDFLAGS := debug all $(LDFLAGS) endif diff --git a/harbour/contrib/hbtpathy/tpos2.c b/harbour/contrib/hbtpathy/tpos2.c index 9074de20e1..c0595fc138 100644 --- a/harbour/contrib/hbtpathy/tpos2.c +++ b/harbour/contrib/hbtpathy/tpos2.c @@ -72,7 +72,7 @@ HB_FUNC( P_INITPORTSPEED ) LINECONTROL lctl; DCBINFO dcb; USHORT Baud = ( USHORT ) hb_parnl( 2 ); - char * ptr = hb_parcx( 4 ); + const char * ptr = hb_parcx( 4 ); memset( &dcb, 0, sizeof( dcb ) ); memset( &lctl, 0, sizeof( lctl ) ); @@ -151,7 +151,7 @@ HB_FUNC( P_READPORT ) HB_FUNC( P_WRITEPORT ) { ULONG nWritten = 0; - APIRET rc = DosWrite( ( HFILE ) hb_parnl( 1 ), hb_parcx( 2 ), hb_parclen( 2 ), &nWritten ); + APIRET rc = DosWrite( ( HFILE ) hb_parnl( 1 ), ( void * ) hb_parcx( 2 ), hb_parclen( 2 ), &nWritten ); hb_retnl( rc == NO_ERROR ? ( long ) nWritten : -1 ); /* Put GetLastError() on error, or better a second byref param? */ } diff --git a/harbour/contrib/rddads/Makefile b/harbour/contrib/rddads/Makefile index 7b35a93b7f..939b115c99 100644 --- a/harbour/contrib/rddads/Makefile +++ b/harbour/contrib/rddads/Makefile @@ -7,6 +7,7 @@ ROOT = ../../ LIBNAME=rddads ifneq ($(HB_ARCHITECTURE),dos) +ifneq ($(HB_ARCHITECTURE),os2) ifeq ($(HB_INC_ADS),) HB_INC_ADS = /usr/local/ads/acesdk $(HOME)/ads/acesdk @@ -14,6 +15,9 @@ endif HB_INC_ADS_OK += $(foreach d, $(HB_INC_ADS), $(if $(wildcard $(d)/ace.h),$(d),)) +endif +endif + ifneq ($(strip $(HB_INC_ADS_OK)),) HB_USER_CFLAGS += $(foreach d, $(HB_INC_ADS_OK), -I$(d)) @@ -38,6 +42,3 @@ install:: else include $(TOP)$(ROOT)config/none.cf endif -else -include $(TOP)$(ROOT)config/none.cf -endif diff --git a/harbour/contrib/xhb/hbserv.c b/harbour/contrib/xhb/hbserv.c index 8dd0284f1d..e8b25d45fd 100644 --- a/harbour/contrib/xhb/hbserv.c +++ b/harbour/contrib/xhb/hbserv.c @@ -67,7 +67,8 @@ #if !defined( HB_OS_DOS ) && \ !defined( HB_OS_DARWIN_5 ) && \ ! ( defined( HB_OS_WIN_CE ) && defined( __POCC__ ) ) && \ - !defined( HB_OS_WIN_64 ) + !defined( HB_OS_WIN_64 ) && \ + ( !defined( HB_OS_OS2 ) || defined( HB_OS_OS2_GCC ) ) #if defined( HB_OS_UNIX ) || defined( HB_OS_OS2_GCC ) #include diff --git a/harbour/include/hbthread.h b/harbour/include/hbthread.h index a98f462b47..b427b107c7 100644 --- a/harbour/include/hbthread.h +++ b/harbour/include/hbthread.h @@ -235,6 +235,10 @@ HB_EXTERN_BEGIN # define HB_THREAD_INFINITE_WAIT SEM_INDEFINITE_WAIT +# ifndef SEM_INDEFINITE_WAIT +# define SEM_INDEFINITE_WAIT ( ( ULONG ) -1 ) +# endif + #else typedef int HB_THREAD_NO; diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index 2814e86de7..ff823cbcc4 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -1714,7 +1714,7 @@ ULONG hb_fsReadAt( HB_FHANDLE hFileHandle, void * pBuff, ULONG ulCount, HB_FOFFS llPos = lseek64( hFileHandle, llOffset, SEEK_SET ); # elif defined( HB_OS_OS2 ) ULONG ulPos; - if( DosSetFilePtr( hFileHandle, lOffset, SEEK_SET, &ulPos ) == 0 ) + if( DosSetFilePtr( hFileHandle, llOffset, SEEK_SET, &ulPos ) == 0 ) llPos = ( HB_FOFFSET ) ulPos; else llPos = ( HB_FOFFSET ) -1; @@ -1808,7 +1808,7 @@ ULONG hb_fsWriteAt( HB_FHANDLE hFileHandle, const void * pBuff, ULONG ulCount, H llPos = lseek64( hFileHandle, llOffset, SEEK_SET ); # elif defined( HB_OS_OS2 ) ULONG ulPos; - if( DosSetFilePtr( hFileHandle, lOffset, SEEK_SET, &ulPos ) == 0 ) + if( DosSetFilePtr( hFileHandle, llOffset, SEEK_SET, &ulPos ) == 0 ) llPos = ( HB_FOFFSET ) ulPos; else llPos = ( HB_FOFFSET ) -1; diff --git a/harbour/source/rtl/hbproces.c b/harbour/source/rtl/hbproces.c index d185c28012..0ce02a36fe 100644 --- a/harbour/source/rtl/hbproces.c +++ b/harbour/source/rtl/hbproces.c @@ -73,7 +73,7 @@ # include # include # include -# if defined( HB_OS_OS2 ) +# if defined( HB_OS_OS2 ) && defined( __GNUC__ ) # include # endif #elif defined( HB_OS_DOS ) @@ -603,14 +603,7 @@ HB_FHANDLE hb_fsProcessOpen( const char *pszFilename, #elif defined( HB_OS_OS2 ) || defined( HB_OS_WIN ) { -#if defined( HB_OS_WIN ) - -# define pid_t int -# define _hb_pipe( e, p ) do { \ - (e) = _pipe( (p), 2048, _O_BINARY ) != 0; \ - } while( 0 ) - -#elif defined( HB_OS_OS2 ) +#if defined( HB_OS_OS2 ) && defined( __GNUC__ ) # define _hb_pipe( e, p ) do { \ (e) = pipe( (p) ) != 0; \ @@ -620,6 +613,12 @@ HB_FHANDLE hb_fsProcessOpen( const char *pszFilename, setmode( (p)[ 1 ], O_BINARY ); \ } \ } while( 0 ) +#else + +# define pid_t int +# define _hb_pipe( e, p ) do { \ + (e) = _pipe( (p), 2048, _O_BINARY ) != 0; \ + } while( 0 ) #endif BOOL fError = FALSE;