From 90ef2137c060e54a3930357801176a2c62728f73 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 12 May 2010 20:19:12 +0000 Subject: [PATCH] 2010-05-12 22:17 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * INSTALL * Two minor cleanups * config/postinst.prg + Will now honor HB_CONTRIBLIBS and HB_CONTRIB_ADDONS when creating import libraries. IOW it will only create implibs to the contribs actually built. * utils/hbmk2/hbmk2.prg + Added trick when using real xhb toolchain to detect -tW C flag and in this case automatically select the ST C RTL library. (Notice that -tW will only be detected when passed normally via cmdline or script, and not when using legacy HB_BUILD_CFLAGS envvar or inherited compiler flags). --- harbour/ChangeLog | 17 ++++++++++++ harbour/INSTALL | 6 ++--- harbour/config/postinst.prg | 51 ++++++++++++++++++++++++++++++----- harbour/utils/hbmk2/hbmk2.prg | 18 ++++++++++--- 4 files changed, 79 insertions(+), 13 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4ffc559d45..31c9dcadab 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,23 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-05-12 22:17 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * INSTALL + * Two minor cleanups + + * config/postinst.prg + + Will now honor HB_CONTRIBLIBS and HB_CONTRIB_ADDONS + when creating import libraries. IOW it will only create + implibs to the contribs actually built. + + * utils/hbmk2/hbmk2.prg + + Added trick when using real xhb toolchain to detect + -tW C flag and in this case automatically select the ST + C RTL library. (Notice that -tW will only be detected + when passed normally via cmdline or script, and not + when using legacy HB_BUILD_CFLAGS envvar or inherited + compiler flags). + 2010-05-12 18:34 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * config/postinst.prg - Deleted -trace option left there. diff --git a/harbour/INSTALL b/harbour/INSTALL index 99ade38247..9ce9bc4840 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -534,7 +534,7 @@ HARBOUR wce --- mingw - MinGW GNU C x86 - mingwarm - MinGW GNU C ARM (from CEGCC 0.55 and above) + mingwarm - MinGW GNU C ARM (CEGCC 0.55 and above) msvcarm - Microsoft Visual C++ ARM poccarm - Pelles C 5.0 ARM @@ -652,9 +652,9 @@ HARBOUR - HB_UTIL_ADDONS= Build space separated of additional utilities stored in the utils directory. - HB_COMPILER_VER=[] Set C compiler version. This is used with msvc - targets currently. + and mingw/cygwin targets currently. format: - <9><0><0> = [.] + <9><0>[<0>] = [.] Default: filled by compiler autodetection or empty - HB_USER_LIBS=[] Add space separated of libs to link process. Lib names should be without extension and path. diff --git a/harbour/config/postinst.prg b/harbour/config/postinst.prg index a06579357b..4a5a0871cd 100644 --- a/harbour/config/postinst.prg +++ b/harbour/config/postinst.prg @@ -76,14 +76,10 @@ PROCEDURE Main() GetEnv( "HB_BUILD_IMPLIB" ) == "yes" .AND. ; ! Empty( GetEnv( "HB_HOST_BIN_DIR" ) ) - FOR EACH tmp IN Directory( "contrib\*", "D" ) - IF "D" $ tmp[ F_ATTR ] .AND. ; - !( tmp[ F_NAME ] == "." ) .AND. ; - !( tmp[ F_NAME ] == ".." ) .AND. ; - hb_FileExists( "contrib\" + tmp[ F_NAME ] + "\" + tmp[ F_NAME ] + ".hbi" ) - + FOR EACH tmp IN PackageList( "contrib\*", GetEnv( "HB_CONTRIBLIBS" ), GetEnv( "HB_CONTRIB_ADDONS" ) ) + IF hb_FileExists( "contrib\" + tmp + "\" + tmp + ".hbi" ) hb_processRun( GetEnv( "HB_HOST_BIN_DIR" ) + _PS_ + "hbmk2" +; - " @" + "contrib\" + tmp[ F_NAME ] + "\" + tmp[ F_NAME ] + ".hbi " +; + " @" + "contrib\" + tmp + "\" + tmp + ".hbi " +; "-o${HB_LIB_INSTALL}/" ) ENDIF NEXT @@ -169,3 +165,44 @@ PROCEDURE Main() STATIC FUNCTION FN_Escape( cFN ) RETURN Chr( 34 ) + cFN + Chr( 34 ) + +/* NOTE: Must be in sync with contrib/Makefile logic */ +STATIC FUNCTION PackageList( cMask, cBase, cAddOn ) + LOCAL aList := {} + LOCAL aBase + LOCAL tmp + + aBase := iif( Empty( cBase ), {}, hb_ATokens( cBase,, .T. ) ) + + DO CASE + CASE Len( aBase ) == 1 .AND. aBase[ 1 ] == "no" + /* fall through */ + CASE Len( aBase ) > 1 .AND. aBase[ 1 ] == "no" + hb_ADel( aBase, 1, .T. ) + FOR EACH tmp IN Directory( cMask, "D" ) + IF "D" $ tmp[ F_ATTR ] .AND. !( tmp[ F_NAME ] == "." ) .AND. !( tmp[ F_NAME ] == ".." ) .AND. ; + AScan( aBase, {| tmp1 | tmp1 == tmp[ F_NAME ] } ) == 0 + AAdd( aList, tmp[ F_NAME ] ) + ENDIF + NEXT + CASE Len( aBase ) > 0 + aList := hb_ATokens( cBase,, .T. ) + OTHERWISE + FOR EACH tmp IN Directory( cMask, "D" ) + IF "D" $ tmp[ F_ATTR ] .AND. !( tmp[ F_NAME ] == "." ) .AND. !( tmp[ F_NAME ] == ".." ) + AAdd( aList, tmp[ F_NAME ] ) + ENDIF + NEXT + ENDCASE + + IF ! Empty( cAddOn ) + FOR EACH tmp IN hb_ATokens( cAddOn,, .T. ) + IF ! Empty( tmp ) + IF AScan( aList, {| tmp1 | tmp1 == tmp } ) == 0 + AAdd( aList, tmp ) + ENDIF + ENDIF + NEXT + ENDIF + + RETURN aList diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index cbd45c9ae9..ede4153f3f 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -689,6 +689,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) LOCAL cPath_CompC LOCAL nErrorLevel := 0 LOCAL tmp, tmp1, tmp2, tmp3, array + LOCAL cLibBCC_CRTL LOCAL cScriptFile LOCAL fhnd LOCAL cFile @@ -3183,10 +3184,21 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) cOptIncMask := "-I{DI}" cBin_CompC := "bcc32.exe" cBin_CompCPP := cBin_CompC - cOpt_CompC := "-c -q -tWM" + cOpt_CompC := "-c -q" IF hbmk[ _HBMK_lOPTIM ] cOpt_CompC += " -d -6 -O2 -OS -Ov -Oi -Oc" ENDIF + cLibBCC_CRTL := "cw32mt.lib" + IF hbmk[ _HBMK_nHBMODE ] == _HBMODE_XHB + /* Adding weird hack for xhb to make it possible to force ST C mode. */ + IF AScan( hbmk[ _HBMK_aOPTC ], {| tmp | tmp == "-tW" } ) == 0 + AAdd( hbmk[ _HBMK_aOPTC ], "-tWM" ) + ELSE + cLibBCC_CRTL := "cw32.lib" + ENDIF + ELSE + AAdd( hbmk[ _HBMK_aOPTC ], "-tWM" ) + ENDIF SWITCH hbmk[ _HBMK_nWARN ] CASE _WARN_MAX ; AAdd( hbmk[ _HBMK_aOPTC ], "-w -Q" ) ; EXIT CASE _WARN_YES ; AAdd( hbmk[ _HBMK_aOPTC ], "-w -Q -w-sig-" ) ; EXIT @@ -3199,8 +3211,8 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) cResExt := ".res" cBin_Link := "ilink32.exe" cBin_Dyn := cBin_Link - cOpt_Link := '-Gn -Tpe -L{DL} {FL} ' + iif( hbmk[ _HBMK_lGUI ], "c0w32.obj", "c0x32.obj" ) + " {LO}, {OE}, " + iif( hbmk[ _HBMK_lMAP ], "{OM}", "nul" ) + ", {LL} {LB} cw32mt.lib import32.lib,, {LS}{SCRIPT}" - cOpt_Dyn := '-Gn -Tpd -L{DL} {FD} ' + "c0d32.obj" + " {LO}, {OD}, " + iif( hbmk[ _HBMK_lMAP ], "{OM}", "nul" ) + ", {LL} {LB} cw32mt.lib import32.lib,, {LS}{SCRIPT}" + cOpt_Link := '-Gn -Tpe -L{DL} {FL} ' + iif( hbmk[ _HBMK_lGUI ], "c0w32.obj", "c0x32.obj" ) + " {LO}, {OE}, " + iif( hbmk[ _HBMK_lMAP ], "{OM}", "nul" ) + ", {LL} {LB} " + cLibBCC_CRTL + " import32.lib,, {LS}{SCRIPT}" + cOpt_Dyn := '-Gn -Tpd -L{DL} {FD} ' + "c0d32.obj" + " {LO}, {OD}, " + iif( hbmk[ _HBMK_lMAP ], "{OM}", "nul" ) + ", {LL} {LB} " + cLibBCC_CRTL + " import32.lib,, {LS}{SCRIPT}" bBlk_ImpLib := {| cSourceDLL, cTargetLib, cFlags | win_implib_command( hbmk, "implib.exe {FI} {OL} {ID}", nCmd_Esc, cSourceDLL, cTargetLib, cFlags ) } cLibPathPrefix := "" cLibPathSep := ";"