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.
This commit is contained in:
Przemyslaw Czerpak
2009-07-11 13:39:02 +00:00
parent ab241a27e5
commit 4057472258
10 changed files with 106 additions and 26 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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? */
}

View File

@@ -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

View File

@@ -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 <sys/types.h>

View File

@@ -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;

View File

@@ -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;

View File

@@ -73,7 +73,7 @@
# include <io.h>
# include <process.h>
# include <fcntl.h>
# if defined( HB_OS_OS2 )
# if defined( HB_OS_OS2 ) && defined( __GNUC__ )
# include <sys/wait.h>
# 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;