diff options
author | obache <obache> | 2014-01-02 08:22:03 +0000 |
---|---|---|
committer | obache <obache> | 2014-01-02 08:22:03 +0000 |
commit | 46eb5530d047ba1380a219f781d14c0fb3350e71 (patch) | |
tree | 9bd6a2f58c942cca839bfe3eda9d7511472c1d13 /graphics/cogl | |
parent | 09cfe521671d68d9ce8606bcfda74b4eff27fea1 (diff) | |
download | pkgsrc-46eb5530d047ba1380a219f781d14c0fb3350e71.tar.gz |
Fixes wrong patch introduced for Mac OS X from stackoverflow.
It is for clock_gettime with CLOCK_REALTIME and also changed to use
CLOCK_REALTIME for other than OS X.
Back to use CLOCK_MONOTONIC and use patch for OS X from MacPorts instead.
Bump PKGREVISION.
Diffstat (limited to 'graphics/cogl')
-rw-r--r-- | graphics/cogl/Makefile | 4 | ||||
-rw-r--r-- | graphics/cogl/distinfo | 4 | ||||
-rw-r--r-- | graphics/cogl/patches/patch-cogl-winsys-cogl-winsys-glx.c | 98 |
3 files changed, 28 insertions, 78 deletions
diff --git a/graphics/cogl/Makefile b/graphics/cogl/Makefile index 3a4d75abe71..6ac25b942fd 100644 --- a/graphics/cogl/Makefile +++ b/graphics/cogl/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.4 2013/10/31 21:28:07 hubertf Exp $ +# $NetBSD: Makefile,v 1.5 2014/01/02 08:22:03 obache Exp $ # DISTNAME= cogl-1.14.0 -PKGREVISION= 3 +PKGREVISION= 4 CATEGORIES= graphics MASTER_SITES= ${MASTER_SITE_GNOME:=sources/cogl/1.14/} EXTRACT_SUFX= .tar.xz diff --git a/graphics/cogl/distinfo b/graphics/cogl/distinfo index 80e3cfa2e9d..90bc80bb1ad 100644 --- a/graphics/cogl/distinfo +++ b/graphics/cogl/distinfo @@ -1,6 +1,6 @@ -$NetBSD: distinfo,v 1.2 2013/10/31 21:28:07 hubertf Exp $ +$NetBSD: distinfo,v 1.3 2014/01/02 08:22:03 obache Exp $ SHA1 (cogl-1.14.0.tar.xz) = ff9a60b54fe79eb336af9c1b686f71f6af6f84f9 RMD160 (cogl-1.14.0.tar.xz) = 69a87d46c21999bde675a518ab3cbb5dfa159131 Size (cogl-1.14.0.tar.xz) = 1656520 bytes -SHA1 (patch-cogl-winsys-cogl-winsys-glx.c) = fcb293eabeaac7037b77a5f7be0fd3e4e79cccd8 +SHA1 (patch-cogl-winsys-cogl-winsys-glx.c) = 865b61bf4926f788548b393dfde1acfa9fb56ce3 diff --git a/graphics/cogl/patches/patch-cogl-winsys-cogl-winsys-glx.c b/graphics/cogl/patches/patch-cogl-winsys-cogl-winsys-glx.c index 217aec2e12e..2bb250fff6b 100644 --- a/graphics/cogl/patches/patch-cogl-winsys-cogl-winsys-glx.c +++ b/graphics/cogl/patches/patch-cogl-winsys-cogl-winsys-glx.c @@ -1,83 +1,33 @@ -$NetBSD: patch-cogl-winsys-cogl-winsys-glx.c,v 1.1 2013/10/31 21:28:07 hubertf Exp $ +$NetBSD: patch-cogl-winsys-cogl-winsys-glx.c,v 1.2 2014/01/02 08:22:03 obache Exp $ + +* for Mac OS X, missing clock_gettime(2), taken from MacPorts. --- cogl/winsys/cogl-winsys-glx.c.orig 2013-02-21 15:41:08.000000000 +0000 +++ cogl/winsys/cogl-winsys-glx.c -@@ -58,6 +58,12 @@ +@@ -56,7 +56,26 @@ + #include <sys/stat.h> + #include <sys/time.h> #include <fcntl.h> - #include <time.h> - -+/* HF: From http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x */ -+#ifdef __MACH__ -+#include <mach/clock.h> -+#include <mach/mach.h> -+#endif + - #include <glib/gi18n-lib.h> - - #include <GL/glx.h> -@@ -214,7 +220,20 @@ ensure_ust_type (CoglRenderer *renderer, - - /* This is the time source that the newer (fixed) linux drm - * drivers use (Linux >= 3.8) */ -- clock_gettime (CLOCK_MONOTONIC, &ts); -+/* HF: From http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x */ -+#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time -+ { -+ clock_serv_t cclock; -+ mach_timespec_t mts; -+ host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); -+ clock_get_time(cclock, &mts); -+ mach_port_deallocate(mach_task_self(), cclock); -+ ts.tv_sec = mts.tv_sec; -+ ts.tv_nsec = mts.tv_nsec; -+ } ++#ifdef __MACH__ ++#include <mach/mach_time.h> ++#define CLOCK_REALTIME 0 ++#define CLOCK_MONOTONIC 0 ++static int ++clock_gettime(int clk_id, struct timespec *t){ ++ mach_timebase_info_data_t timebase; ++ mach_timebase_info(&timebase); ++ uint64_t time; ++ time = mach_absolute_time(); ++ double nseconds = ((double)time * (double)timebase.numer)/((double)timebase.denom); ++ double seconds = ((double)time * (double)timebase.numer)/((double)timebase.denom * 1e9); ++ t->tv_sec = seconds; ++ t->tv_nsec = nseconds; ++ return 0; ++} +#else -+ clock_gettime(CLOCK_REALTIME, &ts); + #include <time.h> +#endif - current_monotonic_time = (ts.tv_sec * G_GINT64_CONSTANT (1000000)) + - (ts.tv_nsec / G_GINT64_CONSTANT (1000)); -@@ -294,7 +313,20 @@ _cogl_winsys_get_clock_time (CoglContext - { - struct timespec ts; - -- clock_gettime (CLOCK_MONOTONIC, &ts); -+/* HF: From http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x */ -+#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time -+ { -+ clock_serv_t cclock; -+ mach_timespec_t mts; -+ host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); -+ clock_get_time(cclock, &mts); -+ mach_port_deallocate(mach_task_self(), cclock); -+ ts.tv_sec = mts.tv_sec; -+ ts.tv_nsec = mts.tv_nsec; -+ } -+#else -+ clock_gettime(CLOCK_REALTIME, &ts); -+#endif - return ts.tv_sec * G_GINT64_CONSTANT (1000000000) + ts.tv_nsec; - } - } -@@ -1500,7 +1532,20 @@ _cogl_winsys_wait_for_vblank (CoglOnscre - (current_count + 1) % 2, - ¤t_count); + #include <glib/gi18n-lib.h> -- clock_gettime (CLOCK_MONOTONIC, &ts); -+/* HF: From http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x */ -+#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time -+ { -+ clock_serv_t cclock; -+ mach_timespec_t mts; -+ host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); -+ clock_get_time(cclock, &mts); -+ mach_port_deallocate(mach_task_self(), cclock); -+ ts.tv_sec = mts.tv_sec; -+ ts.tv_nsec = mts.tv_nsec; -+ } -+#else -+ clock_gettime(CLOCK_REALTIME, &ts); -+#endif - info->presentation_time = - ts.tv_sec * G_GINT64_CONSTANT (1000000000) + ts.tv_nsec; - } |