From d7623dd6b7235c91a15c2531f2ea4d56df497b64 Mon Sep 17 00:00:00 2001 From: Samuli Suominen Date: Wed, 24 Feb 2010 12:49:01 +0000 Subject: Fix building with unixODBC wrt #254920, thanks to David Klempner for reporting. (Portage version: 2.2_rc63/cvs/Linux x86_64) --- dev-libs/log4cxx/ChangeLog | 9 ++- .../log4cxx/files/log4cxx-0.10.0-unixODBC.patch | 75 ++++++++++++++++++++++ dev-libs/log4cxx/log4cxx-0.10.0.ebuild | 34 +++++----- 3 files changed, 97 insertions(+), 21 deletions(-) create mode 100644 dev-libs/log4cxx/files/log4cxx-0.10.0-unixODBC.patch (limited to 'dev-libs/log4cxx') diff --git a/dev-libs/log4cxx/ChangeLog b/dev-libs/log4cxx/ChangeLog index 83b0b1048542..bed531084aae 100644 --- a/dev-libs/log4cxx/ChangeLog +++ b/dev-libs/log4cxx/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for dev-libs/log4cxx -# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/log4cxx/ChangeLog,v 1.30 2009/12/23 16:14:08 grobian Exp $ +# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/log4cxx/ChangeLog,v 1.31 2010/02/24 12:49:00 ssuominen Exp $ + + 24 Feb 2010; Samuli Suominen log4cxx-0.10.0.ebuild, + +files/log4cxx-0.10.0-unixODBC.patch: + Fix building with unixODBC wrt #254920, thanks to David Klempner for + reporting. 23 Dec 2009; Fabian Groffen log4cxx-0.10.0.ebuild: Marked ~amd64-linux and ~ppc-macos, bug #294614 diff --git a/dev-libs/log4cxx/files/log4cxx-0.10.0-unixODBC.patch b/dev-libs/log4cxx/files/log4cxx-0.10.0-unixODBC.patch new file mode 100644 index 000000000000..cedca2ccdf42 --- /dev/null +++ b/dev-libs/log4cxx/files/log4cxx-0.10.0-unixODBC.patch @@ -0,0 +1,75 @@ +http://issues.apache.org/jira/browse/LOGCXX-299 +http://bugs.gentoo.org/show_bug.cgi?id=254920 + +diff -ur apache-log4cxx-0.10.0.orig/src/main/cpp/odbcappender.cpp apache-log4cxx-0.10.0/src/main/cpp/odbcappender.cpp +--- apache-log4cxx-0.10.0.orig/src/main/cpp/odbcappender.cpp 2008-04-01 01:34:09.000000000 +0300 ++++ apache-log4cxx-0.10.0/src/main/cpp/odbcappender.cpp 2010-02-24 14:39:37.000000000 +0200 +@@ -167,7 +167,8 @@ + throw SQLException( SQL_HANDLE_DBC, con, "Failed to allocate sql handle.", p); + } + +- SQLWCHAR* wsql = Transcoder::wencode(sql, p); ++ SQLWCHAR* wsql; ++ encode(&wsql, sql, p); + ret = SQLExecDirectW(stmt, wsql, SQL_NTS); + + if (ret < 0) +@@ -237,9 +238,10 @@ + } + + +- SQLWCHAR* wURL = Transcoder::wencode(databaseURL, p); ++ SQLWCHAR* wURL; ++ encode(&wURL, databaseURL, p); + +- wchar_t szOutConnectionString[1024]; ++ SQLWCHAR szOutConnectionString[1024]; + SQLSMALLINT nOutConnctionLength = 0; + + ret = SQLDriverConnectW( connection, NULL, +@@ -331,3 +333,31 @@ + } + } + } ++ ++void ODBCAppender::encode(wchar_t** dest, const LogString& src, Pool& p) { ++ *dest = Transcoder::wencode(src, p); ++} ++ ++void ODBCAppender::encode(unsigned short** dest, ++ const LogString& src, Pool& p) { ++ // worst case double number of characters from UTF-8 or wchar_t ++ *dest = (unsigned short*) ++ p.palloc((src.size() + 1) * 2 * sizeof(unsigned short)); ++ unsigned short* current = *dest; ++ for(LogString::const_iterator i = src.begin(); ++ i != src.end();) { ++ unsigned int sv = Transcoder::decode(src, i); ++ if (sv < 0x10000) { ++ *current++ = (unsigned short) sv; ++ } else { ++ unsigned char u = (unsigned char) (sv >> 16); ++ unsigned char w = (unsigned char) (u - 1); ++ unsigned short hs = (0xD800 + ((w & 0xF) << 6) + ((sv & 0xFFFF) >> 10)); ++ unsigned short ls = (0xDC00 + (sv && 0x3FF)); ++ *current++ = (unsigned short) hs; ++ *current++ = (unsigned short) ls; ++ } ++ } ++ *current = 0; ++} ++ +diff -ur apache-log4cxx-0.10.0.orig/src/main/include/log4cxx/db/odbcappender.h apache-log4cxx-0.10.0/src/main/include/log4cxx/db/odbcappender.h +--- apache-log4cxx-0.10.0.orig/src/main/include/log4cxx/db/odbcappender.h 2008-04-01 01:34:09.000000000 +0300 ++++ apache-log4cxx-0.10.0/src/main/include/log4cxx/db/odbcappender.h 2010-02-24 14:39:39.000000000 +0200 +@@ -279,6 +279,10 @@ + private: + ODBCAppender(const ODBCAppender&); + ODBCAppender& operator=(const ODBCAppender&); ++ static void encode(wchar_t** dest, const LogString& src, ++ log4cxx::helpers::Pool& p); ++ static void encode(unsigned short** dest, const LogString& src, ++ log4cxx::helpers::Pool& p); + }; // class ODBCAppender + LOG4CXX_PTR_DEF(ODBCAppender); + diff --git a/dev-libs/log4cxx/log4cxx-0.10.0.ebuild b/dev-libs/log4cxx/log4cxx-0.10.0.ebuild index 90d9629a6598..568737a98fb0 100644 --- a/dev-libs/log4cxx/log4cxx-0.10.0.ebuild +++ b/dev-libs/log4cxx/log4cxx-0.10.0.ebuild @@ -1,12 +1,11 @@ -# Copyright 1999-2009 Gentoo Foundation +# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/log4cxx/log4cxx-0.10.0.ebuild,v 1.6 2009/12/23 16:14:08 grobian Exp $ - -EAPI="1" +# $Header: /var/cvsroot/gentoo-x86/dev-libs/log4cxx/log4cxx-0.10.0.ebuild,v 1.7 2010/02/24 12:49:00 ssuominen Exp $ +EAPI=2 inherit eutils -MY_P="apache-${P}" +MY_P=apache-${P} DESCRIPTION="Library of C++ classes for flexible logging to files, syslog and other destinations" HOMEPAGE="http://logging.apache.org/log4cxx/" @@ -17,34 +16,32 @@ SLOT="0" KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~ppc-macos" IUSE="doc iodbc unicode odbc smtp" -RDEPEND="dev-libs/apr:1 +DEPEND="dev-libs/apr:1 dev-libs/apr-util:1 odbc? ( iodbc? ( >=dev-db/libiodbc-3.52.4 ) !iodbc? ( dev-db/unixODBC ) ) smtp? ( net-libs/libesmtp )" -DEPEND="${RDEPEND}" -S="${WORKDIR}/${MY_P}" +S=${WORKDIR}/${MY_P} pkg_setup() { - if use iodbc && ! use odbc ; then + if use iodbc && ! use odbc; then elog "Please enable the odbc USE-flag as well if you want odbc-support through iodbc." fi } -src_unpack() { - unpack ${A} - cd "${S}" +src_prepare() { epatch "${FILESDIR}"/${PV}-missing_includes.patch \ - "${FILESDIR}"/${P}-gcc44.patch + "${FILESDIR}"/${P}-gcc44.patch \ + "${FILESDIR}"/${P}-unixODBC.patch } -src_compile() { +src_configure() { local myconf use smtp && myconf="${myconf} --with-SMTP=libesmtp" - if use odbc ; then - if use iodbc ; then + if use odbc; then + if use iodbc; then myconf="${myconf} --with-ODBC=iODBC" else myconf="${myconf} --with-ODBC=unixODBC" @@ -55,12 +52,11 @@ src_compile() { econf \ --disable-doxygen \ --disable-html-docs \ - ${myconf} || die "econf failed" - emake || die "emake failed" + ${myconf} } src_install () { - emake DESTDIR="${D}" install || die "make install failed" + emake DESTDIR="${D}" install || die dohtml -r site/* insinto /usr/share/doc/${PF}/examples -- cgit v1.2.3-65-gdbad