Skip to content

Instantly share code, notes, and snippets.

@bbqsrc bbqsrc/ports-variants.patch Secret
Last active Jan 2, 2016

Embed
What would you like to do?
VARIANTS support patches and examples
Index: Mk/Scripts/do-depends.sh
===================================================================
--- Mk/Scripts/do-depends.sh (revision 404968)
+++ Mk/Scripts/do-depends.sh (working copy)
@@ -13,6 +13,9 @@
dp_PKGNAME dp_STRICT_DEPENDS dp_LOCALBASE dp_LIB_DIRS dp_SH \
dp_SCRIPTSDIR PORTSDIR dp_MAKE
+# Stop variant flag from going where it does not belong
+VARIANT=
+
set -u
install_depends()
Index: Mk/Uses/python.mk
===================================================================
--- Mk/Uses/python.mk (revision 404968)
+++ Mk/Uses/python.mk (working copy)
@@ -222,6 +222,15 @@
_PYTHON_BASECMD= ${LOCALBASE}/bin/python
_PYTHON_RELPORTDIR= ${PORTSDIR}/lang/python
+.if undefined(VARIANTS)
+VARIANTS= ${_PYTHON_VERSIONS:C;([0-9])\.([0-9]);py\1\2;g}
+.endif
+
+.if !empty(VARIANT)
+#VARIANT= ${_PYTHON_PORTBRANCH:C;([0-9])\.([0-9]);py\1\2;g}
+PYTHON_VERSION?= ${VARIANT:C;^py([0-9])([0-9]);\1.\2;}
+.endif
+
# Make each individual feature available as _PYTHON_FEATURE_<FEATURENAME>
.for var in ${USE_PYTHON}
_PYTHON_FEATURE_${var:tu}= yes
Index: Mk/bsd.port.mk
===================================================================
--- Mk/bsd.port.mk (revision 404968)
+++ Mk/bsd.port.mk (working copy)
@@ -1443,6 +1443,24 @@
.include "${USESDIR}/${f:C/\:.*//}.mk"
.endfor
+VARIANTS?=
+VARIANT?=
+
+# Handle variants
+.if !empty(VARIANT)
+_VARIANT_TEMP:= ${VARIANTS:M${VARIANT}}
+.if empty(_VARIANT_TEMP)
+IGNORE= Unknown variant '${VARIANT}', possible variants: ${VARIANTS}
+.endif
+.endif
+
+.if defined(.PARSEDIR)
+.MAKEOVERRIDES:= ${.MAKEOVERRIDES:NVARIANT}
+.else # old make
+.MAKEFLAGS:= ${.MAKEFLAGS:MVARIANT=*}
+.endif
+
+
EXTRACT_SUFX?= .tar.gz
# You can force skipping these test by defining IGNORE_PATH_CHECKS
@@ -1541,7 +1562,13 @@
CONFIGURE_ENV+= PKG_CONFIG_SYSROOT_DIR="${X_SYSROOT}"
.endif
-WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/work
+.if empty(VARIANT)
+_WRKDIR= work
+.else
+_WRKDIR= work-${VARIANT}
+.endif
+WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/${_WRKDIR}
+
.if !defined(IGNORE_MASTER_SITE_GITHUB) && defined(USE_GITHUB)
WRKSRC?= ${WRKDIR}/${GH_PROJECT}-${GH_TAGNAME_EXTRACT}
.endif
@@ -3942,13 +3969,15 @@
@cd ${.CURDIR} && ${MAKE} limited-clean-depends
.endif
@${ECHO_MSG} "===> Cleaning for ${PKGNAME}"
+.for _variant in "" ${VARIANTS}
.if target(pre-clean)
- @cd ${.CURDIR} && ${MAKE} pre-clean
+ @cd ${.CURDIR} && ${SETENV} VARIANT=${_variant} ${MAKE} pre-clean
.endif
- @cd ${.CURDIR} && ${MAKE} do-clean
+ @cd ${.CURDIR} && ${SETENV} VARIANT=${_variant} ${MAKE} do-clean
.if target(post-clean)
- @cd ${.CURDIR} && ${MAKE} post-clean
+ @cd ${.CURDIR} && ${SETENV} VARIANT=${_variant} ${MAKE} post-clean
.endif
+.endfor
.endif
.if !target(pre-distclean)
Index: devel/py-msgpack/Makefile
===================================================================
--- devel/py-msgpack/Makefile (revision 404968)
+++ devel/py-msgpack/Makefile (working copy)
@@ -20,6 +20,8 @@
USES= python
USE_PYTHON= autoplist distutils
+VARIANTS= py27 py34
+
post-install:
${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/msgpack/_packer.so
${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/msgpack/_unpacker.so
Index: devel/py-setuptools34/Makefile
===================================================================
--- devel/py-setuptools34/Makefile (revision 404968)
+++ devel/py-setuptools34/Makefile (working copy)
@@ -7,4 +7,6 @@
MASTERDIR= ${.CURDIR}/../py-setuptools
+VARIANTS= # None
+
.include "${MASTERDIR}/Makefile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.