diff --git a/ChangeLog.txt b/ChangeLog.txt index f05e513724..2a9859f984 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,22 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2017-05-19 17:03 UTC Viktor Szakats (vszakats users.noreply.github.com) + * utils/hbmk2/hbmk2.prg + + add ability to inject extra code/directives to the hbmk2/hbrun source + code at build time. It can be enabled by defining + `_HBMK2_EXTRA_CODE`, when a source file named `hbmk2_extra.prg` will + be included between the header and code section of hbmk2.prg. + + display note when above option is enabled + + add ability to prepend extra code before the shell execution stub via + the `_HBSHELL_EXEC_PRE` macro. It's initialized by an empty string in + a default build. This macro can be redefined at will by + `hbmk2_extra.prg`. + + ; commit backported to 3.2 from the 3.4 fork: + 2017-05-14 19:35 UTC Viktor Szakats (vszakats users.noreply.github.com) + https://github.com/vszakats/harbour-core/commit/1ee9a9c6dcf10a49b2f0973fa8357990b823bca4 + 2017-05-19 16:08 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * config/android/gcc.mk * config/global.mk diff --git a/utils/hbmk2/hbmk2.prg b/utils/hbmk2/hbmk2.prg index 8e41dded5c..a9993f358f 100644 --- a/utils/hbmk2/hbmk2.prg +++ b/utils/hbmk2/hbmk2.prg @@ -628,6 +628,14 @@ EXTERNAL __dbgEntry #define _HBSH_lClipperComp 15 #define _HBSH_MAX_ 15 +#define _HBSHELL_EXEC_PRE "" + +/* Allow to inject custom code at build-time. The goal is to help + adding necessary customizations for certain use-case. */ +#if defined( _HBMK2_EXTRA_CODE ) +#include "hbmk2_extra.prg" +#endif + /* Trick to make it run if compiled without -n/-n1/-n2 (or with -n-) option. (typically as scripts and precompiled scripts) */ @@ -14703,6 +14711,7 @@ STATIC PROCEDURE __hbshell_Exec( cCommand ) } ) cFunc := ; + _HBSHELL_EXEC_PRE + hb_eol() + ; "STATIC FUNCTION __HBDOT()" + hb_eol() + ; "RETURN {||" + hb_eol() + ; " " + cCommand + hb_eol() + ; @@ -15671,6 +15680,11 @@ STATIC PROCEDURE ShowHeader( hbmk ) ENDIF ENDIF +#if defined( _HBMK2_EXTRA_CODE ) + Eval( hbmk[ _HBMK_bOut ], _OUT_EOL ) + Eval( hbmk[ _HBMK_bOut ], "This build contains build-time customizations." + _OUT_EOL ) +#endif + Eval( hbmk[ _HBMK_bOut ], _OUT_EOL ) RETURN