From 9f5256957eca4440aaa43a4fb6c9b68dd9db047a Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 12 Aug 2008 11:02:16 +0000 Subject: [PATCH] 2008-08-12 13:01 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/make_xmingw.sh * harbour/make_xmingwce.sh ! cleanup and some minor fixes * synced behavior of both scripts in few places * harbour/contrib/rddads/ads1.c * harbour/contrib/rddads/adsfunc.c ! fixed casting of parameters passed to snprintf() --- harbour/ChangeLog | 10 +++++ harbour/contrib/rddads/ads1.c | 3 +- harbour/contrib/rddads/adsfunc.c | 6 ++- harbour/make_xmingw.sh | 67 ++++++++++++++++++++++++-------- harbour/make_xmingwce.sh | 14 ++++--- 5 files changed, 75 insertions(+), 25 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5106b5152f..9c7bfa660f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,16 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-08-12 13:01 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/make_xmingw.sh + * harbour/make_xmingwce.sh + ! cleanup and some minor fixes + * synced behavior of both scripts in few places + + * harbour/contrib/rddads/ads1.c + * harbour/contrib/rddads/adsfunc.c + ! fixed casting of parameters passed to snprintf() + 2008-08-12 12:02 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/rddads/adsfunc.c ! Fixed GCC warning (Ubuntu/GCC422 + ACE 9.00.0.0) diff --git a/harbour/contrib/rddads/ads1.c b/harbour/contrib/rddads/ads1.c index 981f39333f..d17f3f099c 100644 --- a/harbour/contrib/rddads/ads1.c +++ b/harbour/contrib/rddads/ads1.c @@ -2789,7 +2789,8 @@ static ERRCODE adsInfo( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) AdsGetVersion( &ulMajor, &ulMinor, &ucLetter, ucDesc, &usDescLen); - snprintf( ( char * ) ucVersion, sizeof( ucVersion ), "%s, v%ld.%ld%c", ucDesc, ulMajor, ulMinor, ucLetter ); + snprintf( ( char * ) ucVersion, sizeof( ucVersion ), "%s, v%lu.%lu%c", + ( char * ) ucDesc, ( ULONG ) ulMajor, ( ULONG ) ulMinor, ucLetter ); hb_itemPutC( pItem, ( char * ) ucVersion ); break; } diff --git a/harbour/contrib/rddads/adsfunc.c b/harbour/contrib/rddads/adsfunc.c index e3d600e143..b791ce21d5 100644 --- a/harbour/contrib/rddads/adsfunc.c +++ b/harbour/contrib/rddads/adsfunc.c @@ -1614,10 +1614,12 @@ HB_FUNC( ADSVERSION ) switch( hb_parni( 1 ) /* iVersionType */ ) { case 0: - snprintf( ucVersion, sizeof( ucVersion ), "%ld.%ld%c", ulMajor, ulMinor, ucLetter ); + snprintf( ucVersion, sizeof( ucVersion ), "%lu.%lu%c", + ( ULONG ) ulMajor, ( ULONG ) ulMinor, ucLetter ); break; case 3: - snprintf( ucVersion, sizeof( ucVersion ), "%s, v%ld.%ld%c", ( char * ) ucDesc, ulMajor, ulMinor, ucLetter ); + snprintf( ucVersion, sizeof( ucVersion ), "%s, v%lu.%lu%c", + ( char * ) ucDesc, ( ULONG ) ulMajor, ( ULONG ) ulMinor, ucLetter ); break; default: ucVersion[ 0 ] = '\0'; diff --git a/harbour/make_xmingw.sh b/harbour/make_xmingw.sh index 9a7bdb9df7..fac1510c2e 100755 --- a/harbour/make_xmingw.sh +++ b/harbour/make_xmingw.sh @@ -20,10 +20,30 @@ UNAMEU=`echo "$UNAME"|tr a-z A-Z` export HB_ARCHITECTURE=w32 export HB_COMPILER=mingw32 -[ -z "$HB_INSTALL_PREFIX" ] && export HB_INSTALL_PREFIX=/usr/local/mingw32-harbour +if [ "$OSTYPE" = "msdosdjgpp" ]; then + HB_HOST_ARCH="dos" + HB_HOST_CC="djgpp" +else + HB_HOST_ARCH="${UNAMEL}" + HB_HOST_CC="gcc" + case "$HB_HOST_ARCH" in + *windows*|*mingw32*|msys*) HB_HOST_ARCH="w32"; HB_HOST_CC="mingw32" ;; + *dos) HB_HOST_ARCH="dos" ;; + *bsd) HB_HOST_ARCH="bsd" ;; + *darwin) HB_HOST_ARCH="darwin" ;; + esac +fi + +CC_PRG_USR="" +if [ "$HB_HOST_ARCH" != "w32" ]; then + CC_PRG_USR="-D__PLATFORM__WINDOWS -undef:__PLATFORM__UNIX -undef:__PLATFORM__$UNAMEU" +fi + +[ -z "$HB_INSTALL_PREFIX" ] && \ +export HB_INSTALL_PREFIX="/usr/local/mingw32-harbour" export CC_C_USR="" export C_USR="$CC_C_USR $C_USR" -export CC_PRG_USR="-D__PLATFORM__WINDOWS -undef:__PLATFORM__UNIX -undef:__PLATFORM__$UNAMEU" +export CC_PRG_USR export PRG_USR="$CC_PRG_USR $PRG_USR" # try to detect MinGW cross-compiler location @@ -92,16 +112,18 @@ export HB_TOOLS_PREF="hbw" export HB_XBUILD="w32" export HB_HOST_BUILD="lib" -export HB_BIN_COMPILE=/tmp/hb-xmingw-$$ +export HB_BIN_COMPILE="/tmp/hb-xmingw-$$" rm -fR "${HB_BIN_COMPILE}" trap cleanup EXIT >/dev/null 2>&1 mkdir ${HB_BIN_COMPILE} DIR=`cd $(dirname $0);pwd` -if which harbour > /dev/null 2>&1; then - HB_COMP_PATH=`which harbour 2> /dev/null` -else - HB_COMP_PATH="$DIR/source/main/$UNAMEL/gcc/harbour" +if [ -z "${HB_COMP_PATH}" ]; then + if which harbour > /dev/null 2>&1; then + HB_COMP_PATH=`which harbour 2> /dev/null` + else + HB_COMP_PATH="$DIR/source/main/$HB_HOST_ARCH/$HB_HOST_CC/harbour" + fi fi if [ -x "${HB_COMP_PATH}" ]; then @@ -111,20 +133,33 @@ else exit 1 fi -if which hbpp > /dev/null 2>&1; then - HB_COMP_PATH=`which hbpp 2> /dev/null` -else - HB_COMP_PATH="$DIR/source/pp/$UNAMEL/gcc/hbpp" +if [ -z "${HB_PPGEN_PATH}" ]; then + if which hbpp &> /dev/null; then + HB_PPGEN_PATH=`which hbpp 2> /dev/null` + elif [ -x "${DIR}/source/pp/${HB_HOST_ARCH}/${HB_HOST_CC}/hbpp" ]; then + HB_PPGEN_PATH="${DIR}/source/pp/${HB_HOST_ARCH}/${HB_HOST_CC}/hbpp" + else + DIR=`dirname ${HB_COMP_PATH}` + if [ -x "${DIR}/hbpp" ]; then + HB_PPGEN_PATH="${DIR}/hbpp" + else + HB_PPGEN_PATH="$DIR/source/pp/$HB_HOST_ARCH/$HB_HOST_CC/hbpp" + fi + fi fi - -if [ -x "${HB_COMP_PATH}" ]; then - ln -s "${HB_COMP_PATH}" ${HB_BIN_COMPILE}/hbpp.exe +if [ -d "${HB_PPGEN_PATH}" ]; then + if [ -x "${HB_PPGEN_PATH}/hbpp" ]; then + HB_PPGEN_PATH="${HB_PPGEN_PATH}/hbpp" + fi +fi +if [ -x "${HB_PPGEN_PATH}" ] && [ -f "${HB_PPGEN_PATH}" ]; then + ln -s ${HB_PPGEN_PATH} ${HB_BIN_COMPILE}/hbpp.exe + HB_PPGEN_PATH="${HB_BIN_COMPILE}" else echo "You must have a working 'hbpp' executable for your platform on your PATH." exit 1 fi - -export HB_PPGEN_PATH=${HB_BIN_COMPILE} +export HB_PPGEN_PATH case "$1" in tgz|gnu) diff --git a/harbour/make_xmingwce.sh b/harbour/make_xmingwce.sh index b3a60a6d25..613d37c478 100755 --- a/harbour/make_xmingwce.sh +++ b/harbour/make_xmingwce.sh @@ -13,17 +13,18 @@ cleanup() rm -fR "${HB_BIN_COMPILE}" } +UNAME=`uname` +UNAMEL=`echo "$UNAME"|tr A-Z a-z` +UNAMEU=`echo "$UNAME"|tr a-z A-Z` + export HB_ARCHITECTURE=w32 export HB_COMPILER=cemgw -UNAME=`uname -s | tr -d "[-]" 2>/dev/null` -UNAMEU=`echo "$UNAME"|tr a-z A-Z` - if [ "$OSTYPE" = "msdosdjgpp" ]; then HB_HOST_ARCH="dos" HB_HOST_CC="djgpp" else - HB_HOST_ARCH=`echo "$UNAME"|tr '[A-Z]' '[a-z]'` + HB_HOST_ARCH="${UNAMEL}" HB_HOST_CC="gcc" case "$HB_HOST_ARCH" in *windows*|*mingw32*|msys*) HB_HOST_ARCH="w32"; HB_HOST_CC="mingw32" ;; @@ -74,17 +75,18 @@ export HB_GT_LIB="gtwvt" export HB_BIN_COMPILE="/tmp/hb-${CCPREFIX}-$$" rm -fR "${HB_BIN_COMPILE}" -trap cleanup EXIT &>/dev/null +trap cleanup EXIT >/dev/null 2>&1 mkdir ${HB_BIN_COMPILE} DIR=`cd $(dirname $0);pwd` if [ -z "${HB_COMP_PATH}" ]; then - if which harbour &> /dev/null; then + if which harbour > /dev/null 2>&1; then HB_COMP_PATH=`which harbour 2> /dev/null` else HB_COMP_PATH="$DIR/source/main/$HB_HOST_ARCH/$HB_HOST_CC/harbour" fi fi + if [ -x "${HB_COMP_PATH}" ]; then ln -s "${HB_COMP_PATH}" ${HB_BIN_COMPILE}/harbour.exe else