From f91fac0cd3775df031a308554cdf930f505cb25e Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 29 Oct 2009 07:37:56 +0000 Subject: [PATCH] 2009-10-29 08:36 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg ! Fixes to lib dependency detection code. It should now work on darwin/bsd/hpux/beos gcc/clang/sunpro platforms/compilers but obviously I didn't test them all (only darwin/clang). There was one typo hitting generic branch of lib detection plus lib prefix was not taken into account at all there. Probably on some platforms it would be better to implement target specific lib searching algorithm to mimic actual linker behaviour. Currently, differences are to be expected. - Deleted gccomf from a win/wce only branch in LibExists(). --- harbour/ChangeLog | 13 +++++++++++++ harbour/utils/hbmk2/hbmk2.prg | 17 +++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5dda534e01..ccb6e7aa3b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,19 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-29 08:36 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * utils/hbmk2/hbmk2.prg + ! Fixes to lib dependency detection code. + It should now work on darwin/bsd/hpux/beos gcc/clang/sunpro + platforms/compilers but obviously I didn't test them all + (only darwin/clang). + There was one typo hitting generic branch of lib detection + plus lib prefix was not taken into account at all there. + Probably on some platforms it would be better to implement + target specific lib searching algorithm to mimic actual + linker behaviour. Currently, differences are to be expected. + - Deleted gccomf from a win/wce only branch in LibExists(). + 2009-10-28 19:12 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/hbqt_slots.cpp * contrib/hbqt/hbqt_slots.h diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index c726127bcb..10dc0e677d 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -4119,10 +4119,11 @@ FUNCTION hbmk( aArgs, /* @ */ lPause ) /* We need a way to find and pick libraries according to linker rules. */ IF lTargetUpToDate FOR EACH tmp IN l_aLIBRAW - IF ! Empty( tmp2 := FindLib( hbmk, tmp, hbmk[ _HBMK_aLIBPATH ], cLibExt ) ) + IF ! Empty( tmp2 := FindLib( hbmk, tmp, hbmk[ _HBMK_aLIBPATH ], cLibLibPrefix, cLibLibExt ) ) IF hbmk[ _HBMK_lDEBUGINC ] hbmk_OutStd( hb_StrFormat( "debuginc: EXEDEPLIB %1$s", tmp2 ) ) ENDIF + ? hb_FGetDateTime( tmp2, @tmp1 ), tmp2, tmp1, tTarget, tmp1 > tTarget IF ! hb_FGetDateTime( tmp2, @tmp1 ) .OR. tmp1 > tTarget lTargetUpToDate := .F. EXIT @@ -4968,7 +4969,7 @@ STATIC FUNCTION FindHeader( hbmk, cFileName, cParentDir, aINCTRYPATH ) /* Replicating logic used by compilers. */ -STATIC FUNCTION FindLib( hbmk, cLib, aLIBPATH, cLibExt ) +STATIC FUNCTION FindLib( hbmk, cLib, aLIBPATH, cLibPrefix, cLibExt ) LOCAL cDir LOCAL tmp @@ -4989,7 +4990,7 @@ STATIC FUNCTION FindLib( hbmk, cLib, aLIBPATH, cLibExt ) /* Check in current dir */ IF hbmk[ _HBMK_cCOMP ] $ "msvc|msvc64|msvcarm|bcc|pocc|pocc64|poccarm|watcom" - IF ! Empty( tmp := LibExists( hbmk, "", cLib, cLibExt ) ) + IF ! Empty( tmp := LibExists( hbmk, "", cLib, cLibPrefix, cLibExt ) ) RETURN tmp ENDIF ENDIF @@ -4997,7 +4998,7 @@ STATIC FUNCTION FindLib( hbmk, cLib, aLIBPATH, cLibExt ) /* Check in libpaths */ FOR EACH cDir IN aLIBPATH IF ! Empty( cDir ) - IF ! Empty( tmp := LibExists( hbmk, cDir, cLib, cLibExt ) ) + IF ! Empty( tmp := LibExists( hbmk, cDir, cLib, cLibPrefix, cLibExt ) ) RETURN tmp ENDIF ENDIF @@ -5008,7 +5009,7 @@ STATIC FUNCTION FindLib( hbmk, cLib, aLIBPATH, cLibExt ) IF hbmk[ _HBMK_cCOMP ] $ "msvc|msvc64|msvcarm" FOR EACH cDir IN hb_ATokens( GetEnv( "LIB" ), hb_osPathListSeparator(), .T., .T. ) IF ! Empty( cDir ) - IF ! Empty( tmp := LibExists( hbmk, cDir, cLib, cLibExt ) ) + IF ! Empty( tmp := LibExists( hbmk, cDir, cLib, cLibPrefix, cLibExt ) ) RETURN tmp ENDIF ENDIF @@ -5018,13 +5019,13 @@ STATIC FUNCTION FindLib( hbmk, cLib, aLIBPATH, cLibExt ) RETURN NIL -STATIC FUNCTION LibExists( hbmk, cDir, cLib, cLibExt ) +STATIC FUNCTION LibExists( hbmk, cDir, cLib, cLibPrefix, cLibExt ) LOCAL tmp cDir := DirAddPathSep( PathSepToSelf( cDir ) ) DO CASE - CASE hbmk[ _HBMK_cCOMP ] $ "gcc|mingw|mingw64|mingwarm|cygwin|gccomf" .AND. hbmk[ _HBMK_cPLAT ] $ "win|wce" + CASE hbmk[ _HBMK_cCOMP ] $ "gcc|mingw|mingw64|mingwarm|cygwin" .AND. hbmk[ _HBMK_cPLAT ] $ "win|wce" /* NOTE: ld/gcc option -dll-search-prefix isn't taken into account here, So, 'xxx.dll' format libs won't be found by hbmk. */ DO CASE @@ -5047,7 +5048,7 @@ STATIC FUNCTION LibExists( hbmk, cDir, cLib, cLibExt ) ENDCASE OTHERWISE DO CASE - CASE hb_FileExists( tmp := cDir + FN_ExtSet( cLib, cLibExt ) ) ; RETURN tmp + CASE hb_FileExists( tmp := cDir + cLibPrefix + FN_ExtSet( cLib, cLibExt ) ) ; RETURN tmp ENDCASE ENDCASE