aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Bergin <peter@berginkonsult.se>2021-06-11 17:09:47 +0200
committerKhem Raj <raj.khem@gmail.com>2021-06-11 08:55:33 -0700
commitd03e76e2884c7af1075b42c09781f67e93bea51c (patch)
tree96e9b4bf7e57276f8ecea4ab58cf60d941a65c61
parent711e932b14de57a5f341124470b2f3f131615a25 (diff)
downloadmeta-openembedded-d03e76e2884c7af1075b42c09781f67e93bea51c.tar.gz
meta-openembedded-d03e76e2884c7af1075b42c09781f67e93bea51c.tar.bz2
meta-openembedded-d03e76e2884c7af1075b42c09781f67e93bea51c.zip
hiredis: add cmake config file for pkgconfig
In order to be able to use pkgconfig and find_package in cmake the file HiredisConfig.cmake need to be present in sysroot. This commit adds a patch from Ubuntu/Debian that fixes this. As build system for version 0.14 of Hiredis is Makefile based this is not possible to upstream. In later Hiredis the build system is CMake based and this is fixed. Signed-off-by: Peter Bergin <peter@berginkonsult.se> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-extended/hiredis/files/0001-CMake-configuration-for-hiredis.patch117
-rw-r--r--meta-oe/recipes-extended/hiredis/hiredis_0.14.0.bb3
2 files changed, 119 insertions, 1 deletions
diff --git a/meta-oe/recipes-extended/hiredis/files/0001-CMake-configuration-for-hiredis.patch b/meta-oe/recipes-extended/hiredis/files/0001-CMake-configuration-for-hiredis.patch
new file mode 100644
index 000000000..139d13f4c
--- /dev/null
+++ b/meta-oe/recipes-extended/hiredis/files/0001-CMake-configuration-for-hiredis.patch
@@ -0,0 +1,117 @@
+From 2dc0c7e4a3fa7ecc92ee5e22f1d8ee48c2b333a8 Mon Sep 17 00:00:00 2001
+From: Thomas Lee <debian@tomlee.co>
+Date: Sun, 4 Nov 2018 22:59:09 +0000
+Subject: [PATCH] CMake configuration for hiredis
+
+Last-Update: 2018-09-26
+
+Upstream-Status: Backport [Ubuntu 20.04]
+---
+ HiredisConfig.cmake.in | 5 +++++
+ HiredisConfigVersion.cmake.in | 22 ++++++++++++++++++++++
+ Makefile | 17 ++++++++++++++++-
+ 3 files changed, 43 insertions(+), 1 deletion(-)
+ create mode 100644 HiredisConfig.cmake.in
+ create mode 100644 HiredisConfigVersion.cmake.in
+
+diff --git a/HiredisConfig.cmake.in b/HiredisConfig.cmake.in
+new file mode 100644
+index 0000000..2cce290
+--- /dev/null
++++ b/HiredisConfig.cmake.in
+@@ -0,0 +1,5 @@
++find_path(HIREDIS_INCLUDE_DIRS hiredis/hiredis.h HINTS "/usr/include")
++find_library(HIREDIS_LIB_HIREDIS NAMES hiredis HINTS "/usr/lib")
++
++set(HIREDIS_LIBRARIES ${HIREDIS_LIB_HIREDIS})
++
+diff --git a/HiredisConfigVersion.cmake.in b/HiredisConfigVersion.cmake.in
+new file mode 100644
+index 0000000..584144a
+--- /dev/null
++++ b/HiredisConfigVersion.cmake.in
+@@ -0,0 +1,22 @@
++set(PACKAGE_VERSION "@HIREDIS_VERSION@")
++
++string(REPLACE "." ";" HIREDIS_VERSION_COMPONENTS ${PACKAGE_VERSION})
++string(REPLACE "." ";" REQUESTED_VERSION_COMPONENTS ${PACKAGE_FIND_VERSION})
++
++list(GET HIREDIS_VERSION_COMPONENTS 0 HIREDIS_VERSION_MAJOR)
++list(GET HIREDIS_VERSION_COMPONENTS 1 HIREDIS_VERSION_MINOR)
++
++list(GET REQUESTED_VERSION_COMPONENTS 0 REQUESTED_VERSION_MAJOR)
++list(GET REQUESTED_VERSION_COMPONENTS 1 REQUESTED_VERSION_MINOR)
++
++if(("${HIREDIS_VERSION_MAJOR}" EQUAL "${REQUESTED_VERSION_MAJOR}") AND
++ (("${HIREDIS_VERSION_MINOR}" EQUAL "${REQUESTED_VERSION_MINOR}") OR
++ ("${HIREDIS_VERSION_MINOR}" GREATER "${REQUESTED_VERSION_MINOR}")))
++ set(PACKAGE_VERSION_COMPATIBLE TRUE)
++ if("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
++ set(PACKAGE_VERSION_EXACT TRUE)
++ endif()
++else()
++ set(PACKAGE_VERSION_COMPATIBLE FALSE)
++endif()
++
+diff --git a/Makefile b/Makefile
+index 339727f..43704cd 100644
+--- a/Makefile
++++ b/Makefile
+@@ -8,6 +8,8 @@ EXAMPLES=hiredis-example hiredis-example-libevent hiredis-example-libev hiredis-
+ TESTS=hiredis-test
+ LIBNAME=libhiredis
+ PKGCONFNAME=hiredis.pc
++CMAKECONFNAME=HiredisConfig.cmake
++CMAKEVERSNAME=HiredisConfigVersion.cmake
+
+ HIREDIS_MAJOR=$(shell grep HIREDIS_MAJOR hiredis.h | awk '{print $$3}')
+ HIREDIS_MINOR=$(shell grep HIREDIS_MINOR hiredis.h | awk '{print $$3}')
+@@ -19,9 +21,11 @@ PREFIX?=/usr/local
+ INCLUDE_PATH?=include/hiredis
+ LIBRARY_PATH?=lib
+ PKGCONF_PATH?=pkgconfig
++CMAKE_PATH?=cmake/Hiredis
+ INSTALL_INCLUDE_PATH= $(DESTDIR)$(PREFIX)/$(INCLUDE_PATH)
+ INSTALL_LIBRARY_PATH= $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH)
+ INSTALL_PKGCONF_PATH= $(INSTALL_LIBRARY_PATH)/$(PKGCONF_PATH)
++INSTALL_CMAKE_PATH= $(INSTALL_LIBRARY_PATH)/$(CMAKE_PATH)
+
+ # redis-server configuration used for testing
+ REDIS_PORT=56379
+@@ -150,6 +154,7 @@ check: hiredis-test
+
+ clean:
+ rm -rf $(DYLIBNAME) $(STLIBNAME) $(TESTS) $(PKGCONFNAME) examples/hiredis-example* *.o *.gcda *.gcno *.gcov
++ rm -f $(CMAKECONFNAME) $(CMAKEVERSNAME)
+
+ dep:
+ $(CC) -MM *.c
+@@ -169,7 +174,14 @@ $(PKGCONFNAME): hiredis.h
+ @echo Libs: -L\$${libdir} -lhiredis >> $@
+ @echo Cflags: -I\$${includedir} -D_FILE_OFFSET_BITS=64 >> $@
+
+-install: $(DYLIBNAME) $(STLIBNAME) $(PKGCONFNAME)
++$(CMAKECONFNAME): $(CMAKECONFNAME).in
++ cp $(CMAKECONFNAME).in $(CMAKECONFNAME)
++
++$(CMAKEVERSNAME): $(CMAKEVERSNAME).in
++ sed -e "s,@HIREDIS_VERSION@,$(HIREDIS_MAJOR).$(HIREDIS_MINOR).$(HIREDIS_PATCH),g" \
++ $(CMAKEVERSNAME).in >$(CMAKEVERSNAME)
++
++install: $(DYLIBNAME) $(STLIBNAME) $(PKGCONFNAME) $(CMAKECONFNAME) $(CMAKEVERSNAME)
+ mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_INCLUDE_PATH)/adapters $(INSTALL_LIBRARY_PATH)
+ $(INSTALL) hiredis.h async.h read.h sds.h $(INSTALL_INCLUDE_PATH)
+ $(INSTALL) adapters/*.h $(INSTALL_INCLUDE_PATH)/adapters
+@@ -178,6 +190,9 @@ install: $(DYLIBNAME) $(STLIBNAME) $(PKGCONFNAME)
+ $(INSTALL) $(STLIBNAME) $(INSTALL_LIBRARY_PATH)
+ mkdir -p $(INSTALL_PKGCONF_PATH)
+ $(INSTALL) $(PKGCONFNAME) $(INSTALL_PKGCONF_PATH)
++ mkdir -p $(INSTALL_CMAKE_PATH)
++ $(INSTALL) $(CMAKECONFNAME) $(INSTALL_CMAKE_PATH)
++ $(INSTALL) $(CMAKEVERSNAME) $(INSTALL_CMAKE_PATH)
+
+ 32bit:
+ @echo ""
+--
+2.27.0
+
diff --git a/meta-oe/recipes-extended/hiredis/hiredis_0.14.0.bb b/meta-oe/recipes-extended/hiredis/hiredis_0.14.0.bb
index 29f8de8d2..a41888802 100644
--- a/meta-oe/recipes-extended/hiredis/hiredis_0.14.0.bb
+++ b/meta-oe/recipes-extended/hiredis/hiredis_0.14.0.bb
@@ -7,7 +7,8 @@ DEPENDS = "redis"
LIC_FILES_CHKSUM = "file://COPYING;md5=d84d659a35c666d23233e54503aaea51"
SRCREV = "685030652cd98c5414ce554ff5b356dfe8437870"
SRC_URI = "git://github.com/redis/hiredis;protocol=git \
- file://0001-Makefile-remove-hardcoding-of-CC.patch"
+ file://0001-Makefile-remove-hardcoding-of-CC.patch \
+ file://0001-CMake-configuration-for-hiredis.patch"
S = "${WORKDIR}/git"