--- /usr/portage/dev-libs/protobuf/protobuf-2.5.0.ebuild 2014-03-06 11:01:10.000000000 +0000 +++ protobuf-2.5.0.ebuild 2014-07-29 04:01:48.000000000 +0000 @@ -7,7 +7,7 @@ PYTHON_COMPAT=( python{2_6,2_7} ) DISTUTILS_OPTIONAL=1 -inherit autotools eutils distutils-r1 java-pkg-opt-2 elisp-common +inherit autotools eutils distutils-r1 java-pkg-opt-2 elisp-common toolchain-funcs DESCRIPTION="Google's Protocol Buffers -- an efficient method of encoding structured data" HOMEPAGE="http://code.google.com/p/protobuf/" @@ -40,7 +40,20 @@ } src_configure() { + local with_protoc= + if tc-is-cross-compiler; then + if protoc --version | grep -q '^libprotoc '"${PV}"'$'; then + # Host protoc is a match, use that + local host_protoc=$(which protoc) + einfo "Using host ${host_protoc} to cross-compile" + with_protoc="--with-protoc=${host_protoc}" + else + # Need to build protoc for the host + die 'Host protoc is not the right version for this' + fi + fi econf \ + ${with_protoc} $(use_enable static-libs static) }