From 6af24d05a7b61d2da1446cda0462d7cdf62d83e0 Mon Sep 17 00:00:00 2001 From: bad Date: Thu, 14 May 2015 17:09:29 +0000 Subject: Work around missing sem_timedwait(3) in NetBSD < 6.99.4 by reusing the patch for NaCL from Chromium V8 change d4f11c0cf476dd854eaebec1cbacb1afc7bea18e. PKGREVISION++ --- lang/nodejs/Makefile | 3 +- lang/nodejs/distinfo | 3 +- .../patch-deps_v8_src_base_platform_semaphore.cc | 47 ++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 lang/nodejs/patches/patch-deps_v8_src_base_platform_semaphore.cc (limited to 'lang/nodejs') diff --git a/lang/nodejs/Makefile b/lang/nodejs/Makefile index 2d2e2a0e954..9af822b0e2f 100644 --- a/lang/nodejs/Makefile +++ b/lang/nodejs/Makefile @@ -1,9 +1,10 @@ -# $NetBSD: Makefile,v 1.32 2015/04/30 15:04:56 ryoon Exp $ +# $NetBSD: Makefile,v 1.33 2015/05/14 17:09:29 bad Exp $ DISTNAME= node-v0.12.2 CATEGORIES= devel MASTER_SITES= http://nodejs.org/dist/${DISTNAME:S/node-//}/ PKGNAME= ${DISTNAME:S/-v/js-/} +PKGREVISION= 1 MAINTAINER= filip@joyent.com HOMEPAGE= http://nodejs.org/ diff --git a/lang/nodejs/distinfo b/lang/nodejs/distinfo index 37cf90bd5fc..d2db8585434 100644 --- a/lang/nodejs/distinfo +++ b/lang/nodejs/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.26 2015/04/30 15:04:56 ryoon Exp $ +$NetBSD: distinfo,v 1.27 2015/05/14 17:09:29 bad Exp $ SHA1 (node-v0.12.2.tar.gz) = a969f17a0a6c9238584f8946d96e8d39be8eb957 RMD160 (node-v0.12.2.tar.gz) = f486884bcb4f4f64ef9b85ac2be5006baafee19f @@ -8,6 +8,7 @@ SHA1 (patch-deps_cares_cares.gyp) = 2235eb44bc984fa2e745fdf1786f1ae6de6ef80f SHA1 (patch-deps_npm_node__modules_node-gyp_gyp_pylib_gyp_generator_make.py) = 78d6ddd37ae30e869e0da666a78baad86a638c50 SHA1 (patch-deps_uv_common.gypi) = af1c707cbc02a4aeccebebf6691d5a8680646a0d SHA1 (patch-deps_v8_src_base_platform_platform-posix.cc) = aae5e1649a3ea876e724cec95731989fb01ff008 +SHA1 (patch-deps_v8_src_base_platform_semaphore.cc) = 7515ea52573e3d9cfae178b049f5ed225d9d73ec SHA1 (patch-deps_v8_tools_gyp_v8.gyp) = a7e13e7ef8cc078a812a1f6f37da71c84eedaf6f SHA1 (patch-deps_v8_tools_run-llprof.sh) = 39aa3faf77492ef8dd35b411b7b0e4605b469af3 SHA1 (patch-src_cares__wrap.cc) = d9510afd0cd4b0156a604d9197d9f97d6e3b291f diff --git a/lang/nodejs/patches/patch-deps_v8_src_base_platform_semaphore.cc b/lang/nodejs/patches/patch-deps_v8_src_base_platform_semaphore.cc new file mode 100644 index 00000000000..76a7552ba7c --- /dev/null +++ b/lang/nodejs/patches/patch-deps_v8_src_base_platform_semaphore.cc @@ -0,0 +1,47 @@ +$NetBSD: patch-deps_v8_src_base_platform_semaphore.cc,v 1.1 2015/05/14 17:09:29 bad Exp $ +Work around lack of sem_timedwait(3) in NetBSD < 6.99.4. +Adapted from d4f11c0cf476dd854eaebec1cbacb1afc7bea18e of the Chromium V8 sources. + +--- deps/v8/src/base/platform/semaphore.cc.orig 2015-03-31 22:13:01.000000000 +0000 ++++ deps/v8/src/base/platform/semaphore.cc 2015-05-14 12:47:08.000000000 +0000 +@@ -9,9 +9,14 @@ + #include + #endif + ++#if V8_OS_NETBSD ++#include // for __NetBSD_Version__ ++#endif ++ + #include + + #include "src/base/logging.h" ++#include "src/base/platform/elapsed-timer.h" + #include "src/base/platform/time.h" + + namespace v8 { +@@ -106,6 +111,17 @@ + + + bool Semaphore::WaitFor(const TimeDelta& rel_time) { ++#if V8_OS_NACL || (V8_OS_NETBSD && !__NetBSD_Prereq__(6,99,4)) ++ // PNaCL and older NetBSD doesn't support sem_timedwait, do ugly busy waiting. ++ ElapsedTimer timer; ++ timer.Start(); ++ do { ++ int result = sem_trywait(&native_handle_); ++ if (result == 0) return true; ++ DCHECK(errno == EAGAIN || errno == EINTR); ++ } while (!timer.HasExpired(rel_time)); ++ return false; ++#else + // Compute the time for end of timeout. + const Time time = Time::NowFromSystemTime() + rel_time; + const struct timespec ts = time.ToTimespec(); +@@ -129,6 +145,7 @@ + DCHECK_EQ(-1, result); + DCHECK_EQ(EINTR, errno); + } ++#endif + } + + #elif V8_OS_WIN -- cgit v1.2.3