c-ares: move from meta-networking to meta-oe

* nodejs from meta-oe depends on this since:
  commit 76dd3dac1f
  Author: André Draszik <git@andred.net>
  Date:   Tue Oct 29 16:42:24 2019 +0000

    nodejs: allow use of system c-ares (and make default)

    Use system c-ares via PACKAGECONFIG by default. So far,
    nodejs had been built using its embedded copy of c-ares,
    which we generally try to avoid, for the known reasons
    (independent updates, cve & license checks, etc).

    Notes:
    * otherwise nodejs uses its bundled version of c-ares
    * the PACKAGECONFIG variable is 'ares' so as to be in
      line with other uses of this (wget & curl recipes in
      OE core)

    Signed-off-by: André Draszik <git@andred.net>
    Signed-off-by: Khem Raj <raj.khem@gmail.com>

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Martin Jansa
2020-02-25 20:36:15 +01:00
committed by Khem Raj
parent c66896149c
commit e92cbff942
4 changed files with 2 additions and 2 deletions
@@ -107,7 +107,7 @@ RDEPENDS_packagegroup-meta-networking-support = "\
tunctl dovecot ipvsadm stunnel chrony spice-protocol \
usbredir ntop wireshark tnftp lksctp-tools \
cim-schema-docs cim-schema-final cim-schema-exper \
libmemcached smcroute libtevent ipcalc c-ares uftp \
libmemcached smcroute libtevent ipcalc uftp \
ntimed linux-atm ssmtp openvpn rdma-core \
iftop aoetools tcpslice tcpdump libtalloc memcached nuttcp netcat \
netcat-openbsd fetchmail yp-tools ypbind-mt yp-tools \
@@ -1,112 +0,0 @@
From 12414304245cce6ef0e8b9547949be5109845353 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Tue, 24 Jul 2018 13:33:33 +0800
Subject: [PATCH] cmake: Install libcares.pc
Prepare and install libcares.pc file during cmake build, so libraries
using pkg-config to find libcares will not fail.
Signed-off-by: Alexey Firago <alexey_firago@mentor.com>
update to 1.14.0, fix patch warning
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
CMakeLists.txt | 23 +++++++++++++++++++++++
libcares.pc.cmakein | 20 ++++++++++++++++++++
2 files changed, 43 insertions(+)
create mode 100644 libcares.pc.cmakein
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 60a880c..71eaa53 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -193,22 +193,30 @@ ADD_DEFINITIONS(${SYSFLAGS})
# Tell C-Ares about libraries to depend on
+# Also pass these libraries to pkg-config file
+SET(CARES_PRIVATE_LIBS_LIST)
IF (HAVE_LIBRESOLV)
LIST (APPEND CARES_DEPENDENT_LIBS resolv)
+ LIST (APPEND CARES_PRIVATE_LIBS_LIST "-lresolv")
ENDIF ()
IF (HAVE_LIBNSL)
LIST (APPEND CARES_DEPENDENT_LIBS nsl)
+ LIST (APPEND CARES_PRIVATE_LIBS_LIST "-lnsl")
ENDIF ()
IF (HAVE_LIBSOCKET)
LIST (APPEND CARES_DEPENDENT_LIBS socket)
+ LIST (APPEND CARES_PRIVATE_LIBS_LIST "-lsocket")
ENDIF ()
IF (HAVE_LIBRT)
LIST (APPEND CARES_DEPENDENT_LIBS rt)
+ LIST (APPEND CARES_PRIVATE_LIBS_LIST "-lrt")
ENDIF ()
IF (WIN32)
LIST (APPEND CARES_DEPENDENT_LIBS ws2_32)
+ LIST (APPEND CARES_PRIVATE_LIBS_LIST "-lws2_32")
ENDIF ()
+string (REPLACE ";" " " CARES_PRIVATE_LIBS "${CARES_PRIVATE_LIBS_LIST}")
# When checking for symbols, we need to make sure we set the proper
# headers, libraries, and definitions for the detection to work properly
@@ -514,6 +522,15 @@ CONFIGURE_FILE (ares_build.h.cmake ${PROJECT_BINARY_DIR}/ares_build.h)
# Write ares_config.h configuration file. This is used only for the build.
CONFIGURE_FILE (ares_config.h.cmake ${PROJECT_BINARY_DIR}/ares_config.h)
+# Pass required CFLAGS to pkg-config in case of static library
+IF (CARES_STATIC)
+ SET (CPPFLAG_CARES_STATICLIB "-DCARES_STATICLIB")
+ENDIF()
+
+# Write ares_config.h configuration file. This is used only for the build.
+CONFIGURE_FILE (libcares.pc.cmakein ${PROJECT_BINARY_DIR}/libcares.pc @ONLY)
+
+
# TRANSFORM_MAKEFILE_INC
#
@@ -664,6 +681,12 @@ IF (CARES_INSTALL)
INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcares.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
ENDIF ()
+# pkg-config file
+IF (CARES_INSTALL)
+ SET (PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+ INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcares.pc" DESTINATION ${PKGCONFIG_INSTALL_DIR})
+ENDIF ()
+
# Legacy chain-building variables (provided for compatibility with old code).
# Don't use these, external code should be updated to refer to the aliases directly (e.g., Cares::cares).
SET (CARES_FOUND 1 CACHE INTERNAL "CARES LIBRARY FOUND")
diff --git a/libcares.pc.cmakein b/libcares.pc.cmakein
new file mode 100644
index 0000000..3579256
--- /dev/null
+++ b/libcares.pc.cmakein
@@ -0,0 +1,20 @@
+#***************************************************************************
+# Project ___ __ _ _ __ ___ ___
+# / __|____ / _` | '__/ _ \/ __|
+# | (_|_____| (_| | | | __/\__ \
+# \___| \__,_|_| \___||___/
+#
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+
+Name: c-ares
+URL: http://daniel.haxx.se/projects/c-ares/
+Description: asynchronous DNS lookup library
+Version: @VERSION@
+Requires:
+Requires.private:
+Cflags: -I${includedir} @CPPFLAG_CARES_STATICLIB@
+Libs: -L${libdir} -lcares
+Libs.private: @CARES_PRIVATE_LIBS@
--
2.7.4
@@ -1,26 +0,0 @@
# Copyright (c) 2012-2014 LG Electronics, Inc.
SUMMARY = "c-ares is a C library that resolves names asynchronously."
HOMEPAGE = "http://daniel.haxx.se/projects/c-ares/"
SECTION = "libs"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE.md;md5=fb997454c8d62aa6a47f07a8cd48b006"
PV = "1.15.0+gitr${SRCPV}"
SRC_URI = "\
git://github.com/c-ares/c-ares.git \
file://cmake-install-libcares.pc.patch \
"
SRCREV = "e982924acee7f7313b4baa4ee5ec000c5e373c30"
UPSTREAM_CHECK_GITTAGREGEX = "cares-(?P<pver>\d+_(\d_?)+)"
S = "${WORKDIR}/git"
inherit cmake pkgconfig
PACKAGES =+ "${PN}-utils"
FILES_${PN}-utils = "${bindir}"
BBCLASSEXTEND = "native nativesdk"