Subject: Collected Debian patches for avro-c
Author: Robert Edmonds <edmonds@debian.org>

The avro-c package is maintained in Git rather than maintaining
patches as separate files, and separating the patches doesn't seem to
be worth the effort.  They are therefore all included in this single
Debian patch.

For full commit history and separated commits, see the packaging Git
repository.
--- avro-c-1.8.2.orig/CMakeLists.txt
+++ avro-c-1.8.2/CMakeLists.txt
@@ -47,6 +47,16 @@ if (UNIX)
     if(LIBAVRO_VERSION_RESULT)
         message(FATAL_ERROR "Cannot determine libavro version number")
     endif(LIBAVRO_VERSION_RESULT)
+
+    execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/version.sh libcurrent
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        RESULT_VARIABLE LIBAVRO_SOVERSION_RESULT
+        OUTPUT_VARIABLE LIBAVRO_SOVERSION
+        OUTPUT_STRIP_TRAILING_WHITESPACE)
+    if(LIBAVRO_SOVERSION_RESULT)
+        message(FATAL_ERROR "Cannot determine libavro version number")
+    endif(LIBAVRO_SOVERSION_RESULT)
+
 else(UNIX)
     # Hard code for win32 -- need to figure out how to port version.sh for
     # Windows.
--- avro-c-1.8.2.orig/src/CMakeLists.txt
+++ avro-c-1.8.2/src/CMakeLists.txt
@@ -17,6 +17,8 @@
 # under the License.
 #
 
+include(GNUInstallDirs)
+
 set(AVRO_SRC
     allocation.c
     array.c
@@ -79,7 +81,7 @@ set(AVRO_SRC
 
 source_group(Avro FILES ${AVRO_SRC})
 
-# The version.sh script gives us a SOVERSION that uses colon as a
+# The version.sh script gives us a VERSION that uses colon as a
 # separator; we need periods.
 
 string(REPLACE ":" "." LIBAVRO_DOT_VERSION ${LIBAVRO_VERSION})
@@ -94,7 +96,8 @@ add_library(avro-shared SHARED ${AVRO_SR
 target_link_libraries(avro-shared ${JANSSON_LIBRARIES} ${CODEC_LIBRARIES} ${THREADS_LIBRARIES})
 set_target_properties(avro-shared PROPERTIES
         OUTPUT_NAME avro
-        SOVERSION ${LIBAVRO_DOT_VERSION})
+        VERSION ${LIBAVRO_DOT_VERSION}
+        SOVERSION ${LIBAVRO_SOVERSION})
 endif(NOT WIN32)
 
 install(FILES
@@ -114,8 +117,8 @@ install(TARGETS avro-static
 else(WIN32)
 install(TARGETS avro-static avro-shared
         RUNTIME DESTINATION bin
-        LIBRARY DESTINATION lib
-        ARCHIVE DESTINATION lib
+        LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+        ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
        )
 endif(WIN32)
 
@@ -125,23 +128,23 @@ 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)
+target_link_libraries(avrocat avro-shared)
 install(TARGETS avrocat RUNTIME DESTINATION bin)
 
 add_executable(avroappend avroappend.c)
-target_link_libraries(avroappend avro-static)
+target_link_libraries(avroappend avro-shared)
 install(TARGETS avroappend RUNTIME DESTINATION bin)
 
 if (NOT WIN32)
 #TODO: Port getopt() to Windows to compile avropipe.c and avromod.c
 add_executable(avropipe avropipe.c)
-target_link_libraries(avropipe avro-static)
+target_link_libraries(avropipe avro-shared)
 install(TARGETS avropipe RUNTIME DESTINATION bin)
 
 add_executable(avromod avromod.c)
-target_link_libraries(avromod avro-static)
+target_link_libraries(avromod avro-shared)
 install(TARGETS avromod RUNTIME DESTINATION bin)
 endif(NOT WIN32)
--- avro-c-1.8.2.orig/src/avro-c.pc.in
+++ avro-c-1.8.2/src/avro-c.pc.in
@@ -2,6 +2,4 @@ Name: avro-c
 Description: C library for parsing Avro data
 Version: @VERSION@
 URL: http://avro.apache.org/
-Libs: -L@prefix@/lib -lavro
-Cflags: -I@prefix@/include
-Requires: @CODEC_PKG@
+Libs: -lavro
