From owner-svn-ports-head@freebsd.org Thu May 23 09:41:17 2019 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DD8715A4109; Thu, 23 May 2019 09:41:17 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A66E8BA1B; Thu, 23 May 2019 09:41:17 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9ED13014; Thu, 23 May 2019 09:41:16 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4N9fGpN086673; Thu, 23 May 2019 09:41:16 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4N9fGJV086671; Thu, 23 May 2019 09:41:16 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201905230941.x4N9fGJV086671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 23 May 2019 09:41:16 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r502332 - in head/net: libproxy-mozjs libproxy/files X-SVN-Group: ports-head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in head/net: libproxy-mozjs libproxy/files X-SVN-Commit-Revision: 502332 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1A66E8BA1B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 09:41:17 -0000 Author: bapt Date: Thu May 23 09:41:16 2019 New Revision: 502332 URL: https://svnweb.freebsd.org/changeset/ports/502332 Log: Use the most recent spidermonkey in ports Patch obtained from fedora project Approved by: kwm (maintainer) Added: head/net/libproxy/files/libproxy-0.4.15-mozjs52.patch (contents, props changed) Modified: head/net/libproxy-mozjs/Makefile Modified: head/net/libproxy-mozjs/Makefile ============================================================================== --- head/net/libproxy-mozjs/Makefile Thu May 23 09:35:07 2019 (r502331) +++ head/net/libproxy-mozjs/Makefile Thu May 23 09:41:16 2019 (r502332) @@ -1,7 +1,7 @@ # Created by: Joe Marcus Clarke # $FreeBSD$ -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= net www PKGNAMESUFFIX= -${LIBPROXY_SLAVE} @@ -10,7 +10,9 @@ COMMENT= Mozilla JavaScript plug-in for libproxy USES= compiler:c++11-lib USE_CXXSTD= gnu++11 -LIB_DEPENDS= libmozjs-38.so:lang/spidermonkey38 +LIB_DEPENDS= libmozjs-52.so:lang/spidermonkey52 + +EXTRA_PATCHES= ${FILESDIR}/libproxy-0.4.15-mozjs52.patch:-p1 LIBPROXY_SLAVE= mozjs MASTERDIR= ${.CURDIR}/../libproxy Added: head/net/libproxy/files/libproxy-0.4.15-mozjs52.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/libproxy/files/libproxy-0.4.15-mozjs52.patch Thu May 23 09:41:16 2019 (r502332) @@ -0,0 +1,124 @@ +From f594720280b2e40d81fa6e286a0ef8868687ef7e Mon Sep 17 00:00:00 2001 +From: Pierre Lejeune +Date: Sat, 30 Jun 2018 21:10:06 +0200 +Subject: [PATCH] Build with mozjs-52 + +Fixes #71 +--- + libproxy/cmake/modules/pacrunner_mozjs.cmk | 2 +- + libproxy/modules/pacrunner_mozjs.cpp | 19 +++++++------------ + 2 files changed, 8 insertions(+), 13 deletions(-) + +diff --git a/libproxy/cmake/modules/pacrunner_mozjs.cmk b/libproxy/cmake/modules/pacrunner_mozjs.cmk +index c2ae3db..20857fb 100644 +--- a/libproxy/cmake/modules/pacrunner_mozjs.cmk ++++ b/libproxy/cmake/modules/pacrunner_mozjs.cmk +@@ -9,7 +9,7 @@ if(WIN32) + elseif(NOT APPLE) + option(WITH_MOZJS "Search for MOZJS package" ON) + if (WITH_MOZJS) +- pkg_search_module(MOZJS mozjs-38) ++ pkg_search_module(MOZJS mozjs-52) + if(MOZJS_FOUND) + include_directories(${MOZJS_INCLUDE_DIRS}) + link_directories(${MOZJS_LIBRARY_DIRS}) +diff --git a/libproxy/modules/pacrunner_mozjs.cpp b/libproxy/modules/pacrunner_mozjs.cpp +index a70b2e9..ed07c69 100644 +--- a/libproxy/modules/pacrunner_mozjs.cpp ++++ b/libproxy/modules/pacrunner_mozjs.cpp +@@ -35,6 +35,7 @@ using namespace libproxy; + #pragma GCC diagnostic ignored "-Winvalid-offsetof" + #include + #pragma GCC diagnostic error "-Winvalid-offsetof" ++#include + #include + + #include "pacutils.h" +@@ -111,17 +112,14 @@ class mozjs_pacrunner : public pacrunner { + mozjs_pacrunner(string pac, const url& pacurl) throw (bad_alloc) : pacrunner(pac, pacurl) { + + // Set defaults +- this->jsrun = nullptr; + this->jsctx = nullptr; + JS_Init(); + +- // Initialize Javascript runtime environment +- if (!(this->jsrun = JS_NewRuntime(1024 * 1024))) goto error; +- if (!(this->jsctx = JS_NewContext(this->jsrun, 1024 * 1024))) goto error; ++ // Initialize Javascript context ++ if (!(this->jsctx = JS_NewContext(1024 * 1024))) goto error; + { + JS::RootedValue rval(this->jsctx); + JS::CompartmentOptions compart_opts; +- compart_opts.setVersion(JSVERSION_LATEST); + + this->jsglb = new JS::Heap(JS_NewGlobalObject( + this->jsctx, &cls, +@@ -139,16 +137,15 @@ class mozjs_pacrunner : public pacrunner { + JS::CompileOptions options(this->jsctx); + options.setUTF8(true); + +- JS::Evaluate(this->jsctx, global, options, JAVASCRIPT_ROUTINES, +- strlen(JAVASCRIPT_ROUTINES), &rval); ++ JS::Evaluate(this->jsctx, options, JAVASCRIPT_ROUTINES, ++ strlen(JAVASCRIPT_ROUTINES), JS::MutableHandleValue(&rval)); + + // Add PAC to the environment +- JS::Evaluate(this->jsctx, global, options, pac.c_str(), pac.length(), &rval); ++ JS::Evaluate(this->jsctx, options, pac.c_str(), pac.length(), JS::MutableHandleValue(&rval)); + return; + } + error: + if (this->jsctx) JS_DestroyContext(this->jsctx); +- if (this->jsrun) JS_DestroyRuntime(this->jsrun); + throw bad_alloc(); + } + +@@ -156,7 +153,6 @@ class mozjs_pacrunner : public pacrunner { + if (this->jsac) delete this->jsac; + if (this->jsglb) delete this->jsglb; + if (this->jsctx) JS_DestroyContext(this->jsctx); +- if (this->jsrun) JS_DestroyRuntime(this->jsrun); + JS_ShutDown(); + } + +@@ -178,7 +174,7 @@ class mozjs_pacrunner : public pacrunner { + JS::RootedObject global(this->jsctx,this->jsglb->get()); + bool result = JS_CallFunctionName(this->jsctx, global, "FindProxyForURL", args, &rval); + if (!result) return ""; +- ++ + char * tmpanswer = JS_EncodeString(this->jsctx, rval.toString()); + string answer = string(tmpanswer); + JS_free(this->jsctx, tmpanswer); +@@ -188,7 +184,6 @@ class mozjs_pacrunner : public pacrunner { + } + + private: +- JSRuntime *jsrun; + JSContext *jsctx; + JS::Heap *jsglb; + JSAutoCompartment *jsac; +From a9b052c6e30101fb0b702917f245a3e2a2f08366 Mon Sep 17 00:00:00 2001 +From: Laurent Bigonville +Date: Tue, 2 Oct 2018 10:22:56 +0200 +Subject: [PATCH] Add call to JS::InitSelfHostedCode() + +This is needed otherwise mozjs crashes +--- + libproxy/modules/pacrunner_mozjs.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libproxy/modules/pacrunner_mozjs.cpp b/libproxy/modules/pacrunner_mozjs.cpp +index ed07c69..38e7d46 100644 +--- a/libproxy/modules/pacrunner_mozjs.cpp ++++ b/libproxy/modules/pacrunner_mozjs.cpp +@@ -118,6 +118,8 @@ class mozjs_pacrunner : public pacrunner { + // Initialize Javascript context + if (!(this->jsctx = JS_NewContext(1024 * 1024))) goto error; + { ++ if (!JS::InitSelfHostedCode(this->jsctx)) goto error; ++ + JS::RootedValue rval(this->jsctx); + JS::CompartmentOptions compart_opts; +