From b872d7b62cc81f1dd236b03676f3308c98cf41a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Tue, 19 Dec 2017 21:42:15 +0100 Subject: [PATCH] 2017-12-19 21:42 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * config/darwin/clang.mk * config/darwin/gcc.mk * config/darwin/global.mk * config/darwin/icc.mk * config/darwin/libs.mk * utils/hbmk2/hbmk2.prg * synced with Viktor's modifications in 3.4 branch: ; 2017-11-11 13:14 UTC Viktor Szakats: * switch to call the C compiler to link dynamic libs on darwin, which is the recommended way to do this, as suggested by Apple. This also aligns the platform better with other *nix platforms. 'libtool' was used before, but that started having intermittent issues around Sierra (mitigated by disabling parallel build), which returned and got worse in High Sierra (with no remedy). The symptom was 'ld: file not found: ' errors with the filename not shown or appearing as garbage, then a 'libtool: internal link edit command failed'. This was reported and will be fixed in a future Xcode release. Ref: Apple Radar 34944562 * config/global.mk * config/rules.mk + added new user build envvar HB_USER_DCFLAGS It allows to set C compiler parameters to compile .c code for dynamic libraries. * src/rtl/hbsocket.c ! fixed fcntl(F_SETFL) 3-rd parameter in hb_socketSetBlockingIO(), By mistake I used long instead of int. it created problem on big endian 64 bit machines. * include/hbgtcore.h * src/rtl/hbgtcore.c + added new C functions for GT programmers: void hb_gt_BaseUnlock( PHB_GT pGT ); void hb_gt_BaseLock( PHB_GT pGT ); void hb_gtSleep( PHB_GT pGT, double dSeconds ); * src/rtl/hbgtcore.c * src/rtl/gtcrs/gtcrs.c * src/rtl/gtdos/gtdos.c * src/rtl/gtgui/gtgui.c * src/rtl/gtos2/gtos2.c * src/rtl/gtpca/gtpca.c * src/rtl/gtsln/gtsln.c * src/rtl/gtstd/gtstd.c * src/rtl/gttrm/gttrm.c * src/rtl/gtwin/gtwin.c * src/rtl/gtwvt/gtwvt.c * src/rtl/gtxwc/gtxwc.c * use new functions to unblock GT when low level TONE() code is executed. It allows other threads to access shared GT driver when one of them executes TONE() * contrib/hbexpat/hbexpat.hbx * regenerated automatically --- ChangeLog.txt | 58 +++++++++++++++++++++++++++++++++++++ config/darwin/clang.mk | 16 +++++----- config/darwin/gcc.mk | 12 ++------ config/darwin/global.mk | 16 ++++++++++ config/darwin/icc.mk | 23 ++------------- config/darwin/libs.mk | 17 +++++++++-- config/global.mk | 3 ++ config/rules.mk | 4 +++ contrib/hbexpat/hbexpat.hbx | 1 + include/hbgtcore.h | 3 ++ src/rtl/gtcrs/gtcrs.c | 4 +-- src/rtl/gtdos/gtdos.c | 2 +- src/rtl/gtgui/gtgui.c | 3 +- src/rtl/gtos2/gtos2.c | 4 +-- src/rtl/gtpca/gtpca.c | 4 +-- src/rtl/gtsln/gtsln.c | 4 +-- src/rtl/gtstd/gtstd.c | 2 +- src/rtl/gttrm/gttrm.c | 6 ++-- src/rtl/gtwin/gtwin.c | 2 ++ src/rtl/gtwvt/gtwvt.c | 2 ++ src/rtl/gtxwc/gtxwc.c | 2 +- src/rtl/hbgtcore.c | 20 +++++++++++-- src/rtl/hbsocket.c | 2 +- utils/hbmk2/hbmk2.prg | 12 +++++--- 24 files changed, 156 insertions(+), 66 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index f9c05398e2..9aa27bb6b5 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,64 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2017-12-19 21:42 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * config/darwin/clang.mk + * config/darwin/gcc.mk + * config/darwin/global.mk + * config/darwin/icc.mk + * config/darwin/libs.mk + * utils/hbmk2/hbmk2.prg + * synced with Viktor's modifications in 3.4 branch: + ; 2017-11-11 13:14 UTC Viktor Szakats: + * switch to call the C compiler to link dynamic libs on darwin, + which is the recommended way to do this, as suggested by Apple. + This also aligns the platform better with other *nix platforms. + 'libtool' was used before, but that started having intermittent + issues around Sierra (mitigated by disabling parallel build), + which returned and got worse in High Sierra (with no remedy). + The symptom was 'ld: file not found: ' errors with the filename + not shown or appearing as garbage, then a 'libtool: internal link + edit command failed'. This was reported and will be fixed in a + future Xcode release. + Ref: Apple Radar 34944562 + + * config/global.mk + * config/rules.mk + + added new user build envvar HB_USER_DCFLAGS + It allows to set C compiler parameters to compile .c code for + dynamic libraries. + + * src/rtl/hbsocket.c + ! fixed fcntl(F_SETFL) 3-rd parameter in hb_socketSetBlockingIO(), + By mistake I used long instead of int. it created problem on big + endian 64 bit machines. + + * include/hbgtcore.h + * src/rtl/hbgtcore.c + + added new C functions for GT programmers: + void hb_gt_BaseUnlock( PHB_GT pGT ); + void hb_gt_BaseLock( PHB_GT pGT ); + void hb_gtSleep( PHB_GT pGT, double dSeconds ); + + * src/rtl/hbgtcore.c + * src/rtl/gtcrs/gtcrs.c + * src/rtl/gtdos/gtdos.c + * src/rtl/gtgui/gtgui.c + * src/rtl/gtos2/gtos2.c + * src/rtl/gtpca/gtpca.c + * src/rtl/gtsln/gtsln.c + * src/rtl/gtstd/gtstd.c + * src/rtl/gttrm/gttrm.c + * src/rtl/gtwin/gtwin.c + * src/rtl/gtwvt/gtwvt.c + * src/rtl/gtxwc/gtxwc.c + * use new functions to unblock GT when low level TONE() code is + executed. It allows other threads to access shared GT driver + when one of them executes TONE() + + * contrib/hbexpat/hbexpat.hbx + * regenerated automatically + 2017-12-15 19:53 UTC+0100 Aleksander Czajczynski (hb fki.pl) * contrib/hbexpat/3rd/expat/expat.hbp ! add missing bits, previous commit failed to include expat_co[nfig].h diff --git a/config/darwin/clang.mk b/config/darwin/clang.mk index c6e0380b2d..327d98ceb4 100644 --- a/config/darwin/clang.mk +++ b/config/darwin/clang.mk @@ -14,6 +14,10 @@ OBJ_EXT := .o LIB_PREF := lib LIB_EXT := .a +ifeq ($(filter $(HB_PLATFORM),darwin win),) + HB_DYN_COPT := -DHB_DYNLIB -fPIC +endif + CC := $(HB_CCACHE) $(HB_CCPREFIX)$(HB_CMP)$(HB_CCSUFFIX) ifneq ($(filter --analyze, $(HB_USER_CFLAGS)),) CC_IN := @@ -53,18 +57,12 @@ LD := $(CC) LD_OUT := -o$(subst x,x, ) LIBPATHS := $(foreach dir,$(LIB_DIR) $(SYSLIBPATHS),-L$(dir)) -LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib)) +LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib)) LDFLAGS += $(LIBPATHS) -AR := libtool -AR_RULE = ( $(AR) -static -no_warning_for_no_symbols $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) -o $(LIB_DIR)/$@ $(^F) $(ARSTRIP) ) || ( $(RM) $(LIB_DIR)/$@ && $(FALSE) ) - -DY := $(AR) -DFLAGS += -dynamic -flat_namespace -undefined warning -multiply_defined suppress -single_module $(LIBPATHS) -DY_OUT := -o$(subst x,x, ) +DY := $(CC) DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib)) - -DY_RULE = $(DY) $(DFLAGS) -install_name "$(DYN_NAME_NVR)" -compatibility_version $(HB_VER_MAJOR).$(HB_VER_MINOR) -current_version $(HB_VER_MAJOR).$(HB_VER_MINOR).$(HB_VER_RELEASE) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) && $(LN) $(@F) $(DYN_FILE_NVR) && $(LN) $(@F) $(DYN_FILE_CPT) +DFLAGS += $(LIBPATHS) include $(TOP)$(ROOT)config/rules.mk diff --git a/config/darwin/gcc.mk b/config/darwin/gcc.mk index dd71eaad6c..d4f5bd1495 100644 --- a/config/darwin/gcc.mk +++ b/config/darwin/gcc.mk @@ -49,18 +49,12 @@ LD := $(CC) LD_OUT := -o$(subst x,x, ) LIBPATHS := $(foreach dir,$(LIB_DIR) $(SYSLIBPATHS),-L$(dir)) -LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib)) +LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib)) LDFLAGS += $(LIBPATHS) -AR := libtool -AR_RULE = ( $(AR) -static -no_warning_for_no_symbols $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) -o $(LIB_DIR)/$@ $(^F) $(ARSTRIP) ) || ( $(RM) $(LIB_DIR)/$@ && $(FALSE) ) - -DY := $(AR) -DFLAGS += -dynamic -flat_namespace -undefined warning -multiply_defined suppress -single_module $(LIBPATHS) -DY_OUT := -o$(subst x,x, ) +DY := $(CC) DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib)) - -DY_RULE = $(DY) $(DFLAGS) -install_name "$(DYN_NAME_NVR)" -compatibility_version $(HB_VER_MAJOR).$(HB_VER_MINOR) -current_version $(HB_VER_MAJOR).$(HB_VER_MINOR).$(HB_VER_RELEASE) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) && $(LN) $(@F) $(DYN_FILE_NVR) && $(LN) $(@F) $(DYN_FILE_CPT) +DFLAGS += $(LIBPATHS) include $(TOP)$(ROOT)config/rules.mk diff --git a/config/darwin/global.mk b/config/darwin/global.mk index c2d0dafa34..f17b8b30c9 100644 --- a/config/darwin/global.mk +++ b/config/darwin/global.mk @@ -13,3 +13,19 @@ ifneq ($(filter $(HB_BUILD_STRIP),all bin),) LDSTRIP = && strip $(BIN_DIR)/$@ DYSTRIP = && strip -S $(DYN_DIR)/$@ endif + +AR := libtool +AR_RULE = ( $(AR) -static \ + -no_warning_for_no_symbols $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) \ + -o $(LIB_DIR)/$@ $(^F) $(ARSTRIP) ) \ + || ( $(RM) $(LIB_DIR)/$@ && $(FALSE) ) + +DY_OUT := -o$(subst x,x, ) + +DY_RULE = $(DY) -dynamiclib -flat_namespace $(DFLAGS) \ + -install_name "$(DYN_NAME_NVR)" \ + -compatibility_version $(HB_VER_MAJOR).$(HB_VER_MINOR) \ + -current_version $(HB_VER_MAJOR).$(HB_VER_MINOR).$(HB_VER_RELEASE) \ + $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) \ + && $(LN) $(@F) $(DYN_FILE_NVR) \ + && $(LN) $(@F) $(DYN_FILE_CPT) diff --git a/config/darwin/icc.mk b/config/darwin/icc.mk index 04145f2e22..f6fd50949d 100644 --- a/config/darwin/icc.mk +++ b/config/darwin/icc.mk @@ -32,29 +32,12 @@ LD := $(CC) LD_OUT := -o LIBPATHS := $(foreach dir,$(LIB_DIR) $(SYSLIBPATHS),-L$(dir)) -LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib)) +LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib)) LDFLAGS += $(LIBPATHS) -AR := libtool -AR_RULE = ( $(AR) -static -no_warning_for_no_symbols $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) -o $(LIB_DIR)/$@ $(^F) $(ARSTRIP) ) || ( $(RM) $(LIB_DIR)/$@ && $(FALSE) ) - -DY := $(AR) -DFLAGS += -dynamic -flat_namespace -undefined warning -multiply_defined suppress -single_module $(LIBPATHS) -DY_OUT := -o$(subst x,x, ) +DY := $(CC) DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib)) - -# NOTE: The empty line directly before 'endef' HAS TO exist! -define dynlib_object - @$(ECHO) $(ECHOQUOTE)$(subst \,/,$(file))$(ECHOQUOTE) >> __dyn__.tmp - -endef -define create_dynlib - $(if $(wildcard __dyn__.tmp),@$(RM) __dyn__.tmp,) - $(foreach file,$^,$(dynlib_object)) - $(DY) $(DFLAGS) -install_name "$(DYN_NAME_NVR)" -compatibility_version $(HB_VER_MAJOR).$(HB_VER_MINOR) -current_version $(HB_VER_MAJOR).$(HB_VER_MINOR).$(HB_VER_RELEASE) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ -filelist __dyn__.tmp $(DLIBS) $(DYSTRIP) && $(LN) $(@F) $(DYN_FILE_NVR) && $(LN) $(@F) $(DYN_FILE_CPT) -endef - -DY_RULE = $(create_dynlib) +DFLAGS += $(LIBPATHS) include $(TOP)$(ROOT)config/rules.mk diff --git a/config/darwin/libs.mk b/config/darwin/libs.mk index 2eb0e6a801..ddd7788244 100644 --- a/config/darwin/libs.mk +++ b/config/darwin/libs.mk @@ -6,6 +6,9 @@ ifneq ($(HB_LINKING_RTL),) endif ifneq ($(HB_HAS_CURSES),) SYSLIBS += $(HB_LIBNAME_CURSES) + ifneq ($(wildcard /usr/local/opt/ncurses/lib),) + SYSLIBPATHS += /usr/local/opt/ncurses/lib + endif endif ifneq ($(HB_HAS_SLANG),) SYSLIBS += slang @@ -13,16 +16,24 @@ ifneq ($(HB_LINKING_RTL),) ifneq ($(HB_HAS_CURSES),) SYSLIBS += $(HB_LIBNAME_CURSES) endif - ifneq ($(wildcard /sw/lib),) - SYSLIBPATHS += /sw/lib + ifneq ($(wildcard /usr/local/lib),) + SYSLIBPATHS += /usr/local/lib endif ifneq ($(wildcard /opt/local/lib),) SYSLIBPATHS += /opt/local/lib endif + ifneq ($(wildcard /sw/lib),) + SYSLIBPATHS += /sw/lib + endif endif ifneq ($(HB_HAS_X11),) SYSLIBS += X11 - SYSLIBPATHS += /usr/X11R6/lib + ifneq ($(wildcard /usr/X11R6/lib),) + SYSLIBPATHS += /usr/X11R6/lib + endif + ifneq ($(wildcard /opt/X11/lib),) + SYSLIBPATHS += /opt/X11/lib + endif endif ifneq ($(HB_HAS_PCRE),) ifeq ($(HB_HAS_PCRE_LOCAL),) diff --git a/config/global.mk b/config/global.mk index 9d23a88bfd..c4aa945921 100644 --- a/config/global.mk +++ b/config/global.mk @@ -208,6 +208,9 @@ ifeq ($(HB_INIT_DONE),) ifneq ($(HB_USER_DFLAGS),) $(info ! HB_USER_DFLAGS: $(HB_USER_DFLAGS)) endif + ifneq ($(HB_USER_DCFLAGS),) + $(info ! HB_USER_DCFLAGS: $(HB_USER_DCFLAGS)) + endif ifneq ($(HB_USER_LIBS),) $(info ! HB_USER_LIBS: $(HB_USER_LIBS)) endif diff --git a/config/rules.mk b/config/rules.mk index 623ae04e95..a9b8dccc78 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -10,6 +10,10 @@ else endif endif +ifneq ($(HB_USER_DCFLAGS),) + HB_DYN_COPT += $(HB_USER_DCFLAGS) +endif + ifeq ($(HB_DYN_COPT),) OBJ_DYN_SUFFIX := else diff --git a/contrib/hbexpat/hbexpat.hbx b/contrib/hbexpat/hbexpat.hbx index d2807db5f0..387df59f53 100644 --- a/contrib/hbexpat/hbexpat.hbx +++ b/contrib/hbexpat/hbexpat.hbx @@ -39,6 +39,7 @@ DYNAMIC XML_GetSpecifiedAttributeCount DYNAMIC XML_GetUserData DYNAMIC XML_Parse DYNAMIC XML_ParserCreate +DYNAMIC XML_ParserFree DYNAMIC XML_ParserReset DYNAMIC XML_ResumeParser DYNAMIC XML_SetAttlistDeclHandler diff --git a/include/hbgtcore.h b/include/hbgtcore.h index 6b6927ef2c..c92c41d6a0 100644 --- a/include/hbgtcore.h +++ b/include/hbgtcore.h @@ -347,6 +347,9 @@ typedef struct _HB_GT_BASE extern HB_EXPORT PHB_GT hb_gt_Base( void ); extern HB_EXPORT void hb_gt_BaseFree( PHB_GT pGT ); +extern HB_EXPORT void hb_gt_BaseUnlock( PHB_GT pGT ); +extern HB_EXPORT void hb_gt_BaseLock( PHB_GT pGT ); +extern HB_EXPORT void hb_gtSleep( PHB_GT pGT, double dSeconds ); extern HB_EXPORT PHB_GT hb_gt_ItemBase( PHB_ITEM pItemGT ); extern HB_EXPORT void hb_gt_gcMark( void ); diff --git a/src/rtl/gtcrs/gtcrs.c b/src/rtl/gtcrs/gtcrs.c index d1b4b59c73..2da64fe07c 100644 --- a/src/rtl/gtcrs/gtcrs.c +++ b/src/rtl/gtcrs/gtcrs.c @@ -2445,13 +2445,11 @@ static void hb_gt_crs_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { HB_TRACE( HB_TR_DEBUG, ( "hb_gt_crs_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); - HB_SYMBOL_UNUSED( pGT ); - gt_tone( s_ioBase, dFrequency, dDuration ); if( s_ioBase->terminal_type == TERM_LINUX ) /* convert Clipper (DOS) timer tick units to seconds ( x / 18.2 ) */ - hb_idleSleep( dDuration / 18.2 ); + hb_gtSleep( pGT, dDuration / 18.2 ); } /* *********************************************************************** */ diff --git a/src/rtl/gtdos/gtdos.c b/src/rtl/gtdos/gtdos.c index 937dfb8304..68b52f4eae 100644 --- a/src/rtl/gtdos/gtdos.c +++ b/src/rtl/gtdos/gtdos.c @@ -984,7 +984,7 @@ static void hb_gt_dos_Tone( PHB_GT pGT, double dFrequency, double dDuration ) #endif /* convert Clipper (DOS) timer tick units to seconds ( x / 18.2 ) */ - hb_idleSleep( dDuration / 18.2 ); + hb_gtSleep( pGT, dDuration / 18.2 ); #if defined( __BORLANDC__ ) || defined( __WATCOMC__ ) nosound(); diff --git a/src/rtl/gtgui/gtgui.c b/src/rtl/gtgui/gtgui.c index e367b834d7..0dffd85dcc 100644 --- a/src/rtl/gtgui/gtgui.c +++ b/src/rtl/gtgui/gtgui.c @@ -258,8 +258,9 @@ static void hb_gt_gui_Tone( PHB_GT pGT, double dFrequency, double dDuration ) HB_TRACE( HB_TR_DEBUG, ( "hb_gt_gui_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); #if defined( HB_OS_WIN ) - HB_SYMBOL_UNUSED( pGT ); + hb_gt_BaseUnlock( pGT ); hb_gt_winapi_tone( dFrequency, dDuration ); + hb_gt_BaseLock( pGT ); #else HB_GTSUPER_TONE( pGT, dFrequency, dDuration ); #endif diff --git a/src/rtl/gtos2/gtos2.c b/src/rtl/gtos2/gtos2.c index 11478539a0..db7f3022a9 100644 --- a/src/rtl/gtos2/gtos2.c +++ b/src/rtl/gtos2/gtos2.c @@ -783,8 +783,6 @@ static void hb_gt_os2_Tone( PHB_GT pGT, double dFrequency, double dDuration ) HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Tone(%p,%lf,%lf)", ( void * ) pGT, dFrequency, dDuration ) ); - HB_SYMBOL_UNUSED( pGT ); - /* The conversion from Clipper timer tick units to milliseconds is * 1000.0 / 18.2. */ @@ -794,12 +792,14 @@ static void hb_gt_os2_Tone( PHB_GT pGT, double dFrequency, double dDuration ) dFrequency = 32767.0; ulDuration = ( ULONG ) ( dDuration * 1000.0 / 18.2 ); /* milliseconds */ + hb_gt_BaseUnlock( pGT ); while( ulDuration > 0 ) { USHORT temp = ( USHORT ) HB_MIN( ulDuration, USHRT_MAX ); ulDuration -= temp; DosBeep( ( USHORT ) dFrequency, temp ); } + hb_gt_BaseLock( pGT ); } static const char * hb_gt_os2_Version( PHB_GT pGT, int iType ) diff --git a/src/rtl/gtpca/gtpca.c b/src/rtl/gtpca/gtpca.c index 671e8ecf2e..d2c5ac2a84 100644 --- a/src/rtl/gtpca/gtpca.c +++ b/src/rtl/gtpca/gtpca.c @@ -697,8 +697,6 @@ static void hb_gt_pca_Tone( PHB_GT pGT, double dFrequency, double dDuration ) HB_TRACE( HB_TR_DEBUG, ( "hb_gt_pca_Tone(%p, %lf, %lf)", ( void * ) pGT, dFrequency, dDuration ) ); - HB_SYMBOL_UNUSED( pGT ); - /* Output an ASCII BEL character to cause a sound */ /* but throttle to max once per second, in case of sound */ /* effects prgs calling lots of short tone sequences in */ @@ -715,7 +713,7 @@ static void hb_gt_pca_Tone( PHB_GT pGT, double dFrequency, double dDuration ) HB_SYMBOL_UNUSED( dFrequency ); /* convert Clipper (DOS) timer tick units to seconds ( x / 18.2 ) */ - hb_idleSleep( dDuration / 18.2 ); + hb_gtSleep( pGT, dDuration / 18.2 ); } static void hb_gt_pca_Bell( PHB_GT pGT ) diff --git a/src/rtl/gtsln/gtsln.c b/src/rtl/gtsln/gtsln.c index 3bd00ac3fe..16dc212725 100644 --- a/src/rtl/gtsln/gtsln.c +++ b/src/rtl/gtsln/gtsln.c @@ -777,8 +777,6 @@ static void hb_gt_sln_Tone( PHB_GT pGT, double dFrequency, double dDuration ) /* TODO: Implement this for other consoles than linux ? */ - HB_SYMBOL_UNUSED( pGT ); - if( hb_sln_UnderLinuxConsole ) { char escstr[ 64 ]; @@ -800,7 +798,7 @@ static void hb_gt_sln_Tone( PHB_GT pGT, double dFrequency, double dDuration ) /* The conversion from Clipper (DOS) timer tick units to milliseconds is * 1000.0 / 18.2. */ dDuration /= 18.2; - hb_idleSleep( dDuration ); + hb_gtSleep( pGT, dDuration / 18.2 ); } } diff --git a/src/rtl/gtstd/gtstd.c b/src/rtl/gtstd/gtstd.c index 8ada07bb5c..64e0f366cd 100644 --- a/src/rtl/gtstd/gtstd.c +++ b/src/rtl/gtstd/gtstd.c @@ -480,7 +480,7 @@ static void hb_gt_std_Tone( PHB_GT pGT, double dFrequency, double dDuration ) HB_SYMBOL_UNUSED( dFrequency ); /* convert Clipper (DOS) timer tick units to seconds ( x / 18.2 ) */ - hb_idleSleep( dDuration / 18.2 ); + hb_gtSleep( pGT, dDuration / 18.2 ); } static void hb_gt_std_Bell( PHB_GT pGT ) diff --git a/src/rtl/gttrm/gttrm.c b/src/rtl/gttrm/gttrm.c index e058b45ec2..680807002f 100644 --- a/src/rtl/gttrm/gttrm.c +++ b/src/rtl/gttrm/gttrm.c @@ -1468,7 +1468,7 @@ static void hb_gt_trm_LinuxTone( PHB_GTTRM pTerm, double dFrequency, double dDur hb_gt_trm_termFlush( pTerm ); /* convert Clipper (DOS) timer tick units to seconds ( x / 18.2 ) */ - hb_idleSleep( dDuration / 18.2 ); + hb_gtSleep( pTerm->pGT, dDuration / 18.2 ); } static void hb_gt_trm_LinuxSetCursorStyle( PHB_GTTRM pTerm, int iStyle ) @@ -1940,7 +1940,7 @@ static void hb_gt_trm_BsdTone( PHB_GTTRM pTerm, double dFrequency, double dDurat hb_gt_trm_termFlush( pTerm ); /* convert Clipper (DOS) timer tick units to seconds ( x / 18.2 ) */ - hb_idleSleep( dDuration / 18.2 ); + hb_gtSleep( pTerm->pGT, dDuration / 18.2 ); } @@ -2271,7 +2271,7 @@ static void hb_gt_trm_AnsiTone( PHB_GTTRM pTerm, double dFrequency, double dDura HB_SYMBOL_UNUSED( dFrequency ); /* convert Clipper (DOS) timer tick units to seconds ( x / 18.2 ) */ - hb_idleSleep( dDuration / 18.2 ); + hb_gtSleep( pTerm->pGT, dDuration / 18.2 ); } static void hb_gt_trm_AnsiInit( PHB_GTTRM pTerm ) diff --git a/src/rtl/gtwin/gtwin.c b/src/rtl/gtwin/gtwin.c index c5edfa4f43..7c0815c771 100644 --- a/src/rtl/gtwin/gtwin.c +++ b/src/rtl/gtwin/gtwin.c @@ -1809,7 +1809,9 @@ static void hb_gt_win_Tone( PHB_GT pGT, double dFrequency, double dDuration ) HB_SYMBOL_UNUSED( pGT ); + hb_gt_BaseUnlock( pGT ); hb_gt_winapi_tone( dFrequency, dDuration ); + hb_gt_BaseLock( pGT ); } /* *********************************************************************** */ diff --git a/src/rtl/gtwvt/gtwvt.c b/src/rtl/gtwvt/gtwvt.c index ad580ee1e6..2be1797c90 100644 --- a/src/rtl/gtwvt/gtwvt.c +++ b/src/rtl/gtwvt/gtwvt.c @@ -3504,7 +3504,9 @@ static void hb_gt_wvt_Tone( PHB_GT pGT, double dFrequency, double dDuration ) HB_SYMBOL_UNUSED( pGT ); + hb_gt_BaseUnlock( pGT ); hb_gt_winapi_tone( dFrequency, dDuration ); + hb_gt_BaseLock( pGT ); } /* ********************************************************************** */ diff --git a/src/rtl/gtxwc/gtxwc.c b/src/rtl/gtxwc/gtxwc.c index 1304ec1c1b..719cb4ecb0 100644 --- a/src/rtl/gtxwc/gtxwc.c +++ b/src/rtl/gtxwc/gtxwc.c @@ -5138,7 +5138,7 @@ static void hb_gt_xwc_Tone( PHB_GT pGT, double dFrequency, double dDuration ) XSync( wnd->dpy, False ); HB_XWC_XLIB_UNLOCK( wnd->dpy ); } - hb_idleSleep( dDuration ); + hb_gtSleep( pGT, dDuration ); } /* *********************************************************************** */ diff --git a/src/rtl/hbgtcore.c b/src/rtl/hbgtcore.c index 6e71631b51..096bd259ba 100644 --- a/src/rtl/hbgtcore.c +++ b/src/rtl/hbgtcore.c @@ -82,6 +82,23 @@ void hb_gt_BaseFree( PHB_GT pGT ) HB_GTSELF_UNLOCK( pGT ); } +void hb_gt_BaseUnlock( PHB_GT pGT ) +{ + HB_GTSELF_UNLOCK( pGT ); +} + +void hb_gt_BaseLock( PHB_GT pGT ) +{ + HB_GTSELF_LOCK( pGT ); +} + +void hb_gtSleep( PHB_GT pGT, double dSeconds ) +{ + HB_GTSELF_UNLOCK( pGT ); + hb_idleSleep( dSeconds ); + HB_GTSELF_LOCK( pGT ); +} + /* helper internal function */ static void hb_gt_def_BaseInit( PHB_GT_BASE pGT ) { @@ -743,11 +760,10 @@ static void hb_gt_def_OutErr( PHB_GT pGT, const char * szStr, HB_SIZE nLen ) static void hb_gt_def_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { - HB_SYMBOL_UNUSED( pGT ); HB_SYMBOL_UNUSED( dFrequency ); /* convert Clipper (MS-DOS) timer tick units to seconds ( x / 18.2 ) */ - hb_idleSleep( dDuration / 18.2 ); + hb_gtSleep( pGT, dDuration / 18.2 ); } static void hb_gt_def_Bell( PHB_GT pGT ) diff --git a/src/rtl/hbsocket.c b/src/rtl/hbsocket.c index 549d5fad89..9e4f734351 100644 --- a/src/rtl/hbsocket.c +++ b/src/rtl/hbsocket.c @@ -2786,7 +2786,7 @@ int hb_socketSetBlockingIO( HB_SOCKET sd, HB_BOOL fBlocking ) if( ret != -1 ) { HB_BOOL fBlocked; - long flags; + int flags; fBlocked = ( ret & O_NONBLOCK ) == 0; if( fBlocking ? ! fBlocked : fBlocked ) { diff --git a/utils/hbmk2/hbmk2.prg b/utils/hbmk2/hbmk2.prg index 99b1abf806..bd59d81819 100644 --- a/utils/hbmk2/hbmk2.prg +++ b/utils/hbmk2/hbmk2.prg @@ -4111,11 +4111,10 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit ENDIF AAddNotEmpty( hbmk[ _HBMK_aOPTCX ], gcc_opt_lngc_fill( hbmk ) ) AAddNotEmpty( hbmk[ _HBMK_aOPTCPPX ], gcc_opt_lngcpp_fill( hbmk ) ) + cBin_Dyn := cBin_CompC IF hbmk[ _HBMK_cPLAT ] == "darwin" - cBin_Dyn := cBin_Lib - cOpt_Dyn := "-dynamic -o {OD} -flat_namespace -undefined suppress -single_module {FD} {DL} {LO} {LS}" /* NOTE: -single_module is now the default in ld/libtool. */ + cOpt_Dyn := "-dynamiclib -o {OD} -flat_namespace -undefined dynamic_lookup {FD} {DL} {LO} {LS}" /* NOTE: -single_module is now the default in ld/libtool. */ ELSE - cBin_Dyn := cBin_CompC cOpt_Dyn := "-shared -o {OD} {LO} {FD} {DL} {LS}" ENDIF cBin_Link := cBin_CompC @@ -4140,10 +4139,15 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit AAdd( hbmk[ _HBMK_aOPTD ], "{LL} {LB} {LF}" ) l_aLIBHBBASE_2 := iif( hbmk[ _HBMK_lMT ], aLIB_BASE_2_MT, aLIB_BASE_2 ) ENDIF + IF hbmk[ _HBMK_cPLAT ] == "darwin" + /* Leave space for later modifying .dylib paths using `install_name_tool`. + '400' is a hexadecimal value. */ + AAdd( hbmk[ _HBMK_aOPTL ], "-Wl,-headerpad,400" ) + AAdd( hbmk[ _HBMK_aOPTD ], "-Wl,-headerpad,400" ) + ENDIF IF hbmk[ _HBMK_lMAP ] IF hbmk[ _HBMK_cPLAT ] == "darwin" AAdd( hbmk[ _HBMK_aOPTL ], "-Wl,-map,{OM}" ) - AAdd( hbmk[ _HBMK_aOPTD ], "-Wl,-map,{OM}" ) ELSE AAdd( hbmk[ _HBMK_aOPTL ], "-Wl,-Map,{OM}" ) AAdd( hbmk[ _HBMK_aOPTD ], "-Wl,-Map,{OM}" )