From 878e9a84f0fae87bdaa61b57d3e39cc27ca15b51 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 4 Aug 2010 23:39:32 +0000 Subject: [PATCH] 2010-08-05 01:38 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Added ${hb_dynsuffix} macro which returns a dynlib suffix value compatible with the naming system used for Harbour core dynlib (-x64, -wce-arm, -bcc, etc..) % Internals optimized to use dynsuffix value when calculating harbour core dynlib name. ! Fixed to not require macros inside filters to be uppercases. (as a side effect now unknown macro names will be passed as is to getenv() to check for possible envvar value) * contrib/hbpost.hbm + Will now use ${hb_dynsuffix} when forming output name in -hbdyn mode. So f.e. for x64 targets an '-x64' suffix will be used, which matches with the one used with core harbour dynlib. Also bcc targets will get -bcc postfix. + Will now use ${hb_dynsuffix) when forming implib output name if it's not empty (for x86, ia64, wce and bcc in practice). * contrib/make.hbs * config/postinst.hbs ! Display msg about extern generation only if it was really started. * config/hbextern.hbs ! Fixed to check for the presence of input file. --- harbour/ChangeLog | 26 ++++++++++++ harbour/config/hbextern.hbs | 20 +++++----- harbour/config/postinst.hbs | 4 +- harbour/contrib/hbpost.hbm | 5 ++- harbour/contrib/make.hbs | 4 +- harbour/utils/hbmk2/hbmk2.prg | 74 ++++++++++++++--------------------- 6 files changed, 74 insertions(+), 59 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index deae36ab9b..1dc42f661e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,32 @@ The license applies to all entries newer than 2009-04-28. */ +2010-08-05 01:38 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * utils/hbmk2/hbmk2.prg + + Added ${hb_dynsuffix} macro which returns a dynlib suffix + value compatible with the naming system used for Harbour core + dynlib (-x64, -wce-arm, -bcc, etc..) + % Internals optimized to use dynsuffix value when calculating + harbour core dynlib name. + ! Fixed to not require macros inside filters to be uppercases. + (as a side effect now unknown macro names will be passed + as is to getenv() to check for possible envvar value) + + * contrib/hbpost.hbm + + Will now use ${hb_dynsuffix} when forming output name in + -hbdyn mode. So f.e. for x64 targets an '-x64' suffix will + be used, which matches with the one used with core harbour + dynlib. Also bcc targets will get -bcc postfix. + + Will now use ${hb_dynsuffix) when forming implib output name + if it's not empty (for x86, ia64, wce and bcc in practice). + + * contrib/make.hbs + * config/postinst.hbs + ! Display msg about extern generation only if it was really started. + + * config/hbextern.hbs + ! Fixed to check for the presence of input file. + 2010-08-04 23:40 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbct/ctextern.prg ! Fixed missing #defines after latest changes. diff --git a/harbour/config/hbextern.hbs b/harbour/config/hbextern.hbs index 5c52d48e2d..4dff511707 100644 --- a/harbour/config/hbextern.hbs +++ b/harbour/config/hbextern.hbs @@ -44,15 +44,17 @@ STATIC FUNCTION __hb_extern_get_list( cInputName ) LOCAL tmp IF GetEnv( "HB_COMPILER" ) $ "gcc|mingw|mingw64|cygwin" - IF hb_processRun( "nm -g --defined-only -C " + cInputName,, @cStdOut ) == 0 - IF ! Empty( hRegex := hb_regexComp( "[[:blank:]]HB_FUN_(.*)[[:space:]]", .T., .T. ) ) - aResult := hb_regexAll( hRegex, StrTran( cStdOut, Chr( 13 ) ),,,,, .T. ) - aExtern := {} - FOR EACH tmp IN aResult - AAdd( aExtern, tmp[ 2 ] ) - NEXT - ASort( aExtern,,, {| tmp, tmp1 | tmp < tmp1 } ) - RETURN aExtern + IF hb_FileExists( cInputName ) + IF hb_processRun( "nm -g --defined-only -C " + cInputName,, @cStdOut ) == 0 + IF ! Empty( hRegex := hb_regexComp( "[[:blank:]]HB_FUN_(.*)[[:space:]]", .T., .T. ) ) + aResult := hb_regexAll( hRegex, StrTran( cStdOut, Chr( 13 ) ),,,,, .T. ) + aExtern := {} + FOR EACH tmp IN aResult + AAdd( aExtern, tmp[ 2 ] ) + NEXT + ASort( aExtern,,, {| tmp, tmp1 | tmp < tmp1 } ) + RETURN aExtern + ENDIF ENDIF ENDIF ENDIF diff --git a/harbour/config/postinst.hbs b/harbour/config/postinst.hbs index 675d74c2e5..d847755787 100644 --- a/harbour/config/postinst.hbs +++ b/harbour/config/postinst.hbs @@ -543,10 +543,10 @@ STATIC FUNCTION mk_extern_core() IF GetEnv( "HB_REBUILD_EXTERN" ) == "yes" .AND. ; ! Empty( GetEnv( "HB_DYNLIB_ST" ) ) - OutStd( "! Generating core extern headers..." + hb_eol() ) - IF ( aExtern := __hb_extern_get_list( GetEnv( "HB_DYNLIB_DIR" ) + hb_ps() + GetEnv( "HB_DYNLIB_ST" ) + GetEnv( "HB_DYNLIB_EXT" ) ) ) != NIL + OutStd( "! Generating core extern headers..." + hb_eol() ) + __hb_extern_gen( aExtern, "include" + hb_ps() + "hbscalar.hbx" ) __hb_extern_gen( aExtern, "include" + hb_ps() + "hbcpage.hbx" ) __hb_extern_gen( aExtern, "include" + hb_ps() + "hblang.hbx" ) diff --git a/harbour/contrib/hbpost.hbm b/harbour/contrib/hbpost.hbm index fa99754b8d..2bd4118ecc 100644 --- a/harbour/contrib/hbpost.hbm +++ b/harbour/contrib/hbpost.hbm @@ -40,11 +40,14 @@ {_HB_BUILD_LIBDYN}-hbdyn {_HB_BUILD_LIBDYN}-shared {_HB_BUILD_LIBDYN}-implib=../lib/${hb_plat}/${hb_comp}${hb_build}/ -{_HB_BUILD_LIBDYN&hbdyn}-implib=${hb_outputname}_dll +{_HB_BUILD_LIBDYN&hbdyn&hb_dynsuffix}-implib=${hb_outputname}${hb_dynsuffix} +{_HB_BUILD_LIBDYN&hbdyn&!hb_dynsuffix}-implib=${hb_outputname}_dll {_HB_BUILD_LIBDYN&hbexe}-implib=${hb_outputname}_exe {_HB_BUILD_LIBDYN&allwin}-lhbmaindllp {_HB_BUILD_LIBDYN}-depimplib- +{hbdyn}-o${hb_outputname}${hb_dynsuffix} + {hblib}-o../lib/${hb_plat}/${hb_comp}${hb_build}/ {hbexe|hbdyn}-o../bin/${hb_plat}/${hb_comp}${hb_build}/ diff --git a/harbour/contrib/make.hbs b/harbour/contrib/make.hbs index 6c751b092f..1a659e6830 100755 --- a/harbour/contrib/make.hbs +++ b/harbour/contrib/make.hbs @@ -561,10 +561,8 @@ STATIC FUNCTION mk_extern_lib( cInputName, cOutputName ) LOCAL aExtern IF GetEnv( "HB_REBUILD_EXTERN" ) == "yes" - - OutStd( hb_StrFormat( "! Generating extern header: %1$s", cOutputName ) + hb_eol() ) - IF ( aExtern := __hb_extern_get_list( cInputName ) ) != NIL + OutStd( hb_StrFormat( "! Generating extern header: %1$s", cOutputName ) + hb_eol() ) RETURN __hb_extern_gen( aExtern, cOutputName ) ENDIF ENDIF diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index f9257f301b..eb28b1e4df 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -3305,18 +3305,9 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) /* NOTE: Newer xhb version use "-x.y.z" version numbers. */ l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "xharbourmt",; "xharbour" ) } - CASE hbmk[ _HBMK_cCOMP ] == "mingw64" - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + "-x64",; - "harbour" + cDL_Version_Alter + "-x64" ) } - CASE hbmk[ _HBMK_cCOMP ] == "mingwarm" - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + "-wce-arm",; - "harbour" + cDL_Version_Alter + "-wce-arm" ) } - CASE hbmk[ _HBMK_cCOMP ] == "mingw" .AND. hbmk[ _HBMK_cPLAT ] = "wce" - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + "-wce-x86",; - "harbour" + cDL_Version_Alter + "-wce-x86" ) } OTHERWISE - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter,; - "harbour" + cDL_Version_Alter ) } + l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + hbmk_DYNSUFFIX( hbmk ),; + "harbour" + cDL_Version_Alter + hbmk_DYNSUFFIX( hbmk ) ) } ENDCASE IF _HBMODE_IS_XHB( hbmk[ _HBMK_nHBMODE ] ) @@ -3975,24 +3966,8 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) ENDIF ENDIF l_aLIBSYS := ArrayAJoin( { l_aLIBSYS, l_aLIBSYSCORE, l_aLIBSYSMISC } ) - DO CASE - CASE hbmk[ _HBMK_cCOMP ] == "msvc" .AND. hbmk[ _HBMK_cPLAT ] = "wce" - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + "-wce-x86" + cLibExt,; - "harbour" + cDL_Version_Alter + "-wce-x86" + cLibExt ) } - CASE hbmk[ _HBMK_cCOMP ] == "msvcarm" - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + "-wce-arm" + cLibExt,; - "harbour" + cDL_Version_Alter + "-wce-arm" + cLibExt ) } - CASE hbmk[ _HBMK_cCOMP ] $ "msvc|icc" - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + cLibExt,; - "harbour" + cDL_Version_Alter + cLibExt ) } - CASE hbmk[ _HBMK_cCOMP ] == "msvc64" - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + "-x64" + cLibExt,; - "harbour" + cDL_Version_Alter + "-x64" + cLibExt ) } - CASE hbmk[ _HBMK_cCOMP ] $ "msvcia64|iccia64" - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + "-ia64" + cLibExt,; - "harbour" + cDL_Version_Alter + "-ia64" + cLibExt ) } - ENDCASE - + l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + hbmk_DYNSUFFIX( hbmk ) + cLibExt,; + "harbour" + cDL_Version_Alter + hbmk_DYNSUFFIX( hbmk ) + cLibExt ) } l_aLIBSHAREDPOST := { "hbmainstd", "hbmainwin" } IF !( hbmk[ _HBMK_cCOMP ] $ "icc|iccia64" ) @@ -4102,19 +4077,8 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) IF hbmk[ _HBMK_lDEBUG ] AAdd( hbmk[ _HBMK_aOPTL ], "-debug" ) ENDIF - l_aLIBSYS := ArrayAJoin( { l_aLIBSYS, l_aLIBSYSCORE, l_aLIBSYSMISC } ) - DO CASE - CASE hbmk[ _HBMK_cCOMP ] == "pocc64" - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + "-x64" + cLibExt,; - "harbour" + cDL_Version_Alter + "-x64" + cLibExt ) } - CASE hbmk[ _HBMK_cCOMP ] == "poccarm" - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + "-wce-arm" + cLibExt,; - "harbour" + cDL_Version_Alter + "-wce-arm" + cLibExt ) } - OTHERWISE - l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + cLibExt,; - "harbour" + cDL_Version_Alter + cLibExt ) } - ENDCASE - + l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + hbmk_DYNSUFFIX( hbmk ) + cLibExt,; + "harbour" + cDL_Version_Alter + hbmk_DYNSUFFIX( hbmk ) + cLibExt ) } l_aLIBSHAREDPOST := { "hbmainstd", "hbmainwin" } CASE ( hbmk[ _HBMK_cPLAT ] == "sunos" .AND. hbmk[ _HBMK_cCOMP ] == "sunpro" ) .OR. ; @@ -9151,7 +9115,7 @@ STATIC FUNCTION MacroProc( hbmk, cString, cFileName, cMacroPrefix ) DO WHILE ( nStart := At( cStart, cString ) ) > 0 .AND. ; ( nEnd := hb_At( _MACRO_CLOSE, cString, nStart + Len( cStart ) ) ) > 0 - cMacro := MacroGet( hbmk, Upper( SubStr( cString, nStart + Len( cStart ), nEnd - nStart - Len( cStart ) ) ), cFileName ) + cMacro := MacroGet( hbmk, SubStr( cString, nStart + Len( cStart ), nEnd - nStart - Len( cStart ) ), cFileName ) cString := Left( cString, nStart - 1 ) + cMacro + SubStr( cString, nEnd + Len( _MACRO_CLOSE ) ) ENDDO @@ -9170,7 +9134,7 @@ STATIC FUNCTION MacroProc( hbmk, cString, cFileName, cMacroPrefix ) STATIC FUNCTION MacroGet( hbmk, cMacro, cFileName ) - SWITCH cMacro + SWITCH Upper( cMacro ) CASE "HB_ROOT" cMacro := DirAddPathSep( hb_DirBase() ) ; EXIT CASE "HB_DIR" @@ -9206,6 +9170,8 @@ STATIC FUNCTION MacroGet( hbmk, cMacro, cFileName ) cMacro := _WORKDIR_BASE_ ; EXIT CASE "HB_WORKDYNSUB" cMacro := hbmk[ _HBMK_cWorkDirDynSub ] ; EXIT + CASE "HB_DYNSUFFIX" + cMacro := hbmk_DYNSUFFIX( hbmk ) ; EXIT CASE "HB_MAJOR" cMacro := hb_ntos( hb_Version( HB_VERSION_MAJOR ) ) ; EXIT CASE "HB_MINOR" @@ -10420,6 +10386,26 @@ STATIC FUNCTION hbmk_CPU( hbmk ) RETURN "" +/* Return standard dynamic lib name suffix used by Harbour */ +STATIC FUNCTION hbmk_DYNSUFFIX( hbmk ) + + SWITCH hbmk[ _HBMK_cPLAT ] + CASE "wce" + RETURN "-wce-" + hbmk[ _HBMK_cCPU ] + CASE "win" + DO CASE + CASE hbmk[ _HBMK_cCOMP ] == "bcc" + RETURN "-bcc" + CASE hbmk[ _HBMK_cCPU ] == "x86_64" + RETURN "-x64" + CASE !( hbmk[ _HBMK_cCPU ] == "x86" ) + RETURN "-" + hbmk[ _HBMK_cCPU ] + ENDCASE + EXIT + ENDSWITCH + + RETURN "" + /* Keep this public, it's used from macro. */ FUNCTION hbmk_KEYW( hbmk, cKeyword, cValue, cOperator ) LOCAL tmp