diff options
author | pho <pho@pkgsrc.org> | 2015-01-25 06:54:28 +0000 |
---|---|---|
committer | pho <pho@pkgsrc.org> | 2015-01-25 06:54:28 +0000 |
commit | 94db7c4d2e438b65ead87831e3ba5882b54c1d70 (patch) | |
tree | d002ef0ce1ae603467adfebf3100e1f33e97f195 /devel/glib2 | |
parent | 4975faf2e275285a59cdc02f64f648b0ff3eff5f (diff) | |
download | pkgsrc-94db7c4d2e438b65ead87831e3ba5882b54c1d70.tar.gz |
patches/patch-glib_gmain.c: Imported patch from the upstream Bugzilla
Bug 728123 - glib2 @2.40.0 issues a "Got weird mach timebase info" error (Macports, PPC)
https://bugzilla.gnome.org/show_bug.cgi?id=728123
Tested on powerpc-apple-darwin9.
Diffstat (limited to 'devel/glib2')
-rw-r--r-- | devel/glib2/Makefile | 3 | ||||
-rw-r--r-- | devel/glib2/distinfo | 3 | ||||
-rw-r--r-- | devel/glib2/patches/patch-glib_gmain.c | 81 |
3 files changed, 85 insertions, 2 deletions
diff --git a/devel/glib2/Makefile b/devel/glib2/Makefile index f9998738a06..84a742053a6 100644 --- a/devel/glib2/Makefile +++ b/devel/glib2/Makefile @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.224 2014/10/07 23:18:36 prlw1 Exp $ +# $NetBSD: Makefile,v 1.225 2015/01/25 06:54:28 pho Exp $ .include "Makefile.common" CATEGORIES= devel gnome +PKGREVISION= 1 COMMENT= Some useful routines for C programming (glib2) diff --git a/devel/glib2/distinfo b/devel/glib2/distinfo index b7b10081ddb..69834a93754 100644 --- a/devel/glib2/distinfo +++ b/devel/glib2/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.206 2014/11/29 17:55:07 prlw1 Exp $ +$NetBSD: distinfo,v 1.207 2015/01/25 06:54:28 pho Exp $ SHA1 (glib-2.42.1.tar.xz) = b5158fd434f01e84259155c04ff93026a090e586 RMD160 (glib-2.42.1.tar.xz) = 1c2079f5242b5133d345fba9bc9b846c4a46c5cc @@ -23,5 +23,6 @@ SHA1 (patch-cm) = 534af37ae8f2bd667f630142058d4de5ea91be93 SHA1 (patch-cn) = 0cb2fa14b2d3f0ff66f5d5f32e79a36c71a99b78 SHA1 (patch-gio_gdbusauthmechanismsha1.c) = dfbd4a85ea842f11e4bb76d39c5509fb8b0d5baa SHA1 (patch-gio_gresource-tool.c) = 4eb7c9df25e9ac3e977edf3be8fb977a6fb39182 +SHA1 (patch-glib_gmain.c) = d09ff66e475ee52d37ac0dcb463110f690ce6511 SHA1 (patch-glib_gthread-posix.c) = ca93c8dc358453eb79b518c884464c90d7628888 SHA1 (patch-glib_gtimezone.c) = d9686da52f171a073d80cfd9f80aa490088a00a3 diff --git a/devel/glib2/patches/patch-glib_gmain.c b/devel/glib2/patches/patch-glib_gmain.c new file mode 100644 index 00000000000..e87a1ab7caf --- /dev/null +++ b/devel/glib2/patches/patch-glib_gmain.c @@ -0,0 +1,81 @@ +$NetBSD: patch-glib_gmain.c,v 1.1 2015/01/25 06:54:28 pho Exp $ + +Imported patch from the upstream Bugzilla: + + Bug 728123 - glib2 @2.40.0 issues a "Got weird mach timebase info" error (Macports, PPC) + https://bugzilla.gnome.org/show_bug.cgi?id=728123 + +Tested on powerpc-apple-darwin9. + +--- glib/gmain.c.orig 2014-11-09 21:54:26.000000000 +0000 ++++ glib/gmain.c +@@ -2694,47 +2694,31 @@ g_get_monotonic_time (void) + gint64 + g_get_monotonic_time (void) + { +- static mach_timebase_info_data_t timebase_info; ++ mach_timebase_info_data_t timebase_info; ++ guint64 val; + +- if (timebase_info.denom == 0) +- { +- /* This is a fraction that we must use to scale +- * mach_absolute_time() by in order to reach nanoseconds. +- * +- * We've only ever observed this to be 1/1, but maybe it could be +- * 1000/1 if mach time is microseconds already, or 1/1000 if +- * picoseconds. Try to deal nicely with that. +- */ +- mach_timebase_info (&timebase_info); +- +- /* We actually want microseconds... */ +- if (timebase_info.numer % 1000 == 0) +- timebase_info.numer /= 1000; +- else +- timebase_info.denom *= 1000; +- +- /* We want to make the numer 1 to avoid having to multiply... */ +- if (timebase_info.denom % timebase_info.numer == 0) +- { +- timebase_info.denom /= timebase_info.numer; +- timebase_info.numer = 1; +- } +- else +- { +- /* We could just multiply by timebase_info.numer below, but why +- * bother for a case that may never actually exist... +- * +- * Plus -- performing the multiplication would risk integer +- * overflow. If we ever actually end up in this situation, we +- * should more carefully evaluate the correct course of action. +- */ +- mach_timebase_info (&timebase_info); /* Get a fresh copy for a better message */ +- g_error ("Got weird mach timebase info of %d/%d. Please file a bug against GLib.", +- timebase_info.numer, timebase_info.denom); +- } ++ /* we get nanoseconds from mach_absolute_time() using timebase_info */ ++ mach_timebase_info (&timebase_info); ++ val = mach_absolute_time(); ++ ++ if (timebase_info.numer != timebase_info.denom) ++ { ++ guint64 t_high, t_low; ++ guint64 result_high, result_low; ++ ++ /* 64 bit x 32 bit / 32 bit with 96-bit intermediate ++ * algorithm lifted from qemu */ ++ t_low = (val & 0xffffffffLL) * (guint64)timebase_info.numer; ++ t_high = (val >> 32) * (guint64)timebase_info.numer; ++ t_high += (t_low >> 32); ++ result_high = t_high / (guint64)timebase_info.denom; ++ result_low = (((t_high % (guint64)timebase_info.denom) << 32) + ++ (t_low & 0xffffffff)) / (guint64)timebase_info.denom; ++ val = ((result_high << 32) | result_low); + } + +- return mach_absolute_time () / timebase_info.denom; ++ /* nanoseconds to microseconds */ ++ return val / 1000; + } + #else + gint64 |