ctemplate: sync with upstream Gentoo

This includes a fix for building with gcc-4.7.

BUG=None
TEST=`emerge ctemplate` works
TEST=`emerge-amd64-generic ctemplate` works
TEST=`emerge-arm-generic ctemplate` works
TEST=`emerge-x86-generic ctemplate` works

Change-Id: I8752fc23fc1e636c59fc11eee2ee75a5f826ab7b
Reviewed-on: https://gerrit.chromium.org/gerrit/23543
Reviewed-by: Han Shen <shenhan@google.com>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Han Shen <shenhan@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: asharif <asharif@chromium.org>
diff --git a/dev-cpp/ctemplate/ctemplate-1.0.ebuild b/dev-cpp/ctemplate/ctemplate-1.0.ebuild
index fca558d..f6c2b81 100644
--- a/dev-cpp/ctemplate/ctemplate-1.0.ebuild
+++ b/dev-cpp/ctemplate/ctemplate-1.0.ebuild
@@ -1,10 +1,10 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-cpp/ctemplate/ctemplate-1.0.ebuild,v 1.5 2012/02/11 05:11:44 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-cpp/ctemplate/ctemplate-1.0.ebuild,v 1.7 2012/05/24 19:27:18 vapier Exp $
 
 EAPI="4"
 
-inherit elisp-common python
+inherit elisp-common python eutils
 
 DESCRIPTION="A simple but powerful template language for C++"
 HOMEPAGE="http://code.google.com/p/google-ctemplate/"
@@ -28,6 +28,10 @@
 	fi
 }
 
+src_prepare() {
+	epatch "${FILESDIR}"/${P}-gcc-4.7.patch
+}
+
 src_configure() {
 	econf \
 		--enable-shared \
@@ -43,7 +47,7 @@
 }
 
 src_install() {
-	emake DESTDIR="${D}" install
+	default
 
 	# Installs just every piece
 	rm -rf "${ED}/usr/share/doc"
@@ -64,7 +68,7 @@
 		elisp-site-file-install "${FILESDIR}/${SITEFILE}"
 	fi
 
-	find "${ED}" -name '*.la' -exec rm -f {} +
+	find "${ED}"/usr -name '*.la' -delete
 }
 
 pkg_postinst() {
diff --git a/dev-cpp/ctemplate/files/ctemplate-1.0-gcc-4.7.patch b/dev-cpp/ctemplate/files/ctemplate-1.0-gcc-4.7.patch
new file mode 100644
index 0000000..a8eaaa6
--- /dev/null
+++ b/dev-cpp/ctemplate/files/ctemplate-1.0-gcc-4.7.patch
@@ -0,0 +1,29 @@
+backported fix from ctemplate-2.2 for building with gcc-4.7+
+
+--- ctemplate-1.0/src/base/small_map.h
++++ ctemplate-1.0/src/base/small_map.h
+@@ -360,20 +360,20 @@ class small_map {
+     if (size_ >= 0) {
+       for (int i = 0; i < size_; i++) {
+         if (compare(array_[i]->first, x.first)) {
+-          return make_pair(iterator(array_ + i), false);
++          return std::make_pair(iterator(array_ + i), false);
+         }
+       }
+       if (size_ == kArraySize) {
+         ConvertToRealMap();  // Invalidates all iterators!
+         std::pair<typename NormalMap::iterator, bool> ret = map_->insert(x);
+-        return make_pair(iterator(ret.first), ret.second);
++        return std::make_pair(iterator(ret.first), ret.second);
+       } else {
+         array_[size_].Init(x);
+-        return make_pair(iterator(array_ + size_++), true);
++        return std::make_pair(iterator(array_ + size_++), true);
+       }
+     } else {
+       std::pair<typename NormalMap::iterator, bool> ret = map_->insert(x);
+-      return make_pair(iterator(ret.first), ret.second);
++      return std::make_pair(iterator(ret.first), ret.second);
+     }
+   }
+