Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Oct 2017 19:03:25 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r451772 - in head: . Mk
Message-ID:  <201710111903.v9BJ3PfE033322@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Wed Oct 11 19:03:24 2017
New Revision: 451772
URL: https://svnweb.freebsd.org/changeset/ports/451772

Log:
  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

Modified:
  head/CHANGES
  head/Mk/bsd.port.mk

Modified: head/CHANGES
==============================================================================
--- head/CHANGES	Wed Oct 11 18:41:27 2017	(r451771)
+++ head/CHANGES	Wed Oct 11 19:03:24 2017	(r451772)
@@ -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
 

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Wed Oct 11 18:41:27 2017	(r451771)
+++ head/Mk/bsd.port.mk	Wed Oct 11 19:03:24 2017	(r451772)
@@ -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:pat
 				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 \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710111903.v9BJ3PfE033322>