--- /dev/null
+# protobuf
+PROTOBUF_VERSION := 2.5.0
+PROTOBUF_URL := https://protobuf.googlecode.com/files/protobuf-$(PROTOBUF_VERSION).tar.bz2
+
+PKGS += protobuf
+ifeq ($(call need_pkg,"protobuf"),)
+PKGS_FOUND += protobuf
+endif
+
+$(TARBALLS)/protobuf-$(PROTOBUF_VERSION).tar.bz2:
+ $(call download,$(PROTOBUF_URL))
+
+.sum-protobuf: protobuf-$(PROTOBUF_VERSION).tar.bz2
+
+DEPS_protobuf = zlib $(DEPS_zlib)
+
+protobuf: protobuf-$(PROTOBUF_VERSION).tar.bz2 .sum-protobuf
+ $(UNPACK)
+ifdef HAVE_WIN32
+ $(APPLY) $(SRC)/protobuf/win32.patch
+endif
+ $(MOVE)
+
+.protobuf: protobuf
+ $(RECONF)
+# Local protoc Compiler
+ifdef HAVE_CROSS_COMPILE
+ cd $< && ./configure --prefix="$(PREFIX)" && $(MAKE) install
+ cd $< && $(MAKE) clean
+endif
+ cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --with-protoc=protoc
+ cd $< && $(MAKE) install
+ touch $@
--- /dev/null
+diff -ruN protobuf/src/google/protobuf/stubs/common.h protobuf.new/src/google/protobuf/stubs/common.h
+--- protobuf/src/google/protobuf/stubs/common.h 2013-02-26 18:56:38.000000000 +0100
++++ protobuf.new/src/google/protobuf/stubs/common.h 2014-08-13 21:27:13.620935659 +0200
+@@ -619,6 +619,10 @@
+ // ===================================================================
+ // emulates google3/base/logging.h
+
++#if defined(ERROR)
++# undef ERROR
++#endif
++
+ enum LogLevel {
+ LOGLEVEL_INFO, // Informational. This is never actually used by
+ // libprotobuf.
+diff -ruN protobuf/src/google/protobuf/extension_set.cc protobuf.new/src/google/protobuf/extension_set.cc
+--- protobuf/src/google/protobuf/extension_set.cc 2013-02-26 18:56:42.000000000 +0100
++++ protobuf.new/src/google/protobuf/extension_set.cc 2014-08-13 21:23:50.960935943 +0200
+@@ -218,6 +218,10 @@
+ // ===================================================================
+ // Field accessors
+
++#if defined(OPTIONAL)
++# undef OPTIONAL
++#endif
++
+ namespace {
+
+ enum Cardinality {