[PATCH 61/73] guile: Fix build with musl

Khem Raj
2016-01-17T11:37:53Z

strol_l is not available on musl
delete charset.alias as well its not needed

Use internal gc function on musl

We get errors on certain functions not being available in boeheme gc
when built with musl. Therefore use the internal versions
e.g.

Undefined gc_set_finalizer_notifier

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...guile-Check-for-strtol_l-during-configure.patch | 56 ++++++++++++++++++++++
meta/recipes-devtools/guile/guile_2.0.11.bb | 12 +++++
2 files changed, 68 insertions(+)
create mode 100644 meta/recipes-devtools/guile/files/0001-libguile-Check-for-strtol_l-during-configure.patch

diff --git a/meta/recipes-devtools/guile/files/0001-libguile-Check-for-strtol_l-during-configure.patch b/meta/recipes-devtools/guile/files/0001-libguile-Check-for-strtol_l-during-configure.patch
new file mode 100644
index 0000000..24f073f
--- /dev/null
+++ b/meta/recipes-devtools/guile/files/0001-libguile-Check-for-strtol_l-during-configure.patch
@@ -0,0 +1,56 @@
+From 814d6fb6c1f4a544c8fd37f5a390ba020c2d8c85 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 10 Jan 2016 22:28:17 +0000
+Subject: [PATCH] libguile: Check for strtol_l during configure
+
+strtol_l is a gnu extention which may not be available on other linux
+libc implementations e.g. musl. Therefore check for this funciton and
+conditionalize the use of it.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ configure.ac | 5 +++--
+ libguile/i18n.c | 2 +-
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 3969929..f8a6a1a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -752,7 +752,8 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
+ # truncate - not in mingw
+ # isblank - available as a GNU extension or in C99
+ # _NSGetEnviron - Darwin specific
+-# strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
++# strcoll_l, newlocale, strtol_l - GNU extensions (glibc),
++# also available on Darwin
+ # fork - unavailable on Windows
+ # utimensat - posix.1-2008
+ # sched_getaffinity, sched_setaffinity - GNU extensions (glibc)
+@@ -768,7 +769,7 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid \
+ getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp \
+ index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron \
+ strcoll strcoll_l newlocale utimensat sched_getaffinity \
+- sched_setaffinity sendfile])
++ sched_setaffinity sendfile strtol_l])
+
+ AM_CONDITIONAL([BUILD_ICE_9_POPEN],
+ [test "x$enable_posix" = "xyes" && test "x$ac_cv_func_fork" = "xyes"])
+diff --git a/libguile/i18n.c b/libguile/i18n.c
+index 97d44b0..9fb6976 100644
+--- a/libguile/i18n.c
++++ b/libguile/i18n.c
+@@ -1352,7 +1352,7 @@ SCM_DEFINE (scm_locale_string_to_integer, "locale-string->integer",
+
+ if (c_locale != NULL)
+ {
+-#ifdef USE_GNU_LOCALE_API
++#if defined(USE_GNU_LOCALE_API) && defined(HAVE_STRTOL_L)
+ c_result = strtol_l (c_str, &c_endptr, c_base, c_locale);
+ #else
+ RUN_IN_LOCALE_SECTION (c_locale,
+--
+2.7.0
+
diff --git a/meta/recipes-devtools/guile/guile_2.0.11.bb b/meta/recipes-devtools/guile/guile_2.0.11.bb
index 413c81d..6815e25 100644
--- a/meta/recipes-devtools/guile/guile_2.0.11.bb
+++ b/meta/recipes-devtools/guile/guile_2.0.11.bb
@@ -24,6 +24,7 @@ SRC_URI = "${GNU_MIRROR}/guile/guile-${PV}.tar.xz \
file://libguile-Makefile.am-hook.patch \
file://libguile-VM-ASM_MUL-for-ARM-Add-earlyclobber.patch \
file://remove_strcase_l_funcs.patch \
+ file://0001-libguile-Check-for-strtol_l-during-configure.patch \
"

# file://debian/0001-Change-guile-to-guile-X.Y-for-info-pages.patch
@@ -52,6 +53,13 @@ EXTRA_OECONF_append_class-target = " --with-libunistring-prefix=${STAGING_LIBDIR
--with-libgmp-prefix=${STAGING_LIBDIR} \
--with-libltdl-prefix=${STAGING_LIBDIR}"
EXTRA_OECONF_append_libc-uclibc = " guile_cv_use_csqrt=no "
+
+CFLAGS_append_libc-musl = " -DHAVE_GC_SET_FINALIZER_NOTIFIER \
+ -DHAVE_GC_GET_HEAP_USAGE_SAFE \
+ -DHAVE_GC_GET_FREE_SPACE_DIVISOR \
+ -DHAVE_GC_SET_FINALIZE_ON_DEMAND \
+ "
+
do_configure_prepend() {
mkdir -p po
}
@@ -77,6 +85,10 @@ do_install_append_class-target() {
sed -i -e 's:${STAGING_DIR_TARGET}::g' ${D}${libdir}/pkgconfig/guile-2.0.pc
}

+do_install_append_libc-musl() {
+ rm -f ${D}${libdir}/charset.alias
+}
+
SYSROOT_PREPROCESS_FUNCS = "guile_cross_config"

guile_cross_config() {
--
2.7.0