summaryrefslogtreecommitdiff
path: root/mk/alternatives.mk
diff options
context:
space:
mode:
authorjmmv <jmmv@pkgsrc.org>2005-01-25 16:29:16 +0000
committerjmmv <jmmv@pkgsrc.org>2005-01-25 16:29:16 +0000
commite1b9c0a3c252201a2da563fcf32d0ad17e381774 (patch)
tree1b5df806ccd3493842b46ae7bad282fde62f9288 /mk/alternatives.mk
parent3cfcc8be82229d92018f68b27bb29093adb78e97 (diff)
downloadpkgsrc-e1b9c0a3c252201a2da563fcf32d0ad17e381774.tar.gz
Redo previous per suggestion from reed@. Do not process the alternatives
until the pkg_alternatives package has been manually installed. This way we drop the dependency on that package.
Diffstat (limited to 'mk/alternatives.mk')
-rw-r--r--mk/alternatives.mk31
1 files changed, 10 insertions, 21 deletions
diff --git a/mk/alternatives.mk b/mk/alternatives.mk
index d677cacfe40..b772524adae 100644
--- a/mk/alternatives.mk
+++ b/mk/alternatives.mk
@@ -1,4 +1,4 @@
-# $NetBSD: alternatives.mk,v 1.2 2005/01/25 15:37:25 jmmv Exp $
+# $NetBSD: alternatives.mk,v 1.3 2005/01/25 16:29:16 jmmv Exp $
#
# This Makefile fragment handles the alternatives system, registering a
# package in the database.
@@ -8,17 +8,10 @@
# 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
@@ -30,23 +23,21 @@ ALTERNATIVES_SRC?=
.if !empty(ALTERNATIVES_SRC)
${WRKDIR}/.altinstall: ${ALTERNATIVES_SRC}
- @{ ${ECHO} ': $${PKG_ALTERNATIVES:=${PKG_ALTERNATIVES}}'; \
- ${ECHO} 'if ${TEST} $${STAGE} = "POST-INSTALL"; then'; \
+ @{ ${ECHO} 'if ${TEST} $${STAGE} = "POST-INSTALL"; then'; \
${ECHO} '${CAT} >./+ALTERNATIVES <<EOF'; \
${SED} ${FILES_SUBST_SED} <${ALTERNATIVES_SRC}; \
${ECHO} 'EOF'; \
- ${ECHO} 'case $${PKG_ALTERNATIVES} in [Yy][Ee][Ss])'; \
- ${ECHO} '${_ALTERNATIVES_PROG} -s register ./+ALTERNATIVES ;;'; \
- ${ECHO} 'esac'; \
+ ${ECHO} 'if ${TEST} -x ${PKG_ALTERNATIVES}; then'; \
+ ${ECHO} '${PKG_ALTERNATIVES} -s register ./+ALTERNATIVES'; \
+ ${ECHO} 'fi'; \
${ECHO} 'fi'; \
} >${WRKDIR}/.altinstall
${WRKDIR}/.altdeinstall: ${ALTERNATIVES_SRC}
- @{ ${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} 'if ${TEST} $${STAGE} = "DEINSTALL"; then'; \
+ ${ECHO} 'if ${TEST} -x ${PKG_ALTERNATIVES}; then'; \
+ ${ECHO} '${PKG_ALTERNATIVES} -s unregister ./+ALTERNATIVES'; \
+ ${ECHO} 'fi'; \
${ECHO} '${RM} -f ./+ALTERNATIVES'; \
${ECHO} 'fi'; \
} >${WRKDIR}/.altdeinstall
@@ -54,11 +45,9 @@ ${WRKDIR}/.altdeinstall: ${ALTERNATIVES_SRC}
PRINT_PLIST_AWK+= /^libdata\/alternatives\// { next; }
PRINT_PLIST_AWK+= /^@dirrm libdata\/alternatives/ { next; }
-DEPENDS+= pkg_alternatives>=1.0:../../pkgtools/pkg_alternatives
-
EVAL_PREFIX+= PREFIX.pkg_alternatives=pkg_alternatives
PREFIX.alternatives_DEFAULT= ${LOCALBASE}
-_ALTERNATIVES_PROG= ${PREFIX.pkg_alternatives}/sbin/pkg_alternatives
+PKG_ALTERNATIVES= ${PREFIX.pkg_alternatives}/sbin/pkg_alternatives
INSTALL_EXTRA_TMPL+= ${WRKDIR}/.altinstall
DEINSTALL_EXTRA_TMPL+= ${WRKDIR}/.altdeinstall