Add patches from Fedora to fix build with mozjs-17.0 (devel/spidermonkey).

This commit is contained in:
ajacoutot 2013-08-10 12:46:22 +00:00
parent 531c141c25
commit cd6ee3d5b3
3 changed files with 88 additions and 8 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.37 2013/08/07 21:32:18 naddy Exp $
# $OpenBSD: Makefile,v 1.38 2013/08/10 12:46:22 ajacoutot Exp $
# sync with ONLY_FOR_ARCHS in devel/spidermonkey
ONLY_FOR_ARCHS-mozilla= alpha amd64 i386 hppa mips64el mips64 powerpc sparc64
@ -16,9 +16,9 @@ PKGNAME-main= libproxy-${VERSION}
PKGNAME-mozilla= libproxy-mozilla-${VERSION}
PKGNAME-webkit= libproxy-webkit-${VERSION}
REVISION-main= 2
REVISION-mozilla= 1
REVISION-webkit= 1
REVISION-main= 3
REVISION-mozilla= 2
REVISION-webkit= 2
CATEGORIES= net
@ -54,18 +54,18 @@ LIB_DEPENDS-main= ${LIB_DEPENDS} \
RUN_DEPENDS-mozilla= # empty
LIB_DEPENDS-mozilla= ${BUILD_PKGPATH}>=${VERSION} \
devel/spidermonkey
devel/spidermonkey>=17.0,<18.0
RUN_DEPENDS-webkit= ${MODGETTEXT_RUN_DEPENDS}
LIB_DEPENDS-webkit= STEM->=${VERSION}:${BUILD_PKGPATH}, \
www/webkit,gtk3
cWANTLIB += m pthread stdc++
cWANTLIB += m stdc++
WANTLIB-main += ${cWANTLIB} ${MODGETTEXT_WANTLIB}
WANTLIB-main += c gio-2.0 glib-2.0 gobject-2.0 perl
WANTLIB-main += c gio-2.0 glib-2.0 gobject-2.0 perl pthread
WANTLIB-mozilla += ${cWANTLIB} mozjs185 nspr4 plc4 plds4 proxy
WANTLIB-mozilla += ${cWANTLIB} mozjs-17.0 proxy
WANTLIB-webkit += ${cWANTLIB} ${MODGETTEXT_WANTLIB}
WANTLIB-webkit += glib-2.0 javascriptcoregtk-3.0 proxy

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-libproxy_cmake_modules_pacrunner_mozjs_cmk,v 1.1 2013/08/10 12:46:22 ajacoutot Exp $
Support for mozjs-17.0 (from Fedora).
https://bugs.freedesktop.org/show_bug.cgi?id=59830
https://bugzilla.gnome.org/show_bug.cgi?id=690982
--- libproxy/cmake/modules/pacrunner_mozjs.cmk.orig Mon Jun 20 12:31:41 2011
+++ libproxy/cmake/modules/pacrunner_mozjs.cmk Sat Aug 10 10:18:18 2013
@@ -14,7 +14,13 @@ elseif(NOT APPLE)
include_directories(${MOZJS_INCLUDE_DIRS})
link_directories(${MOZJS_LIBRARY_DIRS})
else()
- set(MOZJS_FOUND 0)
+ pkg_search_module(MOZJS mozjs-17.0)
+ if(MOZJS_FOUND)
+ include_directories(${MOZJS_INCLUDE_DIRS})
+ link_directories(${MOZJS_LIBRARY_DIRS})
+ else()
+ set(MOZJS_FOUND 0)
+ endif()
endif()
else()
set(MOZJS_FOUND 0)

View File

@ -0,0 +1,57 @@
$OpenBSD: patch-libproxy_modules_pacrunner_mozjs_cpp,v 1.1 2013/08/10 12:46:23 ajacoutot Exp $
Support for mozjs-17.0 (from Fedora).
https://bugs.freedesktop.org/show_bug.cgi?id=59830
https://bugzilla.gnome.org/show_bug.cgi?id=690982
--- libproxy/modules/pacrunner_mozjs.cpp.orig Fri Mar 9 18:46:11 2012
+++ libproxy/modules/pacrunner_mozjs.cpp Sat Aug 10 10:18:18 2013
@@ -19,6 +19,7 @@
#include <cstring> // ?
#include <unistd.h> // gethostname
+#include <stdint.h>
#include "../extension_pacrunner.hpp"
using namespace libproxy;
@@ -76,12 +77,12 @@ static JSBool dnsResolve_(JSContext *cx, jsval hostnam
return true;
}
-static JSBool dnsResolve(JSContext *cx, uintN /*argc*/, jsval *vp) {
+static JSBool dnsResolve(JSContext *cx, uint32_t /*argc*/, jsval *vp) {
jsval *argv = JS_ARGV(cx, vp);
return dnsResolve_(cx, argv[0], vp);
}
-static JSBool myIpAddress(JSContext *cx, uintN /*argc*/, jsval *vp) {
+static JSBool myIpAddress(JSContext *cx, uint32_t /*argc*/, jsval *vp) {
char *hostname = (char *) JS_malloc(cx, 1024);
if (!gethostname(hostname, 1023)) {
JSString *myhost = JS_NewStringCopyN(cx, hostname, strlen(hostname));
@@ -98,7 +99,12 @@ static JSBool myIpAddress(JSContext *cx, uintN /*argc*
static JSClass cls = {
"global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
- JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
+ JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub,
+#if JS_VERSION == 186
+ NULL,
+#else
+ JS_FinalizeStub,
+#endif
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
@@ -117,7 +123,11 @@ class mozjs_pacrunner : public pacrunner { (public)
//JS_SetOptions(this->jsctx, JSOPTION_VAROBJFIX);
//JS_SetVersion(this->jsctx, JSVERSION_LATEST);
//JS_SetErrorReporter(cx, reportError);
+#if JS_VERSION == 186
+ if (!(this->jsglb = JS_NewGlobalObject(this->jsctx, &cls, NULL))) goto error;
+#else
if (!(this->jsglb = JS_NewCompartmentAndGlobalObject(this->jsctx, &cls, NULL))) goto error;
+#endif
if (!JS_InitStandardClasses(this->jsctx, this->jsglb)) goto error;
// Define Javascript functions