Skip to content

Commit

Permalink
glib-2.0: Add recipe for 2.28.5
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Koen Kooi <koen@openembedded.org>
  • Loading branch information
sakoman authored and Koen Kooi committed May 8, 2011
1 parent 13a44e2 commit 123beae
Show file tree
Hide file tree
Showing 8 changed files with 282 additions and 0 deletions.
@@ -0,0 +1,26 @@
--- glib/tests/threadpool-test.c.old 2008-02-12 06:11:21.000000000 +0100
+++ glib/tests/threadpool-test.c 2008-02-12 06:11:52.000000000 +0100
@@ -5,8 +5,8 @@

#include <glib.h>

-#define DEBUG_MSG(x)
-/* #define DEBUG_MSG(args) g_printerr args ; g_printerr ("\n"); */
+/* #define DEBUG_MSG(x) */
+#define DEBUG_MSG(args) g_printerr args ; g_printerr ("\n");

#define WAIT 5 /* seconds */
#define MAX_THREADS 10
@@ -124,10 +124,10 @@
DEBUG_MSG (("[unused] stopping unused threads"));
g_thread_pool_stop_unused_threads ();

- DEBUG_MSG (("[unused] waiting ONE second for threads to die"));
+ DEBUG_MSG (("[unused] waiting FIVE second for threads to die"));

/* Some time for threads to die. */
- g_usleep (G_USEC_PER_SEC);
+ g_usleep (5 * G_USEC_PER_SEC);

DEBUG_MSG (("[unused] stopped idle threads, %d remain, %d threads still exist",
g_thread_pool_get_num_unused_threads (),
92 changes: 92 additions & 0 deletions recipes/glib-2.0/glib-2.0-2.28.5/configure-ipv6.patch
@@ -0,0 +1,92 @@
From a619a217e3e5aa5345db631213aec5a3684a3001 Mon Sep 17 00:00:00 2001
Subject: [PATCH] autodetect in6addr_{any,loopback} availability

Fixes linking error on systems which choose not to support ipv6:
./.libs/libgio-2.0.so: undefined reference to `in6addr_loopback'
./.libs/libgio-2.0.so: undefined reference to `in6addr_any'

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
configure.ac | 31 +++++++++++++++++++++++++++++++
gio/ginetaddress.c | 16 ++++++++++++++--
2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7114014..023db49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1019,6 +1019,37 @@ if test $glib_native_win32 = no; then
AC_SUBST(LIBASYNCNS_LIBADD)
fi

+dnl handle --disable-ipv6
+AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]))
+if test "$ipv6" != "no"; then
+ AC_DEFINE(HAVE_IPV6, 1, [Define if IPv6 is available])
+
+ AC_MSG_CHECKING([for struct in6addr_any])
+ AC_TRY_LINK(
+ [#define IN_AUTOCONF
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>],
+ [struct in6_addr a = in6addr_any;
+ return a.s6_addr[0];],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_IN6ADDR_ANY, 1, [Define if in6addr_any is available])],
+ [AC_MSG_RESULT(no)]
+ )
+ AC_MSG_CHECKING([for struct in6addr_loopback])
+ AC_TRY_LINK(
+ [#define IN_AUTOCONF
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>],
+ [struct in6_addr a = in6addr_loopback;
+ return a.s6_addr[0];],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_IN6ADDR_LOOPBACK, 1, [Define if in6addr_loopback is available])],
+ [AC_MSG_RESULT(no)]
+ )
+fi
+
case $host in
*-*-solaris* )
AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
diff --git a/gio/ginetaddress.c b/gio/ginetaddress.c
index 0f67e4f..ed29be2 100644
--- a/gio/ginetaddress.c
+++ b/gio/ginetaddress.c
@@ -484,7 +484,13 @@ g_inet_address_new_loopback (GSocketFamily family)
return g_inet_address_new_from_bytes (addr, family);
}
else
- return g_inet_address_new_from_bytes (in6addr_loopback.s6_addr, family);
+ {
+#ifdef HAVE_IN6ADDR_LOOPBACK
+ return g_inet_address_new_from_bytes (in6addr_loopback.s6_addr, family);
+#else
+ return NULL;
+#endif
+ }
}

/**
@@ -511,7 +517,13 @@ g_inet_address_new_any (GSocketFamily family)
return g_inet_address_new_from_bytes (addr, family);
}
else
- return g_inet_address_new_from_bytes (in6addr_any.s6_addr, family);
+ {
+#ifdef HAVE_IN6ADDR_ANY
+ return g_inet_address_new_from_bytes (in6addr_any.s6_addr, family);
+#else
+ return NULL;
+#endif
+ }
}


--
1.7.2.3

30 changes: 30 additions & 0 deletions recipes/glib-2.0/glib-2.0-2.28.5/configure-libtool.patch
@@ -0,0 +1,30 @@
diff -uNr glib-2.28.0.orig//configure.ac glib-2.28.0/configure.ac
--- glib-2.28.0.orig//configure.ac 2011-02-08 05:53:25.000000000 +0100
+++ glib-2.28.0/configure.ac 2011-02-15 15:07:54.683976837 +0100
@@ -1378,7 +1378,7 @@
G_MODULE_LDFLAGS=
else
export SED
- G_MODULE_LDFLAGS=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
+ G_MODULE_LDFLAGS=`($host_alias-libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
fi
dnl G_MODULE_IMPL= don't reset, so cmd-line can override
G_MODULE_NEED_USCORE=0
@@ -1443,7 +1443,7 @@
LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS"
dnl *** check for OSF1/5.0 RTLD_GLOBAL brokenness
echo "void glib_plugin_test(void) { }" > plugin.c
- ${SHELL} ./libtool --mode=compile ${CC} -shared \
+ ${SHELL} $host_alias-libtool --mode=compile ${CC} -shared \
-export-dynamic -o plugin.o plugin.c 2>&1 >/dev/null
AC_CACHE_CHECK([for RTLD_GLOBAL brokenness],
glib_cv_rtldglobal_broken,[
@@ -1517,7 +1517,7 @@

AC_MSG_CHECKING(for the suffix of module shared libraries)
export SED
-shrext_cmds=`./libtool --config | grep '^shrext_cmds='`
+shrext_cmds=`$host_alias-libtool --config | grep '^shrext_cmds='`
eval $shrext_cmds
module=yes eval std_shrext=$shrext_cmds
# chop the initial dot
11 changes: 11 additions & 0 deletions recipes/glib-2.0/glib-2.0-2.28.5/g_once_init_enter.patch
@@ -0,0 +1,11 @@
--- glib-2.22.1/glib/gthread.h.orig 2009-10-13 22:53:23.000000000 +0200
+++ glib-2.22.1/glib/gthread.h 2009-10-13 23:34:59.000000000 +0200
@@ -341,7 +341,7 @@
G_INLINE_FUNC gboolean
g_once_init_enter (volatile gsize *value_location)
{
- if G_LIKELY ((gpointer) g_atomic_pointer_get (value_location) != NULL)
+ if G_LIKELY ((gpointer) g_atomic_pointer_get ((volatile gpointer *)value_location) != NULL)
return FALSE;
else
return g_once_init_enter_impl (value_location);
@@ -0,0 +1,12 @@
diff -uri glib-2.26.1.orig/glib/gatomic.h glib-2.26.1/glib/gatomic.h
--- glib-2.26.1.orig/glib/gatomic.h 2010-07-11 05:56:45.000000000 +0200
+++ glib-2.26.1/glib/gatomic.h 2010-12-01 16:20:33.140009635 +0100
@@ -70,7 +70,7 @@
(g_atomic_int_set) ((volatile gint G_GNUC_MAY_ALIAS *) (volatile void *) (atomic), (newval)))
# define g_atomic_pointer_get(atomic) \
((void) sizeof (gchar [sizeof (*(atomic)) == sizeof (gpointer) ? 1 : -1]), \
- (g_atomic_pointer_get) ((volatile gpointer G_GNUC_MAY_ALIAS *) (volatile void *) (atomic)))
+ (g_atomic_pointer_get) ((volatile gpointer G_GNUC_MAY_ALIAS *) (volatile void G_GNUC_MAY_ALIAS *) (atomic)))
# define g_atomic_pointer_set(atomic, newval) \
((void) sizeof (gchar [sizeof (*(atomic)) == sizeof (gpointer) ? 1 : -1]), \
(g_atomic_pointer_set) ((volatile gpointer G_GNUC_MAY_ALIAS *) (volatile void *) (atomic), (newval)))
10 changes: 10 additions & 0 deletions recipes/glib-2.0/glib-2.0-2.28.5/glib-mkenums-interpreter.patch
@@ -0,0 +1,10 @@
Index: glib-2.28.0/gobject/glib-mkenums.in
===================================================================
--- glib-2.28.0.orig/gobject/glib-mkenums.in
+++ glib-2.28.0/gobject/glib-mkenums.in
@@ -1,4 +1,4 @@
-#! @PERL_PATH@
+#! /usr/bin/env perl

use warnings;
use File::Basename;
@@ -0,0 +1,25 @@
From 58096320ea0888c4fbbff318839017a4d2e82703 Mon Sep 17 00:00:00 2001
From: Lionel Landwerlin <llandwerlin@gmail.com>
Date: Sat, 6 Nov 2010 14:56:15 +0100
Subject: [PATCH] glib: fix compilation with no builtin atomic operations compilers

Signed-off-by: Lionel Landwerlin <llandwerlin@gmail.com>
---
glib/gatomic.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/glib/gatomic.c b/glib/gatomic.c
index 845c866..01468ce 100644
--- a/glib/gatomic.c
+++ b/glib/gatomic.c
@@ -881,6 +881,7 @@ g_atomic_pointer_compare_and_exchange (volatile gpointer G_GNUC_MAY_ALIAS *atomi
#endif /* DEFINE_WITH_WIN32_INTERLOCKED */

#ifdef DEFINE_WITH_MUTEXES
+# include "gthread.h"
/* We have to use the slow, but safe locking method */
static GMutex *g_atomic_mutex;

--
1.7.2.3

76 changes: 76 additions & 0 deletions recipes/glib-2.0/glib-2.0_2.28.5.bb
@@ -0,0 +1,76 @@
DESCRIPTION = "GLib is a general-purpose utility library, \
which provides many useful data types, macros, \
type conversions, string utilities, file utilities, a main \
loop abstraction, and so on. It works on many \
UNIX-like platforms, Windows, OS/2 and BeOS."
LICENSE = "LGPLv2+"
SECTION = "libs"
PRIORITY = "optional"
PR = "r1"
DEPENDS = "glib-2.0-native gtk-doc zlib"
DEPENDS_virtclass-native = "gettext-native gtk-doc-native \
pkgconfig-native"

SRC_URI = "\
http://ftp.gnome.org/pub/GNOME/sources/glib/2.28/glib-${PV}.tar.bz2;name=archive \
file://glibconfig-sysdefs.h \
file://configure-libtool.patch \
file://g_once_init_enter.patch \
file://gatomic-proper-pointer-get-cast.patch \
file://60_wait-longer-for-threads-to-die.patch \
file://glib-mkenums-interpreter.patch \
file://libglib2-fix-compilation-with-no-builtin-atomic.patch \
file://configure-ipv6.patch \
"

SRC_URI[archive.md5sum] = "ddf80a060ec9039ad40452ba3ca2311b"
SRC_URI[archive.sha256sum] = "8eb4b56b228c6d0bf5021dd23db5b0084d80cc6d8d89d7863073c2da575ec22a"

inherit autotools gettext

S = "${WORKDIR}/glib-${PV}"

EXTRA_OECONF = "--disable-debug "

# Add and entry for your favourite arch if your (g)libc has a sane printf
EXTRA_OECONF_append_glibc_arm = " --enable-included-printf=no "

do_configure_prepend () {
install -m 0644 ${WORKDIR}/glibconfig-sysdefs.h .
sed -i -e "s:TEST_PROGS += gdbus-serialization::g" ${S}/gio/tests/Makefile.am
}

do_install_append() {
sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g ${D}${bindir}/glib-mkenums || true
}

EXTRA_OECONF_virtclass-native = ""

do_configure_prepend_virtclass-native() {
if [ -e ${S}/${TARGET_SYS}-libtool ] ; then
echo "${TARGET_SYS}-libtool already present"
else
cp ${STAGING_BINDIR}/${TARGET_SYS}-libtool ${S}
fi

}

BBCLASSEXTEND = "native"

PACKAGES =+ "gobject-2.0 gmodule-2.0 gthread-2.0 gio-2.0 glib-2.0-utils "
LEAD_SONAME = "libglib-2.0.*"
FILES_glib-2.0-utils = "${bindir}/*"
FILES_${PN} = "${libdir}/lib*so.* ${libdir}/gio/modules/*.so"
FILES_${PN}-dev += "${libdir}/glib-2.0 ${datadir}/glib-2.0 ${libdir}/gio/modules/*.la"
FILES_${PN}-dbg += "${libdir}/gio/modules/.debug"
FILES_gmodule-2.0 = "${libdir}/libgmodule-2.0.so.*"
FILES_gobject-2.0 = "${libdir}/libgobject-2.0.so.*"
FILES_gio-2.0 = "${libdir}/libgio-2.0.so.*"
FILES_gthread-2.0 = "${libdir}/libgthread-2.0.so.*"

# Let various glib components end up in glib package
# for compatibility (with binary packages from Maemo).
FILES_gthread-2.0_chinook-compat = ""
FILES_gmodule-2.0_chinook-compat = ""
FILES_gobject-2.0_chinook-compat = ""
FILES_gio-2.0_chinook-compat = ""

0 comments on commit 123beae

Please sign in to comment.