changeset 2749:24b754ef1d76

Merge pull request #82 from lotodore/master Add package protobuf
author mabrand <mabrand@mabrand.nl>
date Tue, 18 Sep 2012 13:11:12 -0700
parents 8fbf0cc2ca6f (current diff) a69eb5b6d9a5 (diff)
children 1334d9ed9c39
files
diffstat 3 files changed, 53 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/index.html	Tue Sep 18 12:00:02 2012 +0200
+++ b/index.html	Tue Sep 18 13:11:12 2012 -0700
@@ -1759,6 +1759,11 @@
         <td id="proj-website"><a href="http://trac.osgeo.org/proj/">proj</a></td>
     </tr>
     <tr>
+        <td id="protobuf-package">protobuf</td>
+        <td id="protobuf-version">2.4.1</td>
+        <td id="protobuf-website"><a href="http://code.google.com/p/protobuf"/>protobuf</a></td>
+    </tr>
+    <tr>
         <td id="pthreads-package">pthreads</td>
         <td id="pthreads-version">2-9-1</td>
         <td id="pthreads-website"><a href="http://sourceware.org/pthreads-win32/">Pthreads-w32</a></td>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/protobuf-test.cpp	Tue Sep 18 13:11:12 2012 -0700
@@ -0,0 +1,9 @@
+#include <google/protobuf/stubs/common.h>
+
+int
+main()
+{
+    GOOGLE_PROTOBUF_VERIFY_VERSION;
+    google::protobuf::ShutdownProtobufLibrary();
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/protobuf.mk	Tue Sep 18 13:11:12 2012 -0700
@@ -0,0 +1,39 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG             := protobuf
+$(PKG)_IGNORE   :=
+$(PKG)_CHECKSUM := df5867e37a4b51fb69f53a8baf5b994938691d6d
+$(PKG)_SUBDIR   := $(PKG)-$($(PKG)_VERSION)
+$(PKG)_FILE     := $(PKG)-$($(PKG)_VERSION).tar.bz2
+$(PKG)_URL      := http://protobuf.googlecode.com/files/$($(PKG)_FILE)
+$(PKG)_DEPS     := gcc zlib
+
+define $(PKG)_UPDATE
+    $(WGET) -q -O- 'http://code.google.com/p/protobuf/downloads/list?sort=-uploaded' | \
+    $(SED) -n 's,.*protobuf-\([0-9][^<]*\)\.tar.*,\1,p' | \
+    head -1
+endef
+
+define $(PKG)_BUILD
+# First step: Build for host system in order to create "protoc" binary.
+    cd '$(1)' && ./configure \
+        --disable-shared
+    $(MAKE) -C '$(1)' -j '$(JOBS)'
+    cp '$(1)/src/protoc' '$(1)/src/protoc_host'
+    $(MAKE) -C '$(1)' -j 1 distclean
+# Second step: Build for target system.
+    cd '$(1)' && ./configure \
+        --host='$(TARGET)' \
+        --prefix='$(PREFIX)/$(TARGET)' \
+        --disable-shared \
+        --with-zlib \
+        --with-protoc=src/protoc_host
+    $(MAKE) -C '$(1)' -j '$(JOBS)'
+    $(MAKE) -C '$(1)' -j 1 install
+
+    '$(TARGET)-gcc' \
+        -W -Wall -Werror -ansi -pedantic \
+        '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-protobuf.exe' \
+        `'$(TARGET)-pkg-config' protobuf --cflags --libs`
+endef