avro-c: Update to 1.9.1

Backport a patch to fix build with musl ( already in future 1.10.x release)
Add a cmake patch to fix build on mulilibbed env
delete already upstreamed patch

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2019-12-19 18:30:21 -08:00
parent 89461fecb7
commit 20b42c1de7
5 changed files with 131 additions and 57 deletions

View File

@ -0,0 +1,42 @@
From 9b39a985bcd6cd34f0820f3680f145d46c0e56bd Mon Sep 17 00:00:00 2001
From: Titouan Christophe <titouan.christophe@railnova.eu>
Date: Sun, 8 Dec 2019 01:55:59 +0100
Subject: [PATCH] Allow avro C to be built on musl based systems.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The type `ssize_t` is defined in sys/types.h, and nowhere else
in the musl standard C library, so it should be included for the
compilation to succeed.
This fixes several errors like:
In file included from src/generic.c:29:0:
src/generic.c: In function avro_generic_value_new:
src/avro_generic_internal.h:63:39:
error: ssize_t undeclared (first use in this function);
did you mean size_t?
Upstream-Status: Backport
Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
---
lang/c/src/avro_generic_internal.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lang/c/src/avro_generic_internal.h b/lang/c/src/avro_generic_internal.h
index 709403c03..9843ed652 100644
--- a/lang/c/src/avro_generic_internal.h
+++ b/lang/c/src/avro_generic_internal.h
@@ -24,6 +24,8 @@ extern "C" {
#define CLOSE_EXTERN
#endif
+#include <sys/types.h>
+
#include "avro/generic.h"
#include "avro/schema.h"
#include "avro/value.h"
--
2.24.1

View File

@ -1,37 +0,0 @@
From 518bb8ccfb3f3fc143fbd571782f3e40573d01b5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 10 Apr 2017 09:15:04 -0700
Subject: [PATCH] avro-c: Fix build with clang compiler
Clang advertizes itself to be compatible with gcc 4.2.1
while that was true several years ago, it now supports
a lot more newer features, the test to just check gcc
version should be supplanted with clang check as well
so atomic support in clang can be asserted as well
Fixes
lang/c/src/avro/refcount.h:301:2: error: "No atomic implementation!"
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
lang/c/src/avro/refcount.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lang/c/src/avro/refcount.h b/lang/c/src/avro/refcount.h
index 69afa4fc..d76ba057 100644
--- a/lang/c/src/avro/refcount.h
+++ b/lang/c/src/avro/refcount.h
@@ -118,7 +118,8 @@ avro_refcount_dec(volatile int *refcount)
* GCC intrinsics
*/
-#elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40500
+#elif (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40500 \
+|| defined(__clang__)
static inline void
avro_refcount_set(volatile int *refcount, int value)
--
2.12.2

View File

@ -0,0 +1,70 @@
From f24f863f3a8ca86f44123a58613f62c3b511da1e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 19 Dec 2019 18:23:41 -0800
Subject: [PATCH] cmake: Use GNUInstallDirs instead of hard-coded paths
This ensures that it can be built on platforms where libdir is not
/usr/lib e.g. ppc64
Upstream-Status: Submitted [https://github.com/apache/avro/pull/749]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
lang/c/CMakeLists.txt | 2 +-
lang/c/src/CMakeLists.txt | 16 +++++++++-------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/lang/c/CMakeLists.txt b/lang/c/CMakeLists.txt
index 11cbf018e..6c8d7aaf3 100644
--- a/lang/c/CMakeLists.txt
+++ b/lang/c/CMakeLists.txt
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-cmake_minimum_required(VERSION 2.4)
+cmake_minimum_required(VERSION 3.1)
project(AvroC)
enable_testing()
diff --git a/lang/c/src/CMakeLists.txt b/lang/c/src/CMakeLists.txt
index 6f5659750..c1761c8de 100644
--- a/lang/c/src/CMakeLists.txt
+++ b/lang/c/src/CMakeLists.txt
@@ -106,17 +106,19 @@ install(DIRECTORY
DESTINATION include
FILES_MATCHING PATTERN "*.h")
+include(GNUInstallDirs)
+
if (WIN32)
install(TARGETS avro-static
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
else(WIN32)
install(TARGETS avro-static avro-shared
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif(WIN32)
@@ -126,7 +128,7 @@ set(prefix ${CMAKE_INSTALL_PREFIX})
set(VERSION ${AVRO_VERSION})
configure_file(avro-c.pc.in avro-c.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/avro-c.pc
- DESTINATION lib/pkgconfig)
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
add_executable(avrocat avrocat.c)
target_link_libraries(avrocat avro-static)
--
2.24.1

View File

@ -1,20 +0,0 @@
SUMMARY = "Apache Avro data serialization system."
HOMEPAGE = "http://apr.apache.org/"
SECTION = "libs"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=73bdf70f268f0b3b9c5a83dd7a6f3324"
DEPENDS = "jansson zlib xz"
PV .= "+git${SRCPV}"
SRCREV = "4b3677c32b879e0e7f717eb95f9135ac654da760"
SRC_URI = "git://github.com/apache/avro \
file://0001-avro-c-Fix-build-with-clang-compiler.patch;patchdir=../../ \
"
S = "${WORKDIR}/git/lang/c"
LDFLAGS_append_libc-uclibc = " -lm"
inherit cmake

View File

@ -0,0 +1,19 @@
SUMMARY = "Apache Avro data serialization system."
HOMEPAGE = "http://apr.apache.org/"
SECTION = "libs"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=6d502b41f76179fc84e536236f359cae"
DEPENDS = "jansson zlib xz"
BRANCH = "branch-1.9"
SRCREV = "89218262cde62e98fcb3778b86cd3f03056c54f3"
SRC_URI = "git://github.com/apache/avro;branch=${BRANCH} \
file://0001-Allow-avro-C-to-be-built-on-musl-based-systems.patch;patchdir=../../ \
file://0001-cmake-Use-GNUInstallDirs-instead-of-hard-coded-paths.patch;patchdir=../../ \
"
S = "${WORKDIR}/git/lang/c"
inherit cmake