From 84a89f08fff571bfd8b7965500ed8773df0a3b96 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 20 Feb 2009 18:06:33 +0000 Subject: [PATCH] 2009-02-20 19:03 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * bin/hb-func.sh ! Fixed gtalleg lib name. % Removed explicit harbour -gc0 option. This is now the default. * utils/hbmk2/hbmk2.prg + Added fmstat/nofmstat support. ! Minor fix to allow more freedom in formatting inside .hbp files. ! Fixed to delete prg stub file when using -hbcc option. + Added Copyright section for Przemek for the ideas I've borrowed from hbmk script and contributed code. + Detect platform default GT and only create stub if the user selected GT is different. + Now using versions shared libs on *nixes. + Mode detection now regards the ending or the beginning of the original name, so prefixed or postfixed names will also be recognized: xhbcmp, hbcmpx, myhbcmp. ! Fixed to multiple -gt options override each other so the last one will be effective. ! Fixed error message text when stub cannot be created. Furthermore in this case hbmk will now quit. + Also using '-Wl,--start-group' for bsd (from hbmk script). + Added '-bind_at_load', '-multiply_defined suppress' gcc options for darwin shared mode (from hbmk script). * Changed stub name to hbstub (from hbmkgt). * pthread lib handling streamlined based on hbmk script, but this probably needs further cleaning as the script isn't clear to me here. + Added fmstat/nofmstat switch. It most probably needs some tweaking, as the conditions seem rather sophisticated here. TODO: For non-*nix/non-gcc platforms (msvc/bcc32/owatcom most importantly). + Added system libs for darwin if gtcrs or gtsln are selected. (nslang isn't a default lib here, so it won't work on plain installations, slang however will). + Missed from previous commit: Fix so that -nohbp doesn't prevent processing the global config .hbp file. ! Fixed typo in prev commit. * utils/hbmk2/examples/contrib.hbp - Removed hbtip as it's not fully portable (dos). + utils/hbmk2/examples/contribf.hbp + Added complete database of contrib, with availability information. * contrib/xhb/Makefile * contrib/hbmsql/Makefile * contrib/hbmzip/Makefile * contrib/hbziparc/Makefile * contrib/hbnf/Makefile * contrib/hbmisc/Makefile * contrib/hbvpdf/Makefile * Formatting. --- harbour/ChangeLog | 54 ++++++++ harbour/bin/hb-func.sh | 4 +- harbour/contrib/hbmisc/Makefile | 4 +- harbour/contrib/hbmsql/Makefile | 4 +- harbour/contrib/hbmzip/Makefile | 4 +- harbour/contrib/hbnf/Makefile | 4 +- harbour/contrib/hbvpdf/Makefile | 4 +- harbour/contrib/hbziparc/Makefile | 4 +- harbour/contrib/xhb/Makefile | 4 +- harbour/utils/hbmk2/examples/contrib.hbp | 2 +- harbour/utils/hbmk2/examples/contribf.hbp | 23 ++++ harbour/utils/hbmk2/hbmk2.prg | 159 ++++++++++++++++------ 12 files changed, 212 insertions(+), 58 deletions(-) create mode 100644 harbour/utils/hbmk2/examples/contribf.hbp diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9e79963a70..fb14611299 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,60 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-20 19:03 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * bin/hb-func.sh + ! Fixed gtalleg lib name. + % Removed explicit harbour -gc0 option. This is now the default. + + * utils/hbmk2/hbmk2.prg + + Added fmstat/nofmstat support. + ! Minor fix to allow more freedom in formatting inside .hbp files. + ! Fixed to delete prg stub file when using -hbcc option. + + Added Copyright section for Przemek for the ideas I've + borrowed from hbmk script and contributed code. + + Detect platform default GT and only create stub if the + user selected GT is different. + + Now using versions shared libs on *nixes. + + Mode detection now regards the ending or the beginning + of the original name, so prefixed or postfixed names will + also be recognized: xhbcmp, hbcmpx, myhbcmp. + ! Fixed to multiple -gt options override each other so the + last one will be effective. + ! Fixed error message text when stub cannot be created. + Furthermore in this case hbmk will now quit. + + Also using '-Wl,--start-group' for bsd (from hbmk script). + + Added '-bind_at_load', '-multiply_defined suppress' gcc + options for darwin shared mode (from hbmk script). + * Changed stub name to hbstub (from hbmkgt). + * pthread lib handling streamlined based on hbmk script, + but this probably needs further cleaning as the script + isn't clear to me here. + + Added fmstat/nofmstat switch. It most probably needs some + tweaking, as the conditions seem rather sophisticated here. + TODO: For non-*nix/non-gcc platforms (msvc/bcc32/owatcom + most importantly). + + Added system libs for darwin if gtcrs or gtsln are selected. + (nslang isn't a default lib here, so it won't work on plain + installations, slang however will). + + Missed from previous commit: Fix so that -nohbp doesn't + prevent processing the global config .hbp file. + ! Fixed typo in prev commit. + + * utils/hbmk2/examples/contrib.hbp + - Removed hbtip as it's not fully portable (dos). + + utils/hbmk2/examples/contribf.hbp + + Added complete database of contrib, with + availability information. + + * contrib/xhb/Makefile + * contrib/hbmsql/Makefile + * contrib/hbmzip/Makefile + * contrib/hbziparc/Makefile + * contrib/hbnf/Makefile + * contrib/hbmisc/Makefile + * contrib/hbvpdf/Makefile + * Formatting. + 2009-02-20 18:36 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/gtxwc/gtxwc.c * harbour/source/rtl/gttrm/gttrm.c diff --git a/harbour/bin/hb-func.sh b/harbour/bin/hb-func.sh index 6e205f1e93..6625024983 100755 --- a/harbour/bin/hb-func.sh +++ b/harbour/bin/hb-func.sh @@ -99,7 +99,7 @@ mk_hbgetlibsctb() then libs="$libs gtwin" fi - echo "$libs hbct hbnf hbmzip hbcrypt hbtip xhb hbgd hbfimage rddsql sddfb sddmy sddpg hbodbc hbpgsql hbmysql hbfbird rddads rddado hbhpdf hbvpdf hbcurl hbwin gtwvg hbgtalleg hbsqlit3 hbbtree $HB_USER_LIBS" + echo "$libs hbct hbnf hbmzip hbcrypt hbtip xhb hbgd hbfimage rddsql sddfb sddmy sddpg hbodbc hbpgsql hbmysql hbfbird rddads rddado hbhpdf hbvpdf hbcurl hbwin gtwvg gtalleg hbsqlit3 hbbtree $HB_USER_LIBS" #"hbgf hbgt hbbmcdx hbmisc hbole hbtpathy hbwhat hbziparc hbmsql" else echo "$@" @@ -422,8 +422,6 @@ HB_MAIN_FUNC=\`echo \${HB_MAIN_FUNC}|tr '[a-z]' '[A-Z]'\` HB_PATHS="-I\${HB_INC_INSTALL}" GCC_PATHS="\${HB_PATHS} -L\${HB_LIB_INSTALL}" -[ "\${HB_GEN}" != "" ] || HB_OPT="\${HB_OPT} -gc0" - HB_GPM_LIB="" if [ -f "\${HB_LIB_INSTALL}/libgtsln.a" ]; then if [ "\${HB_ARCHITECTURE}" = "darwin" ]; then diff --git a/harbour/contrib/hbmisc/Makefile b/harbour/contrib/hbmisc/Makefile index 995d77010e..be2e4767c3 100644 --- a/harbour/contrib/hbmisc/Makefile +++ b/harbour/contrib/hbmisc/Makefile @@ -4,6 +4,8 @@ ROOT = ../../ +LIBNAME=hbmisc + C_SOURCES=\ dates2.c \ hb_f.c \ @@ -19,6 +21,4 @@ PRG_SOURCES=\ stringp.prg \ twirler.prg \ -LIBNAME=hbmisc - include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/contrib/hbmsql/Makefile b/harbour/contrib/hbmsql/Makefile index dec39fdb27..5b228757ac 100644 --- a/harbour/contrib/hbmsql/Makefile +++ b/harbour/contrib/hbmsql/Makefile @@ -4,6 +4,8 @@ ROOT = ../../ +LIBNAME=hbmsql + C_SOURCES=\ msql.c \ @@ -13,8 +15,6 @@ PRG_SOURCES=\ PRG_HEADERS=\ msql.ch \ -LIBNAME=hbmsql - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/contrib/hbmzip/Makefile b/harbour/contrib/hbmzip/Makefile index 5525da4754..550ec34435 100644 --- a/harbour/contrib/hbmzip/Makefile +++ b/harbour/contrib/hbmzip/Makefile @@ -4,6 +4,8 @@ ROOT = ../../ +LIBNAME=hbmzip + C_SOURCES =\ ioapi.c \ zip.c \ @@ -13,8 +15,6 @@ C_SOURCES =\ PRG_HEADERS=\ hbmzip.ch -LIBNAME=hbmzip - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/contrib/hbnf/Makefile b/harbour/contrib/hbnf/Makefile index eafd3705bb..df1db84f50 100644 --- a/harbour/contrib/hbnf/Makefile +++ b/harbour/contrib/hbnf/Makefile @@ -4,6 +4,8 @@ ROOT = ../../ +LIBNAME=hbnf + C_SOURCES =\ alt.c \ caplock.c \ @@ -150,8 +152,6 @@ BAD_PRG_SOURCES=\ PRG_HEADERS=\ ftmenuto.ch \ -LIBNAME=hbnf - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/contrib/hbvpdf/Makefile b/harbour/contrib/hbvpdf/Makefile index c0eb072af1..7a13b1958f 100644 --- a/harbour/contrib/hbvpdf/Makefile +++ b/harbour/contrib/hbvpdf/Makefile @@ -4,6 +4,8 @@ ROOT = ../../ +LIBNAME=hbvpdf + PRG_SOURCES=\ hbvpdf.prg \ hbvpdft.prg \ @@ -12,8 +14,6 @@ PRG_SOURCES=\ PRG_HEADERS=\ hbvpdf.ch \ -LIBNAME=hbvpdf - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/contrib/hbziparc/Makefile b/harbour/contrib/hbziparc/Makefile index 5e98943633..0c94e78a4c 100644 --- a/harbour/contrib/hbziparc/Makefile +++ b/harbour/contrib/hbziparc/Makefile @@ -4,9 +4,9 @@ ROOT = ../../ +LIBNAME=hbziparc + PRG_SOURCES= \ hbziparc.prg \ -LIBNAME=hbziparc - include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/contrib/xhb/Makefile b/harbour/contrib/xhb/Makefile index 71ec94a614..b4fc363aef 100644 --- a/harbour/contrib/xhb/Makefile +++ b/harbour/contrib/xhb/Makefile @@ -4,6 +4,8 @@ ROOT = ../../ +LIBNAME=xhb + C_SOURCES=\ filestat.c \ freadlin.c \ @@ -43,8 +45,6 @@ PRG_HEADERS=\ hbcompat.ch \ xhb.ch \ -LIBNAME=xhb - include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/utils/hbmk2/examples/contrib.hbp b/harbour/utils/hbmk2/examples/contrib.hbp index c9db651222..8e4bdff609 100644 --- a/harbour/utils/hbmk2/examples/contrib.hbp +++ b/harbour/utils/hbmk2/examples/contrib.hbp @@ -7,4 +7,4 @@ # Thank you. [vszakats] # Some popular and portable Harbour contribs -libs=hbct hbmzip hbtip hbcrypt +libs=hbct hbmzip hbcrypt diff --git a/harbour/utils/hbmk2/examples/contribf.hbp b/harbour/utils/hbmk2/examples/contribf.hbp new file mode 100644 index 0000000000..9f924c155a --- /dev/null +++ b/harbour/utils/hbmk2/examples/contribf.hbp @@ -0,0 +1,23 @@ +# +# $Id$ +# + +# Full listing of Harbour contrib libs with availability. +# [ This should be kept in sync with local Makefile information. ] + +# contribs portable, with no external dependencies: +libs=hbbmcdx hbbtree hbclipsm hbcrypt hbct hbgt hbmisc hbmzip hbnf hbvpdf hbziparc rddsql xhb + +# contribs portable, with external dependencies: +libs=hbcurl hbfbird hbgd hbmsql hbmysql hbpgsql sddfb sddmy sddpg + +# contribs with limited availability (some with external dependencies): +{!pocc&!xcc&!dmc&!owatcom} libs=gtalleg +{!dos} libs=hbapollo hbfimage hbhpdf hbssl hbtip rddads +{linux|win|os2} libs=hbtpathy +{win} libs=gtwvg hbblat hbgfwin hbole hbwin rddado +{win&!dmc} libs=hbwhat +{linux} libs=hbgfgtk +{os2} libs=hbgfos2 +{!rsxnt} libs=hbodbc +{!dos&!bsd&!hpux&!pocc} libs=hbsqlit3 diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 15dc994528..14fccf9260 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -50,6 +50,18 @@ * */ +/* + * The following parts are Copyright of the individual authors. + * www - http://www.harbour-project.org + * + * Copyright 2003 Przemyslaw Czerpak + * gcc and *nix configuration elements. + * bash script with similar purpose for gcc family. + * + * See doc/license.txt for licensing terms. + * + */ + #include "common.ch" #include "directry.ch" #include "fileio.ch" @@ -61,8 +73,6 @@ /* TODO: Add support for Windows resource files. */ /* TODO: Add support for library creation. */ /* TODO: Add support for gtsln and gtcrs. */ -/* TODO: Add support for fmstat and nofmstat. Possibly we need something - cleaner than in hbmk (script). */ /* TODO: msvc/bcc32: Use separate link phase. This allows incremental links. */ /* TODO: Support for more compilers/platforms. */ /* TODO: Cleanup on variable names. */ @@ -134,7 +144,7 @@ FUNCTION Main( ... ) "rddfpt" } LOCAL s_cGT - LOCAL s_cGTPRG + LOCAL s_cPRGSTUB LOCAL s_cHB_INSTALL_PREFIX LOCAL s_cHB_BIN_INSTALL @@ -180,9 +190,11 @@ FUNCTION Main( ... ) LOCAL s_lBLDFLGC := .F. LOCAL s_lBLDFLGL := .F. LOCAL s_lRUN := .F. + LOCAL s_lFMSTAT := NIL /* NIL = default, .T. = on, .F. = off */ LOCAL aCOMPDET LOCAL aCOMPSUP + LOCAL cGTDEFAULT LOCAL cLibPrefix LOCAL cLibExt @@ -217,7 +229,11 @@ FUNCTION Main( ... ) LOCAL cSelfFlagC := hb_Version( HB_VERSION_FLAG_C ) LOCAL cSelfFlagL := hb_Version( HB_VERSION_FLAG_LINKER ) - LOCAL cDL_Version := hb_ntos( hb_Version( HB_VERSION_MAJOR ) ) + hb_ntos( hb_Version( HB_VERSION_MINOR ) ) + LOCAL cDL_Version_NonGNU := hb_ntos( hb_Version( HB_VERSION_MAJOR ) ) +; + hb_ntos( hb_Version( HB_VERSION_MINOR ) ) + LOCAL cDL_Version := hb_ntos( hb_Version( HB_VERSION_MAJOR ) ) + "." +; + hb_ntos( hb_Version( HB_VERSION_MINOR ) ) + "." +; + hb_ntos( hb_Version( HB_VERSION_RELEASE ) ) IF PCount() == 0 ShowHeader() @@ -246,26 +262,27 @@ FUNCTION Main( ... ) ENDCASE NEXT - SWITCH Lower( FN_NameGet( hb_argv( 0 ) ) ) - CASE "hbcc" + tmp := Lower( FN_NameGet( hb_argv( 0 ) ) ) + DO CASE + CASE Right( tmp, 4 ) == "hbcc" .OR. ; + Left( tmp, 4 ) == "hbcc" t_lQuiet := .T. ; t_lInfo := .F. ; lStopAfterHarbour := .T. IF t_lInfo OutStd( "hbmk: Enabled -hbcc option." + hb_osNewLine() ) ENDIF - EXIT - CASE "hbcmp" + CASE Right( tmp, 5 ) == "hbcmp" .OR. ; + Left( tmp, 5 ) == "hbcmp" t_lQuiet := .T. ; t_lInfo := .F. ; lStopAfterHarbour := .F. ; lStopAfterCComp := .T. IF t_lInfo OutStd( "hbmk: Enabled -hbcmp option." + hb_osNewLine() ) ENDIF - EXIT - CASE "hblnk" + CASE Right( tmp, 5 ) == "hblnk" .OR. ; + Left( tmp, 5 ) == "hblnk" t_lQuiet := .T. ; t_lInfo := .F. IF t_lInfo OutStd( "hbmk: Enabled -hblnk option." + hb_osNewLine() ) ENDIF - EXIT - ENDSWITCH + ENDCASE IF ! t_lQuiet ShowHeader() @@ -331,16 +348,19 @@ FUNCTION Main( ... ) aCOMPSUP := { "gcc" } cBin_CompPRG := "harbour" s_aLIBHBGT := { "gttrm", "gtxwc" } + cGTDEFAULT := "gttrm" CASE t_cARCH == "linux" aCOMPSUP := { "gcc", "gpp", "owatcom", "mingw", "mingwce" } cBin_CompPRG := "harbour" s_aLIBHBGT := { "gttrm", "gtxwc" } + cGTDEFAULT := "gtstd" CASE t_cARCH == "dos" aCOMPDET := { { {|| FindInPath( "gcc" ) != NIL }, "djgpp" },; { {|| FindInPath( "wpp386" ) != NIL }, "owatcom" } } /* TODO: Add full support for wcc386 */ aCOMPSUP := { "djgpp", "gcc", "owatcom", "rsx32" } cBin_CompPRG := "harbour.exe" s_aLIBHBGT := { "gtdos" } + cGTDEFAULT := "gtdos" CASE t_cARCH == "os2" aCOMPDET := { { {|| FindInPath( "gcc" ) != NIL }, "gcc" },; { {|| FindInPath( "wpp386" ) != NIL }, "owatcom" },; /* TODO: Add full support for wcc386 */ @@ -348,6 +368,7 @@ FUNCTION Main( ... ) aCOMPSUP := { "gcc", "owatcom", "icc" } cBin_CompPRG := "harbour.exe" s_aLIBHBGT := { "gtos2" } + cGTDEFAULT := "gtos2" CASE t_cARCH == "win" /* Ordering is significant. owatcom also keeps a cl.exe in it's binary dir. */ @@ -363,6 +384,7 @@ FUNCTION Main( ... ) aCOMPSUP := { "gcc", "mingw", "msvc", "bcc32", "owatcom", "pocc", "pocc64", "rsxnt", "xcc", "dmc", "icc" } cBin_CompPRG := "harbour.exe" s_aLIBHBGT := { "gtwin", "gtwvt", "gtgui" } + cGTDEFAULT := "gtwin" OTHERWISE OutErr( "hbmk: Error: HB_ARCHITECTURE value unknown: " + t_cARCH + hb_osNewLine() ) PauseForKey() @@ -558,7 +580,7 @@ FUNCTION Main( ... ) NEXT /* Process automatic control files. */ - HBP_ProcessAll( lNOHBP + HBP_ProcessAll( lNOHBP,; @s_aLIBUSER,; @s_aLIBPATH,; @s_aOPTPRG,; @@ -613,6 +635,9 @@ FUNCTION Main( ... ) CASE Lower( cParam ) == "-map" ; s_lMAP := .T. CASE Lower( cParam ) == "-map-" ; s_lMAP := .F. CASE Lower( cParam ) == "-nomap" ; s_lMAP := .F. + CASE Lower( cParam ) == "-fmstat" ; s_lFMSTAT := .T. + CASE Lower( cParam ) == "-fmstat-" ; s_lFMSTAT := .F. + CASE Lower( cParam ) == "-nofmstat" ; s_lFMSTAT := .F. CASE Lower( cParam ) == "-strip" ; s_lSTRIP := .T. CASE Lower( cParam ) == "-strip-" ; s_lSTRIP := .F. CASE Lower( cParam ) == "-nostrip" ; s_lSTRIP := .F. @@ -622,7 +647,7 @@ FUNCTION Main( ... ) CASE Lower( cParam ) == "-trace" ; s_lTRACE := .T. CASE Lower( cParam ) == "-trace-" ; s_lTRACE := .F. CASE Lower( cParam ) == "-notrace" ; s_lTRACE := .F. - CASE Lower( Left( cParam, 3 ) ) == "-gt" ; DEFAULT s_cGT TO SubStr( cParam, 2 ) + CASE Lower( Left( cParam, 3 ) ) == "-gt" ; s_cGT := SubStr( cParam, 2 ) CASE Left( cParam, 2 ) == "-o" tmp := PathSepToSelf( SubStr( cParam, 3 ) ) @@ -678,16 +703,29 @@ FUNCTION Main( ... ) RETURN 4 ENDIF - IF ! Empty( s_cGT ) - fhnd := hb_FTempCreateEx( @s_cGTPRG, ".", "hbmkgt", ".prg" ) + IF t_cCOMP $ "mingwce|poccce" + cGTDEFAULT := "gtwvt" + ENDIF + + IF ( ! Empty( s_cGT ) .AND. !( s_cGT == cGTDEFAULT ) ) .OR. ; + s_lFMSTAT != NIL + + fhnd := hb_FTempCreateEx( @s_cPRGSTUB, ".", "hbstub", ".prg" ) IF fhnd != F_ERROR - FWrite( fhnd, "ANNOUNCE HB_GTSYS" + hb_osNewLine() +; - "REQUEST HB_GT_" + Upper( SubStr( s_cGT, 3 ) ) + "_DEFAULT" + hb_osNewLine() ) + IF ! Empty( s_cGT ) + FWrite( fhnd, "ANNOUNCE HB_GTSYS" + hb_osNewLine() +; + "REQUEST HB_GT_" + Upper( SubStr( s_cGT, 3 ) ) + "_DEFAULT" + hb_osNewLine() ) + ENDIF + IF s_lFMSTAT != NIL + FWrite( fhnd, "REQUEST " + iif( s_lFMSTAT, "HB_FM_STAT", "HB_FM_NOSTAT" ) + hb_osNewLine() ) + ENDIF FClose( fhnd ) ELSE - OutErr( "hbmk: Warning: C compiler script couldn't be created, continuing in command line." + hb_osNewLine() ) + OutErr( "hbmk: Warning: Stub helper program couldn't be created." + hb_osNewLine() ) + PauseForKey() + RETURN 5 ENDIF - AAdd( s_aPRG, s_cGTPRG ) + AAdd( s_aPRG, s_cPRGSTUB ) ENDIF /* Merge user libs from command line and envvar. Command line has priority. */ @@ -710,13 +748,17 @@ FUNCTION Main( ... ) DO CASE CASE t_cARCH $ "bsd|linux|sunos" - s_aLIBSHARED := { iif( s_lMT, "harbourmt.so", "harbour.so" ) } + s_aLIBSHARED := { iif( s_lMT, "harbourmt." + cDL_Version + ".so",; + "harbour." + cDL_Version + ".so" ) } CASE t_cARCH == "hpux" - s_aLIBSHARED := { iif( s_lMT, "harbourmt.sl", "harbour.sl" ) } + s_aLIBSHARED := { iif( s_lMT, "harbourmt." + cDL_Version + ".sl",; + "harbour." + cDL_Version + ".sl" ) } CASE t_cARCH == "darwin" - s_aLIBSHARED := { iif( s_lMT, "harbourmt.dylib", "harbour.dylib" ) } + s_aLIBSHARED := { iif( s_lMT, "harbourmt." + cDL_Version + ".dylib",; + "harbour." + cDL_Version + ".dylib" ) } CASE t_cARCH $ "os2|win" - s_aLIBSHARED := { iif( s_lMT, "harbourmt", "harbour" ) } + s_aLIBSHARED := { iif( s_lMT, "harbourmt",; + "harbour" ) } OTHERWISE s_aLIBSHARED := NIL ENDCASE @@ -742,18 +784,19 @@ FUNCTION Main( ... ) IF ( tmp := hb_run( cCommand ) ) != 0 OutErr( "hbmk: Error: Running Harbour compiler. " + hb_ntos( tmp ) + ": '" + cCommand + "'" + hb_osNewLine() ) - IF ! Empty( s_cGTPRG ) - FErase( s_cGTPRG ) + IF ! Empty( s_cPRGSTUB ) + FErase( s_cPRGSTUB ) ENDIF PauseForKey() - RETURN 5 + RETURN 6 ENDIF ENDIF - IF ! lStopAfterHarbour - - /* Assemble library list */ - + IF lStopAfterHarbour + IF ! Empty( s_cPRGSTUB ) + FErase( s_cPRGSTUB ) + ENDIF + ELSE /* C compilation/linking */ s_aLIB3RD := {} @@ -777,6 +820,8 @@ FUNCTION Main( ... ) {SCRIPT} save command line to script and pass it to command as @ */ + /* Assemble library list */ + s_aLIBVM := iif( s_lMT, aLIB_BASE_MT, aLIB_BASE_ST ) aLIB_BASE2 := ArrayAJoin( { aLIB_BASE2, s_aLIBHBGT } ) @@ -808,7 +853,8 @@ FUNCTION Main( ... ) cOpt_CompC := "{LC} {LO} {LA} -O3 {FC} -I{DI} {DL}" cLibPathPrefix := "-L" cLibPathSep := " " - IF t_cARCH == "linux" + IF t_cARCH == "linux" .OR. ; + t_cARCH == "bsd" cOpt_CompC += " -Wl,--start-group {LL} -Wl,--end-group" ELSE cOpt_CompC += " {LL}" @@ -821,7 +867,12 @@ FUNCTION Main( ... ) cOpt_CompC += " -Wl,-Map " + s_cMAPNAME ENDIF IF t_cARCH == "darwin" - AAdd( s_aOPTC, "-no-cpp-precomp -Wno-long-double" ) + AAdd( s_aOPTC, "-no-cpp-precomp" ) + AAdd( s_aOPTC, "-Wno-long-double" ) + IF s_lSHARED + AAdd( s_aOPTC, "-bind_at_load" ) + AAdd( s_aOPTC, "-multiply_defined suppress" ) + ENDIF ENDIF IF s_lSTRIP .AND. !( t_cARCH == "sunos" ) AAdd( s_aOPTC, "-s" ) @@ -872,13 +923,18 @@ FUNCTION Main( ... ) /* Add system libraries */ AAdd( s_aLIBSYS, "m" ) + IF s_lMT + AAdd( s_aLIBSYS, "pthread" ) + ENDIF DO CASE CASE t_cARCH == "linux" AAdd( s_aLIBSYS, "dl" ) AAdd( s_aLIBSYS, "rt" ) +#if 0 IF ! s_lSHARED .AND. s_lSTATICFULL AAdd( s_aLIBSYS, "pthread" ) ENDIF +#endif CASE t_cARCH == "sunos" AAdd( s_aLIBSYS, "rt" ) AAdd( s_aLIBSYS, "socket" ) @@ -886,8 +942,19 @@ FUNCTION Main( ... ) AAdd( s_aLIBSYS, "resolv" ) CASE t_cARCH == "hpux" AAdd( s_aLIBSYS, "rt" ) + CASE t_cARCH == "darwin" + DO CASE + CASE s_cGT == "gtcrs" + AAdd( s_aLIBSYS, "ncurses" ) + CASE s_cGT == "gtsln" + AAdd( s_aLIBSYS, "slang" ) + ENDCASE ENDCASE + IF s_lFMSTAT != NIL .AND. s_lFMSTAT + AAdd( iif( s_lSHARED, s_aLIBSHARED, s_aLIBUSER ), iif( s_lMT, "hbfmmt", "hbfm" ) ) + ENDIF + CASE ( t_cARCH == "win" .AND. t_cCOMP == "gcc" ) .OR. ; ( t_cARCH == "win" .AND. t_cCOMP == "mingw" ) .OR. ; ( t_cARCH == "win" .AND. t_cCOMP == "rsxnt" ) @@ -934,6 +1001,10 @@ FUNCTION Main( ... ) s_aLIBSYS := ArrayJoin( s_aLIBSYS, { "user32", "winspool", "gdi32", "comctl32", "comdlg32", "ole32", "oleaut32", "uuid", "wsock32", "ws2_32" } ) s_aLIBSHARED := { iif( s_lMT, "harbourmt", "harbour" ) } + IF s_lFMSTAT != NIL .AND. s_lFMSTAT + AAdd( iif( s_lSHARED, s_aLIBSHARED, s_aLIBUSER ), iif( s_lMT, "hbfmmt", "hbfm" ) ) + ENDIF + CASE ( t_cARCH == "dos" .AND. t_cCOMP == "djgpp" ) .OR. ; ( t_cARCH == "dos" .AND. t_cCOMP == "rsx32" ) @@ -1115,7 +1186,11 @@ FUNCTION Main( ... ) ENDIF /* TOFIX: The two build systems should generate the same .dll name, otherwise we can only be compatible with one of them. non-GNU is the common choice here. */ - s_aLIBSHARED := { iif( s_lMT, "harbourmt-" + cDL_Version + "-b32", "harbour-" + cDL_Version + "-b32" ), "hbmainstd", "hbmainwin", "hbcommon" } + s_aLIBSHARED := { iif( s_lMT, "harbourmt-" + cDL_Version_NonGNU + "-b32",; + "harbour-" + cDL_Version_NonGNU + "-b32" ),; + "hbmainstd",; + "hbmainwin",; + "hbcommon" } CASE t_cARCH == "win" .AND. t_cCOMP == "msvc" IF s_lDEBUG @@ -1153,7 +1228,11 @@ FUNCTION Main( ... ) s_aLIBSYS := ArrayJoin( s_aLIBSYS, { "user32", "wsock32", "advapi32", "gdi32" } ) /* TOFIX: The two build systems should generate the same .dll name, otherwise we can only be compatible with one of them. non-GNU is the common choice here. */ - s_aLIBSHARED := { iif( s_lMT, "harbourmt-" + cDL_Version + "-vc", "harbour-" + cDL_Version + "-vc" ), "hbmainstd", "hbmainwin", "hbcommon" } + s_aLIBSHARED := { iif( s_lMT, "harbourmt-" + cDL_Version_NonGNU + "-vc",; + "harbour-" + cDL_Version_NonGNU + "-vc" ),; + "hbmainstd",; + "hbmainwin",; + "hbcommon" } CASE t_cARCH == "win" .AND. t_cCOMP == "pocc" IF s_lGUI @@ -1343,8 +1422,8 @@ FUNCTION Main( ... ) /* Cleanup */ - IF ! Empty( s_cGTPRG ) - FErase( s_cGTPRG ) + IF ! Empty( s_cPRGSTUB ) + FErase( s_cPRGSTUB ) ENDIF AEval( ListCook( s_aPRG, NIL, ".c" ), {|tmp| FErase( tmp ) } ) IF ! lStopAfterCComp @@ -1676,7 +1755,7 @@ STATIC PROCEDURE HBP_ProcessOne( cFileName,; FOR EACH cLine IN hb_ATokens( cFile, _EOL ) - cLine := ArchCompFilter( AllTrim( cLine ) ) + cLine := AllTrim( ArchCompFilter( AllTrim( cLine ) ) ) DO CASE CASE Lower( Left( cLine, Len( "libs=" ) ) ) == "libs=" ; cLine := SubStr( cLine, Len( "libs=" ) + 1 ) @@ -1959,8 +2038,6 @@ STATIC PROCEDURE ShowHeader() STATIC PROCEDURE ShowHelp( lLong ) - /* TODO: " -[no]fmstat enable/disable runtime memory statistics" ,; */ - LOCAL aText_Basic := {; "Syntax: hbmk [options] [] " ,; "" ,; @@ -1979,6 +2056,8 @@ STATIC PROCEDURE ShowHelp( lLong ) " -help long help" } LOCAL aText_Long := {; + " -[no]fmstat enable/disable runtime memory statistics" ,; + " (currently available for gcc compilers)" ,; " -nulrdd[-] link with nulrdd" ,; " -bldf[-] inherit all/no (default) flags from Harbour build" ,; " -bldf=[p][c][l] inherit .prg/.c/linker flags (or none) from Harbour build" ,;