2010-05-06 15:29 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* utils/hbmk2/hbmk2.prg
    + Refining cygwin autodetection by additionally
      looking for gcc.exe next to cygstart.exe.
    + -o option will now accept macros, filters and will inherit
      parent path even in -gh and other Harbour-only modes.
This commit is contained in:
Viktor Szakats
2010-05-06 13:32:14 +00:00
parent 481875eefd
commit d1c80c5c63
2 changed files with 56 additions and 15 deletions

View File

@@ -17,6 +17,13 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-05-06 15:29 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.prg
+ Refining cygwin autodetection by additionally
looking for gcc.exe next to cygstart.exe.
+ -o option will now accept macros, filters and will inherit
parent path even in -gh and other Harbour-only modes.
2010-05-06 08:32 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/common/hbgete.c
! Fixed hb_setenv() to not crash on NULL szName parameter.

View File

@@ -1107,7 +1107,7 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause )
/* Order is significant.
watcom also keeps a cl.exe in its binary dir. */
#if ! defined( __PLATFORM__UNIX )
aCOMPDET := { { {|| FindInPath( "cygstart" ) }, "cygwin" },;
aCOMPDET := { { {|| FindInSamePath( "cygstart", "gcc" ) }, "cygwin" },;
{ {|| FindInPath( "gcc-dw2" ) }, "mingw", "", "-dw2" },; /* tdragon DWARF-2 build */
{ {|| FindInPath( "x86_64-pc-mingw32-gcc" ) }, "mingw64" },; /* Equation Solution build */
{ {|| FindInPath( hbmk[ _HBMK_cCCPREFIX ] + "gcc" + hbmk[ _HBMK_cCCPOSTFIX ] ) }, "mingw" },;
@@ -1843,21 +1843,28 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause )
interact with hbmk. */
#endif
CASE Left( cParam, 2 ) == "-o" .AND. ! lStopAfterHarbour
CASE Left( cParam, 2 ) == "-o"
tmp := MacroProc( hbmk, ArchCompFilter( hbmk, SubStr( cParam, 3 ) ), aParam[ _PAR_cFileName ] )
IF ! Empty( tmp )
tmp := PathProc( PathSepToSelf( tmp ), aParam[ _PAR_cFileName ] )
hb_FNameSplit( tmp, @cDir, @cName, @cExt )
IF ! Empty( cDir ) .AND. Empty( cName ) .AND. Empty( cExt )
/* Only a dir was passed, let's store that and pick a default name later. */
l_cPROGDIR := cDir
ELSEIF ! Empty( tmp )
l_cPROGDIR := NIL
l_cPROGNAME := tmp
ELSE
l_cPROGDIR := NIL
l_cPROGNAME := NIL
IF lStopAfterHarbour
tmp := MacroProc( hbmk, ArchCompFilter( hbmk, SubStr( cParam, 3 ) ), aParam[ _PAR_cFileName ] )
IF ! Empty( tmp )
AAddNotEmpty( hbmk[ _HBMK_aOPTPRG ], "-o" + PathSepToTarget( hbmk, PathNormalize( PathProc( PathSepToSelf( tmp ), aParam[ _PAR_cFileName ] ) ), 2 ) )
ENDIF
ELSE
tmp := MacroProc( hbmk, ArchCompFilter( hbmk, SubStr( cParam, 3 ) ), aParam[ _PAR_cFileName ] )
IF ! Empty( tmp )
tmp := PathProc( PathSepToSelf( tmp ), aParam[ _PAR_cFileName ] )
hb_FNameSplit( tmp, @cDir, @cName, @cExt )
IF ! Empty( cDir ) .AND. Empty( cName ) .AND. Empty( cExt )
/* Only a dir was passed, let's store that and pick a default name later. */
l_cPROGDIR := cDir
ELSEIF ! Empty( tmp )
l_cPROGDIR := NIL
l_cPROGNAME := tmp
ELSE
l_cPROGDIR := NIL
l_cPROGNAME := NIL
ENDIF
ENDIF
ENDIF
@@ -5700,6 +5707,33 @@ STATIC FUNCTION LibExists( hbmk, cDir, cLib, cLibPrefix, cLibExt )
RETURN NIL
STATIC FUNCTION FindInSamePath( cFileName, cFileName2, cPath )
LOCAL cDir, cName, cExt
cFileName := FindInPath( cFileName, cPath )
IF ! Empty( cFileName )
/* Look for the second filename in the same dir the first one was found. */
hb_FNameSplit( cFileName, @cDir )
hb_FNameSplit( cFileName2,, @cName, @cExt )
#if defined( __PLATFORM__WINDOWS ) .OR. ;
defined( __PLATFORM__DOS ) .OR. ;
defined( __PLATFORM__OS2 )
IF Empty( cExt )
cExt := ".exe"
ENDIF
#endif
IF hb_FileExists( cFileName := hb_FNameMerge( cDir, cName, cExt ) )
RETURN cFileName
ENDIF
ENDIF
RETURN NIL
STATIC FUNCTION FindInPath( cFileName, cPath )
LOCAL cDir
LOCAL cName