aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormva <mva@FreeBSD.org>2014-06-08 00:13:11 +0800
committermva <mva@FreeBSD.org>2014-06-08 00:13:11 +0800
commitc0030152f525ce4c9d4edc62fca99f0205e260b0 (patch)
tree61c0461e1651e0e33137cf58b408e0d100eee79e
parent819c448edf05c86a9da4b42b26908d6fe489a909 (diff)
downloadfreebsd-ports-gnome-c0030152f525ce4c9d4edc62fca99f0205e260b0.tar.gz
freebsd-ports-gnome-c0030152f525ce4c9d4edc62fca99f0205e260b0.tar.zst
freebsd-ports-gnome-c0030152f525ce4c9d4edc62fca99f0205e260b0.zip
Introduce a new PYTHON_CONCURRENT_INSTALL knob to support the parallel
installation of ports for different python versions. If set to yes, the knob indicates that the port can be installed for different python versions at the same time. The port will use a unique prefix for certain directories using USES=uniquefiles:dirs (see the uniquefiles.mk Uses for details about the directories). Binaries receive an additional suffix, based on ${PYTHON_VER}. With hat: python@
-rw-r--r--CHANGES27
-rw-r--r--Mk/bsd.python.mk64
2 files changed, 90 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 3fdaf68f288b..0079721b0b4a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,33 @@ in the release notes and/or placed into UPDATING.
All ports committers are allowed to commit to this file.
+20140607:
+AUTHOR: mva@FreeBSD.org
+
+ New PYTHON_CONCURRENT_INSTALL knob to support the parallel installation
+ of ports for different python versions.
+
+ If set to yes, the knob indicates that the port can be installed for
+ different python versions at the same time. The port will use a unique
+ prefix for certain directories using USES=uniquefiles:dirs (see the
+ uniquefiles.mk Uses for details about the directories). Binaries
+ receive an additional suffix, based on ${PYTHON_VER}.
+
+ The values for the uniquefiles USES are set as follows:
+
+ UNIQUE_PREFIX= ${PYTHON_PKGNAMEPREFIX}
+ UNIQUE_SUFFIX= -${PYTHON_VER}
+
+ If the port is installed for the current default python version, scripts and
+ binaries in
+
+ ${PREFIX}/bin
+ ${PREFIX}/sbin
+ ${PREFIX}/libexec
+
+ are linked from the prefixed version to the prefix-less original name,
+ e.g. bin/foo-2.7 --> bin/foo.
+
20140529:
AUTHOR: miwi@FreeBSD.org
diff --git a/Mk/bsd.python.mk b/Mk/bsd.python.mk
index 974b2bb05c4b..e4a92043a695 100644
--- a/Mk/bsd.python.mk
+++ b/Mk/bsd.python.mk
@@ -122,6 +122,29 @@ Python_Include_MAINTAINER= python@FreeBSD.org
# PYXML - Dependency line for the XML extension. As of Python-2.0,
# this extension is in the base distribution.
#
+# PYTHON_CONCURRENT_INSTALL
+# - Indicates that the port can be installed for different
+# python versions at the same time. The port is supposed
+# to use a unique prefix for certain directories using
+# USES=uniquefiles:dirs (see the uniquefiles.mk Uses for
+# details about the directories), if set to yes. Binaries
+# receive an additional suffix, based on PYTHON_VER.
+#
+# The values for the uniquefiles USES are set as follows:
+#
+# UNIQUE_PREFIX= ${PYTHON_PKGNAMEPREFIX}
+# UNIQUE_SUFFIX= -${PYTHON_VER}
+#
+# If the port is installed for the current default
+# python version, scripts and binaries in
+#
+# ${PREFIX}/bin
+# ${PREFIX}/sbin
+# ${PREFIX}/libexec
+#
+# are linked from the prefixed version to the prefix-less
+# original name, e.g. bin/foo-2.7 --> bin/foo.
+#
# USE_PYTHON_PREFIX - Says that the port installs in ${PYTHONBASE}.
#
# USE_PYDISTUTILS - Use distutils as do-configure, do-build and do-install
@@ -414,6 +437,46 @@ PYTHONPREFIX_INCLUDEDIR= ${PYTHON_INCLUDEDIR:S;${PYTHONBASE};${PREFIX};}
PYTHONPREFIX_LIBDIR= ${PYTHON_LIBDIR:S;${PYTHONBASE};${PREFIX};}
PYTHONPREFIX_SITELIBDIR= ${PYTHON_SITELIBDIR:S;${PYTHONBASE};${PREFIX};}
+# Used for recording the installed files.
+_PYTHONPKGLIST= ${WRKDIR}/.PLIST.pymodtmp
+
+# Ports bound to a certain python version SHOULD
+# - use the PYTHON_PKGNAMEPREFIX
+# - use directories using the PYTHON_PKGNAMEPREFIX
+# - install binaries using the required PYTHON_VER, with
+# the default python version creating a symlink to the original binary
+# name (for staging-aware ports).
+#
+# What makes a port 'bound' to a certain python version?
+# - it installs data into PYTHON_SITELIBDIR, PYTHON_INCLUDEDIR, ...
+# - it links against libpython*.so
+# - it uses USE_PYDISTUTILS
+#
+PYTHON_CONCURRENT_INSTALL?= no
+.if defined(NO_STAGE) && ${PYTHON_CONCURRENT_INSTALL} == "yes"
+BROKEN= PYTHON_CONCURRENT_INSTALL uses USES=uniquefiles, which is not stage-safe
+.endif
+
+.if ${PYTHON_CONCURRENT_INSTALL} == "yes"
+_USES_POST+= uniquefiles:dirs
+.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION}
+UNIQUE_DEFAULT_LINKS= yes
+.else
+UNIQUE_DEFAULT_LINKS= no
+.endif
+UNIQUE_PREFIX= ${PYTHON_PKGNAMEPREFIX}
+UNIQUE_SUFFIX= -${PYTHON_VER}
+
+.if defined(PYDISTUTILS_AUTOPLIST)
+UNIQUE_FIND_SUFFIX_FILES= \
+ ${SED} -e 's|^${PREFIX}/||' ${_PYTHONPKGLIST} ${TMPPLIST} | \
+ ${GREP} -e '^bin/.*$$\|^sbin/.*$$\|^libexec/.*$$'
+.else
+UNIQUE_FIND_SUFFIX_FILES= \
+ ${GREP} -he '^bin/.*$$\|^sbin/.*$$\|^libexec/.*$$' ${TMPPLIST} 2>/dev/null
+.endif
+.endif # ${PYTHON_CONCURRENT_INSTALL} == "yes"
+
_CURRENTPORT:= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
.if defined(USE_PYDISTUTILS) && ${_CURRENTPORT:S/${PYTHON_SUFFIX}$//} != ${PYTHON_PKGNAMEPREFIX}setuptools
BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools${PYTHON_SUFFIX}>0:${PORTSDIR}/devel/py-setuptools${PYTHON_SUFFIX}
@@ -497,7 +560,6 @@ PYDISTUTILS_INSTALLARGS+= --single-version-externally-managed
PYDISTUTILS_INSTALLARGS+= --root=${STAGEDIR}
. endif
.endif
-_PYTHONPKGLIST= ${WRKDIR}/.PLIST.pymodtmp
PYDISTUTILS_INSTALLARGS:= --record ${_PYTHONPKGLIST} \
${PYDISTUTILS_INSTALLARGS}