From 0a25e75b8f04d3eadc73612a78b2e1fbbc2d357e Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 16 Jun 2009 13:05:23 +0000 Subject: [PATCH] 2009-06-16 15:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Added preliminary support for autosetup for several more compilers: win/watcom, win/pocc, win/pocc64, wce/poccarm, dos/djgpp, dos/watcom. Only these were tested: dos/djgpp, win/watcom, win/pocc. This means it's now possible to "bundle" DJGPP, watcom or pocc _compiler tools_ with Harbour and hbmk2 will be able to detect them, or user can choose between them using -arch/-comp switches, then hbmk2 will just be able to use them "as is", without the need to change anything on the environment. zero-conf usage in essence, just like we already had for mingw family. ; NOTE: Before the release I'll rethink placement of these tools inside the Harbour directory tree. Currently they are detected in the Harbour root dir, but with multiple compilers this is not ideal. * source/vm/thread.c ! Fixed compile error after 2009-06-16 08:55 UTC+0200. --- harbour/ChangeLog | 21 +++++++++ harbour/source/vm/thread.c | 1 + harbour/utils/hbmk2/hbmk2.prg | 82 +++++++++++++++++++++++++++++++---- 3 files changed, 96 insertions(+), 8 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8fdb2087c6..134d37ebbc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,27 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-06-16 15:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * utils/hbmk2/hbmk2.prg + + Added preliminary support for autosetup for several more + compilers: win/watcom, win/pocc, win/pocc64, wce/poccarm, + dos/djgpp, dos/watcom. + Only these were tested: dos/djgpp, win/watcom, win/pocc. + This means it's now possible to "bundle" DJGPP, watcom or + pocc _compiler tools_ with Harbour and hbmk2 will be able + to detect them, or user can choose between them using + -arch/-comp switches, then hbmk2 will just be able to use + them "as is", without the need to change anything on the + environment. zero-conf usage in essence, just like we + already had for mingw family. + ; NOTE: Before the release I'll rethink placement of these + tools inside the Harbour directory tree. Currently + they are detected in the Harbour root dir, but with + multiple compilers this is not ideal. + + * source/vm/thread.c + ! Fixed compile error after 2009-06-16 08:55 UTC+0200. + 2009-06-16 13:37 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbct/token1.c % use explicit constant value instead of HB_MKULONG() macro diff --git a/harbour/source/vm/thread.c b/harbour/source/vm/thread.c index 692d786470..0e02007df1 100644 --- a/harbour/source/vm/thread.c +++ b/harbour/source/vm/thread.c @@ -2320,6 +2320,7 @@ HB_FUNC( HB_MUTEXSUBSCRIBENOW ) HB_FUNC( HB_MUTEXQUEUEINFO ) { + HB_STACK_TLS_PRELOAD PHB_ITEM pItem = hb_mutexParam( 1 ); if( pItem ) diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 8d8cfbd2b8..57e15b600e 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -155,6 +155,7 @@ REQUEST hbmk_KEYW #define _COMPDETE_cARCH 2 #define _COMPDETE_cCOMP 3 #define _COMPDETE_cCCPREFIX 4 +#define _COMPDETE_bSetup 5 #define _HBMODE_NATIVE 0 #define _HBMODE_HB10 1 @@ -404,6 +405,57 @@ STATIC FUNCTION hbmk_run( cCmd ) RETURN result #endif +STATIC PROCEDURE hbmk_COMP_Setup( cARCH, cCOMP, cBasePath ) + + /* TODO: Use CCPREFIX instead of PATH modification, where possible. */ + + /* NOTE: We have to retain existing PATH as we may need some tools + from it, like upx compressor. [vszakats] */ + + cBasePath := PathNormalize( cBasePath ) + + DO CASE + CASE cARCH == "win" .AND. cCOMP == "watcom" + + hb_SetEnv( "WATCOM", cBasePath ) + hb_SetEnv( "PATH", cBasePath + hb_osPathSeparator() + "BINNT;" + cBasePath + hb_osPathSeparator() + "BINW;" + hb_GetEnv( "PATH" ) ) + hb_SetEnv( "EDPATH", cBasePath + hb_osPathSeparator() + "EDDAT" ) + hb_SetEnv( "INCLUDE", cBasePath + hb_osPathSeparator() + "H;" + cBasePath + hb_osPathSeparator() + "H" + hb_osPathSeparator() + "NT" ) + + CASE cARCH == "win" .AND. cCOMP == "pocc" + + hb_SetEnv( "PATH", cBasePath + hb_osPathSeparator() + "Bin;" + hb_GetEnv( "PATH" ) ) + hb_SetEnv( "INCLUDE", cBasePath + hb_osPathSeparator() + "Include;" + cBasePath + hb_osPathSeparator() + "Include" + hb_osPathSeparator() + "Win" ) + hb_SetEnv( "LIB", cBasePath + hb_osPathSeparator() + "Lib;" + cBasePath + hb_osPathSeparator() + "Lib" + hb_osPathSeparator() + "Win" ) + + CASE cARCH == "win" .AND. cCOMP == "pocc64" + + hb_SetEnv( "PATH", cBasePath + hb_osPathSeparator() + "Bin;" + hb_GetEnv( "PATH" ) ) + hb_SetEnv( "INCLUDE", cBasePath + hb_osPathSeparator() + "Include;" + cBasePath + hb_osPathSeparator() + "Include" + hb_osPathSeparator() + "Win" ) + hb_SetEnv( "LIB", cBasePath + hb_osPathSeparator() + "Lib;" + cBasePath + hb_osPathSeparator() + "Lib" + hb_osPathSeparator() + "Win64" ) + + CASE cARCH == "wce" .AND. cCOMP == "poccarm" + + hb_SetEnv( "PATH", cBasePath + hb_osPathSeparator() + "Bin;" + hb_GetEnv( "PATH" ) ) + hb_SetEnv( "INCLUDE", cBasePath + hb_osPathSeparator() + "Include" + hb_osPathSeparator() + "WinCE;" + cBasePath + hb_osPathSeparator() + "Include" ) + hb_SetEnv( "LIB", cBasePath + hb_osPathSeparator() + "Lib;" + cBasePath + hb_osPathSeparator() + "Lib" + hb_osPathSeparator() + "WinCE" ) + + CASE cARCH == "dos" .AND. cCOMP == "djgpp" + + hb_SetEnv( "DJGPP", cBasePath + hb_osPathSeparator() + "djgpp.env" ) + hb_SetEnv( "PATH", cBasePath + hb_osPathSeparator() + "bin;" + hb_GetEnv( "PATH" ) ) + + CASE cARCH == "dos" .AND. cCOMP == "watcom" + + hb_SetEnv( "WATCOM", cBasePath ) + hb_SetEnv( "PATH", cBasePath + hb_osPathSeparator() + "BINW;" + hb_GetEnv( "PATH" ) ) + hb_SetEnv( "EDPATH", cBasePath + hb_osPathSeparator() + "EDDAT" ) + hb_SetEnv( "INCLUDE", cBasePath + hb_osPathSeparator() + "H" ) + + ENDCASE + + RETURN + FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) LOCAL hbmk[ _HBMK_MAX_ ] @@ -1025,19 +1077,27 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) aCOMPDET_EMBED := {} - IF hbmk[ _HBMK_cARCH ] $ "win|wce" + IF hbmk[ _HBMK_cARCH ] $ "win|wce|dos" #if defined( __PLATFORM__WINDOWS ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingw" + hb_osPathSeparator() + "bin", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "win", "mingw" , "" } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingw64" + hb_osPathSeparator() + "bin", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "win", "mingw64" , "x86_64-pc-mingw32-" } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingwarm" + hb_osPathSeparator() + "bin", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "wce", "mingwarm", "arm-mingw32ce-" } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingwarm" + hb_osPathSeparator() + "bin", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "wce", "mingwarm", "arm-wince-mingw32ce-" } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingw" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "win", "mingw" , "" } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingw64" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "win", "mingw64" , "x86_64-pc-mingw32-" } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingwarm" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "wce", "mingwarm", "arm-mingw32ce-" } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingwarm" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "wce", "mingwarm", "arm-wince-mingw32ce-" } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "pocc" + hb_osPathSeparator() + "Bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "pocc.exe" ), tmp1, NIL ) }, "win", "pocc" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "watcom" + hb_osPathSeparator() + "binnt", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "wpp386.exe" ), tmp1, NIL ) }, "win", "watcom" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "djgpp" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc.exe" ), tmp1, NIL ) }, "dos", "djgpp" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) + + #elif defined( __PLATFORM__DOS ) + + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "djgpp" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc.exe" ), tmp1, NIL ) }, "dos", "djgpp" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) #elif defined( __PLATFORM__UNIX ) IF Empty( hbmk[ _HBMK_cCCPATH ] ) .AND. ; - Empty( hbmk[ _HBMK_cCCPREFIX ] ) + Empty( hbmk[ _HBMK_cCCPREFIX ] ) .AND. ; + !( hbmk[ _HBMK_cARCH ] == "dos" ) DO CASE CASE hbmk[ _HBMK_cCOMP ] $ "mingw" @@ -1080,7 +1140,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) ENDIF NEXT ENDIF - IF Empty( hbmk[ _HBMK_cCOMP ] ) .AND. hbmk[ _HBMK_cARCH ] $ "win|wce" + IF Empty( hbmk[ _HBMK_cCOMP ] ) .AND. hbmk[ _HBMK_cARCH ] $ "win|wce|dos" /* Autodetect embedded MinGW installation */ FOR tmp := 1 TO Len( aCOMPDET_EMBED ) IF hbmk[ _HBMK_cARCH ] == aCOMPDET_EMBED[ tmp ][ _COMPDETE_cARCH ] .AND. ; @@ -1088,6 +1148,9 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) hbmk[ _HBMK_cCOMP ] := aCOMPDET_EMBED[ tmp ][ _COMPDETE_cCOMP ] hbmk[ _HBMK_cCCPREFIX ] := aCOMPDET_EMBED[ tmp ][ _COMPDETE_cCCPREFIX ] hbmk[ _HBMK_cCCPATH ] := cPath_CompC + IF ISBLOCK( aCOMPDET_EMBED[ tmp ][ _COMPDETE_bSetup ] ) + Eval( aCOMPDET_EMBED[ tmp ][ _COMPDETE_bSetup ], hbmk[ _HBMK_cARCH ], hbmk[ _HBMK_cCOMP ], cPath_CompC ) + ENDIF EXIT ENDIF NEXT @@ -1110,7 +1173,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) hbmk_OutErr( hbmk, hb_StrFormat( I_( "Error: Compiler value unknown: %1$s" ), hbmk[ _HBMK_cCOMP ] ) ) RETURN 2 ENDIF - IF hbmk[ _HBMK_cARCH ] $ "win|wce" + IF hbmk[ _HBMK_cARCH ] $ "win|wce|dos" /* Detect cross platform CCPREFIX and CCPATH if embedded MinGW installation is detected */ FOR tmp := 1 TO Len( aCOMPDET_EMBED ) IF aCOMPDET_EMBED[ tmp ][ _COMPDETE_cARCH ] == hbmk[ _HBMK_cARCH ] .AND. ; @@ -1118,6 +1181,9 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) ! Empty( cPath_CompC := Eval( aCOMPDET_EMBED[ tmp ][ _COMPDETE_bBlock ], aCOMPDET_EMBED[ tmp ][ _COMPDETE_cCCPREFIX ] ) ) hbmk[ _HBMK_cCCPATH ] := cPath_CompC hbmk[ _HBMK_cCCPREFIX ] := aCOMPDET_EMBED[ tmp ][ _COMPDETE_cCCPREFIX ] + IF ISBLOCK( aCOMPDET_EMBED[ tmp ][ _COMPDETE_bSetup ] ) + Eval( aCOMPDET_EMBED[ tmp ][ _COMPDETE_bSetup ], hbmk[ _HBMK_cARCH ], hbmk[ _HBMK_cCOMP ], cPath_CompC ) + ENDIF EXIT ENDIF NEXT