Files
harbour-core/harbour/bin/hb-func.sh
Przemyslaw Czerpak 3ea86f8269 2007-09-25 03:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbset.h
  * harbour/source/rtl/set.c
    * changed recently added hb_set*() functions to hb_setGet*()
      Please do not use these functions yet - it's possible that
      they will be removed soon.
    + added hb_setGetL(), hb_setGetCPtr(), hb_setGetNI(), hb_setGetNL()

  * harbour/contrib/libct/dattime2.c
  * harbour/contrib/samples/date.c
    * use hb_setGetCentury() instead of hb_setGetL( hb_set_century )
      we do not have hb_set_century SET switch so hb_setGetL() cannot
      be used

  * harbour/harbour.spec
  * harbour/bin/hb-func.sh
  * harbour/bin/pack_src.sh
  * harbour/contrib/Makefile
  + harbour/contrib/xhb
  + harbour/contrib/xhb/hboutdbg.c
  + harbour/contrib/xhb/cstruct.ch
  + harbour/contrib/xhb/hblog.prg
  + harbour/contrib/xhb/hblog.ch
  + harbour/contrib/xhb/hblognet.prg
  + harbour/contrib/xhb/hbxml.c
  + harbour/contrib/xhb/hbxml.h
  + harbour/contrib/xhb/hbxml.ch
  + harbour/contrib/xhb/hblogdef.ch
  + harbour/contrib/xhb/hbctypes.ch
  + harbour/contrib/xhb/wintypes.ch
  + harbour/contrib/xhb/txml.prg
  + harbour/contrib/xhb/hbsyslog.c
  + harbour/contrib/xhb/cstructc.c
  + harbour/contrib/xhb/Makefile
  + harbour/contrib/xhb/cstruct.prg
  + harbour/contrib/xhb/xhbfunc.c
    + added XHB library with xharbour compatible functions borrowed from
      xHarbour. Now it contains HBLOG, HBXML, HBCSTRUCT, HASH, INET*()
      functions and classes.

  * harbour/source/rtl/itemseri.c
  * harbour/source/rtl/strmatch.c
  * harbour/source/rtl/hbinet.c
  * harbour/source/vm/hashfunc.c
     * moved xHarbour compatible functions to XHB library

  * harbour/source/vm/classes.c
     + added support for ERROR HANDLER message in scalar classes

  * harbour/contrib/tip/mail.prg
  * harbour/contrib/tip/ftpcln.prg
    + added #include "hbcompat.ch"

  * harbour/include/hbdbferr.h
    + added new RT errors: EDBF_CREATE_TEMP, EDBF_WRITE_TEMP, EDBF_READ_TEMP

  * harbour/include/dbinfo.ch
    + added DBI_ENCRYPT, DBI_DECRYPT, DBI_MEMOPACK, DBI_DIRTYREAD
    + added DBOI_INDEXTYPE, DBOI_USECURRENT
    + added RDDI_LOCKRETRY, RDDI_DIRTYREAD

  * harbour/include/dbinfo.ch
  * harbour/include/hbrdddbf.h
  * harbour/include/hbrddfpt.h
  * harbour/include/hbrddcdx.h
  * harbour/include/hbrddntx.h
  * harbour/source/rdd/dbf1.c
  * harbour/source/rdd/dbffpt/dbffpt1.c
  * harbour/source/rdd/dbfntx/dbfntx1.c
  * harbour/source/rdd/dbfcdx/dbfcdx1.c
    + added support for MEMOPACK, table ENCRYPT/DECRYPT, index DIRTYREAD

  * harbour/include/hbapirdd.h
  * harbour/include/dbstruct.ch
  * harbour/include/hbusrrdd.ch
  * harbour/contrib/rdd_ads/ads1.c
  * harbour/contrib/rdd_ads/ace.h
  * harbour/source/rdd/dbfdbt/dbfdbt1.c
  * harbour/source/rdd/dbffpt/dbffpt1.c
  * harbour/source/rdd/dbcmd.c
  * harbour/source/rdd/wafunc.c
  * harbour/source/rdd/workarea.c
  * harbour/source/rdd/dbf1.c
  * harbour/source/rdd/sdf1.c
  * harbour/source/rdd/delim1.c
    * changed HB_IT_* as field type to HB_FT_*
    + added field flags HB_FF_*
    + added support for new field types to core code

  * harbour/source/rdd/dbf1.c
    + added support for AUTOINC (+), ROWVERSION (^), TIME (T), DAYTIME (@)
      and MODTIME (=) fields

  * harbour/contrib/rdd_ads/ads1.c
  * harbour/contrib/rdd_ads/ace.h
    + added support for ROWVERSION (^), and MODTIME (=) fields

  ! harbour/source/rdd/dbcmd.c
    * fixed bug in dbSkipper() reported by Viktor

  + harbour/include/hbsix.ch
  * harbour/source/rdd/hbsix/Makefile
  * harbour/source/rdd/hbsix/sxdate.c
  * harbour/source/rdd/hbsix/sxcompr.c
  * harbour/source/rdd/hbsix/sxcrypt.c
  + harbour/source/rdd/hbsix/sxsem.c
  + harbour/source/rdd/hbsix/sxord.c
  + harbour/source/rdd/hbsix/sxredir.c
  + harbour/source/rdd/hbsix/sxfname.c
  + harbour/source/rdd/hbsix/sxtable.c
  + harbour/source/rdd/hbsix/sxutil.c
  + harbour/source/rdd/hbsix/sxcompat.prg
  + harbour/source/rdd/hbsix/sxtrig.prg
  + harbour/source/rdd/hbsix/sxini.prg
    + added SIx3 compatible functions:
         RDD_Count(), RDD_Name(), RDD_Info(), SetRDD(),
         sxChar(), sxNum(), sxDate(), sxLog(),
         Sx_DToP(), Sx_PToD(),
         Sx_BLOB2File(), Sx_File2BLOB(),
         Sx_Compress(), Sx_Decompress(),
         Sx_FCompress(), Sx_FDecompress(),
         Sx_AutoOpen(), Sx_AutoShare(),
         Sx_MemoExt(), Sx_MemoBlk(), Sx_SetMemoBlock(), Sx_MemoPack(),
         Sx_SetTrigger(), Sx_SetTrig(), Sx_DefTrigger(), 
         Sx_INIheader(), _sx_INIinit(), _sxOpenInit(),
         Sx_SetPass(),
         Sx_Encrypt(), Sx_Decrypt(), Sx_DBFdecrypt(), Sx_DBFencrypt(),
         sx_MakeSem(), sx_KillSem(), sx_IsSem(),
         Sx_ClrScope(), Sx_SetScope(),
         Sx_Freeze(), Sx_Warm(), Sx_Chill(), Sx_Thermometer(),
         Sx_IsReindex(), Sx_Step(), Sx_KeysIncluded(),
         Sx_I_IndexName(), Sx_I_TagName(),
         Sx_IndexCount(), Sx_IndexName(), Sx_IndexType(), Sx_IndexFilter(),
         Sx_ROXLock(), Sx_ROXUnLock(), Sx_IsMyROX(), Sx_IsROXLock(),
         Sx_KeyAdd(), Sx_KeyDrop(), Sx_KeyData(),
         Sx_KeySkip(), Sx_KeyCount(), Sx_KeyNo(), Sx_KeyGoto(),
         Sx_WildSeek(), Sx_WildMatch(),
         Sx_IsFLocked(), Sx_IsReadOnly(), Sx_IsShared(),
         Sx_IsLocked(), Sx_IsDBT(),
         Sx_IDtype(), Sx_TableType(), Sx_TableName(),
         Sx_SetTurbo(), Sx_TurboArea(), Sx_SetDirty(), Sx_DirtyArea(),
         Sx_RLock(), Sx_UnLock(), Sx_GetLocks(), Sx_LockRetry(),
         Sx_SeekLast(), Sx_FindRec(),
         Sx_SkipUnique(), Sx_TagUnique(),
         Sx_TagCount(), Sx_TagOrder(), Sx_TagNo(), Sx_TagName(),
         Sx_TagInfo(), Sx_Tags(),
         Sx_SetTag(), Sx_SetTagOrder(), Sx_SetTagNo(),
         Sx_KillTag(),
         Sx_FileOrder(), Sx_SetFileOrd(), Sx_ClearOrder(),
         Sx_VSigLen(), Sx_VFGet(),
         Sx_dbCreate(), Sx_StrxCheck(), Sx_Rollback(), Sx_SortOption(),
         _sxCondSet(),
         Sx_FNameParser(), Sx_SlimFast(),
         Sx_Version(), Sx_Error(),

    + added SIx3 compatible commands:
         SET DIRTYREAD ON|OFF
         USE ... [TRIGGER <cTrigger>] [PASSWORD <cPassword>]
         SORT ... USECURRENT
         WILDSEEK <str>
         WILDSEEKNEXT <str>
         CLEAR ORDER <order>
         SET TAGORDER TO [<order>]
         SET ORDER TO TAG <(tag)> [OF <(bag)>]
         SET TAG TO [<tag> [OF <(bag)>]]
         REINDEX OPTION <eval> [STEP <step>]
         DELETE TAG <(tag1)> [OF <(bag1)>] [, <(tagN)> [OF <(bagN)>]]
         DELETE TAG ALL [OF <(bag)>]
         CLEAR SCOPE
         SET SCOPETOP TO [<value>]
         SET SCOPEBOTTOM TO [<value>]
         SET SCOPE TO [<value>]
         SET TURBOREAD ON|OFF
         MEMOPACK [BLOCK <size>] [OPTION <opt> [STEP <step>]]
         SET MEMOBLOCK TO <value>
         SUBINDEX ON <key> TO <(file)> ;
               [OPTION <eval> [STEP <every>]] [FILTERON] [EMPTY]
         SUBINDEX ON <key> TAG <(tag)> [OF <(bag)>] [TO <(bag)>] ;
               [OPTION <eval> [STEP <every>]] [FILTERON] [EMPTY]
         INDEX ON <key> [TAG <(tag)>] TO <(bag)> ;
               [OPTION <eval> [STEP <every>]] [FILTERON] [EMPTY] [SUBINDEX]
         INDEX ON <key> TAG <(tag)> [OF <(bag)>] [TO <(bag)>] ;
               [OPTION <eval> [STEP <every>]] [FILTERON] [EMPTY] [SUBINDEX]

      Unlike Ads*() functions the Sx_*() ones can be used with any RDD
      and will work if RDD supports necessary functionality.

      The global settings in SIx3 are RDD dependent in Harbour, f.e.
      in SIx3 Sx_MemoExt() change MEMO file extensions in all SIX* RDDs
      but in Harbour only in default RDD driver.
      In Harbour default trigger function "Sx_DefTrigger" is not
      enabled by default. If user needs such functionality then he
      has to enable it himself using
         rddInfo( RDDI_TRIGGER, "SX_DEFTRIGGER", [<cRDD>] )
      f.e. this code:
         init procedure sx_inittrig()
            local aRDDs := { "DBF", "DBFNTX", "DBFCDX", "SIXCDX", ;
                             "RMDBFNTX", "RMDBFCDX" }
            local aRDDList := RddList(), cRdd

            for each cRdd in aRDDs
               if ascan( aRDDList, { |x| x == cRdd } ) != 0
                  rddInfo( RDDI_TRIGGER, "SX_DEFTRIGGER", cRDD )
               endif
            next
         return
      sets SX_DEFTRIGGER as default trigger in DBF* based RDDs.

      I still do not allow to encrypt tables with memo fields to not
      replicate SIx3 bugs which may cause data corruption.
2007-09-25 01:21:03 +00:00

632 lines
20 KiB
Bash
Executable File

#!/bin/sh
[ "$BASH" ] || exec bash `which $0` ${1+"$@"}
#
# $Id$
#
# ---------------------------------------------------------------
# Copyright 2003 Przemyslaw Czerpak <druzus@priv.onet.pl>
# small set of functions used by Harbour scripts
# warning: some bash extensions are used
#
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
get_hbplatform()
{
local id
if [ "$OSTYPE" = "msdosdjgpp" ]; then
id="djgpp"
else
# please add your distro suffix if it not belong to the one recognized below
# and remember that order checking can be important
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' mandriva-release-One 2>/dev/null) && echo "mdk$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' mandriva-release 2>/dev/null) && echo "mdk$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' mandrake-release 2>/dev/null) && echo "mdk$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' redhat-release 2>/dev/null) && echo "rh$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' fedora-release 2>/dev/null) && echo "fc$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' suse-release 2>/dev/null) && echo "fc$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' conectiva-release 2>/dev/null) && echo "cl$rel"|tr -d "."`
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' aurox-release 2>/dev/null) && echo "cl$rel"|tr -d "."`
[ "${id}" = "" ] && id=`[ -f /etc/pld-release ] && cat /etc/pld-release|sed -e '/1/ !d' -e 's/[^0-9]//g' -e 's/^/pld/'`
[ "${id}" = "" ] && id=`uname -sr | tr '[ A-Z]' '[_a-z]'`
case "${id}" in
mingw*) id="mingw" ;;
*) ;;
esac
fi
echo -n "${id}"
}
get_hbver()
{
local FVER MAJOR MINOR REVIS hb_rootdir
hb_rootdir="${1-.}"
FVER="${hb_rootdir}/include/hbver.h"
MAJOR=`sed -e '/HB_VER_MAJOR/ !d' -e 's/[^0-9]*\([^ ]*\).*/\1/g' "${FVER}"`
MINOR=`sed -e '/HB_VER_MINOR/ !d' -e 's/[^0-9]*\([^ ]*\).*/\1/g' "${FVER}"`
REVIS=`sed -e '/HB_VER_REVISION/ !d' -e 's/[^0-9]*\([^ ]*\).*/\1/g' "${FVER}"`
echo -n "${MAJOR}.${MINOR}.${REVIS}"
}
get_solibname()
{
local name
name="${HB_SHAREDLIB_NAME}"
[ -z "${name}" ] && name="harbour"
echo -n "${name}"
}
mk_hbgetlibs()
{
if [ -z "$@" ]
then
echo -n "vm pp rtl rdd dbffpt dbfcdx dbfntx hsx hbsix usrrdd ${HB_DB_DRVEXT} macro common lang codepage gtcrs gtsln gtxvt gtxwc gtalleg gtcgi gtstd gtpca gttrm gtwin gtwvt gtdos gtos2 debug profiler compiler hbpcre"
else
echo -n "$@"
fi
}
mk_hbgetlibsctb()
{
if [ -z "$@" ]
then
echo -n "rddads ct nf tip xhb hbgd hbodbc hbole hbpg hbmysql"
else
echo -n "$@"
fi
}
mk_hbtools()
{
local name hb_pref hb_tool hb_libs hb_libsc
name=`get_solibname`
hb_pref="$4"
[ -z "${hb_pref}" ] && hb_pref="${HB_TOOLS_PREF-hb}"
hb_cmpname="${HB_CMPNAME-harbour}"
if [ "${HB_ARCHITECTURE}" = "dos" ]; then
hb_tool="$1/${hb_pref}-bld"
hb_path_separator=";"
hb_static="yes"
hb_static_default=" (default)"
hb_exesuf=".exe"
elif [ "${HB_ARCHITECTURE}" = "w32" ]; then
hb_tool="$1/${hb_pref}-build"
hb_path_separator=":"
hb_static="yes"
hb_static_default=" (default)"
hb_exesuf=".exe"
else
hb_tool="$1/${hb_pref}-build"
hb_path_separator=":"
hb_static="no"
hb_shared_default=" (default)"
hb_exesuf=""
fi
hb_libs=`mk_hbgetlibs "$2"`
hb_libsc=`mk_hbgetlibsctb "$3"`
[ -z "${HB_GT_LIB}" ] && HB_GT_LIB="gtstd"
[ -z "${_DEFAULT_BIN_DIR}" ] && _DEFAULT_BIN_DIR="${HB_BIN_INSTALL}"
[ -z "${_DEFAULT_INC_DIR}" ] && _DEFAULT_INC_DIR="${HB_INC_INSTALL}"
[ -z "${_DEFAULT_LIB_DIR}" ] && _DEFAULT_LIB_DIR="${HB_LIB_INSTALL}"
HB_SYS_LIBS="-lm"
HB_CRS_LIB=""
HB_SLN_LIB=""
if [ "${C_USR//-DHB_PCRE_REGEX/}" != "${C_USR}" ]; then
HB_SYS_LIBS="-lpcre ${HB_SYS_LIBS}"
hb_libs="${hb_libs//hbpcre/}"
elif [ "${C_USR//-DHB_POSIX_REGEX/}" != "${C_USR}" ]; then
hb_libs="${hb_libs//hbpcre/}"
fi
if [ "${HB_COMPILER}" = "mingw32" ]; then
HB_SYS_LIBS="${HB_SYS_LIBS} -luser32 -lwinspool -lgdi32 -lcomctl32 -lcomdlg32 -lole32 -loleaut32 -luuid -lwsock32 -lws2_32"
elif [ "${HB_COMPILER}" = "djgpp" ]; then
HB_SYS_LIBS="${HB_SYS_LIBS}"
else
if [ "${HB_ARCHITECTURE}" = "linux" ]; then
HB_SYS_LIBS="${HB_SYS_LIBS} -ldl"
fi
if [ "${HB_ARCHITECTURE}" = "sunos" ]; then
HB_SYS_LIBS="${HB_SYS_LIBS} -lrt"
HB_CRS_LIB="curses"
elif [ -n "${HB_CURSES_VER}" ]; then
HB_CRS_LIB="${HB_CURSES_VER}"
elif [ "${HB_NCURSES_194}" = "yes" ]; then
HB_CRS_LIB="ncur194"
else
HB_CRS_LIB="ncurses"
fi
HB_SLN_LIB="slang"
fi
echo "Generating ${hb_tool}... "
cat > ${hb_tool} <<EOF
#!/bin/sh
[ "\$BASH" ] || exec bash \`which \$0\` \${1+"\$@"}
#
# ---------------------------------------------------------------
# Copyright 2003 Przemyslaw Czerpak <druzus@priv.onet.pl>
# simple script to build binaries .tgz from Harbour sources
#
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
#
# set environment variables
export HB_ARCHITECTURE="${HB_ARCHITECTURE}"
export HB_COMPILER="${HB_COMPILER}"
[ -z "\${HB_BIN_INSTALL}" ] && export HB_BIN_INSTALL="${_DEFAULT_BIN_DIR}"
[ -z "\${HB_INC_INSTALL}" ] && export HB_INC_INSTALL="${_DEFAULT_INC_DIR}"
[ -z "\${HB_LIB_INSTALL}" ] && export HB_LIB_INSTALL="${_DEFAULT_LIB_DIR}"
# be sure that ${name} binaries are in your path
export PATH="\${HB_BIN_INSTALL}${hb_path_separator}${CCPATH}\${PATH}"
if [ "\${HB_COMPILER}" == "gpp" ]; then
HB_CC="g++"
else
HB_CC="gcc"
fi
if [ \$# = 0 ]; then
echo "syntax: \$0 [<options,...>] <file>[.prg|.o]
\"${hb_pref}cc\", \"${hb_pref}cmp\", \"${hb_pref}lnk\" and \"${hb_pref}mk\" parameters:
-o<outputfilename> # output file name
\"${hb_pref}lnk\" and \"${hb_pref}mk\" parameters:
-static # link with static ${name} libs${hb_static_default}
-fullstatic # link with all static libs
-shared # link with shared libs${hb_shared_default}
-mt # link with multi-thread libs
-gt<hbgt> # link with <hbgt> GT driver, can be repeated to
# link with more GTs. The first one will be
# the default at runtime
-xbgtk # link with xbgtk library (xBase GTK+ interface)
-hwgui # link with HWGUI library (GTK+ interface)
-l<libname> # link with <libname> library
-L<libpath> # additional path to search for libraries
-fmstat # link with the memory statistics lib
-nofmstat # do not link with the memory statistics lib (default)
-[no]strip # strip (no strip) binaries
-main=<main_func> # set the name of main program function/procedure.
# if not set then 'MAIN' is used or if it doesn't
# exist the name of first public function/procedure
# in first linked object module (link)
"
exit 1
elif [ "\$*" = "mk-links" ]; then
DIR="\${0%/*}"
NAME="\${0##*/}"
if [ "\${DIR}" != "\${NAME}" ]; then
(cd "\${DIR}"
for n in ${hb_pref}cc ${hb_pref}cmp ${hb_pref}mk ${hb_pref}lnk gharbour harbour-link; do
if [ "\${HB_ARCHITECTURE}" = "dos" ]; then
cp -f "\${NAME}" "\${n}"
else
ln -sf "\${NAME}" "\${n}"
fi
done
)
fi
exit
fi
## default parameters
HB_STATIC="${hb_static}"
HB_MT=""
HB_GT="${HB_GT_LIB#gt}"
HB_GPM_MOUSE="${HB_GPM_MOUSE}"
HB_GT_REQ=""
HB_FM_REQ=""
HB_STRIP="yes"
HB_MAIN_FUNC=""
HB_XBGTK=""
HB_HWGUI=""
HB_USRLIBS=""
HB_USRLPATH=""
HB_GEN=""
[ -n "\$TMPDIR" ] || TMPDIR="\$TMP"
[ -n "\$TMPDIR" ] || TMPDIR="\$TEMP"
[ -n "\$TMPDIR" ] || TMPDIR="/tmp"
_TMP_FILE_="\${TMPDIR}/hb-build-\$USER-\$\$.c"
## parse params
P=( "\$@" ); n=0; DIROUT="."; FILEOUT=""
while [ \$n -lt \${#P[@]} ]; do
v=\${P[\$n]}; p=""
case "\$v" in
-o*)
d="\${v#-o}"; p="\${v}"
if [ -d "\${d}" ]; then
DIROUT="\${d%/}"
elif [ -d "\${d%/*}" ]; then
DIROUT="\${d%/*}"; FILEOUT="\${d##*/}"; p="-o\${d%.*}"
elif [ -n "\${d}" ]; then
FILEOUT="\${d}"; p="-o\${d%.*}"
fi ;;
-static) HB_STATIC="yes" ;;
-fullstatic) HB_STATIC="full" ;;
-shared) HB_STATIC="no" ;;
-xbgtk) HB_XBGTK="yes" ;;
-hwgui) HB_HWGUI="yes" ;;
-mt) HB_MT="MT" ;;
-gt*) HB_GT_REQ="\${HB_GT_REQ} \${v#-gt}" ;;
-fmstat) HB_FM_REQ="STAT" ;;
-nofmstat) HB_FM_REQ="NOSTAT" ;;
-strip) HB_STRIP="yes" ;;
-nostrip) HB_STRIP="no" ;;
-l[^-]*) HB_USRLIBS="\${HB_USRLIBS} \${v}" ;;
-L[^-]*) HB_USRLPATH="\${HB_USRLPATH} \${v}" ;;
-main=*) HB_MAIN_FUNC="\${v#*=}" ;;
-g[cohwij]) HB_GEN="\${v#-g}"; p="\${v}" ;;
-gc[0-9]) HB_GEN="c"; p="\${v}" ;;
-go[0-9]) HB_GEN="o"; p="\${v}" ;;
-*) p="\${v}" ;;
*) [ -z \${FILEOUT} ] && FILEOUT="\${v##*/}"; p="\${v}" ;;
esac
[ -n "\$p" ] && PP[\$n]="\$p"
n=\$[\$n + 1]
done
P=( "\${PP[@]}" )
case "\${HB_MT}" in
[Mm][Tt]|[Yy][Ee][Ss]|1) HB_MT="MT";;
*) HB_MT="";;
esac
SYSTEM_LIBS="${HB_SYS_LIBS}"
# use pthread system library for MT programs
if [ "\${HB_MT}" = "MT" ]; then
case "\${HB_ARCHITECTURE}" in
dos|w32|os2)
;;
*)
SYSTEM_LIBS="-lpthread \${SYSTEM_LIBS}"
;;
esac
fi
HB_GT_STAT=""
[ -z "\${HB_GT_REQ}" ] && HB_GT_REQ="\${HB_GT}"
HB_GT_REQ=\`echo \${HB_GT_REQ}|tr '[a-z]' '[A-Z]'\`
HB_MAIN_FUNC=\`echo \${HB_MAIN_FUNC}|tr '[a-z]' '[A-Z]'\`
HB_PATHS="-I\${HB_INC_INSTALL}"
GCC_PATHS="\${HB_PATHS} -L\${HB_LIB_INSTALL}"
LN_OPT="${CC_L_USR}"
CC_OPT="${CC_C_USR}"
HB_OPT="${CC_PRG_USR}"
[ "\${HB_GEN}" != "" ] || HB_OPT="\${HB_OPT} -gc0"
HB_GPM_LIB=""
if [ -f "\${HB_LIB_INSTALL}/libgtsln.a" ]; then
if [ "\${HB_ARCHITECTURE}" = "darwin" ]; then
SYSTEM_LIBS="\${SYSTEM_LIBS} -L/sw/lib -L/opt/local/lib"
elif [ "\${HB_ARCHITECTURE}" = "bsd" ]; then
SYSTEM_LIBS="\${SYSTEM_LIBS} -L/usr/local/lib"
fi
SYSTEM_LIBS="\${SYSTEM_LIBS} -l${HB_SLN_LIB:-slang}"
[ "\${HB_GPM_MOUSE}" = "yes" ] && HB_GPM_LIB="gpm"
fi
if [ -f "\${HB_LIB_INSTALL}/libgtcrs.a" ]; then
SYSTEM_LIBS="\${SYSTEM_LIBS} -l${HB_CRS_LIB:-ncurses}"
[ "\${HB_GPM_MOUSE}" = "yes" ] && HB_GPM_LIB="gpm"
fi
if [ "\${HB_WITHOUT_X11}" != "yes" ]; then
if [ -f "\${HB_LIB_INSTALL}/libgtxvt.a" ] || [ -f "\${HB_LIB_INSTALL}/libgtxwc.a" ]; then
[ -d "/usr/X11R6/lib64" ] && SYSTEM_LIBS="\${SYSTEM_LIBS} -L/usr/X11R6/lib64"
SYSTEM_LIBS="\${SYSTEM_LIBS} -L/usr/X11R6/lib -lX11"
fi
fi
[ -n "\${HB_GPM_LIB}" ] && SYSTEM_LIBS="\${SYSTEM_LIBS} -l\${HB_GPM_LIB}"
if [ "\${HB_XBGTK}" = "yes" ]; then
SYSTEM_LIBS="\${SYSTEM_LIBS} \`pkg-config --libs gtk+-2.0\`"
elif [ "\${HB_HWGUI}" = "yes" ]; then
SYSTEM_LIBS="\${SYSTEM_LIBS} \`pkg-config --libs gtk+-2.0 --libs libgnomeprint-2.2\`"
fi
if [ "\${HB_STATIC}" = "full" ]; then
if [ "\${HB_ARCHITECTURE}" = "linux" ]; then
SYSTEM_LIBS="\${SYSTEM_LIBS} -ldl -lpthread"
fi
LN_OPT="\${LN_OPT} -static"
HB_STATIC="yes"
fi
HB_LNK_REQ=""
for gt in \${HB_GT_REQ}; do
if [ "\${HB_STATIC}" = "yes" ] || [ "\${gt}" = "ALLEG" ]; then
HB_LNK_REQ="\${HB_LNK_REQ} HB_GT_\${gt}"
if [ "\${gt}" = "ALLEG" ]; then
if [ "\${HB_STATIC}" = "yes" ]; then
SYSTEM_LIBS="\`allegro-config --static 2>/dev/null\` \${SYSTEM_LIBS}"
else
SYSTEM_LIBS="\`allegro-config --libs 2>/dev/null\` \${SYSTEM_LIBS}"
fi
fi
fi
done
[ -n "\${HB_FM_REQ}" ] && HB_LNK_REQ="\${HB_LNK_REQ} HB_FM_\${HB_FM_REQ}"
HB_LNK_ATTR=""
HARBOUR_LIBS=""
if [ "\${HB_STATIC}" = "yes" ]; then
libs="${hb_libs} ${hb_libsc}"
else
l="${name}"
if [ "\${HB_ARCHITECTURE}" = "darwin" ]; then
pref="lib"
ext=".dylib"
LN_OPT="\${LN_OPT} -bind_at_load -multiply_defined suppress"
elif [ "\${HB_ARCHITECTURE}" = "w32" ]; then
pref=""
ext=".dll"
HB_LNK_ATTR="__attribute__ ((dllimport))"
else
pref="lib"
ext=".so"
fi
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/\${pref}\${l}mt\${ext}" ] && l="\${l}mt"
[ -f "\${HB_LIB_INSTALL}/\${pref}\${l}\${ext}" ] && HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
libs="gtalleg hbodbc debug profiler ${hb_libsc}"
fi
for l in \${libs}
do
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt"
if [ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ]; then
HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
fi
done
if [ "\${HB_XBGTK}" = "yes" ]; then
HARBOUR_LIBS="\${HARBOUR_LIBS} -lxbgtk"
HB_PATHS="\${HB_PATHS} -I\`PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --variable=xbgtkincludedir xbgtk\`"
fi
if [ "\${HB_HWGUI}" = "yes" ]; then
HARBOUR_LIBS="\${HARBOUR_LIBS} -lhwgui -lprocmisc -lhbxml"
fi
if [ "\${HB_ARCHITECTURE}" = "darwin" ] || \\
[ "\${HB_ARCHITECTURE}" = "sunos" ] || \\
[ "\${HB_ARCHITECTURE}" = "hpux" ]; then
HARBOUR_LIBS="\${HARBOUR_LIBS} \${HARBOUR_LIBS}"
else
HARBOUR_LIBS="-Wl,--start-group \${HARBOUR_LIBS} -Wl,--end-group"
fi
l="fm"
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt"
if [ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ]; then
if [ "\${HB_STATIC}" = "yes" ] && [ "\${HB_FM_REQ}" = "STAT" ]; then
HARBOUR_LIBS="-l\${l} \${HARBOUR_LIBS}"
else
HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
fi
fi
if [ "\${HB_ARCHITECTURE}" = "darwin" ]; then
CC_OPT="\${CC_OPT} -no-cpp-precomp -Wno-long-double"
elif [ "\${HB_ARCHITECTURE}" = "sunos" ]; then
HB_STRIP="no"
fi
FOUTC="\${DIROUT}/\${FILEOUT%.*}.c"
FOUTO="\${DIROUT}/\${FILEOUT%.*}.o"
FOUTE="\${DIROUT}/\${FILEOUT%.[Pp][Rr][Gg]}"
FOUTE="\${FOUTE%.[oc]}${hb_exesuf}"
hb_cc()
{
local LNK_OPT P n
LNK_OPT="\${LN_OPT} \${HB_USRLPATH} \${HB_USRLIBS} \${HARBOUR_LIBS} \${SYSTEM_LIBS}"
P=( "\$@" ); n=0
while [ \$n -lt \${#P[@]} ]; do
if [ "\${P[\$n]}" = "-c" ]; then
LNK_OPT=""
n=\${#P[@]}
fi
n=\$[\$n + 1]
done
${CCPREFIX}\${HB_CC} "\$@" \${CC_OPT} \${GCC_PATHS} \${LNK_OPT}
}
hb_cmp()
{
${hb_cmpname} "\$@" \${HB_OPT} \${HB_PATHS} && \\
( [ "\${HB_GEN//c/}" != "" ] || \\
( [ -f "\${FOUTC}" ] && \\
hb_cc -c "\${FOUTC}" -o "\${FOUTO}" && \\
( [ "\${HB_GEN}" = "c" ] || rm -f "\${FOUTC}" ) ) )
}
hb_link()
{
if [ "\${HB_COMPILER}" != "djgpp" ]; then
if [ -n "\${HB_MAIN_FUNC}" ]; then
HB_MAIN_FUNC="@\${HB_MAIN_FUNC}"
elif [ -f "\${FOUTO}" ]; then
HB_MAIN_FUNC=\`hb_lnk_main "\${FOUTO}"\`
fi
fi
if [ -n "\${HB_LNK_REQ}" ] || [ -n "\${HB_GT_REQ}" ] || [ -n "\${HB_MAIN_FUNC}" ]; then
hb_lnk_request > \${_TMP_FILE_}
LN_OPT="\${_TMP_FILE_} \${LN_OPT}"
fi
hb_cc "\$@" -o "\${FOUTE}"
}
hb_lnk_request()
{
echo "#include \\"hbapi.h\\""
if [ -n "\${HB_LNK_REQ}" ]; then
for fn in \${HB_LNK_REQ}; do
echo "HB_FUNC_EXTERN( \${fn} );"
done
echo "void _hb_lnk_ForceLink_build( void )"
echo "{"
for fn in \${HB_LNK_REQ}; do
echo " HB_FUNC_EXEC( \${fn} );"
done
echo "}"
fi
gt="\${HB_GT_REQ%% *}"
if [ -n "\$gt" ] || [ -n "\${HB_MAIN_FUNC}" ]; then
echo "#include \\"hbinit.h\\""
echo "HB_EXTERN_BEGIN"
echo "extern \${HB_LNK_ATTR} char * s_defaultGT;"
echo "extern \${HB_LNK_ATTR} char * s_pszLinkedMain;"
echo "HB_EXTERN_END"
echo "HB_CALL_ON_STARTUP_BEGIN( hb_lnk_SetDefault_build )"
if [ -n "\$gt" ]; then
echo " s_defaultGT = \\"\$gt\\";"
fi
if [ -n "\${HB_MAIN_FUNC}" ]; then
echo " s_pszLinkedMain = \\"\${HB_MAIN_FUNC}\\";"
fi
echo "HB_CALL_ON_STARTUP_END( hb_lnk_SetDefault_build )"
fi
}
hb_lnk_main()
{
(${CCPREFIX}nm \$1 -g -n --defined-only -C|sed -e '/ HB_FUN_/ ! d' -e 's/^[0-9a-fA-F]* T HB_FUN_\([A-Z0-9_]*\).*/\1/'|head -1|grep -v '^MAIN\$')2>/dev/null
# (${CCPREFIX}nm \$1 -n --defined-only|sed -e '/HB_FUN_/ ! d' -e 's/^[0-9a-fA-F]* [Tt] HB_FUN_//'|head -1|grep -v '^MAIN\$')2>/dev/null
}
hb_cleanup()
{
rm -f "\${_TMP_FILE_}"
}
trap hb_cleanup EXIT &>/dev/null
## get basename
HB="\${0##*/}"
case "\${HB}" in
*cc)
hb_cc "\${P[@]}"
;;
*cmp|gharbour)
hb_cmp "\${P[@]}"
;;
*lnk|harbour-link)
hb_link "\${P[@]}" && \\
( [ "\${HB_STRIP}" != "yes" ] || strip "\${FOUTE}" )
;;
*mk)
hb_cmp "\${P[@]}" && \\
hb_link "\${FOUTO}" && \\
( [ "\${HB_STRIP}" != "yes" ] || strip "\${FOUTE}" ) && \\
rm -f "\${FOUTO}"
;;
esac
EOF
chmod 755 ${hb_tool}
echo "Creating links..."
${hb_tool} mk-links
}
mk_hblibso()
{
local LIBS LIBSMT l lm ll hb_rootdir hb_ver hb_libs full_lib_name full_lib_name_mt linker_options
name=`get_solibname`
hb_rootdir="${1-.}"
hb_ver=`get_hbver "${hb_rootdir}"`
hb_libs=`mk_hbgetlibs "$2"`
[ -z "${HB_GT_LIB}" ] && HB_GT_LIB="gtstd"
(cd $HB_LIB_INSTALL
LIBS=""
LIBSMT=""
for l in ${hb_libs}
do
case $l in
debug|profiler|fm|hbodbc|gtalleg|rddads) ;;
*)
ls="lib${l}.a"
if [ -f lib${l}mt.a ]
then
lm="lib${l}mt.a"
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 [ "${l}" = gtcrs ]; then
linker_options="$linker_options -lncurses"
elif [ "${l}" = gtsln ]; then
if [ "${HB_WITHOUT_GTSLN}" != "yes" ]; then
linker_options="$linker_options -lslang"
fi
fi
fi
;;
esac
done
if [ "${HB_ARCHITECTURE}" = "darwin" ]; then
full_lib_name="lib${name}.${hb_ver}.dylib"
full_lib_name_mt="lib${name}mt.${hb_ver}.dylib"
linker_options="-L/sw/lib -L/opt/local/lib $linker_options"
elif [ "${HB_ARCHITECTURE}" = "w32" ]; then
full_lib_name="${name}.dll"
full_lib_name_mt="${name}mt.dll"
else
full_lib_name="lib${name}-${hb_ver}.so"
full_lib_name_mt="lib${name}mt-${hb_ver}.so"
fi
echo "Making ${full_lib_name}..."
$HB_BIN_INSTALL/hb-mkslib ${full_lib_name} $LIBS ${linker_options}
if [ "$HB_MT" = "MT" ]; then
echo "Making ${full_lib_name_mt}..."
$HB_BIN_INSTALL/hb-mkslib ${full_lib_name_mt} $LIBSMT ${linker_options}
fi
for l in ${full_lib_name} ${full_lib_name_mt}
do
if [ -f $l ]
then
if [ "${HB_ARCHITECTURE}" = "darwin" ]; then
ll=${l%.${hb_ver}.dylib}.dylib
elif [ "${HB_ARCHITECTURE}" = "w32" ]; then
ll=""
else
ll=${l%-${hb_ver}.so}.so
ln -sf $l $ll
fi
if [ -n "$ll" ]; then
case $HB_LIB_INSTALL in
*/usr/lib/*|*/usr/lib64/*|*/usr/local/lib/*|*/usr/local/lib64/*)
ln -sf ${name}/$l ../$ll
;;
*/usr/local/*)
mkdir -p ../../lib
ln -sf ../${name}/lib/$l ../../lib/$ll
;;
*)
;;
esac
fi
fi
done
)
#export LD_LIBRARY_PATH="$HB_LIB_INSTALL:$LD_LIBRARY_PATH"
}