From 76ff910361ffc7473b72eb513c1da54c06eed9b5 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 11 Apr 2010 19:40:53 +0000 Subject: [PATCH] 2010-04-11 21:40 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbide/ideprojmanager.prg ! Fixed to not ignore hbmk2 path as set in options or via envvar. ! Fixed to not use -c when calling bash with .sh script as parameter. ! Deleted attempt to detect output filename by parsing link command for -o option. This is not portable method. ! Fixed target filename detection to look for Chr( 10 ) instead of .exe. Detection is now fine, but it still cannot launch it for other reasons. Plus, detection only works when -inc mode is used. ! Deleted hard-coded help text of external tools. * contrib/hbide/idemisc.prg % Changed to not include '#!/bin/sh' in generated .sh file. + DirAddPathSep() renamed to hbide_DirAddPathSep() and made public. * contrib/hbide/hbide.prg - Deleted test code. * contrib/hbblink/blinker.prg ! Reverted previous wrong fix. (-C doesn't work as cmd.exe option) --- harbour/ChangeLog | 21 ++ harbour/contrib/hbblink/blinker.prg | 2 +- harbour/contrib/hbide/hbide.prg | 8 - harbour/contrib/hbide/idemisc.prg | 14 +- harbour/contrib/hbide/ideprojmanager.prg | 313 +---------------------- 5 files changed, 38 insertions(+), 320 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c9a546d071..299e804d88 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,27 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-04-11 21:40 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbide/ideprojmanager.prg + ! Fixed to not ignore hbmk2 path as set in options or via envvar. + ! Fixed to not use -c when calling bash with .sh script as parameter. + ! Deleted attempt to detect output filename by parsing link command for -o + option. This is not portable method. + ! Fixed target filename detection to look for Chr( 10 ) instead of .exe. + Detection is now fine, but it still cannot launch it for other reasons. + Plus, detection only works when -inc mode is used. + ! Deleted hard-coded help text of external tools. + + * contrib/hbide/idemisc.prg + % Changed to not include '#!/bin/sh' in generated .sh file. + + DirAddPathSep() renamed to hbide_DirAddPathSep() and made public. + + * contrib/hbide/hbide.prg + - Deleted test code. + + * contrib/hbblink/blinker.prg + ! Reverted previous wrong fix. (-C doesn't work as cmd.exe option) + 2010-04-11 16:52 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbide/hbide.prg * contrib/hbxbp/xbpwindow.prg diff --git a/harbour/contrib/hbblink/blinker.prg b/harbour/contrib/hbblink/blinker.prg index 6891068568..5ecd047b5b 100644 --- a/harbour/contrib/hbblink/blinker.prg +++ b/harbour/contrib/hbblink/blinker.prg @@ -326,7 +326,7 @@ FUNCTION SWPRUNCMD( cCommand, nMem, cRunPath, cTempPath ) IF ! Empty( cShell ) #if defined( __PLATFORM__WINDOWS ) .OR. defined( __PLATFORM__DOS ) - cCommand := cShell + " -c " + cCommand + cCommand := cShell + " /c " + cCommand #else cCommand := cShell + " " + cCommand #endif diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 370a244566..656cfea9fa 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -93,14 +93,6 @@ STATIC s_pathSep PROCEDURE Main( ... ) LOCAL oIde - /* Testing paths */ - #ifdef __TESTING_PATHS__ -HB_TRACE( HB_TR_ALWAYS, hbmk2_PathMakeRelative( "C:\dev_projects", "C:\dev_sources\vouch\myfile.prg", .f. ) ) -HB_TRACE( HB_TR_ALWAYS, hbmk2_PathMakeRelative( "C:\dev_projects", "C:\dev_sources\vouch\myfile.prg", .t. ) ) -HB_TRACE( HB_TR_ALWAYS, hbmk2_PathMakeRelative( "C:/dev_projects", "C:/dev_sources/vouch/myfile.prg", .t. ) ) -HB_TRACE( HB_TR_ALWAYS, hbmk2_PathMakeRelative( "C:\dev_projects", "C:/dev_sources/vouch/myfile.prg", .t. ) ) - #endif - SET CENTURY ON SET EPOCH TO 1970 diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 03d066cf3f..277ff98422 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -1212,7 +1212,6 @@ FUNCTION hbide_buildLinesLabel( nFrom, nTo, nW, nMax ) FUNCTION hbide_getShellCommandsTempFile( aCmd ) LOCAL cExt - LOCAL cPrefix LOCAL fhnd LOCAL cCmdFileName LOCAL cCmdFile @@ -1220,18 +1219,15 @@ FUNCTION hbide_getShellCommandsTempFile( aCmd ) #if defined( __PLATFORM__WINDOWS ) cExt := ".bat" - cPrefix := "" #elif defined( __PLATFORM__OS2 ) cExt := ".cmd" - cPrefix := "" #elif defined( __PLATFORM__UNIX ) cExt := ".sh" - cPrefix := "#!/bin/sh" + hb_osNewLine() #endif IF ! Empty( cExt ) - cCmdFile := cPrefix + cCmdFile := "" FOR EACH tmp IN aCmd cCmdFile += tmp + hb_osNewLine() NEXT @@ -1471,7 +1467,7 @@ FUNCTION hbmk2_PathMakeRelative( cPathBase, cPathTarget, lForceRelative ) DEFAULT lForceRelative TO .F. - cPathBase := PathProc( DirAddPathSep( cPathBase ), hb_dirBase() ) + cPathBase := PathProc( hbide_DirAddPathSep( cPathBase ), hb_dirBase() ) cPathTarget := PathProc( cPathTarget, hb_dirBase() ) /* TODO: Optimize to operate on strings instead of arrays */ @@ -1553,7 +1549,7 @@ STATIC FUNCTION FN_FromArray( aPath, nFrom, nTo, cFileName, cDirPrefix ) cDir += aPath[ tmp ] + hb_osPathSeparator() NEXT - RETURN hb_FNameMerge( DirDelPathSep( DirAddPathSep( cDirPrefix ) + cDir ), cFileName ) + RETURN hb_FNameMerge( DirDelPathSep( hbide_DirAddPathSep( cDirPrefix ) + cDir ), cFileName ) STATIC FUNCTION PathProc( cPathR, cPathA ) @@ -1579,7 +1575,7 @@ STATIC FUNCTION PathProc( cPathR, cPathA ) RETURN hb_FNameMerge( cDirA + cDirR, cNameR, cExtR ) -STATIC FUNCTION DirAddPathSep( cDir ) +FUNCTION hbide_DirAddPathSep( cDir ) IF ! Empty( cDir ) .AND. !( Right( cDir, 1 ) == hb_osPathSeparator() ) cDir += hb_osPathSeparator() @@ -1910,7 +1906,7 @@ PROCEDURE convert_xhp_to_hbp( cSrcName, cDstName ) EXIT CASE "Final Path" IF ! Empty( cValue ) - AAdd( aDst, "-o" + DirAddPathSep( StrTran( cValue, "%HOME%\" ) ) ) + AAdd( aDst, "-o" + hbide_DirAddPathSep( StrTran( cValue, "%HOME%\" ) ) ) ENDIF EXIT CASE "Include" diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index 4d9e63bbf8..aa6ccc939c 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -259,12 +259,7 @@ CLASS IdeProjManager INHERIT IdeObject METHOD synchronizeAlienProject( cProjFileName ) METHOD outputText( cText ) - METHOD harbourFlags() - METHOD hbmk2Flags() - METHOD xppCompileFlags() - METHOD xppLinkFlags() - - ENDCLASS +ENDCLASS /*----------------------------------------------------------------------*/ @@ -1235,6 +1230,10 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) cExeHbMk2 := "hbmk2" /* Needs that path is already set before calling hbmk2 */ + IF ! Empty( ::oProject:cPathMk2 ) + cExeHbMk2 := hbide_DirAddPathSep( ::oProject:cPathMk2 ) + cExeHbMk2 + ENDIF + cCmdParams := hbide_array2cmdParams( aHbp ) ::oProcess := HbpProcess():new() @@ -1244,7 +1243,7 @@ METHOD IdeProjManager:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) ::oProcess:workingPath := hbide_pathToOSPath( ::oProject:location ) // cCmd := hbide_getShellCommand() - cC := iif( hbide_getOS() == "nix", "-c ", "/C " ) + cC := iif( hbide_getOS() == "nix", "", "/C " ) IF hb_fileExists( ::cBatch ) cBuf := memoread( ::cBatch ) @@ -1284,7 +1283,7 @@ METHOD IdeProjManager:finished( nExitCode, nExitStatus, oProcess ) ::outputText( hbide_outputLine() ) cTmp := "Exit Code [ " + hb_ntos( nExitCode ) + " ] Exit Status [ " + hb_ntos( nExitStatus ) + " ] " +; - "Finished at [ " + time() + " ] Done in [ " + hb_ntos( seconds() - oProcess:started ) +" Secs ]" + "Finished at [ " + time() + " ] Done in [ " + hb_ntos( seconds() - oProcess:started ) +" Secs ]" ::outputText( cTmp ) ::outputText( hbide_outputLine() ) @@ -1296,28 +1295,17 @@ METHOD IdeProjManager:finished( nExitCode, nExitStatus, oProcess ) IF empty( cExe ) cTkn := "hbmk2: Linking... " IF ( n := at( cTkn, cTmp ) ) > 0 - cT := ".exe" // Chr( 13 ) + cT := Chr( 10 ) n1 := hb_at( cT, cTmp, n + len( cTkn ) ) - cExe := substr( cTmp, n + len( cTkn ), n1 - n - len( cTkn ) + len( cT ) ) + cExe := StrTran( substr( cTmp, n + len( cTkn ), n1 - n - len( cTkn ) + len( cT ) ), Chr( 13 ) ) ENDIF ENDIF IF empty( cExe ) cTkn := "hbmk2: Target up to date: " IF ( n := at( cTkn, cTmp ) ) > 0 - cT := ".exe" // Chr( 13 ) + cT := Chr( 10 ) n1 := hb_at( cT, cTmp, n + len( cTkn ) ) - cExe := substr( cTmp, n + len( cTkn ), n1 - n - len( cTkn ) + len( cT ) ) - ENDIF - ENDIF - IF empty( cExe ) - cTkn := "hbmk2: Linker command:" - IF ( n := at( cTkn, cTmp ) ) > 0 - cTmp := alltrim( substr( cTmp, n + len( cTkn ) ) ) - IF ( n := at( "-o", cTmp ) ) > 0 - IF ( n1 := hb_at( " ", cTmp, n ) ) > 0 - cExe := alltrim( substr( cTmp, n + 2, n1 - n - 2 ) ) - ENDIF - ENDIF + cExe := StrTran( substr( cTmp, n + len( cTkn ), n1 - n - len( cTkn ) + len( cT ) ), Chr( 13 ) ) ENDIF ENDIF @@ -1417,282 +1405,3 @@ METHOD IdeProjManager:outputText( cText ) ::oOutputResult:oWidget:append( cText ) RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeProjManager:harbourFlags() - LOCAL a_:= {} - - aadd( a_, { "/a ", "automatic memvar declaration " } ) - aadd( a_, { "/b ", "debug info " } ) - aadd( a_, { "/build ", "display detailed version info " } ) - aadd( a_, { "/credits ", "display credits " } ) - aadd( a_, { "/d[=] ", "#define " } ) - aadd( a_, { "/es[] ", "set exit severity " } ) - aadd( a_, { "/fn[:[l|u]|-] ", "set filename casing (l=lower u=upper) " } ) - aadd( a_, { "/fd[:[l|u]|-] ", "set directory casing (l=lower u=upper) " } ) - aadd( a_, { "/fp[:] ", "set path separator " } ) - aadd( a_, { "/fs[-] ", "turn filename space trimming on or off (default) " } ) - aadd( a_, { "/g ", "output type generated is (see below) " } ) - aadd( a_, { "/gc[] ", "output type: C source (.c) (default) " } ) - aadd( a_, { " ", ": 0=compact (default) 1=normal 2=verbose " } ) - aadd( a_, { " ", " 3=generate real C code " } ) - aadd( a_, { "/gh ", "output type: Harbour Portable Object (.hrb) " } ) - aadd( a_, { "/gd[.]", "generate dependencies list into (.d) file " } ) - aadd( a_, { "/ge[] ", "error output : 0=Clipper (default) " } ) - aadd( a_, { " ", " 1=IDE friendly " } ) - aadd( a_, { "/i ", "#include file search path " } ) - aadd( a_, { "/i[-|+] ", "disable/enable support for INCLUDE envvar " } ) - aadd( a_, { "/j[] ", "generate i18n gettext file (.pot) " } ) - aadd( a_, { "/k ", "compilation mode (type -k? for more data) " } ) - aadd( a_, { "/l ", "suppress line number information " } ) - aadd( a_, { "/m ", "compile module only " } ) - aadd( a_, { "/n[] ", "no implicit starting procedure " } ) - aadd( a_, { " ", ": 0=no implicit starting procedure " } ) - aadd( a_, { " ", " 1=no starting procedure at all " } ) - aadd( a_, { " ", " 2=add starting procedure if necessary " } ) - aadd( a_, { "/o ", "object file drive and/or path " } ) - aadd( a_, { "/p[] ", "generate pre-processed output (.ppo) file " } ) - aadd( a_, { "/p+ ", "generate pre-processor trace (.ppt) file " } ) - aadd( a_, { "/q ", "quiet " } ) - aadd( a_, { "/q0 ", "quiet and don't display program header " } ) - aadd( a_, { "/q2 ", "disable all output messages " } ) - aadd( a_, { "/r: ", "set maximum number of preprocessor iterations " } ) - aadd( a_, { "/s[m] ", "syntax check only [minimal for dependencies list] " } ) - aadd( a_, { "/u[] ", "use command def set in (or none) " } ) - aadd( a_, { "/u+ ", "add command def set from " } ) - aadd( a_, { "/undef: ", "#undef " } ) - aadd( a_, { "/v ", "variables are assumed M-> " } ) - aadd( a_, { "/w[] ", "set warning level number (0..3, default 1) " } ) - aadd( a_, { "/x[] ", "set symbol init function name prefix (for .c only) " } ) - aadd( a_, { "/z ", "suppress shortcutting (.and. & .or.) " } ) - - RETURN a_ - -/*----------------------------------------------------------------------*/ - -METHOD IdeProjManager:hbmk2Flags() - LOCAL a_:= {} - - aadd( a_, { "-o ", "output file name " } ) - aadd( a_, { "-l ", "link with library. should be without " } ) - aadd( a_, { " ", "path, extension and 'lib' prefix (unless part of libname). " } ) - aadd( a_, { "-L ", "additional path to search for libraries " } ) - aadd( a_, { "-i

|-incpath=

", "additional path to search for headers " } ) - aadd( a_, { "-static|-shared ", "link with static/shared libs " } ) - aadd( a_, { "-mt|-st ", "link with multi/single-thread VM " } ) - aadd( a_, { "-gt ", "link with GT GT driver, can be repeated to link with " } ) - aadd( a_, { " ", "more GTs. First one will be the default at runtime " } ) - aadd( a_, { "-hbexe ", "create executable (default) " } ) - aadd( a_, { "-hblib ", "create static library " } ) - aadd( a_, { "-hbdyn ", "create dynamic library " } ) - aadd( a_, { " ", " " } ) - aadd( a_, { "-gui|-std ", "create GUI/console executable " } ) - aadd( a_, { "-main= ", "override the name of starting function/procedure " } ) - aadd( a_, { "-fullstatic ", "link with all static libs " } ) - aadd( a_, { "-[full|fix]shared ", "create shared Harbour binaries without/with absolute dir " } ) - aadd( a_, { " ", "reference to Harbour library (default: 'fullshared' when " } ) - aadd( a_, { " ", "Harbour is installed on system location, 'fixshared' " } ) - aadd( a_, { " ", "otherwise) (fix/full option in *nix only) " } ) - aadd( a_, { "-nulrdd[-] ", "link with nulrdd " } ) - aadd( a_, { "-[no]debug ", "add/exclude C compiler debug info. For Harbour level " } ) - aadd( a_, { " ", "debug, use Harbour option -b as usual " } ) - aadd( a_, { "-[no]optim ", "toggle C compiler optimizations (default: on) " } ) - aadd( a_, { "-[no]cpp[=def] ", "force C/C++ mode or reset to default " } ) - aadd( a_, { "-[no]map ", "create (or not) a map file " } ) - aadd( a_, { "-[no]implib ", "create (or not) an import library (in -hbdyn mode) " } ) - aadd( a_, { "-[no]strip ", "strip (no strip) binaries " } ) - aadd( a_, { "-[no]trace ", "show commands executed " } ) - aadd( a_, { "-[no]beep ", "enable (or disable) single beep on successful exit, double " } ) - aadd( a_, { " ", "beep on failure " } ) - aadd( a_, { "-[no]ignore ", "ignore errors when running compiler tools (default: off) " } ) - aadd( a_, { "-[no]hbcppmm ", "forces to override standard C++ memory management " } ) - aadd( a_, { " ", "functions with Harbour ones " } ) - aadd( a_, { "-nohblib[-] ", "do not use static core Harbour libraries when linking " } ) - aadd( a_, { "-nolibgrouping[-] ", "disable library grouping on gcc based compilers " } ) - aadd( a_, { "-nomiscsyslib[-] ", "don't add extra list of system libraries to default " } ) - aadd( a_, { " ", "library list " } ) - aadd( a_, { "-traceonly ", "show commands to be executed, but don't execute them " } ) - aadd( a_, { "-[no]warn[=lev] ", "set C compiler warning level " } ) - aadd( a_, { " ", " can be: yes, no, def (default: yes) " } ) - aadd( a_, { "-[no]compr[=lev] ", "compress executable/dynamic lib (needs UPX) " } ) - aadd( a_, { " ", " can be: min, max, def " } ) - aadd( a_, { "-[no]run ", "run/don't run output executable " } ) - aadd( a_, { "-vcshead= ", "generate .ch header file with local repository " } ) - aadd( a_, { " ", "information. SVN, CVS, Git, Mercurial, Bazaar and Fossil " } ) - aadd( a_, { " ", "are currently supported. Generated header will define " } ) - aadd( a_, { " ", "macro _HBMK_VCS_TYPE_ with the name of detected VCS and " } ) - aadd( a_, { " ", "_HBMK_VCS_ID_ with the unique ID of local repository " } ) - aadd( a_, { "-tshead= ", "generate .ch header file with timestamp information. " } ) - aadd( a_, { " ", "Generated header will define macros _HBMK_BUILD_DATE_, " } ) - aadd( a_, { " ", "_HBMK_BUILD_TIME_, _HBMK_BUILD_TIMESTAMP_ with the " } ) - aadd( a_, { " ", "date/time of build " } ) - aadd( a_, { "-icon= ", "set as application icon. should be a " } ) - aadd( a_, { " ", "supported format on the target platform (experimental) " } ) - aadd( a_, { "-instpath= ", "copy target to . if is a directory, it should " } ) - aadd( a_, { " ", "end with path separator. can be specified multiple times " } ) - aadd( a_, { "-nohbc ", "do not process .hbc files in current directory " } ) - aadd( a_, { "-stop ", "stop without doing anything " } ) - aadd( a_, { "-echo= ", "echo text on screen " } ) - aadd( a_, { " ", " " } ) - aadd( a_, { "-bldf[-] ", "inherit all/no (default) flags from Harbour build " } ) - aadd( a_, { "-bldf=[p][c][l] ", "inherit .prg/.c/linker flags (or none) from Harbour build " } ) - aadd( a_, { "-inctrypath=

", "additional path to autodetect .c header locations " } ) - aadd( a_, { "-prgflag= ", "pass flag to Harbour " } ) - aadd( a_, { "-cflag= ", "pass flag to C compiler " } ) - aadd( a_, { "-resflag= ", "pass flag to resource compiler (Windows only) " } ) - aadd( a_, { "-ldflag= ", "pass flag to linker (executable) " } ) - aadd( a_, { "-aflag= ", "pass flag to linker (static library) " } ) - aadd( a_, { "-dflag= ", "pass flag to linker (dynamic library) " } ) - aadd( a_, { "-runflag= ", "pass flag to output executable when -run option is used " } ) - aadd( a_, { "-3rd= ", "options/flags reserved for 3rd party tools, always ignored " } ) - aadd( a_, { " ", "by hbmk2 itself " } ) - aadd( a_, { "-jobs= ", "start n compilation threads (multiprocess platforms only) " } ) - aadd( a_, { "-inc ", "enable incremental build mode " } ) - aadd( a_, { "-[no]head[=] ", "control source header parsing (in incremental build mode) " } ) - aadd( a_, { " ", " can be: native (uses compiler to extract " } ) - aadd( a_, { " ", "dependencies), full (uses simple text parser on the whole " } ) - aadd( a_, { " ", "file), partial (default, uses simple text parser on 1st " } ) - aadd( a_, { " ", "16KB chunk of the file), off " } ) - aadd( a_, { "-rebuild ", "rebuild all (in incremental build mode) " } ) - aadd( a_, { "-clean ", "clean (in incremental build mode) " } ) - aadd( a_, { "-workdir=

", "working directory " } ) - aadd( a_, { " ", "(default: .hbmk/plat/comp in incremental mode, OS temp " } ) - aadd( a_, { " ", "directory otherwise) " } ) - aadd( a_, { " ", " " } ) - aadd( a_, { "-hbl[=] ", "output .hbl filename. %{hb_lng} macro is accepted in " } ) - aadd( a_, { " ", "filename " } ) - aadd( a_, { "-lng= ", "list of languages to be replaced in %{hb_lng} macros in " } ) - aadd( a_, { " ", ".pot/.po filenames and output .hbl/.po filenames. Comma " } ) - aadd( a_, { " ", "separared list: " } ) - aadd( a_, { " ", "-lng=en,hu-HU,de " } ) - aadd( a_, { "-po= ", "create/update .po file from source. Merge it with previous " } ) - aadd( a_, { " ", ".po file of the same name " } ) - aadd( a_, { "-[no]minipo ", "don't (or do) add Harbour version number and source file " } ) - aadd( a_, { " ", "reference to .po (default: add them) " } ) - aadd( a_, { "-rebuildpo ", "recreate .po file, thus removing all obsolete entries in " } ) - aadd( a_, { " ", "it " } ) - aadd( a_, { " ", " " } ) -* aadd( a_, { "Options below are ", "vailable on command line only: " } ) - aadd( a_, { " ", " " } ) - aadd( a_, { "-target=