Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK)) by mollari.NetBSD.org (Postfix) with ESMTPS id DECE27A16B for ; Sun, 18 Sep 2016 12:36:42 +0000 (UTC) Received: by mail.netbsd.org (Postfix, from userid 605) id 941FC85EB4; Sun, 18 Sep 2016 12:36:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 1C5EB85EBE for ; Sun, 18 Sep 2016 12:36:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id 077_UARoJD1A for ; Sun, 18 Sep 2016 12:36:41 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 7F54885EB4 for ; Sun, 18 Sep 2016 12:36:41 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 7BE59FBD1; Sun, 18 Sep 2016 12:36:41 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1474202201144060" MIME-Version: 1.0 Date: Sun, 18 Sep 2016 12:36:41 +0000 From: "Kamil Rytarowski" Subject: CVS commit: pkgsrc/lang/python34 To: pkgsrc-changes@NetBSD.org Reply-To: kamil@netbsd.org X-Mailer: log_accum Message-Id: <20160918123641.7BE59FBD1@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: pkgsrc-changes.NetBSD.org Precedence: bulk This is a multi-part message in MIME format. --_----------=_1474202201144060 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: kamil Date: Sun Sep 18 12:36:41 UTC 2016 Modified Files: pkgsrc/lang/python34: Makefile Added Files: pkgsrc/lang/python34: options.mk Log Message: Forward port patches from python27 for dlopen(3) Original changes in python27/Makefile r1.62-r1.67 ================================================= Add an option for Python: x11 Fix dlopen(3) calls in _ctypes.so for X11BASE libraries A Python code can dynamically load shared libraries and it's wrapped with a plain dlopen(3) call. The holder of this interface (_ctypes module) without rpath set to X11BASE cannot detect libs like 'GL'. Fixing find_library() on POSIX-like (excluding Darwin) systems. This isn't addressing Python's wrapper for dlopen(3). This possibily addresses mostly NetBSD as other popular OSes have ldconfig. Testing commands: - before applying the patch >>> from ctypes.util import find_library >>> find_library("m") 'libm.so.0' >>> find_library("crypto") 'libcrypto.so.11' >>> find_library("GL") >>> find_library("curl") - after applying the patch >>> from ctypes.util import find_library >>> find_library("m") 'libm.so.0' >>> find_library("crypto") 'libcrypto.so.11' >>> find_library("GL") 'libGL.so.2' >>> find_library("curl") 'libcurl.so.4' This patch doesn't solve the case of custom dirs like $PREFIX/qt5/lib. However it's solving most common cases of using this call. A possible solution is to parse the output "pkg_info -La"... however it's very slow. In other words a cache with libraries might be needed to handle it efficiently. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 pkgsrc/lang/python34/Makefile cvs rdiff -u -r0 -r1.1 pkgsrc/lang/python34/options.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1474202201144060 Content-Disposition: inline Content-Length: 2819 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/lang/python34/Makefile diff -u pkgsrc/lang/python34/Makefile:1.16 pkgsrc/lang/python34/Makefile:1.17 --- pkgsrc/lang/python34/Makefile:1.16 Fri May 13 16:35:03 2016 +++ pkgsrc/lang/python34/Makefile Sun Sep 18 12:36:41 2016 @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.16 2016/05/13 16:35:03 adam Exp $ +# $NetBSD: Makefile,v 1.17 2016/09/18 12:36:41 kamil Exp $ .include "dist.mk" PKGNAME= python34-${PY_DISTVERSION} +PKGREVISION= 1 CATEGORIES= lang python MAINTAINER= pkgsrc-users@NetBSD.org @@ -122,6 +123,26 @@ SUBST_STAGE.findlib= pre-configure SUBST_FILES.findlib= Lib/distutils/unixccompiler.py SUBST_SED.findlib= -e 's,/usr/local,${PREFIX},' +# XXX: It might be needed to add manually more paths like ${PREFIX}/qt5/lib +# Testing: +# >>> from ctypes.util import find_library +# >>> find_library("m") +# 'libm.so.0' +# >>> find_library("crypto") +# 'libcrypto.so.11' +# >>> find_library("GL") +# 'libGL.so.2' +# >>> find_library("curl") +# 'libcurl.so.4' + +SUBST_CLASSES+= pfindlib +SUBST_MESSAGE.pfindlib= Fixing find_library() on POSIX-like (excluding Darwin) systems. +SUBST_STAGE.pfindlib= pre-configure +SUBST_FILES.pfindlib= Lib/ctypes/util.py +SUBST_SED.pfindlib= -e 's!\(-Wl,-t -o\)!${COMPILER_RPATH_FLAG}${PREFIX}/lib -L${PREFIX}/lib \1!' + +.include "options.mk" + SUBST_CLASSES+= sslbase SUBST_MESSAGE.sslbase= Fixing OpenSSL base directory to find header file. SUBST_STAGE.sslbase= pre-configure Added files: Index: pkgsrc/lang/python34/options.mk diff -u /dev/null pkgsrc/lang/python34/options.mk:1.1 --- /dev/null Sun Sep 18 12:36:41 2016 +++ pkgsrc/lang/python34/options.mk Sun Sep 18 12:36:41 2016 @@ -0,0 +1,28 @@ +# $NetBSD: options.mk,v 1.1 2016/09/18 12:36:41 kamil Exp $ + +PKG_OPTIONS_VAR= PKG_OPTIONS.python27 +PKG_SUPPORTED_OPTIONS+= x11 +PKG_SUGGESTED_OPTIONS= x11 + +.include "../../mk/bsd.prefs.mk" +.include "../../mk/bsd.options.mk" + +.if !empty(PKG_OPTIONS:Mx11) +# Support for native X11 paths as an option +# This code is no-op for modular X11, however for simplicity don't make it conditional. +SUBST_CLASSES+= x11findlib +SUBST_MESSAGE.x11findlib= Fixing find_library() for native X11. +SUBST_STAGE.x11findlib= pre-configure +SUBST_FILES.x11findlib= Lib/ctypes/util.py +SUBST_SED.x11findlib= -e 's!\(-Wl,-t -o\)!${COMPILER_RPATH_FLAG}${X11BASE}/lib -L${X11BASE}/lib \1!' + +# Required to get definition of X11BASE and retain X11 rpath paths for linker +# We need to pass rpath to _ctypes.so to get functional dlopen(3) for X11 libs +USE_X11= yes + +SUBST_CLASSES+= cdlopen +SUBST_MESSAGE.cdlopen= Handle X11BASE paths in dlopen(3) calls of _ctypes.so +SUBST_STAGE.cdlopen= pre-configure +SUBST_FILES.cdlopen= setup.py +SUBST_SED.cdlopen= -e "s!\(libraries=\[\],\)!\1 runtime_library_dirs=\['${X11BASE}/lib'\],!" +.endif --_----------=_1474202201144060--