Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Oct 2015 09:22:30 +0000 (UTC)
From:      Kubilay Kocak <koobs@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r399653 - in branches/2015Q4/lang: python27 python27/files python32 python32/files python33 python33/files
Message-ID:  <201510190922.t9J9MUJi025860@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: koobs
Date: Mon Oct 19 09:22:30 2015
New Revision: 399653
URL: https://svnweb.freebsd.org/changeset/ports/399653

Log:
  MFH: r399611
  
  lang/python{27,32,33}: Fix missing shlib path in python-config
  
  In Python 3.4+, upstream added and switched to using a shell
  implementation of the python-config script [1]. The Python
  implementation  (python-config.py) remained used by all versions < 3.4.
  
  While the shell implementation returns the path to the Python
  shared library when using the --ldflags script argument, the Python
  implementation of the script does not. The bug has been reported, but
  has not yet been merged [2].
  
  The Python ports currently default to including ${LOCALBASE}/lib
  in LIBS when the NLS option is enabled (which it is by default).
  
  When built *with* NLS (gettext) support, the flags added to LIBS
  are returned in `pythonX.Y-config --ldflags` output, which happens
  to match the path to the Python shared library.
  
  If the NLS option is disabled, ${LOCALBASE}/lib is not added to LIBS,
  and are therefore not returned in --ldflags output.
  
  This results in potential linking errors for software that uses
  python-config to obtain the correct library path, when the NLS option is
  disabled:
  
  $ make WITH=PYTHON -C audio/alsa-lib
  [...]
  --- smixer-python.la ---
  CCLD     smixer-python.la
  /usr/bin/ld: cannot find -lpython2.7
  
  This change modifies the python-config.in script to match the shell
  implementation, outputting the library path in --ldflags output.
  
  While I'm here:
  
  for Python 3.2 and Python 3.3 ports, backport a library order
  change [3]. This could affect linking with static libraries.
  
  Use standard length lines and reduce diffs in pkg-message
  
  [1] https://bugs.python.org/issue16235
  [2] https://bugs.python.org/issue7352
  [2] https://bugs.python.org/issue18096
  
  PR:		197757
  Submitted by:	jbeich
  
  Approved by:	portmgr (erwin)

Added:
  branches/2015Q4/lang/python27/files/patch-Misc_python-config.in
     - copied unchanged from r399611, head/lang/python27/files/patch-Misc_python-config.in
  branches/2015Q4/lang/python32/files/patch-Misc_python-config.in
     - copied unchanged from r399611, head/lang/python32/files/patch-Misc_python-config.in
  branches/2015Q4/lang/python33/files/patch-Misc_python-config.in
     - copied unchanged from r399611, head/lang/python33/files/patch-Misc_python-config.in
Modified:
  branches/2015Q4/lang/python27/Makefile
  branches/2015Q4/lang/python27/pkg-message
  branches/2015Q4/lang/python32/Makefile
  branches/2015Q4/lang/python32/pkg-message
  branches/2015Q4/lang/python33/Makefile
  branches/2015Q4/lang/python33/pkg-message
Directory Properties:
  branches/2015Q4/   (props changed)

Modified: branches/2015Q4/lang/python27/Makefile
==============================================================================
--- branches/2015Q4/lang/python27/Makefile	Mon Oct 19 09:18:44 2015	(r399652)
+++ branches/2015Q4/lang/python27/Makefile	Mon Oct 19 09:22:30 2015	(r399653)
@@ -2,6 +2,7 @@
 
 PORTNAME=	python27
 PORTVERSION=	2.7.10
+PORTREVISION=	1
 CATEGORIES=	lang python ipv6
 MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
 DISTNAME=	Python-${PORTVERSION}

Copied: branches/2015Q4/lang/python27/files/patch-Misc_python-config.in (from r399611, head/lang/python27/files/patch-Misc_python-config.in)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2015Q4/lang/python27/files/patch-Misc_python-config.in	Mon Oct 19 09:22:30 2015	(r399653, copy of r399611, head/lang/python27/files/patch-Misc_python-config.in)
@@ -0,0 +1,21 @@
+# pythonx.y-config --ldflags out of /usr and missing -L<install_lib_dir>
+# https://bugs.python.org/issue7352
+
+--- Misc/python-config.in.orig	2015-10-18 07:24:01 UTC
++++ Misc/python-config.in
+@@ -21,6 +21,7 @@ except getopt.error:
+ if not opts:
+     exit_with_usage()
+ 
++libdir = sysconfig.EXEC_PREFIX + '/lib'
+ pyver = sysconfig.get_config_var('VERSION')
+ getvar = sysconfig.get_config_var
+ 
+@@ -50,6 +51,7 @@ for opt in opt_flags:
+         # add the prefix/lib/pythonX.Y/config dir, but only if there is no
+         # shared library in prefix/lib/.
+         if opt == '--ldflags':
++            libs.insert(0, '-L' + libdir)
+             if not getvar('Py_ENABLE_SHARED'):
+                 libs.insert(0, '-L' + getvar('LIBPL'))
+             if not getvar('PYTHONFRAMEWORK'):

Modified: branches/2015Q4/lang/python27/pkg-message
==============================================================================
--- branches/2015Q4/lang/python27/pkg-message	Mon Oct 19 09:18:44 2015	(r399652)
+++ branches/2015Q4/lang/python27/pkg-message	Mon Oct 19 09:22:30 2015	(r399653)
@@ -1,4 +1,4 @@
-=====================================================================
+===========================================================================
 
 Note that some standard Python modules are provided as separate ports
 as they require additional dependencies. They are available as:
@@ -8,4 +8,4 @@ gdbm            databases/py-gdbm
 sqlite3         databases/py-sqlite3
 tkinter         x11-toolkits/py-tkinter
 
-=====================================================================
+===========================================================================

Modified: branches/2015Q4/lang/python32/Makefile
==============================================================================
--- branches/2015Q4/lang/python32/Makefile	Mon Oct 19 09:18:44 2015	(r399652)
+++ branches/2015Q4/lang/python32/Makefile	Mon Oct 19 09:22:30 2015	(r399653)
@@ -2,7 +2,7 @@
 
 PORTNAME=	python32
 PORTVERSION=	3.2.5
-PORTREVISION=	13
+PORTREVISION=	14
 CATEGORIES=	lang python ipv6
 MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
 DISTNAME=	Python-${PORTVERSION}

Copied: branches/2015Q4/lang/python32/files/patch-Misc_python-config.in (from r399611, head/lang/python32/files/patch-Misc_python-config.in)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2015Q4/lang/python32/files/patch-Misc_python-config.in	Mon Oct 19 09:22:30 2015	(r399653, copy of r399611, head/lang/python32/files/patch-Misc_python-config.in)
@@ -0,0 +1,32 @@
+# pythonx.y-config --ldflags out of /usr and missing -L<install_lib_dir>
+# https://bugs.python.org/issue7352
+
+# Fix library order returned by python-config. [#18096]
+# bugs.python.org/18096
+
+--- Misc/python-config.in.orig	2013-05-15 16:33:52 UTC
++++ Misc/python-config.in
+@@ -22,6 +22,7 @@ except getopt.error:
+ if not opts:
+     exit_with_usage()
+ 
++libdir = sysconfig.get_config_var('exec_prefix') + '/lib'
+ pyver = sysconfig.get_config_var('VERSION')
+ getvar = sysconfig.get_config_var
+ 
+@@ -45,11 +46,13 @@ for opt in opt_flags:
+         print(' '.join(flags))
+ 
+     elif opt in ('--libs', '--ldflags'):
+-        libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
+-        libs.append('-lpython' + pyver + sys.abiflags)
++        libs = ['-lpython' + pyver + sys.abiflags]
++        libs += getvar('LIBS').split()
++        libs += getvar('SYSLIBS').split()
+         # add the prefix/lib/pythonX.Y/config dir, but only if there is no
+         # shared library in prefix/lib/.
+         if opt == '--ldflags':
++            libs.insert(0, '-L' + libdir)
+             if not getvar('Py_ENABLE_SHARED'):
+                 libs.insert(0, '-L' + getvar('LIBPL'))
+             if not getvar('PYTHONFRAMEWORK'):

Modified: branches/2015Q4/lang/python32/pkg-message
==============================================================================
--- branches/2015Q4/lang/python32/pkg-message	Mon Oct 19 09:18:44 2015	(r399652)
+++ branches/2015Q4/lang/python32/pkg-message	Mon Oct 19 09:22:30 2015	(r399653)
@@ -1,10 +1,10 @@
-====
-Note that some of the standard modules are provided as separate
-ports since they require extra dependencies:
+===========================================================================
+
+Note that some standard Python modules are provided as separate ports
+as they require additional dependencies. They are available as:
 
 gdbm            databases/py-gdbm
 sqlite3         databases/py-sqlite3
 tkinter         x11-toolkits/py-tkinter
 
-Install them as needed.
-====
+===========================================================================

Modified: branches/2015Q4/lang/python33/Makefile
==============================================================================
--- branches/2015Q4/lang/python33/Makefile	Mon Oct 19 09:18:44 2015	(r399652)
+++ branches/2015Q4/lang/python33/Makefile	Mon Oct 19 09:22:30 2015	(r399653)
@@ -2,7 +2,7 @@
 
 PORTNAME=	python33
 PORTVERSION=	3.3.5
-PORTREVISION=	6
+PORTREVISION=	7
 CATEGORIES=	lang python ipv6
 MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
 DISTNAME=	Python-${PORTVERSION}

Copied: branches/2015Q4/lang/python33/files/patch-Misc_python-config.in (from r399611, head/lang/python33/files/patch-Misc_python-config.in)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2015Q4/lang/python33/files/patch-Misc_python-config.in	Mon Oct 19 09:22:30 2015	(r399653, copy of r399611, head/lang/python33/files/patch-Misc_python-config.in)
@@ -0,0 +1,32 @@
+# pythonx.y-config --ldflags out of /usr and missing -L<install_lib_dir>
+# https://bugs.python.org/issue7352
+
+# Fix library order returned by python-config. [#18096]
+# bugs.python.org/18096
+
+--- Misc/python-config.in.orig	2015-10-18 09:00:25 UTC
++++ Misc/python-config.in
+@@ -22,6 +22,7 @@ except getopt.error:
+ if not opts:
+     exit_with_usage()
+ 
++libdir = sysconfig.get_config_var('exec_prefix') + '/lib'
+ pyver = sysconfig.get_config_var('VERSION')
+ getvar = sysconfig.get_config_var
+ 
+@@ -45,11 +46,13 @@ for opt in opt_flags:
+         print(' '.join(flags))
+ 
+     elif opt in ('--libs', '--ldflags'):
+-        libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
+-        libs.append('-lpython' + pyver + sys.abiflags)
++        libs = ['-lpython' + pyver + sys.abiflags]
++        libs += getvar('LIBS').split()
++        libs += getvar('SYSLIBS').split()
+         # add the prefix/lib/pythonX.Y/config dir, but only if there is no
+         # shared library in prefix/lib/.
+         if opt == '--ldflags':
++            libs.insert(0, '-L' + libdir)
+             if not getvar('Py_ENABLE_SHARED'):
+                 libs.insert(0, '-L' + getvar('LIBPL'))
+             if not getvar('PYTHONFRAMEWORK'):

Modified: branches/2015Q4/lang/python33/pkg-message
==============================================================================
--- branches/2015Q4/lang/python33/pkg-message	Mon Oct 19 09:18:44 2015	(r399652)
+++ branches/2015Q4/lang/python33/pkg-message	Mon Oct 19 09:22:30 2015	(r399653)
@@ -1,10 +1,10 @@
-====
-Note that some of the standard modules are provided as separate
-ports since they require extra dependencies:
+===========================================================================
+
+Note that some standard Python modules are provided as separate ports
+as they require additional dependencies. They are available as:
 
 gdbm            databases/py-gdbm
 sqlite3         databases/py-sqlite3
 tkinter         x11-toolkits/py-tkinter
 
-Install them as needed.
-====
+===========================================================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510190922.t9J9MUJi025860>