From a2d19fb47d1c6d8ff4ae19917ac5e42d6a34db6e Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 22 Feb 2009 16:53:11 +0000 Subject: [PATCH] 2009-02-22 17:49 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * config/lib.cf * config/bin.cf + Added -n to Harbour flags to bin.cf. + Added -n1 to Harbour flags to lib.cf. ; TOFIX: The former works, the latter doesn't. Could someone please help why is this happening? * utils/hbmk2/hbmk2.prg - Removed -n from default Harbour switches. ; TODO: Add prgflags=-n to all .hbp files. ; TODO: Add -n to all .hbm files. ; TODO: Add .hbp file to dirs where there are .prgs needing -n flag. + bin/hb-mkdll.bat + Added .dll creation for GNU-make. Not yet enabled, only MSVC supported, and by the nature of the wonderful world of Microsoft, whole Harbour needs to be compiled with HB_USER_CFLAGS=-DHB_DYNLIB to make this work. -DHB_DYNLIB has some drawbacks though: export table will be generated for all executables made from these .libs, .exp/.lib will also be generated for all executables. ; TODO: Solve to compile Harbour lib .prgs using -n1 switch. (needed for .dll, and this one has only befenefits for other scenarios) ; TODO: Add hb-mkdll.bat to postinst.bat. ; TODO: Add BCC support, if possible. ; TODO: Rename hb-mkslib.sh to 8.3 name and sync name with the .bat version (not necessarily mkdll, but something short.) * bin/hb-func.sh ! Added system libs for optional components included in the harbour dynlib. I plan to make some more changes here, but this should fix missing system libs with shared option enabled in hbmk2. * contrib/examples/dbu/dbu.hbm * contrib/examples/rl/rl.hbm + Added -n. * utils/hbdoc/Makefile * utils/hbmk2/Makefile * utils/hbtest/Makefile * utils/hbi18n/Makefile * utils/hbrun/Makefile - Removed explicit -gc0 -n override. Should now be set automatically for all binaries. --- harbour/ChangeLog | 52 ++++++++++++ harbour/bin/hb-func.sh | 20 +++-- harbour/bin/hb-mkdll.bat | 118 +++++++++++++++++++++++++++ harbour/config/bin.cf | 2 + harbour/config/lib.cf | 2 + harbour/contrib/examples/dbu/dbu.hbm | 1 + harbour/contrib/examples/rl/rl.hbm | 1 + harbour/utils/hbdoc/Makefile | 4 +- harbour/utils/hbextern/Makefile | 2 +- harbour/utils/hbi18n/Makefile | 3 - harbour/utils/hbmk2/Makefile | 3 - harbour/utils/hbmk2/hbmk2.prg | 3 - harbour/utils/hbrun/Makefile | 2 - harbour/utils/hbtest/Makefile | 4 +- 14 files changed, 193 insertions(+), 24 deletions(-) create mode 100644 harbour/bin/hb-mkdll.bat diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 58207c2afc..87b1e65a1e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,58 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-22 17:49 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * config/lib.cf + * config/bin.cf + + Added -n to Harbour flags to bin.cf. + + Added -n1 to Harbour flags to lib.cf. + ; TOFIX: The former works, the latter doesn't. + Could someone please help why is this + happening? + + * utils/hbmk2/hbmk2.prg + - Removed -n from default Harbour switches. + ; TODO: Add prgflags=-n to all .hbp files. + ; TODO: Add -n to all .hbm files. + ; TODO: Add .hbp file to dirs where there are .prgs + needing -n flag. + + + bin/hb-mkdll.bat + + Added .dll creation for GNU-make. Not yet enabled, + only MSVC supported, and by the nature of the + wonderful world of Microsoft, whole Harbour needs + to be compiled with HB_USER_CFLAGS=-DHB_DYNLIB to + make this work. -DHB_DYNLIB has some drawbacks + though: export table will be generated for all + executables made from these .libs, .exp/.lib will + also be generated for all executables. + ; TODO: Solve to compile Harbour lib .prgs using + -n1 switch. (needed for .dll, and this + one has only befenefits for other scenarios) + ; TODO: Add hb-mkdll.bat to postinst.bat. + ; TODO: Add BCC support, if possible. + ; TODO: Rename hb-mkslib.sh to 8.3 name and sync + name with the .bat version (not necessarily + mkdll, but something short.) + + * bin/hb-func.sh + ! Added system libs for optional components included + in the harbour dynlib. I plan to make some more + changes here, but this should fix missing system + libs with shared option enabled in hbmk2. + + * contrib/examples/dbu/dbu.hbm + * contrib/examples/rl/rl.hbm + + Added -n. + + * utils/hbdoc/Makefile + * utils/hbmk2/Makefile + * utils/hbtest/Makefile + * utils/hbi18n/Makefile + * utils/hbrun/Makefile + - Removed explicit -gc0 -n override. + Should now be set automatically for all binaries. + 2009-02-22 14:59 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/gtxwc/gtxwc.c + added support for HB_GTI_CLOSABLE and HB_GTI_RESIZABLE. diff --git a/harbour/bin/hb-func.sh b/harbour/bin/hb-func.sh index 5db219fd3d..4fc3db6c29 100755 --- a/harbour/bin/hb-func.sh +++ b/harbour/bin/hb-func.sh @@ -237,12 +237,20 @@ mk_hbtools() if [ "${HB_GPM_MOUSE}" = "yes" ]; then echo "libs=gpm">> ${hb_hbmkcfg} fi -# if [ -n "${HB_CRS_LIB}" ]; then -# echo "libs=${HB_CRS_LIB}">> ${hb_hbmkcfg} -# fi -# if [ -n "${HB_SLN_LIB}" ]; then -# echo "libs=${HB_SLN_LIB}">> ${hb_hbmkcfg} -# fi + if [ "${HB_WITHOUT_X11}" != "yes" ]; then + [ -d "/usr/X11R6/lib64" ] && echo "libpaths=/usr/X11R6/lib64>> ${hb_hbmkcfg} + echo "libpaths=/usr/X11R6/lib>> ${hb_hbmkcfg} + echo "libs=X11>> ${hb_hbmkcfg} + echo "inlibshared=gtxvc>> ${hb_hbmkcfg} + fi + if [ "${HB_WITHOUT_GTCRS}" != "yes" ]; then + echo "libs=${HB_CRS_LIB}>> ${hb_hbmkcfg} + echo "inlibshared=gtcrs>> ${hb_hbmkcfg} + fi + if [ "${HB_WITHOUT_GTSLN}" != "yes" ]; then + echo "libs=${HB_SLN_LIB}>> ${hb_hbmkcfg} + echo "inlibshared=gtsln>> ${hb_hbmkcfg} + fi echo "Generating ${hb_tool}... " cat > ${hb_tool} < _hbocore.txt +for %%f in (%HB_DLL_LIBS%) do ( + echo %%f + lib %HB_LIB_INSTALL%\%%f.lib /nologo /list > _hboraw.txt + for /F %%p in (_hboraw.txt) do ( + lib %HB_LIB_INSTALL%\%%f.lib /nologo /extract:%%p + echo %%p>> _hbocore.txt + ) + del _hboraw.txt +) + +md vm +cd vm +set HB_DLL_LIBS=hbvm +rem ; Extract VM objects +echo.> ..\_hbovm.txt +for %%f in (%HB_DLL_LIBS%) do ( + echo %%f + lib %HB_LIB_INSTALL%\%%f.lib /nologo /list > _hboraw.txt + for /F %%p in (_hboraw.txt) do ( + if not "%%p" == "maindll.obj" ( + if not "%%p" == "maindllp.obj" ( + lib %HB_LIB_INSTALL%\%%f.lib /nologo /extract:%%p + echo vm\%%p>> ..\_hbovm.txt + ) + ) + ) + del _hboraw.txt +) +cd .. + +md vmmt +cd vmmt +set HB_DLL_LIBS=hbvmmt +rem ; Extract VM objects +echo.> ..\_hbovmmt.txt +for %%f in (%HB_DLL_LIBS%) do ( + echo %%f + lib %HB_LIB_INSTALL%\%%f.lib /nologo /list > _hboraw.txt + for /F %%p in (_hboraw.txt) do ( + if not "%%p" == "maindll.obj" ( + if not "%%p" == "maindllp.obj" ( + lib %HB_LIB_INSTALL%\%%f.lib /nologo /extract:%%p + echo vmmt\%%p>> ..\_hbovmmt.txt + ) + ) + ) + del _hboraw.txt +) +cd .. + +link /dll /out:%HB_BIN_INSTALL%\harbour-%HB_DLL_VERSION%-vc.dll @_hbocore.txt @_hbovm.txt user32.lib wsock32.lib advapi32.lib gdi32.lib +link /dll /out:%HB_BIN_INSTALL%\harbourmt-%HB_DLL_VERSION%-vc.dll @_hbocore.txt @_hbovmmt.txt user32.lib wsock32.lib advapi32.lib gdi32.lib + +for /F %%o in (_hbovm.txt) do ( + del %%o +) +del _hbovm.txt +rmdir vm + +rem ; Cleanup +for /F %%o in (_hbovmmt.txt) do ( + del %%o +) +del _hbovmmt.txt +rmdir vmmt + +for /F %%o in (_hbocore.txt) do ( + del %%o +) +del _hbocore.txt +cd .. +rmdir _dll + +goto END + +:NOT_MSVC + +if not "%HB_COMPILER%" == "bcc32" goto NOT_BCC32 + +echo bcc32 not yet supported +rem ilink32 -Gn -C -aa -Tpd -Gi -L$(LIB_DIR) $(HB_USER_LDFLAGS) @&&! c0d32.obj $**, $@,, cw32mt$(RTLIBSUFFIX).lib import32.lib + +goto END + +:NOT_BCC32 + +:END diff --git a/harbour/config/bin.cf b/harbour/config/bin.cf index 8280fd1064..5e8c900a7f 100644 --- a/harbour/config/bin.cf +++ b/harbour/config/bin.cf @@ -9,6 +9,8 @@ include $(TOP)$(ROOT)config/global.cf include $(TOP)$(ROOT)config/c.cf include $(TOP)$(ROOT)config/prg.cf +HB_FLAGS := $(HB_FLAGS) -n -gc0 + EXE_NAME= ifneq ($(C_MAIN),) diff --git a/harbour/config/lib.cf b/harbour/config/lib.cf index af1064a4d2..bf1fa3b642 100644 --- a/harbour/config/lib.cf +++ b/harbour/config/lib.cf @@ -14,6 +14,8 @@ include $(TOP)$(ROOT)config/global.cf include $(TOP)$(ROOT)config/c.cf include $(TOP)$(ROOT)config/prg.cf +HB_FLAGS := $(HB_FLAGS) -n1 + LIB_NAME := $(LIB_PREF)$(LIBNAME)$(LIB_EXT) LIB_ARCH := $(LIB_DIR)/$(LIB_NAME) diff --git a/harbour/contrib/examples/dbu/dbu.hbm b/harbour/contrib/examples/dbu/dbu.hbm index fc30b60c30..f51f018d8e 100644 --- a/harbour/contrib/examples/dbu/dbu.hbm +++ b/harbour/contrib/examples/dbu/dbu.hbm @@ -2,6 +2,7 @@ # $Id$ # +-n DBU.PRG DBUCOPY.PRG DBUEDIT.PRG diff --git a/harbour/contrib/examples/rl/rl.hbm b/harbour/contrib/examples/rl/rl.hbm index 8b59b44088..fb4410bd88 100644 --- a/harbour/contrib/examples/rl/rl.hbm +++ b/harbour/contrib/examples/rl/rl.hbm @@ -2,6 +2,7 @@ # $Id$ # +-n RLBACK.PRG RLDIALG.PRG RLFRONT.PRG diff --git a/harbour/utils/hbdoc/Makefile b/harbour/utils/hbdoc/Makefile index 02af24852e..78ea2e670e 100644 --- a/harbour/utils/hbdoc/Makefile +++ b/harbour/utils/hbdoc/Makefile @@ -3,7 +3,7 @@ # ifeq ($(HB_MAIN),) - HB_MAIN = std +HB_MAIN = std endif ROOT = ../../ @@ -36,6 +36,4 @@ LIBS=\ hbmacro \ hbcommon \ -HB_USER_PRGFLAGS += -gc0 - include $(TOP)$(ROOT)config/bin.cf diff --git a/harbour/utils/hbextern/Makefile b/harbour/utils/hbextern/Makefile index 6271c66eec..89c50c3147 100644 --- a/harbour/utils/hbextern/Makefile +++ b/harbour/utils/hbextern/Makefile @@ -3,7 +3,7 @@ # ifeq ($(HB_MAIN),) - HB_MAIN = std +HB_MAIN = std endif ROOT = ../../ diff --git a/harbour/utils/hbi18n/Makefile b/harbour/utils/hbi18n/Makefile index ca8a8a008f..bf0546fcc4 100644 --- a/harbour/utils/hbi18n/Makefile +++ b/harbour/utils/hbi18n/Makefile @@ -25,7 +25,4 @@ LIBS=\ hbmacro \ hbcommon \ - -HB_USER_PRGFLAGS += -gc0 - include $(TOP)$(ROOT)config/bin.cf diff --git a/harbour/utils/hbmk2/Makefile b/harbour/utils/hbmk2/Makefile index 680630bbd6..d2d47e48e3 100644 --- a/harbour/utils/hbmk2/Makefile +++ b/harbour/utils/hbmk2/Makefile @@ -25,7 +25,4 @@ LIBS=\ hbmacro \ hbcommon \ - -HB_USER_PRGFLAGS += -gc0 - include $(TOP)$(ROOT)config/bin.cf diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index e0845ae13f..2aa8701356 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -92,8 +92,6 @@ /* TODO: Support for more compilers/platforms. */ /* TODO: Cross compilation support. */ /* TODO: Cleanup on variable names and compiler configuration. */ -/* TODO: remove -n from default harbour switches? (can be disabled with -n-) - Disable it when using -hbcc, -hbcmp ? */ ANNOUNCE HB_GTSYS REQUEST HB_GT_CGI_DEFAULT @@ -811,7 +809,6 @@ FUNCTION Main( ... ) cCommand := DirAddPathSep( s_cHB_BIN_INSTALL ) +; cBin_CompPRG +; " " + ArrayToList( s_aPRG ) +; - " -n" +; " -i" + s_cHB_INC_INSTALL +; iif( s_lBLDFLGP, " " + cSelfFlagPRG, "" ) +; iif( ! Empty( GetEnv( "HB_USER_PRGFLAGS" ) ), " " + GetEnv( "HB_USER_PRGFLAGS" ), "" ) +; diff --git a/harbour/utils/hbrun/Makefile b/harbour/utils/hbrun/Makefile index b032a41c2c..c8fb23ac20 100644 --- a/harbour/utils/hbrun/Makefile +++ b/harbour/utils/hbrun/Makefile @@ -38,6 +38,4 @@ ifeq ($(findstring -DHB_EXT_ZLIB, $(HB_USER_CFLAGS)),) LIBS += hbzlib endif -HB_USER_PRGFLAGS += -gc0 - include $(TOP)$(ROOT)config/bin.cf diff --git a/harbour/utils/hbtest/Makefile b/harbour/utils/hbtest/Makefile index cbf6821917..2324de2a9a 100644 --- a/harbour/utils/hbtest/Makefile +++ b/harbour/utils/hbtest/Makefile @@ -3,7 +3,7 @@ # ifeq ($(HB_MAIN),) - HB_MAIN = std +HB_MAIN = std endif ROOT = ../../ @@ -40,6 +40,4 @@ LIBS=\ hbpp \ hbcommon \ -HB_USER_PRGFLAGS += -gc0 - include $(TOP)$(ROOT)config/bin.cf