public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Nirbheek Chauhan" <nirbheek@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gnome:master commit in: net-libs/libproxy/files/, net-libs/libproxy/
Date: Fri, 25 Mar 2011 07:14:26 +0000 (UTC)	[thread overview]
Message-ID: <9acea2fff7cb6728004b120cf58a3a5463b10904.nirbheek@gentoo> (raw)

commit:     9acea2fff7cb6728004b120cf58a3a5463b10904
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 25 07:03:06 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Fri Mar 25 07:03:26 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=9acea2ff

net-libs/libproxy: fix build with xulrunner-2, patch from portage

Fixes bug 360375

---
 .../files/libproxy-0.4.6-xulrunner-2.patch         |  133 ++++++++++++++++++++
 net-libs/libproxy/libproxy-0.4.6-r300.ebuild       |   10 +-
 2 files changed, 137 insertions(+), 6 deletions(-)

diff --git a/net-libs/libproxy/files/libproxy-0.4.6-xulrunner-2.patch b/net-libs/libproxy/files/libproxy-0.4.6-xulrunner-2.patch
new file mode 100644
index 0000000..5f3de3c
--- /dev/null
+++ b/net-libs/libproxy/files/libproxy-0.4.6-xulrunner-2.patch
@@ -0,0 +1,133 @@
+http://bugs.gentoo.org/359879
+http://code.google.com/p/libproxy/issues/detail?id=158
+
+--- libproxy/cmake/modules/pacrunner_mozjs.cmk
++++ libproxy/cmake/modules/pacrunner_mozjs.cmk
+@@ -7,16 +7,23 @@
+     include_directories("${MOZJS_INCLUDE_DIR}")
+   endif()
+ elseif(NOT APPLE)
+-  set(MOZJS_SEARCH_ORDER "xulrunner-js;firefox-js;mozilla-js;seamonkey-js" CACHE STRING "MozJS search order")
++  set(MOZJS_SEARCH_ORDER "mozilla-js;xulrunner-js;firefox-js;seamonkey-js" CACHE STRING "MozJS search order")
+   option(WITH_MOZJS "Search for MOZJS package" ON)
+   if (WITH_MOZJS)
+-    pkg_search_module(MOZJS ${MOZJS_SEARCH_ORDER})
+-    if(MOZJS_FOUND)
+-      include_directories(${MOZJS_INCLUDE_DIRS})
+-      link_directories(${MOZJS_LIBRARY_DIRS})
+-    else()
+-      set(MOZJS_FOUND 0)
+-    endif()
++    foreach(MOZJSLIB ${MOZJS_SEARCH_ORDER})
++      pkg_search_module(MOZJS ${MOZJSLIB})
++      if(MOZJS_FOUND)
++        include_directories(${MOZJS_INCLUDE_DIRS})
++        link_directories(${MOZJS_LIBRARY_DIRS})
++        pkg_search_module(MOZJS2 ${MOZJSLIB}>=2.0b10)
++        if(MOZJS2_FOUND)
++          add_definitions(-DHAVE_MOZJS_2)
++        endif(MOZJS2_FOUND)
++        break()
++      else()
++        set(MOZJS_FOUND 0)
++      endif()
++    endforeach()
+   else()
+     set(MOZJS_FOUND 0)
+   endif()
+--- libproxy/modules/pacrunner_mozjs.cpp
++++ libproxy/modules/pacrunner_mozjs.cpp
+@@ -42,12 +42,12 @@
+ #define INET6_ADDRSTRLEN 46
+ #endif
+ 
+-static JSBool dnsResolve(JSContext *cx, JSObject * /*obj*/, uintN /*argc*/, jsval *argv, jsval *rval) {
++static JSBool dnsResolve_(JSContext *cx, jsval hostname, jsval *vp) {
+ 	// Get hostname argument
+-	char *tmp = JS_strdup(cx, JS_GetStringBytes(JS_ValueToString(cx, argv[0])));
++	char *tmp = JS_EncodeString(cx, JS_ValueToString(cx, hostname));
+ 
+ 	// Set the default return value
+-	*rval = JSVAL_NULL;
++	JS_SET_RVAL(cx, vp, JSVAL_NULL);
+ 
+ 	// Look it up
+ 	struct addrinfo *info = NULL;
+@@ -66,7 +66,7 @@
+ 					NI_NUMERICHOST)) goto out;
+ 
+ 	// We succeeded
+-	*rval = STRING_TO_JSVAL(JS_NewString(cx, tmp, strlen(tmp)));
++	JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyN(cx, tmp, strlen(tmp))));
+ 	tmp = NULL;
+ 
+ 	out:
+@@ -75,15 +75,20 @@
+ 		return true;
+ }
+ 
+-static JSBool myIpAddress(JSContext *cx, JSObject *obj, uintN /*argc*/, jsval * /*argv*/, jsval *rval) {
++static JSBool dnsResolve(JSContext *cx, uintN /*argc*/, jsval *vp) {
++	jsval *argv = JS_ARGV(cx, vp);
++	return dnsResolve_(cx, argv[0], vp);
++}
++
++static JSBool myIpAddress(JSContext *cx, uintN /*argc*/, jsval *vp) {
+ 	char *hostname = (char *) JS_malloc(cx, 1024);
+ 	if (!gethostname(hostname, 1023)) {
+-		JSString *myhost = JS_NewString(cx, hostname, strlen(hostname));
++		JSString *myhost = JS_NewStringCopyN(cx, hostname, strlen(hostname));
+ 		jsval arg = STRING_TO_JSVAL(myhost);
+-		return dnsResolve(cx, obj, 1, &arg, rval);
++		return dnsResolve_(cx, 1, &arg);
+ 	}
+ 	JS_free(cx, hostname);
+-	*rval = JSVAL_NULL;
++	JS_SET_RVAL(cx, vp, JSVAL_NULL);
+ 	return true;
+ }
+ 
+@@ -91,7 +96,7 @@
+ // This MUST be a static global
+ static JSClass cls = {
+ 		"global", JSCLASS_GLOBAL_FLAGS,
+-		JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
++		JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
+ 		JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
+ 		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+ };
+@@ -111,7 +116,11 @@
+ 	    //JS_SetOptions(this->jsctx, JSOPTION_VAROBJFIX);
+ 	    //JS_SetVersion(this->jsctx, JSVERSION_LATEST);
+ 	    //JS_SetErrorReporter(cx, reportError);
++		#ifdef HAVE_MOZJS_2
++		if (!(this->jsglb = JS_NewCompartmentAndGlobalObject(this->jsctx, &cls, NULL))) goto error;
++		#else
+ 		if (!(this->jsglb = JS_NewObject(this->jsctx, &cls, NULL, NULL))) goto error;
++		#endif
+ 		if (!JS_InitStandardClasses(this->jsctx, this->jsglb))            goto error;
+ 
+ 		// Define Javascript functions
+@@ -147,15 +156,19 @@
+ 			throw bad_alloc();
+ 		}
+ 		jsval args[2] = {
+-			STRING_TO_JSVAL(JS_NewString(this->jsctx, tmpurl, strlen(tmpurl))),
+-			STRING_TO_JSVAL(JS_NewString(this->jsctx, tmphost, strlen(tmphost)))
++			STRING_TO_JSVAL(JS_NewStringCopyN(this->jsctx, tmpurl, strlen(tmpurl))),
++			STRING_TO_JSVAL(JS_NewStringCopyN(this->jsctx, tmphost, strlen(tmphost)))
+ 		};
+ 
+ 		// Find the proxy (call FindProxyForURL())
+ 		jsval rval;
+ 		JSBool result = JS_CallFunctionName(this->jsctx, this->jsglb, "FindProxyForURL", 2, args, &rval);
+ 		if (!result) return "";
+-		string answer = string(JS_GetStringBytes(JS_ValueToString(this->jsctx, rval)));
++		
++		char * tmpanswer = JS_EncodeString(this->jsctx, JS_ValueToString(this->jsctx, rval));
++		string answer = string(tmpanswer);
++		JS_free(this->jsctx, tmpanswer);
++
+ 		if (answer == "undefined") return "";
+ 		return answer;
+ 	}

diff --git a/net-libs/libproxy/libproxy-0.4.6-r300.ebuild b/net-libs/libproxy/libproxy-0.4.6-r300.ebuild
index 55367b6..24f5aca 100644
--- a/net-libs/libproxy/libproxy-0.4.6-r300.ebuild
+++ b/net-libs/libproxy/libproxy-0.4.6-r300.ebuild
@@ -32,8 +32,10 @@ DEPEND="${RDEPEND}
 
 DOCS="AUTHORS NEWS README ChangeLog"
 
-PATCHES=( "${FILESDIR}"/${P}-mozjs-link_directory.patch )
-		 # "${FILESDIR}"/${P}-webkit-gtk-3.patch )
+PATCHES=(
+	"${FILESDIR}"/${P}-mozjs-link_directory.patch
+	"${FILESDIR}"/${P}-xulrunner-2.patch )
+	# "${FILESDIR}"/${P}-webkit-gtk-3.patch )
 
 pkg_setup() {
 	if use python; then
@@ -67,10 +69,6 @@ src_compile() {
 	cmake-utils_src_compile
 }
 
-pkg_preinst() {
-	preserve_old_lib /usr/$(get_libdir)/libproxy.so.0
-}
-
 pkg_postinst() {
 	preserve_old_lib_notify /usr/$(get_libdir)/libproxy.so.0
 



             reply	other threads:[~2011-03-25  7:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25  7:14 Nirbheek Chauhan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-07-06 14:34 [gentoo-commits] proj/gnome:master commit in: net-libs/libproxy/files/, net-libs/libproxy/ Alexandre Restovtsev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9acea2fff7cb6728004b120cf58a3a5463b10904.nirbheek@gentoo \
    --to=nirbheek@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox