From 1eb4121bd99e31e8c927b4d5a7f5cba24b66025f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Fri, 19 May 2017 16:08:57 +0200 Subject: [PATCH] 2017-05-19 16:08 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * config/android/gcc.mk * config/global.mk * config/linux/gcc.mk * config/postinst.hb * contrib/hbpost.hbm ! removed version number from dynamic libraries for Android. Pure Linux style dynamic library numbers in Android systems can be used only with system libraries but it's not supported inside .apk packages so our dynamic libraries were unusable for Android programmers unless someone plans to install more then one version of Harbour dynamic libraries as Android system libraries. It's rather unusual situation and I believe that in such case he can easy create such libraries building Harbour for Linux with NDK. * enabled by default building contrib dynamic libraries in Harbour Android build. + added -Wl,--no-undefined to linker parameters when dynamic libraries are created to verify if dynamic libraries can be used in Android .apk packages during Harbour build process. ; After above modification dynamic (*.so) libraries created in Harbour build process can be used in .apk packages. It means that projects like HDroidGUI do not longer need their own custom versions of libharbour.so but can use the one from standard Harbour Android build. They can also use Harbour contrib dynamic libraries. ; TODO: add support for automatic NDK detection in Harbour build process ; TODO: add to HBMK2 basic support for generating .apk packages * contrib/gtqtc/gtqtc.hbp * disabled dynamic GTQTC library in Android builds until we set explicit bindings with QT/C++ dynamic libs --- ChangeLog.txt | 31 +++++++++++++++++++++++++++++++ config/android/gcc.mk | 2 ++ config/global.mk | 16 +++++++++------- config/linux/gcc.mk | 2 +- config/postinst.hb | 16 ++++++++++++---- contrib/gtqtc/gtqtc.hbp | 2 +- contrib/hbpost.hbm | 13 ++++++++----- 7 files changed, 64 insertions(+), 18 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 5ec7d69628..f05e513724 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,37 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2017-05-19 16:08 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * config/android/gcc.mk + * config/global.mk + * config/linux/gcc.mk + * config/postinst.hb + * contrib/hbpost.hbm + ! removed version number from dynamic libraries for Android. + Pure Linux style dynamic library numbers in Android systems can be used + only with system libraries but it's not supported inside .apk packages + so our dynamic libraries were unusable for Android programmers unless + someone plans to install more then one version of Harbour dynamic + libraries as Android system libraries. It's rather unusual situation + and I believe that in such case he can easy create such libraries + building Harbour for Linux with NDK. + * enabled by default building contrib dynamic libraries in Harbour + Android build. + + added -Wl,--no-undefined to linker parameters when dynamic libraries + are created to verify if dynamic libraries can be used in Android .apk + packages during Harbour build process. + ; After above modification dynamic (*.so) libraries created in Harbour + build process can be used in .apk packages. It means that projects + like HDroidGUI do not longer need their own custom versions of + libharbour.so but can use the one from standard Harbour Android build. + They can also use Harbour contrib dynamic libraries. + ; TODO: add support for automatic NDK detection in Harbour build process + ; TODO: add to HBMK2 basic support for generating .apk packages + + * contrib/gtqtc/gtqtc.hbp + * disabled dynamic GTQTC library in Android builds until we set explicit + bindings with QT/C++ dynamic libs + 2017-05-19 00:54 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/rddads/ads1.c + added support for "VarCharFox" and "VarBinaryFox" field types. diff --git a/config/android/gcc.mk b/config/android/gcc.mk index 82ba8ec628..5d5e64f7ff 100644 --- a/config/android/gcc.mk +++ b/config/android/gcc.mk @@ -1 +1,3 @@ +DFLAGS += -Wl,--no-undefined -Wl,-z,noexecstack + include $(TOP)$(ROOT)config/linux/gcc.mk diff --git a/config/global.mk b/config/global.mk index d7ef4916ab..8c70cfe8e3 100644 --- a/config/global.mk +++ b/config/global.mk @@ -396,8 +396,8 @@ ifeq ($(HB_HOST_PLAT),) endif endif -ifneq ($(filter $(HB_HOST_PLAT),win),) - ifeq ($(HB_BUILD_CONTRIB_DYN),) +ifeq ($(HB_BUILD_CONTRIB_DYN),) + ifneq ($(filter $(HB_HOST_PLAT),win android),) export HB_BUILD_CONTRIB_DYN := yes endif endif @@ -2004,11 +2004,13 @@ ifeq ($(HB_INIT_DONE),) HB_DYNLIB_POST := .$(HB_DYN_VER) HB_DYNLIB_POSC := .$(HB_DYN_VERCPT) else - # libharbour.s?.2.1.0 - # libharbour.s?.2.1 -> - # libharbour.s? -> - HB_DYNLIB_PEXT := .$(HB_DYN_VER) - HB_DYNLIB_PEXC := .$(HB_DYN_VERCPT) + ifneq ($(HB_PLATFORM),android) + # libharbour.s?.2.1.0 + # libharbour.s?.2.1 -> + # libharbour.s? -> + HB_DYNLIB_PEXT := .$(HB_DYN_VER) + HB_DYNLIB_PEXC := .$(HB_DYN_VERCPT) + endif endif endif endif diff --git a/config/linux/gcc.mk b/config/linux/gcc.mk index 47f40456dd..bfe1b5c55d 100644 --- a/config/linux/gcc.mk +++ b/config/linux/gcc.mk @@ -68,7 +68,7 @@ DY_OUT := -o$(subst x,x, ) DLIBS := $(foreach lib,$(HB_USER_LIBS) $(SYSLIBS),-l$(lib)) ifeq ($(HB_SHELL),sh) - DY_RULE = $(DY) $(DFLAGS) -Wl,-soname,$(DYN_NAME_CPT) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) && $(LN) $(@F) $(DYN_FILE_NVR) && $(LN) $(@F) $(DYN_FILE_CPT) + DY_RULE = $(DY) $(DFLAGS) -Wl,-soname,$(DYN_NAME_CPT) $(HB_USER_DFLAGS) $(DY_OUT)$(DYN_DIR)/$@ $^ $(DLIBS) $(DYSTRIP) && ([ "$(@F)" = "$(notdir $(DYN_FILE_NVR))" ] || $(LN) $(@F) $(DYN_FILE_NVR)) && ([ "$(@F)" = "$(notdir $(DYN_FILE_CPT))" ] || $(LN) $(@F) $(DYN_FILE_CPT)) else # NOTE: The empty line directly before 'endef' HAVE TO exist! diff --git a/config/postinst.hb b/config/postinst.hb index ec00f2ad7a..a7235c2b7e 100644 --- a/config/postinst.hb +++ b/config/postinst.hb @@ -140,8 +140,12 @@ PROCEDURE Main( ... ) cDynVersionComp := GetEnvC( "HB_DYNLIB_PREF" ) + GetEnvC( "HB_DYNLIB_BASE" ) + GetEnvC( "HB_DYNLIB_POSC" ) + GetEnvC( "HB_DYNLIB_EXT" ) + GetEnvC( "HB_DYNLIB_PEXC" ) cDynVersionless := GetEnvC( "HB_DYNLIB_PREF" ) + GetEnvC( "HB_DYNLIB_BASE" ) + GetEnvC( "HB_DYNLIB_EXT" ) - mk_hb_FLinkSym( cDynVersionFull, hb_DirSepToOS( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + cDynVersionComp ) - mk_hb_FLinkSym( cDynVersionFull, hb_DirSepToOS( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + cDynVersionless ) + IF ! cDynVersionFull == cDynVersionComp + mk_hb_FLinkSym( cDynVersionFull, hb_DirSepToOS( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + cDynVersionComp ) + ENDIF + IF ! cDynVersionFull == cDynVersionless + mk_hb_FLinkSym( cDynVersionFull, hb_DirSepToOS( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + cDynVersionless ) + ENDIF DO CASE CASE EndsWith( GetEnvC( "HB_INSTALL_DYN" ), "/usr/lib/harbour" ) .OR. ; @@ -149,8 +153,12 @@ PROCEDURE Main( ... ) EndsWith( GetEnvC( "HB_INSTALL_DYN" ), "/usr/local/lib/harbour" ) .OR. ; EndsWith( GetEnvC( "HB_INSTALL_DYN" ), "/usr/local/lib64/harbour" ) - mk_hb_FLinkSym( "harbour" + hb_ps() + cDynVersionFull, hb_DirSepToOS( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cDynVersionless ) - mk_hb_FLinkSym( "harbour" + hb_ps() + cDynVersionFull, hb_DirSepToOS( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cDynVersionComp ) + IF ! cDynVersionFull == cDynVersionless + mk_hb_FLinkSym( "harbour" + hb_ps() + cDynVersionFull, hb_DirSepToOS( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cDynVersionless ) + ENDIF + IF ! cDynVersionFull == cDynVersionComp + mk_hb_FLinkSym( "harbour" + hb_ps() + cDynVersionFull, hb_DirSepToOS( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cDynVersionComp ) + ENDIF mk_hb_FLinkSym( "harbour" + hb_ps() + cDynVersionFull, hb_DirSepToOS( GetEnvC( "HB_INSTALL_DYN" ) ) + hb_ps() + ".." + hb_ps() + cDynVersionFull ) CASE GetEnvC( "HB_INSTALL_DYN" ) == "/usr/local/harbour/lib" diff --git a/contrib/gtqtc/gtqtc.hbp b/contrib/gtqtc/gtqtc.hbp index c33aaec788..3e7c3a5513 100644 --- a/contrib/gtqtc/gtqtc.hbp +++ b/contrib/gtqtc/gtqtc.hbp @@ -5,7 +5,7 @@ -w3 -es2 --stop{dos|watcom|bcc|pocc|pocc64|poccarm|msvcia64|pcc} +-stop{dos|watcom|bcc|pocc|pocc64|poccarm|msvcia64|pcc|(hbdyn&android)} -pic diff --git a/contrib/hbpost.hbm b/contrib/hbpost.hbm index 646bb4c8c6..77b9309a46 100644 --- a/contrib/hbpost.hbm +++ b/contrib/hbpost.hbm @@ -29,23 +29,26 @@ {hbdyn}-implib=../lib/${hb_plat}/${hb_comp}${hb_build}/ {hbdyn&hb_dynsuffix}-implib=${hb_outputname}${hb_dynsuffix} {hbdyn&!hb_dynsuffix}-implib=${hb_outputname}_dll -{hbdyn&unix&!cygwin}-ln=${hb_dynprefix}${hb_outputname}${hb_dynext} -{hbdyn&unix&!darwin&!cygwin}-ln=${hb_dynprefix}${hb_outputname}${hb_dynext}.${hb_major}.${hb_minor} +{hbdyn&unix&!android&!cygwin}-ln=${hb_dynprefix}${hb_outputname}${hb_dynext} +{hbdyn&unix&!darwin&!android&!cygwin}-ln=${hb_dynprefix}${hb_outputname}${hb_dynext}.${hb_major}.${hb_minor} {hbdyn&unix&darwin}-ln=${hb_dynprefix}${hb_outputname}.${hb_major}.${hb_minor}${hb_dynext} +{hbdyn&android}-lharbour +{hbdyn&android}-lm {hbdyn&(allwin|cygwin)}-lhbmaindllp {hbdyn}-depimplib- "{hbdyn&darwin}-dflag=-install_name '${hb_dynprefix}${hb_outputname}${hb_dynext}'" "{hbdyn&darwin}-dflag=-compatibility_version ${hb_major}.${hb_minor}" "{hbdyn&darwin}-dflag=-current_version ${hb_major}.${hb_minor}.${hb_release}" -"{hbdyn&linux}-dflag=-Wl,-soname,${hb_dynprefix}${hb_outputname}${hb_dynext}.${hb_major}.${hb_minor}" +"{hbdyn&android}-dflag=-Wl,-soname,${hb_dynprefix}${hb_outputname}${hb_dynext} -Wl,--no-undefined -Wl,-z,noexecstack" +"{hbdyn&linux&!android}-dflag=-Wl,-soname,${hb_dynprefix}${hb_outputname}${hb_dynext}.${hb_major}.${hb_minor}" "{hbdyn&sunos}-dflag=-Wl,-h,${hb_dynprefix}${hb_outputname}${hb_dynext}.${hb_major}.${hb_minor}" # output name tweaks for dynamic libs # NOTE: We're altering previously set output name value here -{hbdyn&unix&!darwin&!cygwin}-o${hb_outputname}${hb_dynext}.${hb_major}.${hb_minor}.${hb_release} +{hbdyn&unix&!darwin&!android&!cygwin}-o${hb_outputname}${hb_dynext}.${hb_major}.${hb_minor}.${hb_release} {hbdyn&unix&darwin}-o${hb_outputname}.${hb_major}.${hb_minor}.${hb_release}${hb_dynext} -{hbdyn&unix&cygwin}-o${hb_outputname}${hb_dynext} +{hbdyn&unix&(cygwin|android)}-o${hb_outputname}${hb_dynext} {hbdyn&!unix&allwin}-o${hb_outputname}-${hb_major}${hb_minor}${hb_dynsuffix} {hbdyn&!unix&!allwin}-o${hb_outputname}${hb_dynsuffix}