From 589551e057cddb2d11544476e07c5c6d70e63ef6 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 28 Mar 2009 20:19:20 +0000 Subject: [PATCH] 2009-03-28 21:16 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk2/hbmk2.prg + Added autofilling CCPREFIX on Windows platform when -comp=mingw64 or -comp=mingwce is specified. + Added autofilling CCPATH on Windows platform when -comp=mingw64 or -comp=mingwce is specified and corresponding embedded MinGW installations are found in Harbour directory. ; IOW this means that it's now possible to create a unified, self-contained install kit, which is able to easily build x64, WinCE and x86 executables with command below: > hbmk2 test.prg => test.exe for x86 > hbmk2 -comp=mingw64 a.prg => test.exe for x64 > hbmk2 -comp=mingwce a.prg => test.exe for ARM/WinCE Can it be any simpler than that? My sample install .zip is 322MB and it contains Harbour libs for msvc, mingw, mingw64, mingwce, bcc, owatcom and contains all required MinGW files. It will be even easier if we add CPU platform identifiers to Harbour. --- harbour/ChangeLog | 23 ++++++++++++++ harbour/utils/hbmk2/hbmk2.prg | 56 +++++++++++++++++++---------------- 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 62b5de5c11..08a4f3623d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,29 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-03-28 21:16 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * utils/hbmk2/hbmk2.prg + + Added autofilling CCPREFIX on Windows platform when + -comp=mingw64 or -comp=mingwce is specified. + + Added autofilling CCPATH on Windows platform when + -comp=mingw64 or -comp=mingwce is specified and + corresponding embedded MinGW installations are found in + Harbour directory. + + ; IOW this means that it's now possible to create a unified, + self-contained install kit, which is able to easily build + x64, WinCE and x86 executables with command below: + > hbmk2 test.prg => test.exe for x86 + > hbmk2 -comp=mingw64 a.prg => test.exe for x64 + > hbmk2 -comp=mingwce a.prg => test.exe for ARM/WinCE + Can it be any simpler than that? + + My sample install .zip is 322MB and it contains Harbour libs + for msvc, mingw, mingw64, mingwce, bcc, owatcom and contains + all required MinGW files. + It will be even easier if we add CPU platform identifiers + to Harbour. + 2009-03-28 18:09 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * config/dos/owatcom.cf * config/win/owatcom.cf diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 9396604427..598f27de39 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -255,6 +255,7 @@ FUNCTION Main( ... ) LOCAL s_lFMSTAT := NIL /* NIL = default, .T. = on, .F. = off */ LOCAL aCOMPDET + LOCAL aCOMPDET_LOCAL LOCAL aCOMPSUP LOCAL cLibPrefix @@ -289,7 +290,7 @@ FUNCTION Main( ... ) LOCAL cBin_Lib LOCAL cBin_Dyn LOCAL nErrorLevel - LOCAL tmp, array + LOCAL tmp, tmp1, array LOCAL cScriptFile LOCAL fhnd LOCAL lNOHBP @@ -575,6 +576,13 @@ FUNCTION Main( ... ) RETURN 3 ENDIF + IF t_cARCH == "win" + aCOMPDET_LOCAL := {; + { {| cPrefix | tmp1 := PathNormalize( s_cHB_INSTALL_PREFIX ) + "mingw" + hb_osPathSeparator() + "bin", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc.exe" ), tmp1, NIL ) }, "mingw" , "" } ,; + { {| cPrefix | tmp1 := PathNormalize( s_cHB_INSTALL_PREFIX ) + "mingw64" + hb_osPathSeparator() + "bin", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc.exe" ), tmp1, NIL ) }, "mingw64", "x86_64-pc-mingw32-" } ,; + { {| cPrefix | tmp1 := PathNormalize( s_cHB_INSTALL_PREFIX ) + "mingwce" + hb_osPathSeparator() + "bin", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc.exe" ), tmp1, NIL ) }, "mingwce", "arm-wince-mingw32ce-" } } + ENDIF + /* Autodetect compiler */ IF lStopAfterHarbour @@ -590,31 +598,17 @@ FUNCTION Main( ... ) t_cCOMP := NIL ENDIF ELSE - #if defined( __PLATFORM__WINDOWS ) - IF Empty( t_cCCPATH ) - tmp := PathNormalize( s_cHB_INSTALL_PREFIX ) + "mingw" + hb_osPathSeparator() + "bin" - IF hb_FileExists( tmp + hb_osPathSeparator() + "gcc.exe" ) - t_cCOMP := "mingw" - t_cCCPATH := tmp + IF t_cARCH == "win" + /* Autodetect embedded MinGW installation */ + FOR tmp := 1 TO Len( aCOMPDET_LOCAL ) + IF ! Empty( tmp1 := Eval( aCOMPDET_LOCAL[ tmp ][ 1 ], aCOMPDET_LOCAL[ tmp ][ 3 ] ) ) + t_cCOMP := aCOMPDET_LOCAL[ tmp ][ 2 ] + t_cCCPREFIX := aCOMPDET_LOCAL[ tmp ][ 3 ] + t_cCCPATH := tmp1 + EXIT ENDIF - ENDIF - IF Empty( t_cCCPATH ) - tmp := PathNormalize( s_cHB_INSTALL_PREFIX ) + "mingw64" + hb_osPathSeparator() + "bin" - IF hb_FileExists( tmp + hb_osPathSeparator() + "x86_64-pc-mingw32-gcc.exe" ) - t_cCOMP := "mingw64" - t_cCCPATH := tmp - t_cCCPREFIX := "x86_64-pc-mingw32-" - ENDIF - ENDIF - IF Empty( t_cCCPATH ) - tmp := PathNormalize( s_cHB_INSTALL_PREFIX ) + "mingwce" + hb_osPathSeparator() + "bin" - IF hb_FileExists( tmp + hb_osPathSeparator() + "arm-wince-mingw32ce-gcc.exe" ) - t_cCOMP := "mingwce" - t_cCCPATH := tmp - t_cCCPREFIX := "arm-wince-mingw32ce-" - ENDIF - ENDIF - #endif + NEXT + ENDIF IF Empty( t_cCOMP ) .AND. ! Empty( aCOMPDET ) /* Look for this compiler first */ FOR tmp := 1 TO Len( aCOMPDET ) @@ -658,6 +652,18 @@ FUNCTION Main( ... ) PauseForKey() RETURN 2 ENDIF + IF t_cARCH == "win" + /* Detect cross platform CCPREFIX and CCPATH if embedded MinGW installation is detected */ + FOR tmp := 1 TO Len( aCOMPDET_LOCAL ) + IF aCOMPDET_LOCAL[ tmp ][ 2 ] == t_cCOMP + IF ! Empty( tmp1 := Eval( aCOMPDET_LOCAL[ tmp ][ 1 ], aCOMPDET_LOCAL[ tmp ][ 3 ] ) ) + t_cCCPATH := tmp1 + ENDIF + t_cCCPREFIX := aCOMPDET_LOCAL[ tmp ][ 3 ] + EXIT + ENDIF + NEXT + ENDIF ENDIF ENDIF