pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Add alternatives.mk, a file used to manipulate the ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/7987166c2d70
branches: trunk
changeset: 488168:7987166c2d70
user: jmmv <jmmv%pkgsrc.org@localhost>
date: Tue Jan 25 13:13:35 2005 +0000
description:
Add alternatives.mk, a file used to manipulate the alternatives system.
A package can optionally provide an ALTERNATIVES file which contains pairs
of wrapper/alternative, one per line. The file is then used by the install
and deinstall scripts to register the alternatives and to create the
appropriate wrappers.
Make bsd.pkg.mk include this new file. This happens unconditionally to
keep all the alternatives logic in an independent file. Otherwise, some
of the stuff could have to be moved to bsd.pkg.mk, breaking consistency.
diffstat:
mk/alternatives.mk | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
mk/bsd.pkg.mk | 6 ++++-
2 files changed, 61 insertions(+), 1 deletions(-)
diffs (80 lines):
diff -r 813b4af4f629 -r 7987166c2d70 mk/alternatives.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/alternatives.mk Tue Jan 25 13:13:35 2005 +0000
@@ -0,0 +1,56 @@
+# $NetBSD: alternatives.mk,v 1.1 2005/01/25 13:13:35 jmmv Exp $
+#
+# This Makefile fragment handles the alternatives system, registering a
+# package in the database.
+#
+# The ALTERNATIVES_SRC variable contains the path to a file listing the
+# alternatives provided by the package. It defaults to the ALTERNATIVES
+# file in the current directory if found. If this variable is empty, no
+# actions are taken by this file.
+#
+
+.if !defined(ALTERNATIVES_MK)
+ALTERNATIVES_MK= # defined
+
+.if !defined(ALTERNATIVES_SRC)
+. if exists(${.CURDIR}/ALTERNATIVES)
+ALTERNATIVES_SRC?= ${.CURDIR}/ALTERNATIVES
+. else
+ALTERNATIVES_SRC?=
+. endif
+.endif
+
+.if !empty(ALTERNATIVES_SRC)
+
+${WRKDIR}/.altinstall: ${ALTERNATIVES_SRC}
+ @{ ${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} 'fi'; \
+ } >${WRKDIR}/.altinstall
+
+${WRKDIR}/.altdeinstall: ${ALTERNATIVES_SRC}
+ @{ ${ECHO} 'if ${TEST} $${STAGE} = "DEINSTALL"; then'; \
+ ${ECHO} '${PKG_ALTERNATIVES} -s unregister ./+ALTERNATIVES'; \
+ ${ECHO} '${RM} -f ./+ALTERNATIVES'; \
+ ${ECHO} 'fi'; \
+ } >${WRKDIR}/.altdeinstall
+
+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}
+PKG_ALTERNATIVES= ${PREFIX.pkg_alternatives}/sbin/pkg_alternatives
+
+INSTALL_EXTRA_TMPL+= ${WRKDIR}/.altinstall
+DEINSTALL_EXTRA_TMPL+= ${WRKDIR}/.altdeinstall
+USE_PKGINSTALL= YES
+
+.endif
+
+.endif # ALTERNATIVES_MK
diff -r 813b4af4f629 -r 7987166c2d70 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk Tue Jan 25 13:11:16 2005 +0000
+++ b/mk/bsd.pkg.mk Tue Jan 25 13:13:35 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1572 2005/01/24 19:57:42 tv Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1573 2005/01/25 13:13:35 jmmv Exp $
#
# This file is in the public domain.
#
@@ -749,6 +749,10 @@
. include "../../mk/texinfo.mk"
.endif
+# Handle alternatives
+#
+.include "../../mk/alternatives.mk"
+
# CONF_DEPENDS notes a dependency where the config directory for the
# package matches the dependency's config directory. CONF_DEPENDS is
# only meaningful if ${PKG_INSTALLATION_TYPE} == "pkgviews".
Home |
Main Index |
Thread Index |
Old Index