diff options
author | jmmv <jmmv> | 2005-01-25 15:37:25 +0000 |
---|---|---|
committer | jmmv <jmmv> | 2005-01-25 15:37:25 +0000 |
commit | 0ca650241e7fe09735183335f6981dff595b24fb (patch) | |
tree | 480dc71a2f32f094b710d0269ecc5ef4eaa2f304 /mk | |
parent | 920db7cfe5060e05152e3119676e600244472a5c (diff) | |
download | pkgsrc-0ca650241e7fe09735183335f6981dff595b24fb.tar.gz |
Make the usage of alternatives optional through the PKG_ALTERNATIVES variable,
which is similar to PKG_CONFIG. This does not change how the binary packages
are built, only whether the pkg_alternatives command should be run at package
installation/deinstallation time or not. The variable can take either YES or
NO as values and defaults to YES.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/alternatives.mk | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/mk/alternatives.mk b/mk/alternatives.mk index 1d6770ba5dd..d677cacfe40 100644 --- a/mk/alternatives.mk +++ b/mk/alternatives.mk @@ -1,4 +1,4 @@ -# $NetBSD: alternatives.mk,v 1.1 2005/01/25 13:13:35 jmmv Exp $ +# $NetBSD: alternatives.mk,v 1.2 2005/01/25 15:37:25 jmmv Exp $ # # This Makefile fragment handles the alternatives system, registering a # package in the database. @@ -8,10 +8,17 @@ # file in the current directory if found. If this variable is empty, no # actions are taken by this file. # +# The PKG_ALTERNATIVES variable indicates wether the INSTALL/DEINSTALL +# scripts should do automatic alternatives handling, i.e., if they should +# register the installed packages into the wrappers database. It is +# either YES or NO and defaults to YES. +# .if !defined(ALTERNATIVES_MK) ALTERNATIVES_MK= # defined +PKG_ALTERNATIVES?= YES + .if !defined(ALTERNATIVES_SRC) . if exists(${.CURDIR}/ALTERNATIVES) ALTERNATIVES_SRC?= ${.CURDIR}/ALTERNATIVES @@ -23,17 +30,23 @@ ALTERNATIVES_SRC?= .if !empty(ALTERNATIVES_SRC) ${WRKDIR}/.altinstall: ${ALTERNATIVES_SRC} - @{ ${ECHO} 'if ${TEST} $${STAGE} = "POST-INSTALL"; then'; \ + @{ ${ECHO} ': $${PKG_ALTERNATIVES:=${PKG_ALTERNATIVES}}'; \ + ${ECHO} 'if ${TEST} $${STAGE} = "POST-INSTALL"; then'; \ ${ECHO} '${CAT} >./+ALTERNATIVES <<EOF'; \ ${SED} ${FILES_SUBST_SED} <${ALTERNATIVES_SRC}; \ ${ECHO} 'EOF'; \ - ${ECHO} '${PKG_ALTERNATIVES} -s register ./+ALTERNATIVES'; \ + ${ECHO} 'case $${PKG_ALTERNATIVES} in [Yy][Ee][Ss])'; \ + ${ECHO} '${_ALTERNATIVES_PROG} -s register ./+ALTERNATIVES ;;'; \ + ${ECHO} 'esac'; \ ${ECHO} 'fi'; \ } >${WRKDIR}/.altinstall ${WRKDIR}/.altdeinstall: ${ALTERNATIVES_SRC} - @{ ${ECHO} 'if ${TEST} $${STAGE} = "DEINSTALL"; then'; \ - ${ECHO} '${PKG_ALTERNATIVES} -s unregister ./+ALTERNATIVES'; \ + @{ ${ECHO} ': $${PKG_ALTERNATIVES:=${PKG_ALTERNATIVES}}'; \ + ${ECHO} 'if ${TEST} $${STAGE} = "DEINSTALL"; then'; \ + ${ECHO} 'case $${PKG_ALTERNATIVES} in [Yy][Ee][Ss])'; \ + ${ECHO} '${_ALTERNATIVES_PROG} -s unregister ./+ALTERNATIVES ;;'; \ + ${ECHO} 'esac'; \ ${ECHO} '${RM} -f ./+ALTERNATIVES'; \ ${ECHO} 'fi'; \ } >${WRKDIR}/.altdeinstall @@ -45,7 +58,7 @@ DEPENDS+= pkg_alternatives>=1.0:../../pkgtools/pkg_alternatives EVAL_PREFIX+= PREFIX.pkg_alternatives=pkg_alternatives PREFIX.alternatives_DEFAULT= ${LOCALBASE} -PKG_ALTERNATIVES= ${PREFIX.pkg_alternatives}/sbin/pkg_alternatives +_ALTERNATIVES_PROG= ${PREFIX.pkg_alternatives}/sbin/pkg_alternatives INSTALL_EXTRA_TMPL+= ${WRKDIR}/.altinstall DEINSTALL_EXTRA_TMPL+= ${WRKDIR}/.altdeinstall |