Package: librdkafka Version: 0.8.3-1 Severity: normal Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu trusty ubuntu-patch
In Ubuntu, the attached patch was applied to achieve the following: * link-atomic.patch: Switch from __sync to __atomic to support more arches. * Switch back to arch:any instead of the Debian maintainer's shorter list. So, this patch should be almost upstreamable, depending on who their intended target is. If they need to support __sync on non-Linux, they could wrap __sync and __atomic blocks in ifdef/ifndef magic to test for linux or perhaps specific GCC versions. This patch, as it is, however, should be fine for Debian. Tested in Ubuntu with the 6 arches we build (amd64, i386, arm64, armhf, powerpc, and ppc64el), and all looks fine here: https://launchpad.net/ubuntu/+source/librdkafka/0.8.3-1ubuntu1 ... Adam -- System Information: Debian Release: jessie/sid APT prefers trusty-updates APT policy: (500, 'trusty-updates'), (500, 'trusty-security'), (500, 'trusty') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.13.0-11-generic (SMP w/4 CPU cores) Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
diff -Nru librdkafka-0.8.3/debian/changelog librdkafka-0.8.3/debian/changelog diff -Nru librdkafka-0.8.3/debian/control librdkafka-0.8.3/debian/control --- librdkafka-0.8.3/debian/control 2014-02-17 17:22:09.000000000 -0700 +++ librdkafka-0.8.3/debian/control 2014-02-23 18:07:25.000000000 -0700 @@ -9,7 +9,7 @@ Vcs-Browser: https://github.com/edenhill/librdkafka/tree/debian Package: librdkafka1 -Architecture: i386 amd64 x32 ia64 armel armhf arm64 ppc64 sparc64 s390x kfreebsd-i386 kfreebsd-amd64 +Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: library implementing the Apache Kafka protocol librdkafka is a C implementation of the Apache Kafka protocol. It currently @@ -20,7 +20,7 @@ Package: librdkafka-dev Section: libdevel -Architecture: i386 amd64 x32 ia64 armel armhf arm64 ppc64 sparc64 s390x kfreebsd-i386 kfreebsd-amd64 +Architecture: any Depends: librdkafka1 (= ${binary:Version}), ${misc:Depends} Description: library implementing the Apache Kafka protocol (development headers) librdkafka is a C implementation of the Apache Kafka protocol. It currently @@ -34,7 +34,7 @@ Package: librdkafka1-dbg Section: debug Priority: extra -Architecture: i386 amd64 x32 ia64 armel armhf arm64 ppc64 sparc64 s390x kfreebsd-i386 kfreebsd-amd64 +Architecture: any Depends: librdkafka1 (= ${binary:Version}), ${misc:Depends} Description: library implementing the Apache Kafka protocol (debugging symbols) librdkafka is a C implementation of the Apache Kafka protocol. It currently diff -Nru librdkafka-0.8.3/debian/patches/link-atomic.patch librdkafka-0.8.3/debian/patches/link-atomic.patch --- librdkafka-0.8.3/debian/patches/link-atomic.patch 1969-12-31 17:00:00.000000000 -0700 +++ librdkafka-0.8.3/debian/patches/link-atomic.patch 2014-02-22 17:51:42.000000000 -0700 @@ -0,0 +1,78 @@ +Description: Switch from __sync functions to __atomic for better arch support +Author: Adam Conrad <adcon...@ubuntu.com> + +Index: librdkafka-0.8.3/Makefile +=================================================================== +--- librdkafka-0.8.3.orig/Makefile 2014-02-10 09:37:21.000000000 -0700 ++++ librdkafka-0.8.3/Makefile 2014-02-22 17:15:42.000000000 -0700 +@@ -57,7 +57,7 @@ + $(CC) $(LDFLAGS) \ + -shared -Wl,-soname,$@ \ + -Wl,--version-script=librdkafka.lds \ +- $(OBJS) -o $@ -lpthread -lrt -lz -lc ; \ ++ $(OBJS) -o $@ -lpthread -lrt -lz -lc -latomic ; \ + fi) + + $(LIBNAME).a: $(OBJS) +Index: librdkafka-0.8.3/examples/Makefile +=================================================================== +--- librdkafka-0.8.3.orig/examples/Makefile 2014-02-10 09:37:21.000000000 -0700 ++++ librdkafka-0.8.3/examples/Makefile 2014-02-22 17:15:57.648623936 -0700 +@@ -6,7 +6,7 @@ + LDFLAGS += ../librdkafka.a + LDFLAGS += -lpthread -lz + ifeq ($(shell uname -s), Linux) +- LDFLAGS += -lrt ++ LDFLAGS += -lrt -latomic + endif + + # Profiling +Index: librdkafka-0.8.3/tests/Makefile +=================================================================== +--- librdkafka-0.8.3.orig/tests/Makefile 2014-02-10 09:37:21.000000000 -0700 ++++ librdkafka-0.8.3/tests/Makefile 2014-02-22 17:16:59.336621754 -0700 +@@ -8,7 +8,7 @@ + LDFLAGS += -L../ -lrdkafka + LDFLAGS += -lpthread -lz + ifeq ($(shell uname -s), Linux) +- LDFLAGS += -lrt ++ LDFLAGS += -lrt -latomic + endif + + # Profiling +Index: librdkafka-0.8.3/README.md +=================================================================== +--- librdkafka-0.8.3.orig/README.md 2014-02-22 17:17:42.672620221 -0700 ++++ librdkafka-0.8.3/README.md 2014-02-22 17:18:06.864619365 -0700 +@@ -91,7 +91,7 @@ + + See [examples/rdkafka_example.c](https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_example.c) for an example producer and consumer. + +-Link your program with `-lrdkafka -lz -lpthread -lrt`. ++Link your program with `-lrdkafka -lz -lpthread -lrt -latomic`. + + + ## Documentation +Index: librdkafka-0.8.3/rd.h +=================================================================== +--- librdkafka-0.8.3.orig/rd.h 2014-02-10 09:37:21.000000000 -0700 ++++ librdkafka-0.8.3/rd.h 2014-02-22 17:50:11.804551280 -0700 +@@ -83,13 +83,13 @@ + ((val) < (low) ? low : ((val) > (hi) ? (hi) : (val))) + + +-#define rd_atomic_add(PTR,VAL) __sync_add_and_fetch(PTR,VAL) +-#define rd_atomic_sub(PTR,VAL) __sync_sub_and_fetch(PTR,VAL) ++#define rd_atomic_add(PTR,VAL) __atomic_add_fetch(PTR,VAL,__ATOMIC_SEQ_CST) ++#define rd_atomic_sub(PTR,VAL) __atomic_sub_fetch(PTR,VAL,__ATOMIC_SEQ_CST) + +-#define rd_atomic_add_prev(PTR,VAL) __sync_fetch_and_add(PTR,VAL) +-#define rd_atomic_sub_prev(PTR,VAL) __sync_fetch_and_sub(PTR,VAL) ++#define rd_atomic_add_prev(PTR,VAL) __atmoic_fetch_add(PTR,VAL,__ATOMIC_SEQ_CST) ++#define rd_atomic_sub_prev(PTR,VAL) __atomic_fetch_sub(PTR,VAL,__ATOMIC_SEQ_CST) + +-#define rd_atomic_set(PTR,VAL) __sync_lock_test_and_set(PTR,VAL) ++#define rd_atomic_set(PTR,VAL) __atomic_test_and_set(PTR,__ATOMIC_SEQ_CST) + + + #ifndef be64toh diff -Nru librdkafka-0.8.3/debian/patches/series librdkafka-0.8.3/debian/patches/series --- librdkafka-0.8.3/debian/patches/series 1969-12-31 17:00:00.000000000 -0700 +++ librdkafka-0.8.3/debian/patches/series 2014-02-22 17:06:46.000000000 -0700 @@ -0,0 +1 @@ +link-atomic.patch