* harbour/bin/hb-func.sh
! restored default optimization flag (-O3) in hb* scripts
* harbour/harbour.spec
! fixed recent modification
* harbour/contrib/rddads/ads1.c
* harbour/contrib/rddads/adsfunc.c
* harbour/contrib/hbmisc/strfmt.c
* harbour/contrib/hbcrypt/sha1.c
! fixed wrongly used C reference operator
* harbour/contrib/hbwin/win_prn2.c
* harbour/contrib/hbwin/wapi_commctrl.c
* harbour/source/vm/maindllp.c
! fixes for unicode builds
* harbour/include/std.ch
+ added SET TIME FORMAT [TO] <f>
* harbour/include/set.ch
* harbour/include/hbset.h
* harbour/source/vm/set.c
+ added _SET_TIMEFORMAT
The folowing modifiers are supported:
hh - hours
mm - minutes
ss - seconds
fff - fraction part of seconds
p - 1-st letter from PM / AM signature. When used time is shown
in 12 hour format otherwise 24 hour format is used
ex: Set( __SET_TIMEFORMAT, "hh:mm pm" )
default _SET_TIMEFORMAT value is "hh:mm:ss:fff"
+ added C function: char * hb_setGetTimeFormat( void );
* harbour/include/hbpp.h
* harbour/source/pp/ppcore.c
+ added support for timestamp constant values in the form:
t"YYYY-MM-DD HH:MM:SS.fff"
The exact accepted timestamp pattern is is:
YYYY-MM-DD [H[H][:M[M][:S[S][.f[f[f[f]]]]]]] [PM|AM]
i.e.:
tValue := t"2009-03-21 5:31:45.437 PM"
or:
YYYY-MM-DDT[H[H][:M[M][:S[S][.f[f[f[f]]]]]]] [PM|AM]
with literal "T" as date and time part delimiters (XML timestamp
format), i.e.:
tValue := t"2009-03-21T17:31:45.437"
The folowing characters can be used as date delimiters: "-", "/", "."
if PM or AM is used HH is in range < 1 : 12 > otherwise
in range < 0 : 23 >
* harbour/source/compiler/complex.c
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
* harbour/source/compiler/harbour.yyh
+ added support for t"YYYY-MM-DD HH:MM:SS.fff" time stamp constant
to compiler
+ added support for VFP datetime constant values:
{ ^ [ YYYY-MM-DD [,] ] [ HH[:MM[:SS][.FFF]] [AM|PM] ] }
The following characters can be used as date delimiters: "-", "/".
Dot "." as date delimiter is not supported.
There is no limit on number of characters in YYYY, MM, DD, HH, MM,
SS, FFF parts. Important is only their value. This is the format
in semi PP notation:
{ ^ <YEAR> <sep:/-> <MONTH> <sep:/-> <DAY> [[<sep2:,>]
[ <HOUR> [ : <MIN> [ : <SEC> [ . <FRAQ> ] ] ] [AM|PP] ] }
In practice it allows to also parse xHarbour datetime constant
values with compatible conditions though xHarbour support onlu "/"
as date delimiter.
NOTE: there is one important difference to VFP and xHarbour in
decoding above format. In VFP and xHarbour when date part is
missing then it's set by default to: 1899-12-30 so this code:
{ ^ 12:00 }
gived the same results as:
{ ^ 1899/12/30 12:00 }
Harbour does not set any default date value when timestamp
constant value contains only time part.
If you want we can change it for strict VFP compatiblity.
Now this extension is enabled by default for testing. In the future
it will be probably covered by HB_COMPAT_FOXPRO macro.
* harbour/source/macro/macro.yyc
* harbour/source/macro/macro.y
* harbour/source/macro/macro.yyh
* harbour/source/macro/macrolex.c
+ added support for t"YYYY-MM-DD HH:MM:SS.fff" time stamp constant
to macro compiler
* harbour/include/hbmacro.h
* harbour/source/vm/macro.c
+ added new function:
void hb_macroGenPushTimeStamp( LONG lDate, LONG lTime, HB_COMP_DECL );
* harbour/include/hberrors.h
* harbour/source/compiler/hbgenerr.c
+ added new compile time error: "Invalid timestamp constant '%s'"
* harbour/source/compiler/cmdcheck.c
* use Harbour API timestamp functions instead of calling system
functions
* harbour/include/hbpcode.h
* harbour/source/compiler/hbfix.c
* harbour/source/compiler/hbpcode.c
* harbour/source/compiler/hbdead.c
* harbour/source/compiler/genc.c
* harbour/source/compiler/gencc.c
* harbour/source/compiler/hblbl.c
* harbour/source/compiler/hbstripl.c
* harbour/source/compiler/hbopt.c
+ added new PCODE HB_P_PUSHTIMESTAMP (replaced one unused PCODE value)
to store timestamp constant values in the PCODE
* harbour/include/hbcomp.h
* harbour/source/compiler/hbmain.c
+ added new function:
void hb_compGenPushTimeStamp( LONG lDate, LONG lTime, HB_COMP_DECL );
* harbour/include/hbexprop.h
* harbour/source/common/expropt1.c
+ added new C functions:
HB_EXPR_PTR hb_compExprNewTimeStamp( LONG, LONG, HB_COMP_DECL );
* harbour/include/hbexprb.c
* harbour/include/hbcompdf.h
* harbour/source/common/expropt2.c
+ added timestamp expressions support
+ added compile time optimization for timestamp expressions
* updated function optimization for timestamp expressions
* harbour/include/hbdate.h
* harbour/source/common/hbdate.c
* changed hb_dateMilliSeconds() to return UTC julian timestamp in
milliseconds
* changed existing seconds, time and timestamp functions to operate
on common OS specific functions to eliminate possible problems
with different OS time counters
+ added new functions to operates on time and timestamp values.
See source code for details.
+ harbour/source/rtl/cputime.c
* moved double hb_secondsCPU( int n ) function to separate file
* harbour/source/rtl/seconds.c
- removed old version of date/seconds functions
* harbour/source/vm/hashes.c
* harbour/source/vm/arrays.c
+ added support for timestamp values as hash item indexes
* harbour/source/vm/hashfunc.c
+ added support for find timestamp values in hash and array items
by simple date value in AScan(), hb_HScan(), hb_AScan() and hb_RAScan()
functions when exact comparison is not used.
* harbour/source/vm/asort.c
+ added support for sorting timestamp values
* harbour/source/vm/classes.c
+ added support for timestamp scallar classes
+ added support for timestamp typed instance variables
* harbour/source/vm/memvars.c
+ added support for timestamp values in .mem files
* harbour/source/vm/estack.c
+ show timestamp values in stack dump
* harbour/include/hbapi.h
* harbour/source/vm/arrays.c
+ added new C functions:
double hb_arrayGetTD( PHB_ITEM pArray, ULONG ulIndex );
BOOL hb_arraySetTD( PHB_ITEM pArray, ULONG ulIndex, double dTimeStamp )
BOOL hb_arrayGetTDT( PHB_ITEM pArray, ULONG ulIndex,
LONG * plJulian, LONG * plMilliSec );
BOOL hb_arraySetTDT( PHB_ITEM pArray, ULONG ulIndex,
LONG lJulian, LONG lMilliSec );
* harbour/include/hbapi.h
* harbour/source/vm/extend.c
+ accept timestamp items in date functions - use only date part of
timestamp value
+ added new C functions:
double hb_partd( int iParam, ... );
BOOL hb_partdt( LONG * plJulian, LONG * plMilliSec , int iParam, ... );
void hb_rettd( double dTimeStamp );
void hb_rettdt( LONG lJulian, LONG lMilliSec );
int hb_stortd( double dTimeStamp, int iParam, ... );
int hb_stortdt( LONG lJulian, LONG lMilliSec, int iParam, ... );
* harbour/include/hbapiitm.h
* harbour/source/vm/itemapi.c
+ accept timestamp items in date functions - use only date part of
timestamp value
+ added new C functions:
char * hb_itemGetTS( PHB_ITEM pItem, char * szDateTime );
PHB_ITEM hb_itemPutTS( PHB_ITEM pItem, const char * szDateTime );
double hb_itemGetTD( PHB_ITEM pItem );
PHB_ITEM hb_itemPutTD( PHB_ITEM pItem, double dTimeStamp )
BOOL hb_itemGetTDT( PHB_ITEM pItem, LONG * plJulian, LONG * plMilliSec );
PHB_ITEM hb_itemPutTDT( PHB_ITEM pItem, LONG lJulian, LONG lMilliSec );
+ support for timestamp items in hb_itemString(), hb_itemPadConv() and
hb_itemTypeStr() functions
* harbour/include/hbvm.h
* harbour/include/hbxvm.h
* harbour/include/hbapi.h
* harbour/source/vm/hvm.c
+ added HB_IT_TIMESTAMP items
* modified HB_IT_DATE internal item structure to use common structure
with HB_IT_TIMESTAMP - it simplifies HVM code and eliminates additional
RT conditions.
+ added HB_IS_TIMESTAMP() and ISTIMESTAMP() macros
+ added HB_IS_DATETIME() and ISDATETIME() macros - they return true
if item/parameter is DATE or TIMESTAMP type.
+ added void hb_vmPushTimeStamp( long lJulian, long lMilliSec );
and xhb_vmPushTimeStamp()
+ added support for timestamp values in relational operators:
<, <=, >, >=, =, ==
When two timestamp values are compared then VM compares date and
time parts in both values.
When date and timestamp values are used in <, <=, >, >=, = operations
then VM compares only date part in both values.
When date and timestamp values are used in == operation then VM
compares date part in both values and then check if time part
of timestamp value is 0.
+ added support for timestamp values in + and - math operations.
The following rules are used in timestamp arithmetic:
<t> + <t> => <t>
<t> - <t> => <n>
<t> + <n> => <t>
<n> + <t> => <t>
<t> - <n> => <t>
<d> + <t> => <t>
<t> + <d> => <t>
<d> - <t> => <n>
<t> - <d> => <n>
When number is result or argument of timestamp operation then the
its integer part is a number of day and fractional part is the time.
* harbour/source/rtl/dateshb.c
+ added new .prg functions to mange date and timestamp values:
HB_DATETIME() -> <tTimeStamp>
HB_CTOD( <cDate> [, <cDateFormat> ] ) -> <dDate>
HB_DTOC( <dDate> [, <cDateFormat> ] ) -> <cDate>
HB_NTOT( <nValue> ) -> <tTimeStamp>
HB_TTON( <tTimeStamp> ) -> <nValue>
HB_TTOC( <tTimeStamp>, [ <cDateFormat> ] [, <cTimeFormat> ] ) ->
<cTimeStamp>
HB_CTOT( <cTimeStamp>, [ <cDateFormat> ] [, <cTimeFormat> ] ) ->
<tTimeStamp>
HB_TTOS( <tTimeStamp> ) -> <cYYYYMMDDHHMMSSFFF>
HB_STOT( <cDateTime> ) -> <tTimeStamp>
<cDateTime> should be in one of the above form:
- "YYYYMMDDHHMMSSFFF"
- "YYYYMMDDHHMMSSFF"
- "YYYYMMDDHHMMSSF"
- "YYYYMMDDHHMMSS"
- "YYYYMMDDHHMM"
- "YYYYMMDDHH"
- "YYYYMMDD"
- "HHMMSSFFF"
- "HHMMSSF"
- "HHMMSS"
- "HHMM"
- "HH"
Important is number of digits.
HB_TSTOSTR( <tTimeStamp> ) -> <cTimeStamp> // YYYY-MM-DD HH:MM:SS.fff
HB_STRTOTS( <cTimeStamp> ) -> <tTimeStamp>
<cTimeStamp> should be in one of the above form:
YYYY-MM-DD [H[H][:M[M][:S[S][.f[f[f[f]]]]]]] [PM|AM]
YYYY-MM-DDT[H[H][:M[M][:S[S][.f[f[f[f]]]]]]] [PM|AM]
The folowing characters can be used as date delimiters: "-", "/", "."
T - is literal "T" - it's for XML timestamp format
if PM or AM is used HH is in range < 1 : 12 > otherwise
in range < 0 : 23 >
HB_HOUR( <tTimeStamp> ) -> <nHour>
HB_MINUTE( <tTimeStamp> ) -> <nMinute>
HB_SEC( <tTimeStamp> ) -> <nSeconds> // with milliseconds
* harbour/source/rtl/datec.c
+ accept timestamp parameters in CMONTH() and CDOW() functions
* harbour/source/rtl/empty.c
+ added support for timestamp items
* harbour/source/rtl/itemseri.c
+ added support for timestamp items serialization
* harbour/source/rtl/minmax.c
+ added support for timestamp values to MIN() and MAX() functions.
when only one of given parameters is timestamp value and other
is date value and date parts are equal then always date item
is returned as both MIN() or MAX() value.
* harbour/source/rtl/dates.c
+ added new C functions: hb_timeFormat(), hb_timeUnformat(),
hb_timeStampFormat(), hb_timeStampUnformat()
* harbour/source/rtl/valtype.c
+ added .prg functions: HB_ISDATETIME(), HB_ISTIMESTAMP()
* harbour/source/rtl/transfrm.c
+ added support for timestamp items formatting.
+ added new function modifier @T.
When @T is used without @D then only time part of timestamp value
is formatted and return.
When @D is used without @T then only date part of timestamp value
is formatted and return.
* harbour/source/rtl/tbrowse.prg
+ display timestamp values
* harbour/source/rtl/philes.c
+ accept timestamp value as second parameter of HB_FSETDATETIME()
function
+ store file data and time in second parameter of HB_FGETDATETIME()
as timestamp value.
Old parameters (2-dDate, 3-cTime) are still supported but please think
about removing them - they are redundant.
* harbour/source/rtl/filesys.c
* updated function names
* harbour/source/rdd/dbf1.c
+ added native support for time and timestamp fields
* harbour/include/hbrddcdx.h
* harbour/include/hbrddnsx.h
* harbour/source/rdd/dbfntx/dbfntx1.c
* harbour/source/rdd/dbfcdx/dbfcdx1.c
* harbour/source/rdd/dbfnsx/dbfnsx1.c
* harbour/source/rdd/dbffpt/dbffpt1.c
+ added support for indexing timestamp fields
+ added support for using DATE values with timestamp fields
which replicate HVM behavior.
SEEK and SEEKLAST with date value when active index is on
timestamp positions to 1-st or last record where date part
of indexed timesamp value is equal.
Settings scopes to date values when active index is on timestamp
value reduce the visible record range to these ones which have
date part of timestamp value in the range of dates values used
for scopes. It possible to mix date and timestamp values in scope
and set one scope to date value and the second to timesamp.
* harbour/source/rdd/sdf1.c
* harbour/source/rdd/delim1.c
+ added support for exporting timestamp fields
* harbour/source/rdd/dbsql.c
! fixed typo in logical value export
+ export timestamp fields.
Please update the format to given SQL syntax.
* harbour/contrib/hbct/files.c
+ changed SETFDATI() to optionally accept timestamp parameter
instead of two parameters dDate and cTime
* harbour/contrib/hbct/misc1.c
+ added timestamp support to XTOC() function
* harbour/contrib/hbct/misc2.c
+ added timestamp support to COMPLEMENT() function
* harbour/contrib/hbct/dattime2.c
+ accept timestamp values in ADDMONTH(), DOY(), ISLEAP(), QUARTER()
LASTDAYOM(), WEEK() functions
* harbour/contrib/hbmzip/hbmzip.c
+ updated HB_ZipFileCreate( hZip, cZipName, tDateTime, cTime, ... )
functions to optionaly accept timestamp value in 3-rd parameter
instead od dDate, and cTime in 3-rd and 4-th parameters.
+ updated HB_UnzipFileInfo( hUnzip, @cZipName, @tDateTime, @cTime, ... )
to return timestamp value in 3-rd parameter instead of date value.
TODO: Please think about removing 4-th parameter from:
HB_ZipFileCreate( hZip, cZipName, tDateTime, cTime, ... )
HB_UnzipFileInfo( hUnzip, @cZipName, @tDateTime, @cTime, ... )
Now it's redundant.
* harbour/contrib/hbmzip/readme.txt
* updated parameters description for above functions
* harbour/contrib/hbnf/descendn.c
+ added timestamp support to FT_DESCEND() function
* harbour/contrib/hbclipsm/date.c
+ accept timestamp values in DATEASAGE(), DATEASARRAY() and DATEISLEAP()
functions
* harbour/contrib/hbmisc/dates2.c
+ accept timestamp values in ISLEAPYEAR(), DAYSINMONTH(), EOM(), BOM(),
WOM(), WOY(), EOY() and BOY() functions
The following contrib files should be updated but I'm leaving it to
other developers who want to keep this code alive:
contrib/hbtip/utils.c
contrib/hbvpdf/hbvpdf.prg
contrib/hbvpdf/hbvpdft.prg
contrib/hbwin/win_dll.c
some minor cleanups if necessary and authors will find
timestamp values usable
contrib/hbole/ole2.c
contrib/hbwin/win_ole.c
add support for timestamp values in OLE
contrib/rddado/adordd.prg
contrib/rddads/ads1.c
contrib/rddads/adsx.c
contrib/rddsql/...
add support for timestamp values in RDDs
Warning: this implementation is not xHarbour compatible. There are many
important differences. Mostly on C level and used API. Please be careful
in porting xHarbour source code to Harbour.
884 lines
30 KiB
Bash
Executable File
884 lines
30 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 "sus$rel"|tr -d "."`
|
|
[ "${id}" = "" ] && id=`rel=$(rpm -q --queryformat='.%{VERSION}' openSUSE-release 2>/dev/null) && echo "sus$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 -s | tr '[ A-Z]' '[_a-z]'`
|
|
case "${id}" in
|
|
mingw*) id="mingw" ;;
|
|
*) ;;
|
|
esac
|
|
fi
|
|
echo "${id}"
|
|
}
|
|
|
|
get_hbver()
|
|
{
|
|
local FVER MAJOR MINOR RELEA 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}"`
|
|
RELEA=`sed -e '/HB_VER_RELEASE/ !d' -e 's/[^0-9]*\([^ ]*\).*/\1/g' "${FVER}"`
|
|
echo "${MAJOR}.${MINOR}.${RELEA}"
|
|
}
|
|
|
|
get_hbver_win()
|
|
{
|
|
local FVER MAJOR MINOR 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}"`
|
|
echo "${MAJOR}${MINOR}"
|
|
}
|
|
|
|
get_hbverstat()
|
|
{
|
|
local FVER VERSTAT hb_rootdir
|
|
|
|
hb_rootdir="${1-.}"
|
|
FVER="${hb_rootdir}/include/hbver.h"
|
|
VERSTAT=`sed -e '/HB_VER_STATUS/ !d' -e 's/[^\"]*\"\([^\"]*\).*/\1/g' "${FVER}"`
|
|
echo "${VERSTAT}"
|
|
}
|
|
|
|
get_solibname()
|
|
{
|
|
local name
|
|
|
|
name="${HB_SHAREDLIB_NAME}"
|
|
[ -z "${name}" ] && name="harbour"
|
|
echo "${name}"
|
|
}
|
|
|
|
mk_hbgetlibs()
|
|
{
|
|
local libs
|
|
|
|
if [ -z "$@" ]
|
|
then
|
|
libs=""
|
|
if [ "$HB_COMPILER" != "mingwce" ]
|
|
then
|
|
libs="$libs gtwin"
|
|
fi
|
|
echo "hbextern hbvm hbpp hbrtl hbrdd rddfpt rddcdx rddnsx rddntx hbhsx hbsix hbusrrdd ${HB_DB_DRVEXT} hbmacro hbcommon hblang hbcpage gtcrs gtsln gtxvt gtxwc gtalleg gtcgi gtstd gtpca gttrm $libs gtwvt gtgui gtdos gtos2 hbdebug profiler hbcplr hbpcre hbzlib"
|
|
else
|
|
echo "$@"
|
|
fi
|
|
}
|
|
|
|
mk_hbgetlibsctb()
|
|
{
|
|
local libs
|
|
|
|
if [ -z "$@" ]
|
|
then
|
|
libs=""
|
|
if [ "$HB_COMPILER" = "mingwce" ]
|
|
then
|
|
libs="$libs gtwin"
|
|
fi
|
|
echo "$libs hbct hbnf hbmzip hbcrypt hbtip xhb hbgd hbfimage rddsql sddfb sddmy sddpg hbodbc hbpgsql hbmysql hbfbird rddads rddado hbhpdf hbvpdf hbcurl hbwin gtwvg gtalleg hbsqlit3 hbbtree $HB_USER_LIBS"
|
|
#"hbgf hbgt hbbmcdx hbmisc hbole hbtpathy hbwhat hbziparc hbmsql"
|
|
else
|
|
echo "$@"
|
|
fi
|
|
}
|
|
|
|
mk_hbtools()
|
|
{
|
|
local name hb_pref hb_tool hb_libs hb_libsc hb_hbmkcfg hb_gt_ori
|
|
|
|
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}" = "win" ]; then
|
|
hb_tool="$1/${hb_pref}-build"
|
|
hb_path_separator=":"
|
|
if [ "${HB_MK_STATIC}" = "yes" ]; then
|
|
hb_static="yes"
|
|
hb_static_default=" (default)"
|
|
else
|
|
hb_static="no"
|
|
hb_shared_default=" (default)"
|
|
fi
|
|
hb_exesuf=".exe"
|
|
elif [ "${HB_ARCHITECTURE}" = "darwin" ]; then
|
|
hb_tool="$1/${hb_pref}-build"
|
|
hb_path_separator=":"
|
|
if [ "${HB_MK_STATIC}" = "yes" ]; then
|
|
hb_static="yes"
|
|
hb_static_default=" (default)"
|
|
else
|
|
hb_static="no"
|
|
hb_shared_default=" (default)"
|
|
fi
|
|
hb_exesuf=""
|
|
else
|
|
hb_tool="$1/${hb_pref}-build"
|
|
hb_path_separator=":"
|
|
if [ "${HB_MK_STATIC}" = "yes" ]; then
|
|
hb_static="yes"
|
|
hb_static_default=" (default)"
|
|
else
|
|
hb_static="no"
|
|
hb_shared_default=" (default)"
|
|
fi
|
|
hb_exesuf=""
|
|
fi
|
|
hb_libs=`mk_hbgetlibs "$2"`
|
|
hb_libsc=`mk_hbgetlibsctb "$3"`
|
|
hb_gt_ori=${HB_GT_LIB}
|
|
[ -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 [ "${HB_USER_CFLAGS//-DHB_PCRE_REGEX/}" != "${HB_USER_CFLAGS}" ]; then
|
|
HB_SYS_LIBS="-lpcre ${HB_SYS_LIBS}"
|
|
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
|
|
HB_SYS_LIBS="-lz ${HB_SYS_LIBS}"
|
|
hb_libs="${hb_libs//hbzlib/}"
|
|
fi
|
|
if [ "${HB_COMPILER}" = "mingw" ]; then
|
|
HB_SYS_LIBS="${HB_SYS_LIBS} -luser32 -lwinspool -lgdi32 -lcomctl32 -lcomdlg32 -lole32 -loleaut32 -luuid -lwsock32 -lws2_32"
|
|
HB_WITHOUT_X11="yes"
|
|
elif [ "${HB_COMPILER}" = "mingwce" ]; then
|
|
HB_SYS_LIBS="${HB_SYS_LIBS} -lwininet -lws2 -lcommdlg -lcommctrl -luuid -lole32"
|
|
HB_WITHOUT_X11="yes"
|
|
elif [ "${HB_COMPILER}" = "djgpp" ]; then
|
|
HB_SYS_LIBS="${HB_SYS_LIBS}"
|
|
HB_WITHOUT_X11="yes"
|
|
else
|
|
HB_CRS_LIB=""
|
|
if [ "${HB_ARCHITECTURE}" = "linux" ]; then
|
|
HB_SYS_LIBS="${HB_SYS_LIBS} -ldl -lrt"
|
|
elif [ "${HB_ARCHITECTURE}" = "sunos" ]; then
|
|
HB_SYS_LIBS="${HB_SYS_LIBS} -lrt"
|
|
HB_SYS_LIBS="${HB_SYS_LIBS} -lsocket -lnsl -lresolv"
|
|
HB_CRS_LIB="curses"
|
|
elif [ "${HB_ARCHITECTURE}" = "hpux" ]; then
|
|
HB_SYS_LIBS="${HB_SYS_LIBS} -lrt"
|
|
fi
|
|
if [ -n "${HB_CURSES_VER}" ]; then
|
|
HB_CRS_LIB="${HB_CURSES_VER}"
|
|
elif [ "${HB_NCURSES_194}" = "yes" ]; then
|
|
HB_CRS_LIB="ncur194"
|
|
elif [ -z "${HB_CRS_LIB}" ]; then
|
|
HB_CRS_LIB="ncurses"
|
|
fi
|
|
HB_SLN_LIB="slang"
|
|
fi
|
|
if [ "${HB_USER_CFLAGS//-mlp64/}" != "${HB_USER_CFLAGS}" ]; then
|
|
CC_HB_USER_CFLAGS="${CC_HB_USER_CFLAGS} -mlp64"
|
|
CC_HB_USER_LDFLAGS="${CC_HB_USER_LDFLAGS} -mlp64"
|
|
elif [ "${HB_USER_CFLAGS//-mlp32/}" != "${HB_USER_CFLAGS}" ]; then
|
|
CC_HB_USER_CFLAGS="${CC_HB_USER_CFLAGS} -mlp32"
|
|
CC_HB_USER_LDFLAGS="${CC_HB_USER_LDFLAGS} -mlp32"
|
|
elif [ "${HB_USER_CFLAGS//-m64/}" != "${HB_USER_CFLAGS}" ]; then
|
|
CC_HB_USER_CFLAGS="${CC_HB_USER_CFLAGS} -m64"
|
|
CC_HB_USER_LDFLAGS="${CC_HB_USER_LDFLAGS} -m64"
|
|
elif [ "${HB_USER_CFLAGS//-m32/}" != "${HB_USER_CFLAGS}" ]; then
|
|
CC_HB_USER_CFLAGS="${CC_HB_USER_CFLAGS} -m32"
|
|
CC_HB_USER_LDFLAGS="${CC_HB_USER_LDFLAGS} -m32"
|
|
fi
|
|
if [ "${HB_USER_CFLAGS//-fPIC/}" != "${HB_USER_CFLAGS}" ]; then
|
|
CC_HB_USER_CFLAGS="${CC_HB_USER_CFLAGS} -fPIC"
|
|
elif [ "${HB_USER_CFLAGS//-fpic/}" != "${HB_USER_CFLAGS}" ]; then
|
|
CC_HB_USER_CFLAGS="${CC_HB_USER_CFLAGS} -fpic"
|
|
fi
|
|
|
|
hb_hbmkcfg="$1/hbmk.cfg"
|
|
echo "Generating ${hb_hbmkcfg}... "
|
|
echo "# Harbour Make configuration"> ${hb_hbmkcfg}
|
|
echo "# Generated by Harbour build process">> ${hb_hbmkcfg}
|
|
echo "arch=${HB_ARCHITECTURE}">> ${hb_hbmkcfg}
|
|
echo "comp=${HB_COMPILER}">> ${hb_hbmkcfg}
|
|
if [ -n "${hb_gt_ori}" ]; then
|
|
echo "gtdef=${hb_gt_ori}">> ${hb_hbmkcfg}
|
|
fi
|
|
if [ -n "${CC_HB_USER_CFLAGS}" ]; then
|
|
echo "cflags=${CC_HB_USER_CFLAGS}">> ${hb_hbmkcfg}
|
|
fi
|
|
if [ -n "${CC_HB_USER_LDFLAGS}" ]; then
|
|
echo "ldflags=${CC_HB_USER_LDFLAGS}">> ${hb_hbmkcfg}
|
|
fi
|
|
if [ "${HB_GPM_MOUSE}" = "yes" ]; then
|
|
echo "libs=gpm">> ${hb_hbmkcfg}
|
|
fi
|
|
if [ "${HB_WITHOUT_X11}" != "yes" ]; then
|
|
echo "libdynhas=gtxwc">> ${hb_hbmkcfg}
|
|
fi
|
|
if [ "${HB_WITHOUT_GTCRS}" != "yes" ] && [ -n "${HB_CRS_LIB}" ]; then
|
|
echo "libdynhas=gtcrs">> ${hb_hbmkcfg}
|
|
fi
|
|
if [ "${HB_WITHOUT_GTSLN}" != "yes" ] && [ -n "${HB_SLN_LIB}" ]; then
|
|
echo "libdynhas=gtsln">> ${hb_hbmkcfg}
|
|
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}${HB_CCPATH}\${PATH}"
|
|
|
|
if [ "\${HB_COMPILER}" == "gpp" ]; then
|
|
HB_CC="g++"
|
|
elif [ "\${HB_COMPILER}" == "icc" ]; then
|
|
HB_CC="icc"
|
|
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)
|
|
-xhgtk # link with xHGtk library (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; do
|
|
if [ "\${HB_ARCHITECTURE}" = "dos" ]; then
|
|
cp -f "\${NAME}" "\${n}"
|
|
else
|
|
ln -sf "\${NAME}" "\${n}"
|
|
fi
|
|
done
|
|
)
|
|
fi
|
|
exit
|
|
fi
|
|
|
|
## check basename
|
|
case "\${0##*/}" in
|
|
*cc) HB=cc ;;
|
|
*cmp) HB=cmp ;;
|
|
*lnk) HB=lnk ;;
|
|
*mk) HB=mk ;;
|
|
*) exit 1 ;;
|
|
esac
|
|
|
|
## 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_XHGTK=""
|
|
HB_HWGUI=""
|
|
HB_USRLIBS=""
|
|
HB_USRLPATH=""
|
|
HB_GEN=""
|
|
HB_MODE=""
|
|
LN_OPT="${CC_HB_USER_LDFLAGS}"
|
|
CC_OPT="-O3 ${CC_HB_USER_CFLAGS}"
|
|
HB_OPT="${CC_HB_USER_PRGFLAGS}"
|
|
|
|
[ -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}"
|
|
[ \${HB} = "cc" ] || p="-o\${d%.*}"
|
|
elif [ -n "\${d}" ]; then
|
|
FILEOUT="\${d}"; p="-o\${d}"
|
|
[ \${HB} = "cc" ] || p="-o\${d%.*}"
|
|
fi ;;
|
|
-static) HB_STATIC="yes" ;;
|
|
-fullstatic) HB_STATIC="full" ;;
|
|
-shared) HB_STATIC="no" ;;
|
|
-xbgtk) HB_XBGTK="yes" ;;
|
|
-xhgtk) HB_XHGTK="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}" ;;
|
|
-mwindows) LN_OPT="\${LN_OPT} \${v}"; HB_MODE="gui" ;;
|
|
-mconsole) LN_OPT="\${LN_OPT} \${v}"; HB_MODE="std" ;;
|
|
-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|win|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}"
|
|
|
|
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="-l${HB_SLN_LIB:-slang} \${SYSTEM_LIBS}"
|
|
[ "\${HB_GPM_MOUSE}" = "yes" ] && HB_GPM_LIB="gpm"
|
|
fi
|
|
if [ -f "\${HB_LIB_INSTALL}/libgtcrs.a" ]; then
|
|
SYSTEM_LIBS="-l${HB_CRS_LIB:-ncurses} \${SYSTEM_LIBS}"
|
|
[ "\${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="-L/usr/X11R6/lib -lX11 \${SYSTEM_LIBS}"
|
|
fi
|
|
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
|
|
SYSTEM_LIBS="\${SYSTEM_LIBS} \`pkg-config --libs gtk+-2.0 libglade-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} -lpthread -ldl"
|
|
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}" = "win" ]; then
|
|
pref=""
|
|
ext=".dll"
|
|
HB_LNK_ATTR="__attribute__ ((dllimport))"
|
|
elif [ "\${HB_ARCHITECTURE}" = "hpux" ]; then
|
|
pref="lib"
|
|
ext=".sl"
|
|
else
|
|
pref="lib"
|
|
ext=".so"
|
|
fi
|
|
if [ "\${HB_MT}" = "MT" ]; then
|
|
if [ -f "\${HB_LIB_INSTALL}/\${pref}\${l}mt\${ext}" ]; then
|
|
HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}mt"
|
|
l=""
|
|
elif [ -f "\${HB_BIN_INSTALL}/\${pref}\${l}mt\${ext}" ]; then
|
|
HARBOUR_LIBS="\${HARBOUR_LIBS} -L\${HB_BIN_INSTALL} -l\${l}mt"
|
|
l=""
|
|
fi
|
|
fi
|
|
if [ -n "\${l}" ]; then
|
|
if [ -f "\${HB_LIB_INSTALL}/\${pref}\${l}\${ext}" ]; then
|
|
HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
|
|
elif [ -f "\${HB_BIN_INSTALL}/\${pref}\${l}\${ext}" ]; then
|
|
HARBOUR_LIBS="\${HARBOUR_LIBS} -L\${HB_BIN_INSTALL} -l\${l}"
|
|
fi
|
|
fi
|
|
libs="gtalleg hbdebug profiler hbcplr ${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_XHGTK}" = "yes" ]; then
|
|
HARBOUR_LIBS="\${HARBOUR_LIBS} -lxhgtk"
|
|
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=""
|
|
if [ "\${HB_COMPILER}" = "mingw" ]; then
|
|
if [ -z "\${HB_MODE}" ]; then
|
|
LN_OPT="\${LN_OPT} -mwindows"
|
|
l="hbmainwin"
|
|
elif [ "\${HB_MODE}" = "gui" ]; then
|
|
l="hbmainwin"
|
|
elif [ "\${HB_MODE}" = "std" ]; then
|
|
l="hbmainstd"
|
|
fi
|
|
elif [ "\${HB_COMPILER}" = "mingwce" ]; then
|
|
if [ "\${HB_MODE}" = "std" ]; then
|
|
l="hbmainstd"
|
|
else
|
|
l="hbmainwin"
|
|
fi
|
|
fi
|
|
if [ -n "\${l}" ]; then
|
|
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt"
|
|
[ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ] && HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
|
|
fi
|
|
|
|
l="hbfm"
|
|
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/lib\${l}mt.a" ] && l="\${l}mt"
|
|
if [ -f "\${HB_LIB_INSTALL}/lib\${l}.a" ] && \\
|
|
( [ -n "\${HB_FM_REQ}" ] || [ "\${HB_STATIC}" = "yes" ] ) && \\
|
|
( [ "\${HB_COMPILER}" != "mingwce" ] || [ "\${HB_FM_REQ}" = "STAT" ] ); 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]}"
|
|
FOUTE="\${FOUTE%${hb_exesuf}}${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
|
|
|
|
${HB_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 [ -n "\${HB_MAIN_FUNC}" ]; then
|
|
HB_MAIN_FUNC="@\${HB_MAIN_FUNC}"
|
|
elif [ "\${HB_COMPILER}" != "djgpp" ] && [ -f "\${FOUTO}" ]; then
|
|
HB_MAIN_FUNC=\`hb_lnk_main "\${FOUTO}"\`
|
|
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} const char * hb_gt_szNameDefault;"
|
|
echo "extern \${HB_LNK_ATTR} void hb_vmSetLinkedMain( const char * szMain );"
|
|
echo "HB_EXTERN_END"
|
|
echo "HB_CALL_ON_STARTUP_BEGIN( hb_lnk_SetDefault_build )"
|
|
if [ -n "\$gt" ]; then
|
|
echo " hb_gt_szNameDefault = \\"\$gt\\";"
|
|
fi
|
|
if [ -n "\${HB_MAIN_FUNC}" ]; then
|
|
echo " hb_vmSetLinkedMain( \\"\${HB_MAIN_FUNC}\\" );"
|
|
fi
|
|
echo "HB_CALL_ON_STARTUP_END( hb_lnk_SetDefault_build )"
|
|
fi
|
|
}
|
|
|
|
hb_lnk_main()
|
|
{
|
|
(${HB_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
|
|
# (${HB_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
|
|
|
|
case "\${HB}" in
|
|
*cc)
|
|
hb_cc "\${P[@]}"
|
|
;;
|
|
*cmp)
|
|
hb_cmp "\${P[@]}"
|
|
;;
|
|
*lnk)
|
|
hb_link "\${P[@]}" && \\
|
|
( [ "\${HB_STRIP}" != "yes" ] || ${HB_CCPREFIX}strip "\${FOUTE}" )
|
|
;;
|
|
*mk)
|
|
hb_cmp "\${P[@]}" && \\
|
|
hb_link "\${FOUTO}" && \\
|
|
( [ "\${HB_STRIP}" != "yes" ] || ${HB_CCPREFIX}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 dir hb_rootdir hb_ver hb_libs full_lib_name full_lib_name_mt linker_options linker_mtoptions gpm
|
|
|
|
dir=`pwd`
|
|
name=`get_solibname`
|
|
hb_rootdir="${1-.}"
|
|
|
|
if [ "${HB_ARCHITECTURE}" = "win" ]; then
|
|
hb_ver=`get_hbver_win "${hb_rootdir}"`
|
|
else
|
|
hb_ver=`get_hbver "${hb_rootdir}"`
|
|
fi
|
|
hb_libs=`mk_hbgetlibs "$2"`
|
|
[ -z "${HB_GT_LIB}" ] && HB_GT_LIB="gtstd"
|
|
|
|
(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
|
|
hbdebug|profiler|hbcplr|hbfm|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 $lm ]
|
|
then
|
|
LIBSMT="$LIBSMT $lm"
|
|
fi
|
|
if [ -f $ls ]
|
|
then
|
|
LIBS="$LIBS $ls"
|
|
if [ "${l}" = gtcrs ]; then
|
|
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
|
|
;;
|
|
esac
|
|
done
|
|
if [ "${HB_ARCHITECTURE}" = "darwin" ]; then
|
|
lib_ext=".dylib"
|
|
full_lib_name="lib${name}.${hb_ver}${lib_ext}"
|
|
full_lib_name_mt="lib${name}mt.${hb_ver}${lib_ext}"
|
|
elif [ "${HB_ARCHITECTURE}" = "win" ]; then
|
|
lib_ext=".dll"
|
|
full_lib_name="${name}-${hb_ver}${lib_ext}"
|
|
full_lib_name_mt="${name}mt-${hb_ver}${lib_ext}"
|
|
elif [ "${HB_ARCHITECTURE}" = "hpux" ]; then
|
|
lib_ext=".sl"
|
|
full_lib_name="lib${name}-${hb_ver}${lib_ext}"
|
|
full_lib_name_mt="lib${name}mt-${hb_ver}${lib_ext}"
|
|
else
|
|
lib_ext=".so"
|
|
full_lib_name="lib${name}-${hb_ver}${lib_ext}"
|
|
full_lib_name_mt="lib${name}mt-${hb_ver}${lib_ext}"
|
|
fi
|
|
if [ -n "${HB_TOOLS_PREF}" ]; then
|
|
hb_mkdyn="${HB_BIN_INSTALL}/${HB_TOOLS_PREF}-mkdyn"
|
|
else
|
|
hb_mkdyn="${HB_BIN_INSTALL}/hb-mkdyn"
|
|
fi
|
|
echo "Making ${full_lib_name}..."
|
|
${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_mtoptions} ${linker_options}
|
|
fi
|
|
for l in ${full_lib_name} ${full_lib_name_mt}
|
|
do
|
|
if [ -f $l ]
|
|
then
|
|
if [ "${HB_ARCHITECTURE}" = "win" ]; then
|
|
if [ "${HB_XBUILD}" = "" ]; then
|
|
(cd "$dir"
|
|
mv "${HB_LIB_INSTALL}/$l" "${HB_BIN_INSTALL}")
|
|
fi
|
|
else
|
|
if [ "${HB_ARCHITECTURE}" = "darwin" ]; then
|
|
ll=${l%.${hb_ver}${lib_ext}}${lib_ext}
|
|
else
|
|
ll=${l%-${hb_ver}${lib_ext}}${lib_ext}
|
|
ln -sf $l $ll
|
|
fi
|
|
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"
|
|
}
|