From 978c5b8107739c23fbe46736f8858c381e137209 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Jun 03 2013 23:42:35 +0000 Subject: Add patch to build with mozjs17, use it by default --- diff --git a/0001-pacrunner_mozjs-Also-support-mozjs-17.0.patch b/0001-pacrunner_mozjs-Also-support-mozjs-17.0.patch new file mode 100644 index 0000000..217b843 --- /dev/null +++ b/0001-pacrunner_mozjs-Also-support-mozjs-17.0.patch @@ -0,0 +1,90 @@ +From cccc44ce0c8a251d987d0d83f05e93d31aa659d7 Mon Sep 17 00:00:00 2001 +From: Colin Walters +Date: Mon, 3 Jun 2013 17:09:25 -0400 +Subject: [PATCH] pacrunner_mozjs: Also support mozjs-17.0 + +GNOME 3.10 is moving to hard require mozjs-17.0, so we should support +it too. See also: + +https://bugs.freedesktop.org/show_bug.cgi?id=59830 +https://bugzilla.gnome.org/show_bug.cgi?id=690982 +--- + libproxy/cmake/modules/pacrunner_mozjs.cmk | 8 +++++++- + libproxy/modules/pacrunner_mozjs.cpp | 16 +++++++++++++--- + 2 files changed, 20 insertions(+), 4 deletions(-) + +diff --git a/libproxy/cmake/modules/pacrunner_mozjs.cmk b/libproxy/cmake/modules/pacrunner_mozjs.cmk +index 21072db..49856a6 100644 +--- a/libproxy/cmake/modules/pacrunner_mozjs.cmk ++++ b/libproxy/cmake/modules/pacrunner_mozjs.cmk +@@ -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) +diff --git a/libproxy/modules/pacrunner_mozjs.cpp b/libproxy/modules/pacrunner_mozjs.cpp +index abb4b9d..f5e678c 100644 +--- a/libproxy/modules/pacrunner_mozjs.cpp ++++ b/libproxy/modules/pacrunner_mozjs.cpp +@@ -19,6 +19,7 @@ + + #include // ? + #include // gethostname ++#include + + #include "../extension_pacrunner.hpp" + using namespace libproxy; +@@ -76,12 +77,12 @@ static JSBool dnsResolve_(JSContext *cx, jsval hostname, jsval *vp) { + 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*/, jsval *vp) { + 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 @@ 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 +-- +1.7.1 + diff --git a/libproxy.spec b/libproxy.spec index e72a400..3ae494c 100644 --- a/libproxy.spec +++ b/libproxy.spec @@ -12,7 +12,7 @@ Name: libproxy Version: 0.4.11 -Release: 3%{?svn}%{?dist} +Release: 4%{?svn}%{?dist} Summary: A library handling all the details of proxy configuration Group: System Environment/Libraries @@ -21,6 +21,7 @@ URL: http://code.google.com/p/libproxy/ Source0: http://libproxy.googlecode.com/files/libproxy-%{version}%{?svn}.tar.gz Patch0: libproxy-0.4.10-mozjs.patch +Patch1: 0001-pacrunner_mozjs-Also-support-mozjs-17.0.patch BuildRequires: python-devel BuildRequires: libmodman-devel >= 2.0.1 @@ -32,7 +33,7 @@ BuildRequires: GConf2-devel BuildRequires: libXmu-devel } # mozjs -%{?_with_mozjs:BuildRequires: js-devel} +%{?_with_mozjs:BuildRequires: mozjs17-devel} # NetworkManager %{?_with_networkmanager: BuildRequires: NetworkManager-devel @@ -171,6 +172,7 @@ developing applications that use %{name}. %prep %setup -q %patch0 -p1 -b .orig +%patch1 -p1 -b .orig %build %{cmake} \ @@ -267,6 +269,9 @@ make test %changelog +* Mon Jul 03 2013 Colin Walters - 0.4.11-4 +- Add patch to build with mozjs17, use it by default + * Thu Feb 14 2013 Fedora Release Engineering - 0.4.11-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild