From fbe48a538502ede0c7a0e7f0fdbd1022b2748752 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 4 Mar 2009 11:50:35 +0000 Subject: [PATCH] 2009-03-04 12:56 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/bin/hb-func.sh * explicitly bind system libraries with harbour shared library. RPM/DEB packages should automatically detect these dependencies. Viktor, now you do not have to pass system libraries like m, dl, rt, pthread, socket, nsl, resolv, curses, slang, x11, wininet, ws2, commdlg, commctrl, uuid, ole32 ... when you create shared binaries by hbmk2 - all bindings are in harbour shared library. They are necessary only for static builds. --- harbour/ChangeLog | 10 ++++++ harbour/bin/hb-func.sh | 75 +++++++++++++++++++++++++++++++++++------- 2 files changed, 74 insertions(+), 11 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1f98e1e6d1..2bae850a63 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,16 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-03-04 12:56 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/bin/hb-func.sh + * explicitly bind system libraries with harbour shared library. + RPM/DEB packages should automatically detect these dependencies. + Viktor, now you do not have to pass system libraries like + m, dl, rt, pthread, socket, nsl, resolv, curses, slang, x11, + wininet, ws2, commdlg, commctrl, uuid, ole32 ... when you create + shared binaries by hbmk2 - all bindings are in harbour shared + library. They are necessary only for static builds. + 2009-03-04 10:00 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * bin/hb-mkdyn.sh * bin/postinst.sh diff --git a/harbour/bin/hb-func.sh b/harbour/bin/hb-func.sh index 3b978f76f7..89acb8b1a4 100755 --- a/harbour/bin/hb-func.sh +++ b/harbour/bin/hb-func.sh @@ -454,6 +454,11 @@ if [ "\${HB_WITHOUT_X11}" != "yes" ]; then fi [ -n "\${HB_GPM_LIB}" ] && SYSTEM_LIBS="-l\${HB_GPM_LIB} \${SYSTEM_LIBS}" + +if [ "\${HB_STATIC}" = "no" ]; then + SYSTEM_LIBS="" +fi + if [ "\${HB_XBGTK}" = "yes" ]; then SYSTEM_LIBS="\${SYSTEM_LIBS} \`pkg-config --libs gtk+-2.0\`" elif [ "\${HB_XHGTK}" = "yes" ]; then @@ -706,7 +711,7 @@ EOF mk_hblibso() { - local LIBS LIBSMT l lm ll dir hb_rootdir hb_ver hb_libs full_lib_name full_lib_name_mt linker_options + local LIBS LIBSMT l lm ll dir hb_rootdir hb_ver hb_libs full_lib_name full_lib_name_mt linker_options linker_mtoptions gpm dir=`pwd` name=`get_solibname` @@ -719,6 +724,42 @@ mk_hblibso() (cd $HB_LIB_INSTALL LIBS="" LIBSMT="" + gpm="${HB_GPM_MOUSE}" + linker_options="-lm" + linker_mtoptions="" + if [ "${HB_USER_CFLAGS//-DHB_PCRE_REGEX/}" != "${HB_USER_CFLAGS}" ]; then + linker_options="-lpcre ${linker_options}" + hb_libs="${hb_libs//hbpcre/}" + elif [ "${HB_USER_CFLAGS//-DHB_POSIX_REGEX/}" != "${HB_USER_CFLAGS}" ]; then + hb_libs="${hb_libs//hbpcre/}" + fi + if [ "${HB_USER_CFLAGS//-DHB_EXT_ZLIB/}" != "${HB_USER_CFLAGS}" ]; then + linker_options="-lz ${linker_options}" + hb_libs="${hb_libs//hbzlib/}" + fi + if [ "${HB_COMPILER}" = "mingw" ]; then + linker_options="${linker_options} -luser32 -lwinspool -lgdi32 -lcomctl32 -lcomdlg32 -lole32 -loleaut32 -luuid -lwsock32 -lws2_32" + elif [ "${HB_COMPILER}" = "mingwce" ]; then + linker_options="${linker_options} -lwininet -lws2 -lcommdlg -lcommctrl -luuid -lole32" + elif [ "${HB_COMPILER}" = "djgpp" ]; then + linker_options="${linker_options}" + elif [ "${HB_ARCHITECTURE}" = "linux" ]; then + linker_options="${linker_options} -ldl -lrt" + linker_mtoptions="${linker_mtoptions} -lpthread" + elif [ "${HB_ARCHITECTURE}" = "sunos" ]; then + linker_options="${linker_options} -lrt -lsocket -lnsl -lresolv" + linker_mtoptions="${linker_mtoptions} -lpthread" + elif [ "${HB_ARCHITECTURE}" = "hpux" ]; then + linker_options="${linker_options} -lrt" + linker_mtoptions="${linker_mtoptions} -lpthread" + elif [ "${HB_ARCHITECTURE}" = "bsd" ]; then + linker_options="$-L/usr/local/lib {linker_options}" + linker_mtoptions="${linker_mtoptions} -lpthread" + elif [ "${HB_ARCHITECTURE}" = "darwin" ]; then + linker_options="-L/sw/lib -L/opt/local/lib ${linker_options}" + linker_mtoptions="${linker_mtoptions} -lpthread" + fi + for l in ${hb_libs} do case $l in @@ -731,21 +772,34 @@ mk_hblibso() else lm="${ls}" fi - if [ -f $ls ] - then - LIBS="$LIBS $ls" - fi if [ -f $lm ] then LIBSMT="$LIBSMT $lm" fi - if [ "${HB_ARCHITECTURE}" = "darwin" ]; then + if [ -f $ls ] + then + LIBS="$LIBS $ls" if [ "${l}" = gtcrs ]; then - linker_options="$linker_options -lncurses" + if [ "${HB_ARCHITECTURE}" = "sunos" ]; then + linker_options="$linker_options -lcurses" + else + linker_options="$linker_options -lncurses" + fi elif [ "${l}" = gtsln ]; then if [ "${HB_WITHOUT_GTSLN}" != "yes" ]; then linker_options="$linker_options -lslang" fi + elif [ "${l}" = gtxwc ]; then + [ -d "/usr/X11R6/lib" ] && \ + linker_options="$linker_options -L/usr/X11R6/lib" + [ -d "/usr/X11R6/lib64" ] && \ + linker_options="$linker_options -L/usr/X11R6/lib64" + linker_options="$linker_options -lX11" + fi + if [ "${gpm}" = yes ] && ( [ "${l}" = gtcrs ] || \ + [ "${l}" = gtsln ] || [ "${l}" = gttrm ] ); then + linker_options="$linker_options -lgpm" + gpm="" fi fi ;; @@ -755,7 +809,6 @@ mk_hblibso() lib_ext=".dylib" full_lib_name="lib${name}.${hb_ver}${lib_ext}" full_lib_name_mt="lib${name}mt.${hb_ver}${lib_ext}" - linker_options="-L/sw/lib -L/opt/local/lib $linker_options" elif [ "${HB_ARCHITECTURE}" = "win" ]; then lib_ext=".dll" full_lib_name="${name}${lib_ext}" @@ -775,10 +828,10 @@ mk_hblibso() hb_mkdyn="${HB_BIN_INSTALL}/hb-mkdyn" fi echo "Making ${full_lib_name}..." - ${hb_mkdyn} ${full_lib_name} $LIBS ${linker_options} - if [ "${HB_ARCHITECTURE}" != "dos" ]; then + ${hb_mkdyn} ${full_lib_name} ${LIBS} ${linker_options} + if [ "${LIBS}" != "${LIBSMT}" ]; then echo "Making ${full_lib_name_mt}..." - ${hb_mkdyn} ${full_lib_name_mt} $LIBSMT ${linker_options} + ${hb_mkdyn} ${full_lib_name_mt} ${LIBSMT} ${linker_mtoptions} ${linker_options} fi for l in ${full_lib_name} ${full_lib_name_mt} do