Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145170711
D10327.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D10327.id.diff
View Options
Index: head/Mk/Scripts/depends-list.sh
===================================================================
--- head/Mk/Scripts/depends-list.sh
+++ head/Mk/Scripts/depends-list.sh
@@ -59,8 +59,13 @@
IFS=${myifs}
case "${2}" in
- /*) d=${2} ;;
- *) d=${PORTSDIR}/${2} ;;
+ /*) d=${2} ;;
+ *) d=${PORTSDIR}/${2} ;;
+ esac
+
+ case "${d}" in
+ *@*/*) ;; # Ignore @ in the path which would not be a flavor
+ *@*) d=${d%@*} ;;
esac
case " ${checked} " in
Index: head/Mk/Scripts/do-depends.sh
===================================================================
--- head/Mk/Scripts/do-depends.sh
+++ head/Mk/Scripts/do-depends.sh
@@ -94,13 +94,15 @@
anynotfound=0
err=0
for _line in ${dp_RAWDEPENDS} ; do
+ # ensure we never leak flavors
+ unset FLAVOR
myifs=${IFS}
IFS=:
set -- ${_line}
IFS=${myifs}
if [ $# -lt 2 -o $# -gt 3 ]; then
echo "Error: bad dependency syntax in ${dp_DEPTYPE}" >&2
- echo "expecting: pattern:origin[:target]" >&2
+ echo "expecting: pattern:origin[@flavour][:target]" >&2
echo "got: ${_line}" >&2
err=1
continue
@@ -124,6 +126,13 @@
case "${origin}" in
/*) ;;
*) origin="${PORTSDIR}/${origin}" ;;
+ esac
+ case "${origin}" in
+ *@*/*) ;; # Ignore @ in the path which would not be a flavor
+ *@*)
+ export FLAVOR="${origin##*@}"
+ origin=${origin%@*}
+ ;;
esac
depends_args="${dp_DEPENDS_ARGS}"
Index: head/Mk/bsd.port.mk
===================================================================
--- head/Mk/bsd.port.mk
+++ head/Mk/bsd.port.mk
@@ -1056,6 +1056,9 @@
LIB_DIRS?= /lib /usr/lib ${LOCALBASE}/lib
STAGEDIR?= ${WRKDIR}/stage
NOTPHONY?=
+FLAVORS?=
+FLAVOR?=
+PORTS_FEATURES+= FLAVORS
MINIMAL_PKG_VERSION= 1.6.0
_PORTS_DIRECTORIES+= ${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} \
@@ -1071,6 +1074,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(CROSS_SYSROOT)
IGNORE= CROSS_SYSROOT should be defined
@@ -1508,6 +1526,11 @@
PKG_NOTE_expiration_date= ${EXPIRATION_DATE}
.endif
+.if !empty(FLAVOR)
+PKG_NOTES+= flavor
+PKG_NOTE_flavor= ${FLAVOR}
+.endif
+
TEST_ARGS?= ${MAKE_ARGS}
TEST_ENV?= ${MAKE_ENV}
@@ -1576,7 +1599,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
@@ -3680,20 +3709,59 @@
.endif
.if !target(clean)
-clean:
+pre-clean: clean-msg
+clean-msg:
+ @${ECHO_MSG} "===> Cleaning for ${PKGNAME}"
+
+.if empty(FLAVORS)
+CLEAN_DEPENDENCIES=
.if !defined(NOCLEANDEPENDS)
+CLEAN_DEPENDENCIES+= limited-clean-depends-noflavor
+limited-clean-depends-noflavor:
@cd ${.CURDIR} && ${MAKE} limited-clean-depends
.endif
- @${ECHO_MSG} "===> Cleaning for ${PKGNAME}"
.if target(pre-clean)
- @cd ${.CURDIR} && ${MAKE} pre-clean
+CLEAN_DEPENDENCIES+= pre-clean-noflavor
+pre-clean-noflavor:
+ @cd ${.CURDIR} && ${SETENV} ${MAKE} pre-clean
.endif
- @cd ${.CURDIR} && ${MAKE} do-clean
+CLEAN_DEPENDENCIES+= do-clean-noflavor
+do-clean-noflavor:
+ @cd ${.CURDIR} && ${SETENV} ${MAKE} do-clean
.if target(post-clean)
- @cd ${.CURDIR} && ${MAKE} post-clean
+CLEAN_DEPENDENCIES+= post-clean-noflavor
+post-clean-${_f}:
+ @cd ${.CURDIR} && ${SETENV} ${MAKE} post-clean
.endif
+.ORDER: ${CLEAN_DEPENDENCIES}
+clean: ${CLEAN_DEPENDENCIES}
.endif
+.for _f in ${FLAVORS}
+CLEAN_DEPENDENCIES=
+.if !defined(NOCLEANDEPENDS)
+CLEAN_DEPENDENCIES+= limited-clean-depends-${_f}
+limited-clean-depends-${_f}:
+ @cd ${.CURDIR} && ${MAKE} FLAVOR=${_f} limited-clean-depends
+.endif
+.if target(pre-clean)
+CLEAN_DEPENDENCIES+= pre-clean-${_f}
+pre-clean-${_f}:
+ @cd ${.CURDIR} && ${SETENV} FLAVOR=${_f} ${MAKE} pre-clean
+.endif
+CLEAN_DEPENDENCIES+= do-clean-${_f}
+do-clean-${_f}:
+ @cd ${.CURDIR} && ${SETENV} FLAVOR=${_f} ${MAKE} do-clean
+.if target(post-clean)
+CLEAN_DEPENDENCIES+= post-clean-${_f}
+post-clean-${_f}:
+ @cd ${.CURDIR} && ${SETENV} FLAVOR=${_f} ${MAKE} post-clean
+.endif
+.ORDER: ${CLEAN_DEPENDENCIES}
+clean: ${CLEAN_DEPENDENCIES}
+.endfor
+.endif
+
.if !target(distclean)
distclean: clean
@cd ${.CURDIR} && ${MAKE} delete-distfiles RESTRICTED_FILES="${_DISTFILES:Q} ${_PATCHFILES:Q}"
@@ -4217,12 +4285,12 @@
# first to avoid gratuitous breakage.
. if !target(describe)
-_EXTRACT_DEPENDS=${EXTRACT_DEPENDS:C/^[^ :]+:([^ :]+)(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
-_PATCH_DEPENDS=${PATCH_DEPENDS:C/^[^ :]+:([^ :]+)(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
-_FETCH_DEPENDS=${FETCH_DEPENDS:C/^[^ :]+:([^ :]+)(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
-_LIB_DEPENDS=${LIB_DEPENDS:C/^[^ :]+:([^ :]+)(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
-_BUILD_DEPENDS=${BUILD_DEPENDS:C/^[^ :]+:([^ :]+)(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,} ${_LIB_DEPENDS}
-_RUN_DEPENDS=${RUN_DEPENDS:C/^[^ :]+:([^ :]+)(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,} ${_LIB_DEPENDS}
+_EXTRACT_DEPENDS=${EXTRACT_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
+_PATCH_DEPENDS=${PATCH_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
+_FETCH_DEPENDS=${FETCH_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
+_LIB_DEPENDS=${LIB_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
+_BUILD_DEPENDS=${BUILD_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,} ${_LIB_DEPENDS}
+_RUN_DEPENDS=${RUN_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,} ${_LIB_DEPENDS}
. if exists(${DESCR})
_DESCR=${DESCR}
. else
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 17, 5:39 PM (8 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28819700
Default Alt Text
D10327.id.diff (6 KB)
Attached To
Mode
D10327: Implement basic flavors
Attached
Detach File
Event Timeline
Log In to Comment