diff mbox series

[oe,meta-oe,5/6] modemmanager: Fix build with musl provide canonicalize_file_name()

Message ID 20180609064415.10270-5-raj.khem@gmail.com
State New
Headers show
Series [oe,meta-networking,1/6] celt051: Fix building testcases | expand

Commit Message

Khem Raj June 9, 2018, 6:44 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 ...eck-for-canonicalize_file_name-befor.patch | 56 +++++++++++++++++++
 .../modemmanager/modemmanager_1.7.991.bb      |  4 +-
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-connectivity/modemmanager/modemmanager/0001-Add-configure-check-for-canonicalize_file_name-befor.patch

-- 
2.17.1

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
diff mbox series

Patch

diff --git a/meta-oe/recipes-connectivity/modemmanager/modemmanager/0001-Add-configure-check-for-canonicalize_file_name-befor.patch b/meta-oe/recipes-connectivity/modemmanager/modemmanager/0001-Add-configure-check-for-canonicalize_file_name-befor.patch
new file mode 100644
index 0000000000..d474edbda6
--- /dev/null
+++ b/meta-oe/recipes-connectivity/modemmanager/modemmanager/0001-Add-configure-check-for-canonicalize_file_name-befor.patch
@@ -0,0 +1,56 @@ 
+From 07f1eda630517816bfa900e811963745a149e57c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 8 Jun 2018 20:38:30 -0700
+Subject: [PATCH] Add configure check for canonicalize_file_name() before use
+
+Define canonicalize_file_name API if not provided by system C library
+musl e.g. does not provide this API
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ configure.ac                                |  2 ++
+ src/kerneldevice/mm-kernel-device-generic.c | 18 ++++++++++++++++++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 9bf26ed..6d7abdb 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -72,6 +72,8 @@ AC_SUBST(MM_GLIB_LT_CURRENT)
+ AC_SUBST(MM_GLIB_LT_REVISION)
+ AC_SUBST(MM_GLIB_LT_AGE)
+ 
++AC_CHECK_FUNCS([canonicalize_file_name])
++
+ dnl-----------------------------------------------------------------------------
+ dnl Documentation
+ dnl
+diff --git a/src/kerneldevice/mm-kernel-device-generic.c b/src/kerneldevice/mm-kernel-device-generic.c
+index 6b0f072..a108b7d 100644
+--- a/src/kerneldevice/mm-kernel-device-generic.c
++++ b/src/kerneldevice/mm-kernel-device-generic.c
+@@ -100,6 +100,24 @@ read_sysfs_property_as_string (const gchar *path,
+     return contents;
+ }
+ 
++#ifndef HAVE_CANONICALIZE_FILE_NAME
++#include <limits.h>
++#include <string.h>
++#include <stdlib.h>
++#include <stdio.h>
++static char * canonicalize_file_name(const char *path)
++{
++   char buf[PATH_MAX] = { };
++
++   snprintf(buf, sizeof(buf) - 1, "%s", path);
++
++   if (!realpath(path, buf))
++       return NULL;
++
++   return strdup(buf);
++}
++#endif
++
+ /*****************************************************************************/
+ /* Load contents */
+ 
diff --git a/meta-oe/recipes-connectivity/modemmanager/modemmanager_1.7.991.bb b/meta-oe/recipes-connectivity/modemmanager/modemmanager_1.7.991.bb
index b1a718dbfb..26b56d17d0 100644
--- a/meta-oe/recipes-connectivity/modemmanager/modemmanager_1.7.991.bb
+++ b/meta-oe/recipes-connectivity/modemmanager/modemmanager_1.7.991.bb
@@ -11,7 +11,9 @@  inherit gnomebase gettext systemd vala gobject-introspection bash-completion
 
 DEPENDS = "glib-2.0 libgudev dbus-glib intltool-native"
 
-SRC_URI = "http://www.freedesktop.org/software/ModemManager/ModemManager-${PV}.tar.xz"
+SRC_URI = "http://www.freedesktop.org/software/ModemManager/ModemManager-${PV}.tar.xz \
+           file://0001-Add-configure-check-for-canonicalize_file_name-befor.patch \
+           "
 
 SRC_URI[md5sum] = "4efe6a240cef212bf8855c95424e7c7f"
 SRC_URI[sha256sum] = "4e366243bd4983f2e6efe35cb901cf5da51939307b5d6299fe622a9fcf411745"