Introduce the new BINARY_ALIAS variable

When defined it will create symlinks of some given binaries in a directory which
will be prepended to the PATH.

The syntax is the following:
BINARY_ALIAS=   target1=source1  target2=source2

For example to have a "swig" binary in the path which will be pointing at
swig3.0 and a "sed" pointing at GNU sed: gsed

BINARY_ALIAS=  swig=swig3.0 sed=gsed

Reviewed by:	swills, adamw, mat
Approved by:	swills (portmgr)
Differential Revision:	https://reviews.freebsd.org/D12603
This commit is contained in:
Baptiste Daroussin 2017-10-11 19:03:24 +00:00
parent 86a88c2df0
commit ec229aec83
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=451772
2 changed files with 33 additions and 2 deletions

14
CHANGES
View File

@ -10,6 +10,20 @@ in the release notes and/or placed into UPDATING.
All ports committers are allowed to commit to this file.
20171011:
AUTHOR: bapt@FreeBSD.org
New BINARY_ALIAS variable has been added, when defined it will create symlinks
of some given binaries in a directory which will be prepended to the PATH.
The syntax is the following:
BINARY_ALIAS= target1=source1 target2=source2
For example to have a "swig" binary in the path which will be pointing at
swig3.0 and a "sed" pointing at GNU sed: gsed
BINARY_ALIAS= swig=swig3.0 sed=gsed
20170625:
AUTHOR: kde@FreeBSD.org

View File

@ -1063,7 +1063,7 @@ FLAVOR?=
MINIMAL_PKG_VERSION= 1.6.0
_PORTS_DIRECTORIES+= ${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} \
${STAGEDIR}${PREFIX} ${WRKDIR}/pkg
${STAGEDIR}${PREFIX} ${WRKDIR}/pkg ${BINARY_LINKDIR}
# Ensure .CURDIR contains an absolute path without a trailing slash. Failed
# builds can occur when PORTSDIR is a symbolic link, or with something like
@ -1607,6 +1607,13 @@ _WRKDIR= work-${FLAVOR}
.endif
WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/${_WRKDIR}
BINARY_LINKDIR= ${WRKDIR}/.bin
PATH:= ${BINARY_LINKDIR}:${PATH}
.if !${MAKE_ENV:MPATH=*} && !${CONFIGURE_ENV:MPATH=*}
MAKE_ENV+= PATH=${PATH}
CONFIGURE_ENV+= PATH=${PATH}
.endif
.if !defined(IGNORE_MASTER_SITE_GITHUB) && defined(USE_GITHUB) && empty(USE_GITHUB:Mnodefault)
WRKSRC?= ${WRKDIR}/${GH_PROJECT}-${GH_TAGNAME_EXTRACT}
.endif
@ -5182,6 +5189,15 @@ install-desktop-entries:
.endif
.endif
.if !empty(BINARY_ALIAS)
.if !target(create-binary-alias)
create-binary-alias: ${BINARY_LINKDIR}
.for target src in ${BINARY_ALIAS:C/=/ /}
@${RLN} `which ${src}` ${BINARY_LINKDIR}/${target}
.endfor
.endif
.endif
.if defined(WARNING)
WARNING_WAIT?= 10
show-warnings:
@ -5269,7 +5285,8 @@ _PATCH_SEQ= 050:ask-license 100:patch-message 150:patch-depends \
700:post-patch 850:post-patch-script \
${_OPTIONS_patch} ${_USES_patch}
_CONFIGURE_DEP= patch
_CONFIGURE_SEQ= 150:build-depends 151:lib-depends 200:configure-message \
_CONFIGURE_SEQ= 150:build-depends 151:lib-depends 160:create-binary-alias \
200:configure-message \
300:pre-configure 450:pre-configure-script \
490:run-autotools-fixup 500:do-configure 700:post-configure \
850:post-configure-script \