From 4c2614bf6599740ef7b4cba8953148cc1562efac Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 20 Jan 2015 14:35:01 +0100 Subject: [PATCH] openwatcom: more things got upstreamed, more needs to be fixed. --- sys-devel/openwatcom/openwatcom-2.0.0.recipe | 2 +- .../patches/openwatcom-2.0.0.patchset | 783 +++++++++--------- 2 files changed, 377 insertions(+), 408 deletions(-) diff --git a/sys-devel/openwatcom/openwatcom-2.0.0.recipe b/sys-devel/openwatcom/openwatcom-2.0.0.recipe index 02601abfb..a993a237e 100644 --- a/sys-devel/openwatcom/openwatcom-2.0.0.recipe +++ b/sys-devel/openwatcom/openwatcom-2.0.0.recipe @@ -17,7 +17,7 @@ if [ $effectiveTargetArchitecture != x86_gcc2 ]; then fi SECONDARY_ARCHITECTURES="x86" -SRC_URI="git@github.com:open-watcom/open-watcom-v2.git#a3b3e22c3a0266a93da5f7d67bc368ff34813449" +SRC_URI="git@github.com:open-watcom/open-watcom-v2.git#da9bd7daad78cfae6219ab29ffadb60797481d6d" PATCHES="openwatcom-$portVersion.patchset" PROVIDES=" diff --git a/sys-devel/openwatcom/patches/openwatcom-2.0.0.patchset b/sys-devel/openwatcom/patches/openwatcom-2.0.0.patchset index 0df4298d4..ebb1b1a89 100644 --- a/sys-devel/openwatcom/patches/openwatcom-2.0.0.patchset +++ b/sys-devel/openwatcom/patches/openwatcom-2.0.0.patchset @@ -1,9 +1,251 @@ -From 1b692403e242c2383cb1055e5fac6d3014920993 Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Tue, 15 Jul 2014 19:39:16 +0200 -Subject: Replace "local" with "static". +From 23162357097c5f295ee9143311b1f8dc058eb06d Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sun, 18 Jan 2015 15:35:30 +0100 +Subject: Adjust setvars.sh to Haiku build environment. +diff --git a/setvars.sh b/setvars.sh +index a64d135..30bce44 100755 +--- a/setvars.sh ++++ b/setvars.sh +@@ -6,14 +6,14 @@ + # modify it as necessary for your own use!! + + # Change this to point your Open Watcom source tree +-export OWROOT=/home/ow/ow ++export OWROOT=/sources/openwatcom-2.0.0 + + # Subdirectory to be used for building OW build tools + export OWOBJDIR=binbuild + + # Set this entry to identify your toolchain used by build process + # supported values are WATCOM GCC CLANG +-export OWTOOLS=WATCOM ++export OWTOOLS=GCC + + # Documentation related variables + +-- +1.8.3.4 + + +From 8eb0dea26f4e2d7e0d7924fa980660da52dc77f3 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Mon, 19 Jan 2015 22:44:26 +0100 +Subject: Fix local.mif for Haiku. + +* It was still referencing BSD from which it was copied, resulting in +broken build. + +diff --git a/build/mif/local.mif b/build/mif/local.mif +index 7a21e56..3f3b863 100644 +--- a/build/mif/local.mif ++++ b/build/mif/local.mif +@@ -296,7 +296,7 @@ bld_cl_sys = + + bld_incs = $(bld_extra_incs) -I"$(watcom_dir)/h" + +-bld_cppflags = $(common_cppflags_bsd) $(common_cppflags_$(bld_cpu)) ++bld_cppflags = $(common_cppflags_haiku) $(common_cppflags_$(bld_cpu)) + + bld_cflags = $(common_cflags) $(common_flags) -o $@ + +@@ -328,8 +328,8 @@ cl = clang -pipe + + librarian = ar + +-cppflags_bsd = $(common_cppflags_bsd) +-cppflags_osi = $(common_cppflags_bsd) ++cppflags_haiku = $(common_cppflags_haiku) ++cppflags_osi = $(common_cppflags_haiku) + cppflags_386 = $(common_cppflags_386) + cppflags_ppc = $(common_cppflags_ppc) + cppflags_x64 = $(common_cppflags_x64) +-- +1.8.3.4 + + +From fb3e476980b1832ac3faff2a0c1f8501bff68890 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Tue, 20 Jan 2015 12:36:48 +0100 +Subject: trmem: fix build with non-watcom compiler + +* i86.h is not available in this case, use the stubs. + +diff --git a/bld/trmem/trmem.c b/bld/trmem/trmem.c +index f2c6eb9..a7ea28f 100644 +--- a/bld/trmem/trmem.c ++++ b/bld/trmem/trmem.c +@@ -33,7 +33,7 @@ + #include + #include + +-#if defined( _M_IX86 ) ++#if defined( _M_IX86 ) && defined( __WATCOMC__ ) + #include + #endif + +@@ -782,7 +782,7 @@ memsize _trmem_get_peak_usage( _trmem_hdl hdl ) { + return( hdl->max_mem ); + } + +-#ifndef _M_IX86 ++#if !defined( _M_IX86 ) || !defined( __WATCOMC__) + _trmem_who _trmem_guess_who( void ) + /**********************************/ + /* NYI: stubbed for now */ +-- +1.8.3.4 + + +From d08d3eac330bd61aaff31170eaa67de964874cd5 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Tue, 20 Jan 2015 12:37:36 +0100 +Subject: clibext: better implementation of _cmdname for haiku + +We need to look for the app image and not take whatever is listed first. + +diff --git a/bld/watcom/c/clibext.c b/bld/watcom/c/clibext.c +index d7fc1e0..f857228 100644 +--- a/bld/watcom/c/clibext.c ++++ b/bld/watcom/c/clibext.c +@@ -1270,9 +1270,13 @@ char *_cmdname( char *name ) + + char *_cmdname( char *name ) + { +- image_info info; +- get_image_info( 0, &info ); +- return( strcpy( name, info.name ) ); ++ image_info info; ++ int32 cookie; ++ while ( get_next_image_info( 0, &cookie, &info ) == B_OK) { ++ if ( info.type != B_APP_IMAGE ) ++ continue; ++ return( strcpy( name, info.name ) ); ++ } + } + + #elif defined( __UNIX__ ) +-- +1.8.3.4 + + +From 2b23463882316209eecbaa20416eee963710ae87 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Tue, 20 Jan 2015 12:38:16 +0100 +Subject: Fix more WResFileOffset type mismatches + +* Needed for things to build on Haiku. + +diff --git a/bld/as/c/asmsg.c b/bld/as/c/asmsg.c +index 00f29c3..f7df3d5 100644 +--- a/bld/as/c/asmsg.c ++++ b/bld/as/c/asmsg.c +@@ -70,7 +70,7 @@ static unsigned msgShift; + #define NO_RES_MESSAGE "Error: could not open message resource file\r\n" + #define NO_RES_SIZE (sizeof(NO_RES_MESSAGE)-1) + +-extern long FileShift; ++extern WResFileOffset FileShift; + + static HANDLE_INFO hInstance = {0}; + +diff --git a/bld/wasm/c/wasmmsg.c b/bld/wasm/c/wasmmsg.c +index 51a406f..302bb9d 100644 +--- a/bld/wasm/c/wasmmsg.c ++++ b/bld/wasm/c/wasmmsg.c +@@ -60,7 +60,7 @@ static const char *txtmsgs[] = { + #define NO_RES_MESSAGE "Error: could not open message resource file.\r\n" + #define NO_RES_SIZE (sizeof( NO_RES_MESSAGE ) - 1) + +-extern long FileShift; ++extern WResFileOffset FileShift; + + static HANDLE_INFO hInstance = { 0 }; + static unsigned MsgShift; +diff --git a/bld/wl/c/loadpe.c b/bld/wl/c/loadpe.c +index 41b7457..e0e674f 100644 +--- a/bld/wl/c/loadpe.c ++++ b/bld/wl/c/loadpe.c +@@ -773,7 +773,7 @@ WResFileSSize RcWrite( WResFileID hdl, const void *buf, WResFileSize len ) + return( len ); + } + +-long RcSeek( int hdl, long off, int pos ) ++WResFileOffset RcSeek( WResFileID hdl, WResFileOffset off, int pos ) + { + DbgAssert( pos != SEEK_END ); + DbgAssert( !(pos == SEEK_CUR && off < 0) ); +@@ -794,7 +794,7 @@ long RcSeek( int hdl, long off, int pos ) + } + } + +-long RcTell( int hdl ) ++WResFileOffset RcTell( WResFileID hdl ) + { + DbgAssert( hdl == Root->outfile->handle ); + +diff --git a/bld/wres/c/loadfind.c b/bld/wres/c/loadfind.c +index 1449fa6..e8aa881 100644 +--- a/bld/wres/c/loadfind.c ++++ b/bld/wres/c/loadfind.c +@@ -55,7 +55,7 @@ typedef struct dbgheader { + } dbgheader; + #include "poppck.h" + +-long FileShift = 0; ++WResFileOffset FileShift = 0; + + unsigned char FindResources( PHANDLE_INFO hInstance ) + /* look for the resource information in a debugger record at the end of file */ +-- +1.8.3.4 + + +From 85d972cda11f12d57fa958551805f02113193855 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Tue, 20 Jan 2015 14:25:55 +0100 +Subject: Another missing haiku define. + + +diff --git a/bld/watcom/h/wstd.h b/bld/watcom/h/wstd.h +index 01e8745..f892d58 100644 +--- a/bld/watcom/h/wstd.h ++++ b/bld/watcom/h/wstd.h +@@ -82,6 +82,9 @@ typedef unsigned_8 sbit; + #elif defined( __LINUX__ ) + #undef OS_LINUX + #define OS_LINUX 1 ++#elif defined( __HAIKU__ ) ++ #undef OS_HAIKU ++ #define OS_HAIKU 1 + #elif defined( __BSD__ ) + #undef OS_BSD + #define OS_BSD 1 +-- +1.8.3.4 + + +From 62d47ba56c04a1b6dddd343a96ddbb59bc83a97f Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Tue, 20 Jan 2015 14:26:59 +0100 +Subject: Some missing local > static conversions. + +* Not doing this really confuses gcc on Haiku. + +diff --git a/bld/cc/c/ccmain.c b/bld/cc/c/ccmain.c +index 547fc50..a75b4db 100644 +--- a/bld/cc/c/ccmain.c ++++ b/bld/cc/c/ccmain.c +@@ -81,7 +81,7 @@ static bool TryOpen( const char *path, const char *filename ); + static void ParseInit( void ); + static void CPP_Parse( void ); + static bool FCB_Alloc( FILE *fp, const char *filename ); +-local void Parse( void ); ++static void Parse( void ); + static bool OpenPgmFile( void ); + static void DelDepFile( void ); + static const char *IncludeAlias( const char *filename, bool is_lib ); diff --git a/bld/cc/c/cexpr.c b/bld/cc/c/cexpr.c index 9cbb2cf..2333caf 100644 --- a/bld/cc/c/cexpr.c @@ -314,424 +556,151 @@ index 9cbb2cf..2333caf 100644 { TREEPTR tree; TYPEPTR typ; -diff --git a/bld/cc/c/cmac2.c b/bld/cc/c/cmac2.c -index 232b456..bea45a7 100644 ---- a/bld/cc/c/cmac2.c -+++ b/bld/cc/c/cmac2.c -@@ -51,8 +51,8 @@ static void CLine( void ); - static void CError( void ); - static void CIdent( void ); +diff --git a/bld/cc/c/ctype.c b/bld/cc/c/ctype.c +index 12d8062..7561b22 100644 +--- a/bld/cc/c/ctype.c ++++ b/bld/cc/c/ctype.c +@@ -33,10 +33,10 @@ --local void GrabTokens( mac_parm_count parm_count, macro_flags mflags, MPPTR formal_parms, const char *mac_name, source_loc *src_loc ); --local mac_parm_count FormalParm( MPPTR formal_parms ); -+static void GrabTokens( mac_parm_count parm_count, macro_flags mflags, MPPTR formal_parms, const char *mac_name, source_loc *src_loc ); -+static mac_parm_count FormalParm( MPPTR formal_parms ); + extern unsigned SymTypedef; - struct preproc { - char *directive; -@@ -107,7 +107,7 @@ static void PPFlush2EOL( void ) +-local TYPEPTR StructDecl(DATA_TYPE,bool); +-//local TYPEPTR ComplexDecl(int,bool); +-local void SetPlainCharType( DATA_TYPE char_type ); +-local void CheckBitfieldType( TYPEPTR typ ); ++static TYPEPTR StructDecl(DATA_TYPE,bool); ++//static TYPEPTR ComplexDecl(int,bool); ++static void SetPlainCharType( DATA_TYPE char_type ); ++static void CheckBitfieldType( TYPEPTR typ ); + + #if _CPU == 386 + #define _CHECK_SIZE( s ) +@@ -325,7 +325,7 @@ type_modifiers TypeQualifier( void ) + return( flags ); + } + +-local TYPEPTR GetScalarType( bool *plain_int, int bmask, type_modifiers flags ) ++static TYPEPTR GetScalarType( bool *plain_int, int bmask, type_modifiers flags ) + { + DATA_TYPE data_type; + TYPEPTR typ; +@@ -400,7 +400,7 @@ local TYPEPTR GetScalarType( bool *plain_int, int bmask, type_modifiers flags ) } --local void ChkEOL( void ) -+static void ChkEOL( void ) +-local void AdvanceToken( void ) ++static void AdvanceToken( void ) { - if( CurToken != T_EOF ) { - ExpectingToken( T_NULL ); -@@ -115,7 +115,7 @@ local void ChkEOL( void ) + if( CurToken == T_SAVED_ID ) { + CMemFree( SavedId ); +@@ -763,7 +763,7 @@ TAGPTR VfyNewTag( TAGPTR tag, DATA_TYPE tag_type ) } --local void WantEOL( void ) -+static void WantEOL( void ) +-local FIELDPTR NewField( FIELDPTR new_field, TYPEPTR decl ) ++static FIELDPTR NewField( FIELDPTR new_field, TYPEPTR decl ) { + FIELDPTR field; + FIELDPTR prev_field; +@@ -823,7 +823,7 @@ local FIELDPTR NewField( FIELDPTR new_field, TYPEPTR decl ) + } + + +-local TYPEPTR EnumFieldType( TYPEPTR ftyp, bool plain_int, ++static TYPEPTR EnumFieldType( TYPEPTR ftyp, bool plain_int, + bitfield_width start, bitfield_width width ) + { + TYPEPTR typ; +@@ -877,7 +877,7 @@ align_type GetTypeAlignment( TYPEPTR typ ) + } + + +-local target_size FieldAlign( target_size next_offset, FIELDPTR field, align_type *worst_alignment ) ++static target_size FieldAlign( target_size next_offset, FIELDPTR field, align_type *worst_alignment ) + { + align_type pack_adjustment; + align_type align; +@@ -902,7 +902,7 @@ local target_size FieldAlign( target_size next_offset, FIELDPTR field, align_typ + return( next_offset ); + } + +-local DATA_TYPE UnQualifiedType( TYPEPTR typ ) ++static DATA_TYPE UnQualifiedType( TYPEPTR typ ) + { + SKIP_TYPEDEFS( typ ); + SKIP_ENUM( typ ); +@@ -932,7 +932,7 @@ local DATA_TYPE UnQualifiedType( TYPEPTR typ ) + + /* clear the hash table of all fields that were just defined + in the struct with tag tag */ +-local void ClearFieldHashTable( TAGPTR tag ) ++static void ClearFieldHashTable( TAGPTR tag ) + { + FIELDPTR field; + FIELDPTR hash_field; +@@ -984,7 +984,7 @@ static void AdjFieldTypeNode( FIELDPTR field, type_modifiers decl_mod ) + } + } + +-local target_size GetFields( TYPEPTR decl ) ++static target_size GetFields( TYPEPTR decl ) + { + target_size start; + TYPEPTR typ; +@@ -1129,7 +1129,7 @@ local target_size GetFields( TYPEPTR decl ) + } + + +-local TYPEPTR StructDecl( DATA_TYPE decl_typ, bool packed ) ++static TYPEPTR StructDecl( DATA_TYPE decl_typ, bool packed ) + { + TYPEPTR typ; + TAGPTR tag; +@@ -1202,7 +1202,7 @@ struct { + */ + + /* +-local void GetComplexFieldTypeSpecifier( decl_info *info, DATA_TYPE data_type ) ++static void GetComplexFieldTypeSpecifier( decl_info *info, DATA_TYPE data_type ) + { + info->stg = SC_NONE; // indicate don't want any storage class specifiers + info->mod = FLAG_NONE; +@@ -1214,7 +1214,7 @@ local void GetComplexFieldTypeSpecifier( decl_info *info, DATA_TYPE data_type ) + } + + +-local target_size GetComplexFields( TYPEPTR decl ) ++static target_size GetComplexFields( TYPEPTR decl ) + { + target_size start; + TYPEPTR typ; +@@ -1270,7 +1270,7 @@ local target_size GetComplexFields( TYPEPTR decl ) + } + + +-local TYPEPTR ComplexDecl( DATA_TYPE decl_typ, bool packed ) ++static TYPEPTR ComplexDecl( DATA_TYPE decl_typ, bool packed ) + { + TYPEPTR typ; + TAGPTR tag; +@@ -1297,7 +1297,7 @@ local TYPEPTR ComplexDecl( DATA_TYPE decl_typ, bool packed ) + } + */ + +-local void CheckBitfieldType( TYPEPTR typ ) ++static void CheckBitfieldType( TYPEPTR typ ) + { + SKIP_TYPEDEFS( typ ); if( CompFlags.extensions_enabled ) { - if( CurToken != T_NULL && CurToken != T_EOF ) { -@@ -129,7 +129,7 @@ local void WantEOL( void ) +@@ -1437,7 +1437,7 @@ TYPEPTR ArrayNode( TYPEPTR the_object ) } --local void IncLevel( bool value ) -+static void IncLevel( bool value ) +-local TYPEPTR MkPtrNode( TYPEPTR typ, type_modifiers flags, ++static TYPEPTR MkPtrNode( TYPEPTR typ, type_modifiers flags, + segment_id segid, SYM_HANDLE base, BASED_KIND based_kind ) { - struct cpp_info *cpp; - -@@ -150,7 +150,7 @@ local void IncLevel( bool value ) - } - - --local void CUnknown( void ) -+static void CUnknown( void ) - { - if( NestLevel == SkipLevel ) { - CErr2p( ERR_UNKNOWN_DIRECTIVE, Buffer ); -@@ -244,18 +244,18 @@ TOKEN ChkControl( void ) - } - - --local void CSkip( void ) -+static void CSkip( void ) - { - } - - --local void CSkipIf( void ) -+static void CSkipIf( void ) - { - IncLevel( FALSE ); - } - - --local void CIdent( void ) -+static void CIdent( void ) - { - if( !CompFlags.extensions_enabled ) { - CUnknown(); -@@ -319,7 +319,7 @@ void CInclude( void ) - } - - --local void CDefine( void ) -+static void CDefine( void ) - { - MPPTR mp; - MPPTR prev_mp; -@@ -406,7 +406,7 @@ local void CDefine( void ) - } - - --local void GrabTokens( mac_parm_count parm_count, macro_flags mflags, MPPTR formal_parms, const char *mac_name, source_loc *loc ) -+static void GrabTokens( mac_parm_count parm_count, macro_flags mflags, MPPTR formal_parms, const char *mac_name, source_loc *loc ) - { - MEPTR mentry; - size_t len; -@@ -524,7 +524,7 @@ local void GrabTokens( mac_parm_count parm_count, macro_flags mflags, MPPTR form - } - - --local mac_parm_count FormalParm( MPPTR formal_parms ) -+static mac_parm_count FormalParm( MPPTR formal_parms ) - { - mac_parm_count i; - -@@ -539,7 +539,7 @@ local mac_parm_count FormalParm( MPPTR formal_parms ) - } - - --local void CIfDef( void ) -+static void CIfDef( void ) - { - MEPTR mentry; - -@@ -561,7 +561,7 @@ local void CIfDef( void ) - } - - --local void CIfNDef( void ) -+static void CIfNDef( void ) - { - MEPTR mentry; - -@@ -582,7 +582,7 @@ local void CIfNDef( void ) - } - - --local bool GetConstExpr( void ) -+static bool GetConstExpr( void ) - { - bool value; - bool useful_side_effect; -@@ -603,7 +603,7 @@ local bool GetConstExpr( void ) - return( value ); - } - --local void CIf( void ) -+static void CIf( void ) - { - bool value; - -@@ -616,7 +616,7 @@ local void CIf( void ) - } - - --local void CElif( void ) -+static void CElif( void ) - { - bool value; - -@@ -646,7 +646,7 @@ local void CElif( void ) - } - - --local void CElse( void ) -+static void CElse( void ) - { - if( ( NestLevel == 0 ) || ( CppStack->cpp_type == PRE_ELSE ) ) { - CErr1( ERR_MISPLACED_ELSE ); -@@ -668,7 +668,7 @@ local void CElse( void ) - } - - --local void CEndif( void ) -+static void CEndif( void ) - { - if( NestLevel == 0 ) { - CErr1( ERR_MISPLACED_ENDIF ); -@@ -733,7 +733,7 @@ bool MacroDel( const char *name ) - } - - --local void CUndef( void ) -+static void CUndef( void ) - { - - PPNextToken(); -@@ -745,7 +745,7 @@ local void CUndef( void ) - } - - --local void CLine( void ) -+static void CLine( void ) - { - FNAMEPTR flist; - unsigned src_line; -@@ -791,7 +791,7 @@ local void CLine( void ) - } - - --local void CError( void ) -+static void CError( void ) - { - size_t len; - bool save; -diff --git a/bld/cc/master.mif b/bld/cc/master.mif -index 45a69b5..0ac6a97 100644 ---- a/bld/cc/master.mif -+++ b/bld/cc/master.mif -@@ -53,7 +53,7 @@ pre_obj_deps += code$(target_cpu).gh - # - # C compiler options - # --extra_cpp_flags = -Dlocal=static -+extra_cpp_flags = -Dlocal="static" - !ifneq cc_dll 1 - extra_cpp_flags += -DIDE_PGM - !endif --- -1.8.3.4 - - -From eda63ead29387368ea13473af964ada010826c8e Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Sun, 18 Jan 2015 15:35:30 +0100 -Subject: Adjust setvars.sh to Haiku build environment. - - -diff --git a/setvars.sh b/setvars.sh -index a64d135..30bce44 100755 ---- a/setvars.sh -+++ b/setvars.sh -@@ -6,14 +6,14 @@ - # modify it as necessary for your own use!! - - # Change this to point your Open Watcom source tree --export OWROOT=/home/ow/ow -+export OWROOT=/sources/openwatcom-2.0.0 - - # Subdirectory to be used for building OW build tools - export OWOBJDIR=binbuild - - # Set this entry to identify your toolchain used by build process - # supported values are WATCOM GCC CLANG --export OWTOOLS=WATCOM -+export OWTOOLS=GCC - - # Documentation related variables - --- -1.8.3.4 - - -From a720938fa74b28394287eb1c4f13804520089948 Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Mon, 19 Jan 2015 19:36:32 +0100 -Subject: loadfind: long is 32-bit, off_t might be 64bit - -Use the proper type to get the correct sign expansion effect. - -diff --git a/bld/wres/c/loadfind.c b/bld/wres/c/loadfind.c -index 28b9529..c94ae26 100644 ---- a/bld/wres/c/loadfind.c -+++ b/bld/wres/c/loadfind.c -@@ -61,7 +61,7 @@ unsigned char FindResources( PHANDLE_INFO hInstance ) - /* look for the resource information in a debugger record at the end of file */ - { - long currpos; -- long offset; -+ off_t offset; - dbgheader header; - bool notfound; - char buffer[sizeof( PATCH_LEVEL )]; -@@ -69,7 +69,7 @@ unsigned char FindResources( PHANDLE_INFO hInstance ) - notfound = true; - FileShift = 0; - offset = sizeof( dbgheader ); -- if( WRESSEEK( hInstance->handle, -(long)sizeof( PATCH_LEVEL ), SEEK_END ) != -1 ) { -+ if( WRESSEEK( hInstance->handle, -(off_t)sizeof( PATCH_LEVEL ), SEEK_END ) != -1 ) { - if( WRESREAD( hInstance->handle, buffer, sizeof( PATCH_LEVEL ) ) == sizeof( PATCH_LEVEL ) ) { - if( memcmp( buffer, PATCH_LEVEL, PATCH_LEVEL_HEAD_SIZE ) == 0 ) { - offset += sizeof( PATCH_LEVEL ); --- -1.8.3.4 - - -From 48aea848589760809e793b3f38af51fc4c0dd313 Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Mon, 19 Jan 2015 22:44:26 +0100 -Subject: Fix local.mif for Haiku. - -* It was still referencing BSD from which it was copied, resulting in -broken build. - -diff --git a/build/mif/local.mif b/build/mif/local.mif -index 1990b94..4537b76 100644 ---- a/build/mif/local.mif -+++ b/build/mif/local.mif -@@ -453,7 +453,7 @@ bld_cl_sys = - - bld_incs = $(bld_extra_incs) -I"$(watcom_dir)/h" - --bld_cppflags = $(common_cppflags_bsd) $(common_cppflags_$(bld_cpu)) -+bld_cppflags = $(common_cppflags_haiku) $(common_cppflags_$(bld_cpu)) - - bld_cflags = $(common_cflags) $(common_flags) -o $@ - -@@ -485,8 +485,8 @@ cl = gcc -pipe - - librarian = ar - --cppflags_bsd = $(common_cppflags_bsd) --cppflags_osi = $(common_cppflags_bsd) -+cppflags_haiku = $(common_cppflags_haiku) -+cppflags_osi = $(common_cppflags_haiku) - cppflags_386 = $(common_cppflags_386) - cppflags_ppc = $(common_cppflags_ppc) - cppflags_x64 = $(common_cppflags_x64) --- -1.8.3.4 - - -From 4b0ebc440cc9f2b217c39f00f89cf2e280fc4bc1 Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Mon, 19 Jan 2015 22:45:36 +0100 -Subject: makeinit, variety.h: Haiku support. - -Not sure if this is needed, for symmetry with other systems only. - -diff --git a/bld/lib_misc/h/variety.h b/bld/lib_misc/h/variety.h -index 241183e..7323caa 100644 ---- a/bld/lib_misc/h/variety.h -+++ b/bld/lib_misc/h/variety.h -@@ -164,6 +164,16 @@ - #else - #error unrecognized processor for Linux - #endif -+#elif defined(__HAIKU__) -+ #define __PROTECT_MODE__ -+ #define __UNIX__ -+ #if defined(__386__) -+ #define __HAIKU_386__ -+ #elif defined(__PPC__) -+ #define __HAIKU_PPC__ -+ #else -+ #error unrecognized processor for Haiku -+ #endif - #elif defined(__NETWARE__) - #define __PROTECT_MODE__ - #if defined(__386__) -diff --git a/build/makeinit b/build/makeinit -index f9bc945..692675a 100644 ---- a/build/makeinit -+++ b/build/makeinit -@@ -82,6 +82,17 @@ bld64host_osi = 1 - !else ifdef __BSDPPC__ - bld_cpu = ppc - bld_os = bsd -+!else ifdef __HAIKU386__ -+bld_cpu = 386 -+bld_os = haiku -+!else ifdef __HAIKUX64__ -+bld_cpu = x64 -+bld_os = haiku -+bld64host_bsd = 1 -+bld64host_osi = 1 -+!else ifdef __HAIKUPPC__ -+bld_cpu = ppc -+bld_os = haiku - !endif - - !ifdef nulldevice_$(bld_os) --- -1.8.3.4 - - -From 61579736f40c305f7e33642c17e36c4daad73094 Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Mon, 19 Jan 2015 22:46:14 +0100 -Subject: walloca: silcene warning on Haiku - -We already define __alloca in Haiku system headers, and this triggers a -warning during build. - -diff --git a/bld/watcom/h/walloca.h b/bld/watcom/h/walloca.h -index 66a7ac8..6f70d1c 100644 ---- a/bld/watcom/h/walloca.h -+++ b/bld/watcom/h/walloca.h -@@ -41,7 +41,7 @@ - #if !defined( __WATCOMC__ ) - #if defined( _MSC_VER ) - #define __alloca _alloca --#else -+#elif !defined(__HAIKU__) - #define __alloca alloca - #endif - #endif --- -1.8.3.4 - - -From bfc9f3a6eab0dbc28d4eb91698842faa8fb94ac8 Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Mon, 19 Jan 2015 22:47:04 +0100 -Subject: wl, builder: let makefiles know about Haiku - -* We want the POSIX stuff used, otherwise there are undefined -references. - -diff --git a/bld/builder/master.mif b/bld/builder/master.mif -index 6ce7918..2d7f651 100644 ---- a/bld/builder/master.mif -+++ b/bld/builder/master.mif -@@ -36,6 +36,7 @@ inc_dirs = -I"../h" -I"$(pmake_dir)" -I"$(posix_dir)/h" - sys_bsd = sys.obj sysposix.obj - sys_dos = sys.obj sysdos.obj sysdoscd.obj - sys_linux = sys.obj sysposix.obj -+sys_haiku = sys.obj sysposix.obj - sys_nt = sysnt.obj sysdoscd.obj - sys_os2 = sys.obj sysos2.obj sysdoscd.obj - -diff --git a/bld/wl/wlobjs.mif b/bld/wl/wlobjs.mif -index 7b50b4f..e1efd0b 100644 ---- a/bld/wl/wlobjs.mif -+++ b/bld/wl/wlobjs.mif -@@ -125,6 +125,7 @@ wlink_ide_objs = $(_subdir_)idedrv.obj - wlink_objs_dos = $(_subdir_)linkio.obj - wlink_objs_qnx = $(_subdir_)posixio.obj - wlink_objs_linux = $(_subdir_)posixio.obj -+wlink_objs_haiku = $(_subdir_)posixio.obj - wlink_objs_osx = $(_subdir_)posixio.obj - wlink_objs_bsd = $(_subdir_)posixio.obj - wlink_objs_nt = $(_subdir_)ntio.obj + TYPEPTR ptrtyp; -- 1.8.3.4