Package: protobuf
Version: 2.4.1-3
Tags: patch
User: [email protected]
Usertags: origin-ubuntu saucy ubuntu-patch

Hi guys,

I had a look this evening at the protobuf package, which is used in building
a few projects in Ubuntu that target ARM.  Targeting ARM means it would be
useful to be able to cross-install the package for use as build
dependencies, and also to cross-build the package itself.  The upstream
protobuf sources are nicely cross-compatible, so the changes to make the
package work in a cross-build environment are quite minimal - the test suite
even passes at build time when run under qemu-user-static. ;)

The attached patch works for me (in Ubuntu saucy - there are no
cross-compilers in Debian to test with yet), letting me cross-build the
package to armhf /and/ coinstall the amd64 and armhf versions of the
libraries and -dev packages.  Along the way, it also takes care of bug
#703628.

The list of changes for this patch is:

  * Non-maintainer upload.
  * Don't recommend protobuf-compiler from the bindings, it's not used and
    this doesn't need to be pulled in at runtime.  Closes: #703628.
  * Mark protobuf-compiler Multi-Arch: foreign; the output of this command
    is architecture-independent source, we don't need the version of the
    compiler to match the target arch.
  * Bump to debhelper compat 9, so that our libs get installed to the
    multiarch locations.
  * Mark the library packages Multi-Arch: same.
  * Fix debian/rules to support cross-building of the python bindings.
  * Build-depend on libpython-dev, not python-dev, for cross-build
    compatibility.


Please consider applying the patch in Debian.

Thanks,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
[email protected]                                     [email protected]
=== modified file 'debian/compat'
--- debian/compat	2008-08-03 11:01:44 +0000
+++ debian/compat	2013-10-12 04:10:26 +0000
@@ -1 +1 @@
-7
+9

=== modified file 'debian/control'
--- debian/control	2012-05-24 01:27:26 +0000
+++ debian/control	2013-10-12 04:11:42 +0000
@@ -4,7 +4,7 @@
 Maintainer: Iustin Pop <[email protected]>
 Uploaders: Robert S. Edmonds <[email protected]>
 Build-Depends: dpkg-dev (>=1.16.1~), debhelper (>= 7),
- python (>= 2.3.5-11), python-dev (>= 2.3.5-11),
+ python (>= 2.3.5-11), libpython-dev (>= 2.3.5-11),
  python-setuptools (>= 0.6c9), xmlto, ant, zlib1g-dev,
  default-jdk, unzip, python-support (>= 0.6), chrpath,
  maven-repo-helper
@@ -15,6 +15,7 @@
 
 Package: libprotobuf7
 Architecture: any
+Multi-Arch: same
 Section: libs
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: protocol buffers C++ library
@@ -33,6 +34,7 @@
 
 Package: libprotobuf-lite7
 Architecture: any
+Multi-Arch: same
 Section: libs
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: protocol buffers C++ library (lite version)
@@ -52,6 +54,7 @@
 
 Package: libprotobuf-dev
 Architecture: any
+Multi-Arch: same
 Section: libdevel
 Depends: ${shlibs:Depends}, ${misc:Depends}, zlib1g-dev,
  libprotobuf7 (= ${binary:Version}), libprotobuf-lite7 (= ${binary:Version})
@@ -72,6 +75,7 @@
 
 Package: libprotoc7
 Architecture: any
+Multi-Arch: same
 Section: libs
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: protocol buffers compiler library
@@ -91,6 +95,7 @@
 
 Package: libprotoc-dev
 Architecture: any
+Multi-Arch: same
 Section: libdevel
 Depends: ${shlibs:Depends}, ${misc:Depends},
  libprotoc7 (= ${binary:Version}), libprotobuf-dev (= ${binary:Version})
@@ -113,6 +118,7 @@
 
 Package: protobuf-compiler
 Architecture: any
+Multi-Arch: foreign
 Depends: ${shlibs:Depends}, ${misc:Depends}, libprotoc7 (= ${binary:Version})
 Description: compiler for protocol buffer definition files
  Protocol buffers are a flexible, efficient, automated mechanism for
@@ -135,7 +141,6 @@
 Section: python
 Depends: ${shlibs:Depends}, ${python:Depends}, ${misc:Depends}
 Provides: ${python:Provides}
-Recommends: protobuf-compiler
 Description: Python bindings for protocol buffers
  Protocol buffers are a flexible, efficient, automated mechanism for
  serializing structured data - similar to XML, but smaller, faster, and
@@ -160,7 +165,6 @@
 Package: libprotobuf-java
 Architecture: all
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Recommends: protobuf-compiler
 Section: java
 Description: Java bindings for protocol buffers
  Protocol buffers are a flexible, efficient, automated mechanism for

=== modified file 'debian/libprotobuf-dev.install'
--- debian/libprotobuf-dev.install	2010-01-25 18:14:49 +0000
+++ debian/libprotobuf-dev.install	2013-10-12 04:10:26 +0000
@@ -1,8 +1,8 @@
-usr/lib/libprotobuf.a
-usr/lib/libprotobuf-lite.a
-usr/lib/libprotobuf.so
-usr/lib/libprotobuf-lite.so
-usr/lib/libprotobuf.la
-usr/lib/libprotobuf-lite.la
-usr/lib/pkgconfig/*
+usr/lib/*/libprotobuf.a
+usr/lib/*/libprotobuf-lite.a
+usr/lib/*/libprotobuf.so
+usr/lib/*/libprotobuf-lite.so
+usr/lib/*/libprotobuf.la
+usr/lib/*/libprotobuf-lite.la
+usr/lib/*/pkgconfig/*
 usr/include

=== modified file 'debian/libprotobuf-lite7.install'
--- debian/libprotobuf-lite7.install	2011-02-16 21:24:42 +0000
+++ debian/libprotobuf-lite7.install	2013-10-12 04:10:26 +0000
@@ -1 +1 @@
-usr/lib/libprotobuf-lite.so.*
+usr/lib/*/libprotobuf-lite.so.*

=== modified file 'debian/libprotobuf7.install'
--- debian/libprotobuf7.install	2011-02-16 21:24:42 +0000
+++ debian/libprotobuf7.install	2013-10-12 04:10:26 +0000
@@ -1 +1 @@
-usr/lib/libprotobuf.so.*
+usr/lib/*/libprotobuf.so.*

=== modified file 'debian/libprotoc-dev.install'
--- debian/libprotoc-dev.install	2010-01-25 18:14:49 +0000
+++ debian/libprotoc-dev.install	2013-10-12 04:10:26 +0000
@@ -1,4 +1,4 @@
-usr/lib/libprotoc.a
-usr/lib/libprotoc.so
-usr/lib/libprotoc.la
+usr/lib/*/libprotoc.a
+usr/lib/*/libprotoc.so
+usr/lib/*/libprotoc.la
 usr/include/google/protobuf/compiler

=== modified file 'debian/libprotoc7.install'
--- debian/libprotoc7.install	2011-02-16 21:24:42 +0000
+++ debian/libprotoc7.install	2013-10-12 04:10:26 +0000
@@ -1 +1 @@
-usr/lib/libprotoc*.so.*
+usr/lib/*/libprotoc*.so.*

=== modified file 'debian/rules'
--- debian/rules	2012-05-24 01:27:26 +0000
+++ debian/rules	2013-10-12 04:10:26 +0000
@@ -19,6 +19,16 @@
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk
 
+DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+CC  = gcc
+CXX = g++
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+  CC  := $(DEB_HOST_GNU_TYPE)-$(CC)
+  CXX := $(DEB_HOST_GNU_TYPE)-$(CXX)
+endif
+
 CFLAGS += -Wall
 CXXFLAGS += -Wall -fpermissive
 
@@ -64,7 +74,7 @@
 
 	# python bindings
 	cd python && \
-	  PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp python setup.py build
+	  CC=$(CC) CXX=$(CXX) PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp python setup.py build
 
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 	# run tests via pure-python

Reply via email to