2012-02-26 10:17:41 +01:00
|
|
|
# $NetBSD: pyversion.mk,v 1.95 2012/02/26 09:17:41 sbd Exp $
|
2006-09-07 18:22:54 +02:00
|
|
|
|
|
|
|
# This file determines which Python version is used as a dependency for
|
|
|
|
# a package.
|
|
|
|
#
|
2008-01-31 14:47:19 +01:00
|
|
|
# === User-settable variables ===
|
2006-09-07 18:22:54 +02:00
|
|
|
#
|
|
|
|
# PYTHON_VERSION_DEFAULT
|
|
|
|
# The preferred Python version to use.
|
|
|
|
#
|
2011-06-17 03:01:04 +02:00
|
|
|
# Possible values: 24 25 26 27 31
|
2010-02-10 20:16:48 +01:00
|
|
|
# Default: 26
|
2006-09-07 18:22:54 +02:00
|
|
|
#
|
2008-01-31 14:47:19 +01:00
|
|
|
# === Package-settable variables ===
|
2006-09-07 18:22:54 +02:00
|
|
|
#
|
|
|
|
# PYTHON_VERSIONS_ACCEPTED
|
|
|
|
# The Python versions that are acceptable for the package. The
|
2008-01-31 14:47:19 +01:00
|
|
|
# order of the entries matters, since earlier entries are
|
2009-01-23 19:02:32 +01:00
|
|
|
# preferred over later ones.
|
2006-09-07 18:22:54 +02:00
|
|
|
#
|
2011-06-17 03:01:04 +02:00
|
|
|
# Possible values: 31 27 26 25 24
|
2011-12-03 01:02:14 +01:00
|
|
|
# Default: (31) 27 26 25 24
|
|
|
|
#
|
|
|
|
# PYTHON_VERSIONS_INCLUDE_3X
|
|
|
|
# Wether the default PYTHON_VERSIONS_ACCEPTED should include
|
|
|
|
# 3.x versions for for this package or not.
|
|
|
|
# This variable must be set before including bsd.prefs.mk.
|
|
|
|
#
|
|
|
|
# Possible values: yes no
|
|
|
|
# Default: no
|
2006-09-07 18:22:54 +02:00
|
|
|
#
|
|
|
|
# PYTHON_VERSIONS_INCOMPATIBLE
|
|
|
|
# The Python versions that are NOT acceptable for the package.
|
|
|
|
#
|
2011-06-17 03:01:04 +02:00
|
|
|
# Possible values: 24 25 26 27 31
|
2006-09-07 18:22:54 +02:00
|
|
|
# Default: (depends on the platform)
|
|
|
|
#
|
|
|
|
# PYTHON_FOR_BUILD_ONLY
|
|
|
|
# Whether Python is needed only at build time or at run time.
|
|
|
|
#
|
|
|
|
# Possible values: (defined) (undefined)
|
|
|
|
# Default: (undefined)
|
|
|
|
#
|
2008-02-20 11:43:55 +01:00
|
|
|
# === Defined variables ===
|
|
|
|
#
|
|
|
|
# PYPKGPREFIX
|
|
|
|
# The prefix to use in PKGNAME for extensions which are meant
|
|
|
|
# to be installed for multiple Python versions.
|
|
|
|
#
|
2011-02-22 10:01:28 +01:00
|
|
|
# Example: py26
|
2008-02-20 11:43:55 +01:00
|
|
|
#
|
|
|
|
# PYVERSSUFFIX
|
|
|
|
# The suffix to executables and in the library path, equal to
|
|
|
|
# sys.version[0:3].
|
|
|
|
#
|
2011-02-22 10:01:28 +01:00
|
|
|
# Example: 2.6
|
2008-02-20 11:43:55 +01:00
|
|
|
#
|
2007-01-07 02:04:22 +01:00
|
|
|
# Keywords: python
|
|
|
|
#
|
2002-01-15 18:18:01 +01:00
|
|
|
|
|
|
|
.if !defined(PYTHON_PYVERSION_MK)
|
|
|
|
PYTHON_PYVERSION_MK= defined
|
2002-01-10 21:44:16 +01:00
|
|
|
|
2009-03-08 18:05:10 +01:00
|
|
|
# derive a python version from the package name if possible
|
|
|
|
# optionally handled quoted package names
|
|
|
|
.if defined(PKGNAME_REQD) && !empty(PKGNAME_REQD:Mpy[0-9][0-9]-*) || \
|
|
|
|
defined(PKGNAME_REQD) && !empty(PKGNAME_REQD:M*-py[0-9][0-9]-*)
|
|
|
|
PYTHON_VERSION_REQD?= ${PKGNAME_REQD:C/(^.*-|^)py([0-9][0-9])-.*/\2/}
|
|
|
|
.elif defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:Mpy[0-9][0-9]-*) || \
|
|
|
|
defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:M*-py[0-9][0-9]-*)
|
|
|
|
PYTHON_VERSION_REQD?= ${PKGNAME_OLD:C/(^.*-|^)py([0-9][0-9])-.*/\2/}
|
|
|
|
.endif
|
|
|
|
|
2002-01-10 21:44:16 +01:00
|
|
|
.include "../../mk/bsd.prefs.mk"
|
|
|
|
|
2007-01-07 02:04:22 +01:00
|
|
|
BUILD_DEFS+= PYTHON_VERSION_DEFAULT
|
|
|
|
BUILD_DEFS_EFFECTS+= PYPACKAGE
|
|
|
|
|
2012-02-26 10:17:41 +01:00
|
|
|
PYTHON_VERSION_DEFAULT?= 26
|
2011-12-03 01:02:14 +01:00
|
|
|
.if ${PYTHON_VERSIONS_INCLUDE_3X:U:tl} == "yes"
|
2011-06-17 03:01:04 +02:00
|
|
|
PYTHON_VERSIONS_ACCEPTED?= 31 27 26 25 24
|
2011-12-03 01:02:14 +01:00
|
|
|
.else
|
|
|
|
PYTHON_VERSIONS_ACCEPTED?= 27 26 25 24
|
|
|
|
.endif
|
2008-04-18 14:24:21 +02:00
|
|
|
PYTHON_VERSIONS_INCOMPATIBLE?= # empty by default
|
|
|
|
|
2006-04-06 08:21:32 +02:00
|
|
|
BUILDLINK_API_DEPENDS.python24?= python24>=2.4
|
2008-02-01 09:17:00 +01:00
|
|
|
BUILDLINK_API_DEPENDS.python25?= python25>=2.5.1
|
2009-04-19 17:14:19 +02:00
|
|
|
BUILDLINK_API_DEPENDS.python26?= python26>=2.6
|
2011-02-22 10:12:37 +01:00
|
|
|
BUILDLINK_API_DEPENDS.python27?= python27>=2.7
|
2011-06-17 03:01:04 +02:00
|
|
|
BUILDLINK_API_DEPENDS.python31?= python31>=3.1
|
2002-01-16 21:09:08 +01:00
|
|
|
|
2002-01-10 21:44:16 +01:00
|
|
|
# transform the list into individual variables
|
|
|
|
.for pv in ${PYTHON_VERSIONS_ACCEPTED}
|
2004-06-06 18:24:55 +02:00
|
|
|
.if empty(PYTHON_VERSIONS_INCOMPATIBLE:M${pv})
|
2002-01-10 21:44:16 +01:00
|
|
|
_PYTHON_VERSION_${pv}_OK= yes
|
2008-04-18 14:24:21 +02:00
|
|
|
_PYTHON_VERSIONS_ACCEPTED+= ${pv}
|
2004-06-06 18:24:55 +02:00
|
|
|
.endif
|
2002-01-10 21:44:16 +01:00
|
|
|
.endfor
|
|
|
|
|
|
|
|
#
|
|
|
|
# choose a python version where to add,
|
|
|
|
# try to be intelligent
|
|
|
|
#
|
2002-01-15 18:18:01 +01:00
|
|
|
# if a version is explicitely required, take it
|
|
|
|
.if defined(PYTHON_VERSION_REQD)
|
2006-06-04 18:26:53 +02:00
|
|
|
# but check if it is acceptable first, error out otherwise
|
|
|
|
. if defined(_PYTHON_VERSION_${PYTHON_VERSION_REQD}_OK)
|
2002-01-15 18:18:01 +01:00
|
|
|
_PYTHON_VERSION= ${PYTHON_VERSION_REQD}
|
2006-06-04 18:26:53 +02:00
|
|
|
. endif
|
|
|
|
.else
|
|
|
|
# if the default is accepted, it is first choice
|
|
|
|
. if !defined(_PYTHON_VERSION)
|
|
|
|
. if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
|
2002-01-10 21:44:16 +01:00
|
|
|
_PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
|
2006-06-04 18:26:53 +02:00
|
|
|
. endif
|
|
|
|
. endif
|
2002-01-10 21:44:16 +01:00
|
|
|
# prefer an already installed version, in order of "accepted"
|
2006-06-04 18:26:53 +02:00
|
|
|
. if !defined(_PYTHON_VERSION)
|
|
|
|
. for pv in ${PYTHON_VERSIONS_ACCEPTED}
|
|
|
|
. if defined(_PYTHON_VERSION_${pv}_OK)
|
2002-01-10 21:44:16 +01:00
|
|
|
_PYTHON_VERSION?= ${pv}
|
2006-06-04 18:26:53 +02:00
|
|
|
. endif
|
|
|
|
. endfor
|
|
|
|
. endif
|
2002-01-10 21:44:16 +01:00
|
|
|
.endif
|
2006-06-04 18:26:53 +02:00
|
|
|
|
2011-03-12 15:07:13 +01:00
|
|
|
#
|
|
|
|
# Variable assignment for multi-python packages
|
|
|
|
MULTI+= PYTHON_VERSION_REQD=${_PYTHON_VERSION}
|
|
|
|
|
2006-06-04 18:26:53 +02:00
|
|
|
# No supported version found, annotate to simplify statements below.
|
2002-01-10 21:44:16 +01:00
|
|
|
.if !defined(_PYTHON_VERSION)
|
2006-06-04 18:26:53 +02:00
|
|
|
_PYTHON_VERSION= none
|
2002-01-10 21:44:16 +01:00
|
|
|
.endif
|
|
|
|
|
2011-06-17 03:01:04 +02:00
|
|
|
.if ${_PYTHON_VERSION} == "31"
|
|
|
|
PYPKGSRCDIR= ../../lang/python31
|
2011-06-21 16:11:24 +02:00
|
|
|
PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python31}:${PYPKGSRCDIR}
|
2011-06-17 03:01:04 +02:00
|
|
|
PYPACKAGE= python31
|
|
|
|
PYVERSSUFFIX= 3.1
|
|
|
|
PYPKGPREFIX= py31
|
2011-07-07 20:46:32 +02:00
|
|
|
PYDISTUTILS_CREATES_EGGFILES= yes
|
2011-06-17 03:01:04 +02:00
|
|
|
.elif ${_PYTHON_VERSION} == "27"
|
2011-02-22 10:01:28 +01:00
|
|
|
PYPKGSRCDIR= ../../lang/python27
|
|
|
|
PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python27}:${PYPKGSRCDIR}
|
|
|
|
PYPACKAGE= python27
|
|
|
|
PYVERSSUFFIX= 2.7
|
|
|
|
PYPKGPREFIX= py27
|
|
|
|
PYDISTUTILS_CREATES_EGGFILES= yes
|
|
|
|
.elif ${_PYTHON_VERSION} == "26"
|
2009-04-19 16:48:17 +02:00
|
|
|
PYPKGSRCDIR= ../../lang/python26
|
|
|
|
PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python26}:${PYPKGSRCDIR}
|
|
|
|
PYPACKAGE= python26
|
|
|
|
PYVERSSUFFIX= 2.6
|
|
|
|
PYPKGPREFIX= py26
|
2010-07-24 14:32:22 +02:00
|
|
|
PYDISTUTILS_CREATES_EGGFILES= yes
|
2009-04-19 16:48:17 +02:00
|
|
|
.elif ${_PYTHON_VERSION} == "25"
|
2008-04-24 04:02:04 +02:00
|
|
|
PYPKGSRCDIR= ../../lang/python25
|
2008-02-01 09:17:00 +01:00
|
|
|
PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python25}:${PYPKGSRCDIR}
|
|
|
|
PYPACKAGE= python25
|
|
|
|
PYVERSSUFFIX= 2.5
|
|
|
|
PYPKGPREFIX= py25
|
2010-07-24 14:32:22 +02:00
|
|
|
PYDISTUTILS_CREATES_EGGFILES= yes
|
2008-02-01 09:17:00 +01:00
|
|
|
.elif ${_PYTHON_VERSION} == "24"
|
2004-12-06 00:39:03 +01:00
|
|
|
PYPKGSRCDIR= ../../lang/python24
|
2006-04-06 08:21:32 +02:00
|
|
|
PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python24}:${PYPKGSRCDIR}
|
2004-12-06 00:39:03 +01:00
|
|
|
PYPACKAGE= python24
|
|
|
|
PYVERSSUFFIX= 2.4
|
|
|
|
PYPKGPREFIX= py24
|
2010-07-24 14:32:22 +02:00
|
|
|
PYDISTUTILS_CREATES_EGGFILES= no
|
2002-02-02 14:26:01 +01:00
|
|
|
.else
|
2008-01-31 14:47:19 +01:00
|
|
|
PKG_FAIL_REASON+= "No valid Python version"
|
2011-07-07 20:46:32 +02:00
|
|
|
PYDISTUTILS_CREATES_EGGFILES= no
|
2012-01-28 13:14:08 +01:00
|
|
|
PYPKGPREFIX=
|
2002-01-10 21:44:16 +01:00
|
|
|
.endif
|
2002-01-15 18:18:01 +01:00
|
|
|
|
2005-11-04 19:24:37 +01:00
|
|
|
PTHREAD_OPTS+= require
|
2005-03-24 23:42:58 +01:00
|
|
|
.include "../../mk/pthread.buildlink3.mk"
|
2005-11-04 19:24:37 +01:00
|
|
|
|
2005-03-24 23:42:58 +01:00
|
|
|
.if defined(PYTHON_FOR_BUILD_ONLY)
|
2005-06-23 13:10:32 +02:00
|
|
|
BUILDLINK_DEPMETHOD.python?= build
|
2002-01-19 13:54:52 +01:00
|
|
|
.endif
|
2005-07-09 03:11:15 +02:00
|
|
|
.if defined(PYPKGSRCDIR)
|
2005-03-24 23:42:58 +01:00
|
|
|
.include "${PYPKGSRCDIR}/buildlink3.mk"
|
2005-07-09 03:11:15 +02:00
|
|
|
.endif
|
2002-01-17 12:06:42 +01:00
|
|
|
|
2002-09-21 00:53:21 +02:00
|
|
|
PYTHONBIN= ${LOCALBASE}/bin/python${PYVERSSUFFIX}
|
2010-02-09 23:55:16 +01:00
|
|
|
PYTHONCONFIG= ${LOCALBASE}/bin/python${PYVERSSUFFIX}-config
|
2009-07-08 15:55:58 +02:00
|
|
|
PY_COMPILE_ALL= \
|
|
|
|
${PYTHONBIN} ${PREFIX}/lib/python${PYVERSSUFFIX}/compileall.py -q
|
|
|
|
PY_COMPILE_O_ALL= \
|
|
|
|
${PYTHONBIN} -O ${PREFIX}/lib/python${PYVERSSUFFIX}/compileall.py -q
|
2002-09-21 00:53:21 +02:00
|
|
|
|
2008-11-29 20:30:33 +01:00
|
|
|
.if exists(${PYTHONBIN})
|
2002-09-21 00:53:21 +02:00
|
|
|
PYINC!= ${PYTHONBIN} -c "import distutils.sysconfig; \
|
2011-02-22 12:12:51 +01:00
|
|
|
print (distutils.sysconfig.get_python_inc(0, \"\"))" || ${ECHO} ""
|
2002-09-21 00:53:21 +02:00
|
|
|
PYLIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
|
2011-02-22 12:12:51 +01:00
|
|
|
print (distutils.sysconfig.get_python_lib(0, 1, \"\"))" || ${ECHO} ""
|
2002-09-21 00:53:21 +02:00
|
|
|
PYSITELIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
|
2011-02-22 12:12:51 +01:00
|
|
|
print (distutils.sysconfig.get_python_lib(0, 0, \"\"))" || ${ECHO} ""
|
2009-07-02 11:37:12 +02:00
|
|
|
|
|
|
|
PRINT_PLIST_AWK+= /^${PYINC:S|/|\\/|g}/ \
|
2011-02-13 09:07:39 +01:00
|
|
|
{ gsub(/${PYINC:S|/|\\/|g}/, "$${PYINC}") }
|
2009-07-02 11:37:12 +02:00
|
|
|
PRINT_PLIST_AWK+= /^${PYSITELIB:S|/|\\/|g}/ \
|
2011-02-13 09:07:39 +01:00
|
|
|
{ gsub(/${PYSITELIB:S|/|\\/|g}/, "$${PYSITELIB}") }
|
2009-07-02 11:37:12 +02:00
|
|
|
PRINT_PLIST_AWK+= /^${PYLIB:S|/|\\/|g}/ \
|
2011-02-13 09:07:39 +01:00
|
|
|
{ gsub(/${PYLIB:S|/|\\/|g}/, "$${PYLIB}") }
|
2002-09-21 00:53:21 +02:00
|
|
|
.endif
|
|
|
|
|
2007-08-24 09:14:28 +02:00
|
|
|
ALL_ENV+= PYTHON=${PYTHONBIN}
|
2010-02-12 14:45:54 +01:00
|
|
|
.if defined(USE_CMAKE)
|
|
|
|
# used by FindPythonInterp.cmake and FindPythonLibs.cmake
|
|
|
|
CMAKE_ARGS+= -DPYVERSSUFFIX:STRING=${PYVERSSUFFIX}
|
|
|
|
.endif
|
2007-08-24 09:14:28 +02:00
|
|
|
|
2002-01-15 18:18:01 +01:00
|
|
|
.endif # PYTHON_PYVERSION_MK
|