From 64c3fde6306060c25675e2ff67a8cfe7b4928b5c Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Fri, 1 Jun 2007 17:39:46 +0000 Subject: [PATCH] 2007-06-01 19:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/harbour.spec * harbour/make_rpm.sh * harbour/contrib/Makefile * cleanup and added HB_CONTRIBLIBS to set additional contrib libraries + added -with xhb switch to build Harbour RPMs with HB_COMPAT_XHB macro * harbour/contrib/mysql/Makefile + added -I/usr/include/mysql -I/usr/local/include/mysql to C compiler flags * harbour/contrib/mysql/tmysql.prg * harbour/contrib/mysql/tsqlbrw.prg * cleaned -w2 warnings - in few places I added HB_SYMBOL_UNUSED() which should be replace sin the future by valid code --- harbour/ChangeLog | 16 ++++++++++++ harbour/contrib/Makefile | 1 + harbour/contrib/mysql/Makefile | 4 +++ harbour/contrib/mysql/tmysql.prg | 18 ++++++------- harbour/contrib/mysql/tsqlbrw.prg | 5 +++- harbour/harbour.spec | 43 +++++++++++++++++-------------- harbour/make_rpm.sh | 3 ++- 7 files changed, 60 insertions(+), 30 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 537adc65f0..1ba6a2cea5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,22 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-06-01 19:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/harbour.spec + * harbour/make_rpm.sh + * harbour/contrib/Makefile + * cleanup and added HB_CONTRIBLIBS to set additional contrib libraries + + added -with xhb switch to build Harbour RPMs with HB_COMPAT_XHB + macro + + * harbour/contrib/mysql/Makefile + + added -I/usr/include/mysql -I/usr/local/include/mysql to C compiler + flags + * harbour/contrib/mysql/tmysql.prg + * harbour/contrib/mysql/tsqlbrw.prg + * cleaned -w2 warnings - in few places I added HB_SYMBOL_UNUSED() + which should be replace sin the future by valid code + 2007-06-01 15:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/harbour.spec * set attributes explicitly to clean some wrong attributes committed diff --git a/harbour/contrib/Makefile b/harbour/contrib/Makefile index 748da61f11..fe4a489a0e 100644 --- a/harbour/contrib/Makefile +++ b/harbour/contrib/Makefile @@ -12,6 +12,7 @@ DIRS=\ libmisc \ libnf \ samples \ + $(HB_CONTRIBLIBS) ifneq ($(HB_ARCHITECTURE),dos) diff --git a/harbour/contrib/mysql/Makefile b/harbour/contrib/mysql/Makefile index 73da9c158e..ac655aa6ff 100644 --- a/harbour/contrib/mysql/Makefile +++ b/harbour/contrib/mysql/Makefile @@ -14,3 +14,7 @@ PRG_SOURCES=\ LIBNAME=hbmysql include $(TOP)$(ROOT)config/lib.cf + +# a workaround of a problem with different include directories +# for mysql header files between different unix distributions +CFLAGS := -I/usr/include/mysql -I/usr/local/include/mysql diff --git a/harbour/contrib/mysql/tmysql.prg b/harbour/contrib/mysql/tmysql.prg index d5affae44c..1fed24135d 100644 --- a/harbour/contrib/mysql/tmysql.prg +++ b/harbour/contrib/mysql/tmysql.prg @@ -899,7 +899,7 @@ return nil METHOD Update(oRow, lOldRecord, lRefresh ) CLASS TMySQLTable local cUpdateQuery := "UPDATE " + ::cTable + " SET " - local i, cField + local i //DAVID: local ni, cWhere := " WHERE " default lOldRecord to .F. @@ -1126,7 +1126,7 @@ return !::lError METHOD Append(oRow, lRefresh) CLASS TMySQLTable local cInsertQuery := "INSERT INTO " + ::cTable + " (" - local i, cField + local i //DAVID: too many ::refresh() can slow some processes, so we can desactivate it by parameter default lRefresh to .T. @@ -1280,9 +1280,7 @@ METHOD GetBlankRow( lSetValues ) CLASS TMySQLTable next endif - return TMySQLRow():New(aRow, ::aFieldStruct, ::cTable, .F.) - -return nil +return TMySQLRow():New(aRow, ::aFieldStruct, ::cTable, .F.) METHOD FieldPut(cnField, Value) CLASS TMySQLTable @@ -1320,7 +1318,7 @@ return nil METHOD Refresh() CLASS TMySQLTABLE - local rc, i + local rc // free present result handle sqlFreeR(::nResultHandle) @@ -1707,12 +1705,14 @@ return aList /* TOFIX: Conversion creates a .dbf with fields of wrong dimension (often) */ METHOD TableStruct(cTable) CLASS TMySQLServer - local nRes, aField, aStruct, aSField, i + local aStruct := {} - - aStruct := {} + HB_SYMBOL_UNUSED( cTable ) /* TODO: rewrite for MySQL + local nRes, aField, aStruct, aSField, i + + aStruct := {} nRes := sqlListF(::nSocket, cTable) if nRes > 0 diff --git a/harbour/contrib/mysql/tsqlbrw.prg b/harbour/contrib/mysql/tsqlbrw.prg index 0da6b21883..2a8ee6f1a4 100644 --- a/harbour/contrib/mysql/tsqlbrw.prg +++ b/harbour/contrib/mysql/tsqlbrw.prg @@ -160,6 +160,9 @@ METHOD New(nTop, nLeft, nBottom, nRight, oServer, oQuery, cTable) CLASS TBrowseS local i, oCol + HB_SYMBOL_UNUSED( oServer ) + HB_SYMBOL_UNUSED( cTable ) + super:New(nTop, nLeft, nBottom, nRight) ::oQuery := oQuery @@ -246,7 +249,6 @@ METHOD EditField() CLASS TBrowseSQL local oCol local aGetList local nKey - local xGetValue local cMemoBuff, cMemo // Get the current column object from the browse @@ -412,5 +414,6 @@ return Self // Empty method to be subclassed METHOD KeyboardHook(nKey) CLASS TBrowseSQL + HB_SYMBOL_UNUSED( nKey ) return Self diff --git a/harbour/harbour.spec b/harbour/harbour.spec index 98dad81cad..9160bc5533 100644 --- a/harbour/harbour.spec +++ b/harbour/harbour.spec @@ -13,19 +13,20 @@ ###################################################################### # Conditional build: # --with static - link all binaries with static libs -# --with mysql - build mysql lib (unused) +# --with mysql - build mysql lib # --with pgsql - build pgsql lib # --with pgsql4 - build pgsql4 lib # --with gd - build gd lib -# --with tip - build tip lib +# --with tip - build tip lib (needs --withxhb) # --with odbc - build odbc lib +# --with allegro - build GTALLEG - Allegro based GT driver +# --with xhb - build with xHarbour compatible extensions # --without adsrdd - do not build ADS RDD # --without gpl - do not build libs which needs GPL 3-rd party code # --without nf - do not build nanforum lib -# --without x11 - do not build GTXVT and GTXWC (unused) +# --without x11 - do not build GTXWC # --without gpm - build GTSLN and GTCRS without GPM support # --without gtsln - do not build GTSLN -# --without tip - do not build tip lib ###################################################################### ###################################################################### @@ -68,7 +69,7 @@ %define hb_pref hb %define hb_arch export HB_ARCHITECTURE=linux %define hb_cc export HB_COMPILER=gcc -%define hb_cflag export C_USR="${C_USR}" +%define hb_cflag export C_USR="-O3 -DHB_FM_STATISTICS_OFF" %define hb_lflag export L_USR="${CC_L_USR} %{?_with_static:-static}" %define hb_mt export HB_MT=no %define hb_gt export HB_GT_LIB=gtcrs @@ -81,7 +82,8 @@ %define hb_ldir export HB_LIB_INSTALL=%{_libdir}/%{name} %define hb_opt export HB_GTALLEG=%{?_with_allegro:yes} %define hb_cmrc export HB_COMMERCE=%{?_without_gpl:yes} -%define hb_env %{hb_arch} ; %{hb_cc} ; %{hb_cflag} ; %{hb_lflag} ; %{hb_mt} ; %{hb_gt} ; %{hb_defgt} ; %{hb_gpm} ; %{hb_sln} ; %{hb_x11} ; %{hb_bdir} ; %{hb_idir} ; %{hb_ldir} ; %{hb_opt} ; %{hb_cmrc} +%define hb_ctrb export HB_CONTRIBLIBS="%{?_with_gd:gd} %{?_with_tip:tip} %{?_with_pgsql:pgsql} %{?_with_mysql:mysql}" +%define hb_env %{hb_arch} ; %{hb_cc} ; %{hb_cflag} ; %{hb_lflag} ; %{hb_mt} ; %{hb_gt} ; %{hb_defgt} ; %{hb_gpm} ; %{hb_sln} ; %{hb_x11} ; %{hb_bdir} ; %{hb_idir} ; %{hb_ldir} ; %{hb_opt} ; %{hb_ctrb} ; %{hb_cmrc} %define hb_host www.harbour-project.org %define readme README.RPM @@ -294,8 +296,12 @@ case "`uname -m`" in export C_USR="$C_USR -fPIC" ;; esac - -[ "%{?_with_odbc:1}" ] || rm -fR contrib/odbc +if [ "%{?_with_xhb:1}" ]; then + sed -e "s!/\* #define HB_COMPAT_XHB \*/!#define HB_COMPAT_XHB !g" \ + include/hbsetup.ch > include/hbsetup.ch-new && \ + mv include/hbsetup.ch-new include/hbsetup.ch +fi +[ "%{?_with_odbc:1}" ] || rm -fR contrib/odbc make -r @@ -328,7 +334,6 @@ mkdir -p $HB_LIB_INSTALL make -r -i install [ "%{?_without_gtsln:1}" ] && rm -f $HB_LIB_INSTALL/libgtsln.a -[ "%{?_without_tip:1}" ] && rm -f $HB_LIB_INSTALL/libtip.a [ "%{?_with_odbc:1}" ] || rm -f $HB_LIB_INSTALL/libhbodbc.a [ "%{?_with_allegro:1}" ] || rm -f $HB_LIB_INSTALL/libgtalleg.a @@ -348,7 +353,7 @@ EOF # Create PP pushd contrib/dot -$HB_BIN_INSTALL/%{hb_pref}mk pp -n -w %{?_with_pgsql:-lpq} %{?_with_gd:-lgd} -D_DEFAULT_INC_DIR=\"$_DEFAULT_INC_DIR\" +$HB_BIN_INSTALL/%{hb_pref}mk pp -q0 -n -w %{?_with_pgsql:-lpq} %{?_with_gd:-lgd} -D_DEFAULT_INC_DIR=\"$_DEFAULT_INC_DIR\" install -m755 -s pp $HB_BIN_INSTALL/pp ln -s pp $HB_BIN_INSTALL/pprun install -m644 rp_dot.ch $HB_INC_INSTALL/ @@ -539,7 +544,7 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/hbpp %{_bindir}/hbmake %dir %{_includedir}/%{name} -%attr(644,root,root,755) %{_includedir}/%{name}/* +%attr(644,root,root) %{_includedir}/%{name}/* %files static %defattr(644,root,root,755) @@ -552,7 +557,7 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/%{name}/libdb*.a %{_libdir}/%{name}/libgt*.a %{_libdir}/%{name}/liblang.a -%{_libdir}/%{name}/libmacro*.a +%{_libdir}/%{name}/libmacro.a %{_libdir}/%{name}/libhbpcre.a %{_libdir}/%{name}/libnulsys.a %{_libdir}/%{name}/libpp.a @@ -568,13 +573,13 @@ rm -rf $RPM_BUILD_ROOT %defattr(644,root,root,755) %dir %{_libdir}/%{name} %{?_with_odbc: %{_libdir}/%{name}/libhbodbc.a} -%{!?_without_nf: %{_libdir}/%{name}/libnf*.a} -%{!?_without_adsrdd: %{_libdir}/%{name}/librddads*.a} -%{?_with_mysql: %{_libdir}/%{name}/libmysql*.a} -%{?_with_pgsql: %{_libdir}/%{name}/libhbpg*.a} -%{?_with_pgsql4: %{_libdir}/%{name}/libhbpg*.a} -%{?_with_gd: %{_libdir}/%{name}/libhbgd*.a} -%{!?_without_tip: %{_libdir}/%{name}/libtip.a} +%{!?_without_nf: %{_libdir}/%{name}/libnf.a} +%{!?_without_adsrdd: %{_libdir}/%{name}/librddads.a} +%{?_with_mysql: %{_libdir}/%{name}/libhbmysql.a} +%{?_with_pgsql: %{_libdir}/%{name}/libhbpg.a} +%{?_with_pgsql4: %{_libdir}/%{name}/libhbpg.a} +%{?_with_gd: %{_libdir}/%{name}/libhbgd.a} +%{?_with_tip: %{_libdir}/%{name}/libtip.a} %{_libdir}/%{name}/libhbbtree.a %{_libdir}/%{name}/libhtml.a diff --git a/harbour/make_rpm.sh b/harbour/make_rpm.sh index b7e8a0e2ee..5295055e43 100644 --- a/harbour/make_rpm.sh +++ b/harbour/make_rpm.sh @@ -16,15 +16,16 @@ # --with mysql - build mysql lib # --with pgsql - build pgsql lib # --with gd - build gd lib +# --with tip - build tip lib (needs --withxhb) # --with odbc - build odbc lib # --with allegro - build GTALLEG - Allegro based GT driver +# --with xhb - build with xHarbour compatible extensions # --without adsrdd - do not build ADS RDD # --without gpl - do not build libs which needs GPL 3-rd party code # --without nf - do not build nanforum lib # --without x11 - do not build GTXWC # --without gpm - build GTSLN and GTCRS without GPM support # --without gtsln - do not build GTSLN -# --without tip - do not build tip lib ###################################################################### test_reqrpm()