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
This commit is contained in:
Przemysław Czerpak
2017-12-19 21:42:15 +01:00
parent 517b7654dd
commit b872d7b62c
24 changed files with 156 additions and 66 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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),)

View File

@@ -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

View File

@@ -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