commit:     0ff192d63f46225f557ec26daef552f2bda232bf
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  6 14:23:16 2019 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Jan 13 19:26:34 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ff192d6

net-libs/libproxy: 0.4.15 version bump, EAPI-7 bump, python3 support

Closes: https://bugs.gentoo.org/608886
Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 net-libs/libproxy/Manifest                         |   1 +
 .../files/libproxy-0.4.15-avoid-nm-build-dep.patch |  63 +++++++++++++
 .../files/libproxy-0.4.15-mozjs-52-1.patch         | 101 +++++++++++++++++++++
 .../files/libproxy-0.4.15-mozjs-52-2.patch         |  23 +++++
 .../files/libproxy-0.4.15-python-3.7.patch         |  23 +++++
 net-libs/libproxy/libproxy-0.4.15.ebuild           |  92 +++++++++++++++++++
 6 files changed, 303 insertions(+)

diff --git a/net-libs/libproxy/Manifest b/net-libs/libproxy/Manifest
index 39a629475f8..1e6520ca0b2 100644
--- a/net-libs/libproxy/Manifest
+++ b/net-libs/libproxy/Manifest
@@ -1 +1,2 @@
 DIST libproxy-0.4.13.tar.gz 89296 BLAKE2B 
05e1c6a56e562a9fc8c8123bead6f3a264589f97895079f3d90cd0edd03d980c9b2bb0a4a3c2d2c2aa553e0ed0450863bd74236c00d94b9c42930efe9c37bff1
 SHA512 
babbe5e9326cb2bfdf4504662533b314f72c3475687f8b57c235614698cb18e0ed31752b834cb1d33cc94ecd3af6589684b2846e73830f0be3557c465a1f1c42
+DIST libproxy-0.4.15.tar.gz 93084 BLAKE2B 
9aa86403eaf4e1791958013c2739e251c61f11da40e66b3296b33a7f380828895f621175add5efb3cd17222ff016941801c25c2d70c19ef3a6652510268a0b3d
 SHA512 
8f68bd56e44aeb3f553f4657bef82a5d14302780508dafa32454d6f724b724c884ceed6042f8df53a081d26ea0b05598cf35eab44823257c47c5ef8afb36442b

diff --git a/net-libs/libproxy/files/libproxy-0.4.15-avoid-nm-build-dep.patch 
b/net-libs/libproxy/files/libproxy-0.4.15-avoid-nm-build-dep.patch
new file mode 100644
index 00000000000..0b9320a6dfd
--- /dev/null
+++ b/net-libs/libproxy/files/libproxy-0.4.15-avoid-nm-build-dep.patch
@@ -0,0 +1,63 @@
+From 518214ee85e10c5bc99d3b115ae7ac9cc3fc14fc Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev <tetrom...@gentoo.org>
+Date: Mon, 29 Apr 2013 23:02:25 -0400
+Subject: [PATCH] Avoid build-time dependency on NetworkManager
+
+Needed to prevent a dependency loop:
+nm -> libsoup -> glib-networking -> libproxy -> nm
+
+https://bugs.gentoo.org/467696
+
+* ast...@gentoo.org: Rebased on top of 0.4.15
+---
+ libproxy/cmake/modules/network_networkmanager.cmk |  4 ++--
+ libproxy/modules/network_networkmanager.cpp       | 23 +++++++++++++++++------
+ 2 files changed, 19 insertions(+), 8 deletions(-)
+
+--- a/libproxy/cmake/modules/network_networkmanager.cmk        2017-05-11 
11:33:33.000000000 +0200
++++ b/libproxy/cmake/modules/network_networkmanager.cmk        2019-10-06 
15:17:37.881932672 +0200
+@@ -1,6 +1,6 @@
+ if (NOT WIN32 AND NOT APPLE)
+-  px_check_modules(NM libnm dbus-1)
++  px_check_modules(NM dbus-1)
+   if (NOT NM_FOUND)
+-    px_check_modules(NMold NetworkManager dbus-1)
++    px_check_modules(NMold dbus-1)
+   endif (NOT NM_FOUND)
+ endif()
+
+--- a/libproxy/modules/network_networkmanager.cpp      2017-05-11 
11:33:33.000000000 +0200
++++ b/libproxy/modules/network_networkmanager.cpp      2019-10-06 
15:24:21.621173178 +0200
+@@ -23,13 +23,24 @@
+ using namespace libproxy;
+ 
+ #include <dbus/dbus.h>
+-#include <NetworkManager.h>
+ 
+-// Backwards compatibility: with the switch to libnm, NM_STATE_CONNECTED is no
+-// longer defined. NM_STATE_CONNECTED_GLOBAL appeared with NM 0.9 and was 
aliased
+-#ifndef NM_STATE_CONNECTED
+-  #define NM_STATE_CONNECTED NM_STATE_CONNECTED_GLOBAL
+-#endif
++/*
++ * copy-pasted from NetworkManager-0.9.6.4's NetworkManager.h to prevent
++ * a circular dependency; https://bugs.gentoo.org/467696
++ */
++#define       NM_DBUS_PATH                        
"/org/freedesktop/NetworkManager"
++#define       NM_DBUS_INTERFACE                   
"org.freedesktop.NetworkManager"
++typedef enum {
++      NM_STATE_UNKNOWN          = 0,
++      NM_STATE_ASLEEP           = 10,
++      NM_STATE_DISCONNECTED     = 20,
++      NM_STATE_DISCONNECTING    = 30,
++      NM_STATE_CONNECTING       = 40,
++      NM_STATE_CONNECTED_LOCAL  = 50,
++      NM_STATE_CONNECTED_SITE   = 60,
++      NM_STATE_CONNECTED_GLOBAL = 70
++} NMState;
++#define NM_STATE_CONNECTED NM_STATE_CONNECTED_GLOBAL
+ 
+ class networkmanager_network_extension : public network_extension {
+ public:
+-- 
+1.8.2.1

diff --git a/net-libs/libproxy/files/libproxy-0.4.15-mozjs-52-1.patch 
b/net-libs/libproxy/files/libproxy-0.4.15-mozjs-52-1.patch
new file mode 100644
index 00000000000..c2d0257d437
--- /dev/null
+++ b/net-libs/libproxy/files/libproxy-0.4.15-mozjs-52-1.patch
@@ -0,0 +1,101 @@
+From f594720280b2e40d81fa6e286a0ef8868687ef7e Mon Sep 17 00:00:00 2001
+From: Pierre Lejeune <superhe...@gmail.com>
+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 mozjs-60)
+     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 <jsapi.h>
+ #pragma GCC diagnostic error "-Winvalid-offsetof"
++#include <js/Initialization.h>
+ #include <js/CallArgs.h>
+ 
+ #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<JSObject*>(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<JSObject*> *jsglb;
+       JSAutoCompartment *jsac;

diff --git a/net-libs/libproxy/files/libproxy-0.4.15-mozjs-52-2.patch 
b/net-libs/libproxy/files/libproxy-0.4.15-mozjs-52-2.patch
new file mode 100644
index 00000000000..fc23ef2cf8e
--- /dev/null
+++ b/net-libs/libproxy/files/libproxy-0.4.15-mozjs-52-2.patch
@@ -0,0 +1,23 @@
+From a9b052c6e30101fb0b702917f245a3e2a2f08366 Mon Sep 17 00:00:00 2001
+From: Laurent Bigonville <bi...@bigon.be>
+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;
+ 

diff --git a/net-libs/libproxy/files/libproxy-0.4.15-python-3.7.patch 
b/net-libs/libproxy/files/libproxy-0.4.15-python-3.7.patch
new file mode 100644
index 00000000000..95e56c2fe25
--- /dev/null
+++ b/net-libs/libproxy/files/libproxy-0.4.15-python-3.7.patch
@@ -0,0 +1,23 @@
+From 2d6da65598b90480b4a62c4633eda035ea51681f Mon Sep 17 00:00:00 2001
+From: David King <amigad...@amigadave.com>
+Date: Wed, 27 Jun 2018 06:36:00 +0100
+Subject: [PATCH] python: support Python 3.7 and 3.8
+
+Add 3.7 and 3.8 to the list of accepted Python 3 versions.
+---
+ cmake/FindPython3Interp.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/FindPython3Interp.cmake b/cmake/FindPython3Interp.cmake
+index c6cbe3d..8e5e409 100644
+--- a/cmake/FindPython3Interp.cmake
++++ b/cmake/FindPython3Interp.cmake
+@@ -39,7 +39,7 @@
+ 
+ unset(_Python3_NAMES)
+ 
+-set(_Python3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
++set(_Python3_VERSIONS 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+ 
+ if(Python3Interp_FIND_VERSION)
+     if(Python3Interp_FIND_VERSION_COUNT GREATER 1)

diff --git a/net-libs/libproxy/libproxy-0.4.15.ebuild 
b/net-libs/libproxy/libproxy-0.4.15.ebuild
new file mode 100644
index 00000000000..0e4f5379188
--- /dev/null
+++ b/net-libs/libproxy/libproxy-0.4.15.ebuild
@@ -0,0 +1,92 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+CMAKE_ECLASS=cmake
+PYTHON_COMPAT=( python3_{6,7,8} )
+inherit cmake-multilib flag-o-matic mono-env python-r1
+
+DESCRIPTION="Library for automatic proxy configuration management"
+HOMEPAGE="https://github.com/libproxy/libproxy";
+SRC_URI="https://github.com/libproxy/libproxy/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="LGPL-2.1+"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc 
~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE="gnome kde mono networkmanager perl python spidermonkey test webkit"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+       virtual/pkgconfig:0[${MULTILIB_USEDEP}]
+"
+DEPEND="
+       gnome? ( dev-libs/glib:2[${MULTILIB_USEDEP}] )
+       mono? ( dev-lang/mono )
+       networkmanager? ( sys-apps/dbus:0[${MULTILIB_USEDEP}] )
+       perl? ( dev-lang/perl:= )
+       python? ( ${PYTHON_DEPS} )
+       spidermonkey? ( >=dev-lang/spidermonkey-52.0.0:= )
+       webkit? ( net-libs/webkit-gtk:4 )
+"
+RDEPEND="${DEPEND}
+       kde? ( kde-frameworks/kconfig:5 )
+"
+# avoid dependency loop, bug #467696
+PDEPEND="networkmanager? ( net-misc/networkmanager )"
+
+PATCHES=(
+       # get-pac-test freezes when run by the ebuild, succeeds when building
+       # manually; virtualx.eclass doesn't help :(
+       "${FILESDIR}/${PN}-0.4.10-disable-pac-test.patch"
+
+       # https://github.com/libproxy/libproxy/issues/27
+       "${FILESDIR}/${PN}-0.4.12-macosx.patch"
+
+       # prevent dependency loop with networkmanager, libsoup, 
glib-networking; bug #467696
+       # https://github.com/libproxy/libproxy/issues/28
+       "${FILESDIR}/${P}-avoid-nm-build-dep.patch"
+
+       # backports from git master:
+       "${FILESDIR}"/${P}-python-3.7.patch # find python-3.7 and 3.8 as well
+       "${FILESDIR}"/${P}-mozjs-52-{1,2}.patch
+)
+
+multilib_src_configure() {
+       local mycmakeargs=(
+               -DCMAKE_C_FLAGS="${CFLAGS}"
+               -DCMAKE_CXX_FLAGS="${CXXFLAGS}"
+               -DWITH_NATUS=OFF
+               -DWITH_PYTHON2=OFF
+               # WITH_VALA just copies the .vapi file over and needs no deps,
+               # hence always enable it unconditionally
+               -DWITH_VALA=ON
+               -DWITH_WEBKIT=OFF
+               $(multilib_is_native_abi && usex mono 
-DGMCS_EXECUTABLE="${EPREFIX}"/usr/bin/mcs)
+               -DWITH_GNOME3=$(usex gnome)
+               -DWITH_KDE=$(usex kde)
+               -DWITH_DOTNET=$(multilib_is_native_abi && usex mono || echo OFF)
+               -DWITH_NM=$(usex networkmanager)
+               $(multilib_is_native_abi && usex perl -DPERL_VENDORINSTALL=ON)
+               -DWITH_PERL=$(multilib_is_native_abi && usex perl || echo OFF)
+               -DWITH_PYTHON3=$(multilib_is_native_abi && usex python || echo 
OFF)
+               -DWITH_MOZJS=$(multilib_is_native_abi && usex spidermonkey || 
echo OFF)
+               -DBUILD_TESTING=$(usex test)
+               -DWITH_WEBKIT3=$(multilib_is_native_abi && usex webkit || echo 
OFF)
+       )
+       cmake_src_configure
+}
+
+src_configure() {
+       [[ ${CHOST} == *-solaris* ]] && append-libs -lsocket -lnsl
+
+       use python && python_setup
+       multilib-minimal_src_configure
+}
+
+multilib_src_install_all() {
+       doman "${FILESDIR}"/proxy.1
+       use python && python_foreach_impl python_domodule 
bindings/python/libproxy.py
+}

Reply via email to