aboutsummaryrefslogtreecommitdiff
path: root/Mk
diff options
context:
space:
mode:
authorSunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>2020-05-25 18:31:40 +0000
committerSunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>2020-05-25 18:31:40 +0000
commit56fba292230033b4cb53ef23c8f5020e7d5d2e51 (patch)
tree724f0792b5166a63f692716e77a240c45a83a4f3 /Mk
parentd0f1c5967664ce397dab7b839e8a9f2c600dc51b (diff)
downloadports-56fba292230033b4cb53ef23c8f5020e7d5d2e51.tar.gz
ports-56fba292230033b4cb53ef23c8f5020e7d5d2e51.zip
Add Python flavor support
USES=scons:python2 usage is a temporary solution for ports using Python 2. It will be removed when all consumers moved to Python 3. Or it will go away with Python 2 removal by December 31, 2020.
Notes
Notes: svn path=/head/; revision=536495
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Uses/scons.mk26
1 files changed, 20 insertions, 6 deletions
diff --git a/Mk/Uses/scons.mk b/Mk/Uses/scons.mk
index 423b09d2da29..201816c1b759 100644
--- a/Mk/Uses/scons.mk
+++ b/Mk/Uses/scons.mk
@@ -3,22 +3,36 @@
# Provide support to use the scons
#
# Feature: scons
-# Usage: USES=scons
+# Usage: USES=scons[:ARGS]
+# Valid ARGS: python2 python3
+#
+# python2: Use default python 2.x to run scons
+# python3: Use default python 3.x to run scons (default)
#
# MAINTAINER: python@FreeBSD.org
.if !defined(_INCLUDE_USES_SCONS_MK)
_INCLUDE_USES_SCONS_MK= yes
-.if !empty(scons_ARGS)
-IGNORE= Incorrect 'USES+= scons:${scons_ARGS}' scons takes no arguments
+.if empty(scons_ARGS)
+scons_ARGS= python3
+.endif
+
+.if ${scons_ARGS} == python3
+_SCONS_PYTHON_VER= ${PYTHON3_DEFAULT}
+.elif ${scons_ARGS} == python2
+_SCONS_PYTHON_VER= ${PYTHON2_DEFAULT}
+.else
+IGNORE= Incorrect 'USES+= scons:${scons_ARGS}' usage
.endif
-SCONS= ${LOCALBASE}/bin/scons
+_SCONS_PYTHON_FLAVOR= py${_SCONS_PYTHON_VER:S|.||}
+
+SCONS= ${LOCALBASE}/bin/scons-${_SCONS_PYTHON_VER}
-BUILD_DEPENDS+= ${SCONS}:devel/scons
+BUILD_DEPENDS+= ${SCONS}:devel/scons@${_SCONS_PYTHON_FLAVOR}
-ALL_TARGET= #
+ALL_TARGET?= #
CCFLAGS?= ${CFLAGS}
CPPPATH?= ${LOCALBASE}/include
LIBPATH?= ${LOCALBASE}/lib