Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147396838
D10327.id27244.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D10327.id27244.diff
View Options
Index: Mk/Scripts/do-depends.sh
===================================================================
--- Mk/Scripts/do-depends.sh
+++ Mk/Scripts/do-depends.sh
@@ -94,6 +94,8 @@
anynotfound=0
err=0
for _line in ${dp_RAWDEPENDS} ; do
+ # ensure we never leak flavors
+ unset FLAVOR
myifs=${IFS}
IFS=:
set -- ${_line}
@@ -121,6 +123,18 @@
continue
fi
+ case "${last}" in
+ *=) last="" ;;
+ *=*)
+ IFS=\=
+ set -- ${last}
+ IFS=${myifs}
+ setvar $1 $2
+ export $1
+ last=""
+ ;;
+ esac
+
case "${origin}" in
/*) ;;
*) origin="${PORTSDIR}/${origin}" ;;
Index: Mk/Uses/python.mk
===================================================================
--- Mk/Uses/python.mk
+++ Mk/Uses/python.mk
@@ -307,6 +307,12 @@
PYTHON3_DEFAULT_VERSION?= python${PYTHON3_DEFAULT}
.endif
+.if ${FLAVOR} == python2
+_PYTHON_ARGS= 2
+.elif ${FLAVOR} == python3
+_PYTHON_ARGS= 3
+.endif
+
.if ${_PYTHON_ARGS} == "2"
_PYTHON_ARGS= ${PYTHON2_DEFAULT_VERSION:S/^python//}
_WANTS_META_PORT= 2
Index: Mk/bsd.port.mk
===================================================================
--- Mk/bsd.port.mk
+++ Mk/bsd.port.mk
@@ -1054,6 +1054,8 @@
LIB_DIRS?= /lib /usr/lib ${LOCALBASE}/lib
STAGEDIR?= ${WRKDIR}/stage
NOTPHONY?=
+FLAVORS?=
+FLAVOR?=
MINIMAL_PKG_VERSION= 1.6.0
_PORTS_DIRECTORIES+= ${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} \
@@ -1064,6 +1066,21 @@
.include "${PORTSDIR}/Mk/bsd.commands.mk"
+.if !empty(FLAVOR)
+. if empty(FLAVORS)
+IGNORE= FLAVOR is defined while this port does not have FLAVORS.
+. elif ! ${FLAVORS:M${FLAVOR}}
+IGNORE= Unknown flavor '${FLAVOR}', possible flavors: ${FLAVORS}.
+. endif
+.endif
+
+.if !empty(FLAVORS) && empty(FLAVOR)
+FLAVOR= ${FLAVORS:[1]}
+.endif
+
+# Do not leak flavors to childs make
+.MAKEOVERRIDES:= ${MAKEOVERRIDES:NFLAVOR=*}
+
.if defined(CROSS_TOOLCHAIN)
.if !defined(.PARSEDIR)
IGNORE= Cross building can only be done when using bmake(1) as make(1)
@@ -1569,7 +1586,13 @@
CONFIGURE_ENV+= PKG_CONFIG_SYSROOT_DIR="${CROSS_SYSROOT}"
.endif
-WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/work
+.if empty(FLAVOR)
+_WRKDIR= work
+.else
+_WRKDIR= work-${FLAVOR}
+.endif
+
+WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/${_WRKDIR}
.if !defined(IGNORE_MASTER_SITE_GITHUB) && defined(USE_GITHUB) && empty(USE_GITHUB:Mnodefault)
WRKSRC?= ${WRKDIR}/${GH_PROJECT}-${GH_TAGNAME_EXTRACT}
.endif
@@ -3700,13 +3723,15 @@
@cd ${.CURDIR} && ${MAKE} limited-clean-depends
.endif
@${ECHO_MSG} "===> Cleaning for ${PKGNAME}"
+.for _f in ${FLAVORS}
.if target(pre-clean)
- @cd ${.CURDIR} && ${MAKE} pre-clean
+ @cd ${.CURDIR} && ${SETENV} FLAVOR=${_f} ${MAKE} pre-clean
.endif
- @cd ${.CURDIR} && ${MAKE} do-clean
+ @cd ${.CURDIR} && ${SETENV} FLAVOR=${_f} ${MAKE} do-clean
.if target(post-clean)
- @cd ${.CURDIR} && ${MAKE} post-clean
+ @cd ${.CURDIR} && ${SETENV} FLAVOR=${_f} ${MAKE} post-clean
.endif
+.endfor
.endif
.if !target(pre-distclean)
Index: devel/py-args/Makefile
===================================================================
--- devel/py-args/Makefile
+++ devel/py-args/Makefile
@@ -16,4 +16,6 @@
USES= python
USE_PYTHON= distutils autoplist
+FLAVORS= python2 python3
+
.include <bsd.port.mk>
Index: devel/py-clint/Makefile
===================================================================
--- devel/py-clint/Makefile
+++ devel/py-clint/Makefile
@@ -13,7 +13,9 @@
LICENSE= ISCL
-RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}args>=0.1.0:devel/py-args
+FLAVORS= python2 python3
+
+RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}args>=0.1.0:devel/py-args:FLAVOR=${FLAVOR}
USES= python
USE_PYTHON= autoplist distutils
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 11, 3:38 PM (17 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29543040
Default Alt Text
D10327.id27244.diff (3 KB)
Attached To
Mode
D10327: Implement basic flavors
Attached
Detach File
Event Timeline
Log In to Comment