summaryrefslogtreecommitdiff
path: root/mk/bsd.pkg.install.mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2005-01-23 20:45:22 +0000
committerjlam <jlam@pkgsrc.org>2005-01-23 20:45:22 +0000
commitdaf62c20003ff80a6251b79dfc40f20fa70622e9 (patch)
tree9bb4d987543c10b00ecbc69398b6eafe263e7f70 /mk/bsd.pkg.install.mk
parent367eed19feed744dba7b8ab45ae14c8d83feaf5b (diff)
downloadpkgsrc-daf62c20003ff80a6251b79dfc40f20fa70622e9.tar.gz
Rework the way that packages are registered during a "make install". We
split the fake-pkg target into three smaller pieces: pre-install-fake-pkg - Create files in ${WRKSRC}/.pkgdb meant to be installed into ${PKG_DBDIR}/${PKGNAME} that don't depend on the installed files. post-install-fake-pkg - Create files in ${WRKSRC}/.pkgdb meant to be installed into ${PKG_DBDIR}/${PKGNAME} that may depend on the installed files. register-pkg - Copy the files in ${WRKSRC}/.pkgdb and create a few additional meta-files in ${PKG_DBDIR}/${PKGNAME}. The idea is that ${WRKSRC}/.pkgdb contains as much of the state as possible that will be copied into ${PKG_DBDIR}/${PKGNAME}. The INSTALL and DEINSTALL scripts generated by bsd.pkg.install.mk are now invoked with ${WRKSRC}/.pkgdb as the working directory, so the scripts may use the working directory to store temporary files, regardless of whether they're invoked from bsd.pkg.mk or by pkg_add.
Diffstat (limited to 'mk/bsd.pkg.install.mk')
-rw-r--r--mk/bsd.pkg.install.mk14
1 files changed, 9 insertions, 5 deletions
diff --git a/mk/bsd.pkg.install.mk b/mk/bsd.pkg.install.mk
index 80b9a874a85..665477d3798 100644
--- a/mk/bsd.pkg.install.mk
+++ b/mk/bsd.pkg.install.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.install.mk,v 1.69 2005/01/15 10:50:17 jmmv Exp $
+# $NetBSD: bsd.pkg.install.mk,v 1.70 2005/01/23 20:45:22 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk to use the common
# INSTALL/DEINSTALL scripts. To use this Makefile fragment, simply:
@@ -13,8 +13,8 @@ BSD_PKG_INSTALL_MK= 1
.include "../../mk/bsd.prefs.mk"
-DEINSTALL_FILE= ${WRKDIR}/.DEINSTALL
-INSTALL_FILE= ${WRKDIR}/.INSTALL
+DEINSTALL_FILE= ${PKG_DB_TMPDIR}/+DEINSTALL
+INSTALL_FILE= ${PKG_DB_TMPDIR}/+INSTALL
# These are the template scripts for the INSTALL/DEINSTALL scripts. Packages
# may do additional work in the INSTALL/DEINSTALL scripts by overriding the
@@ -299,11 +299,13 @@ INSTALL_SCRIPTS_ENV= PKG_PREFIX=${PREFIX}
.PHONY: pre-install-script post-install-script
pre-install-script: generate-install-scripts
- ${_PKG_SILENT}${_PKG_DEBUG}${SETENV} ${INSTALL_SCRIPTS_ENV} \
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${PKG_DB_TMPDIR} && \
+ ${SETENV} ${INSTALL_SCRIPTS_ENV} \
${_PKG_DEBUG_SCRIPT} ${INSTALL_FILE} ${PKGNAME} PRE-INSTALL
post-install-script:
- ${_PKG_SILENT}${_PKG_DEBUG}${SETENV} ${INSTALL_SCRIPTS_ENV} \
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${PKG_DB_TMPDIR} && \
+ ${SETENV} ${INSTALL_SCRIPTS_ENV} \
${_PKG_DEBUG_SCRIPT} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL
.PHONY: generate-install-scripts
@@ -313,6 +315,7 @@ generate-install-scripts: # do nothing
.if !empty(DEINSTALL_SRC)
generate-install-scripts: ${DEINSTALL_FILE}
${DEINSTALL_FILE}: ${DEINSTALL_SRC}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} | \
${SED} ${FILES_SUBST_SED} > ${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
@@ -321,6 +324,7 @@ ${DEINSTALL_FILE}: ${DEINSTALL_SRC}
.if !empty(INSTALL_SRC)
generate-install-scripts: ${INSTALL_FILE}
${INSTALL_FILE}: ${INSTALL_SRC}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} | \
${SED} ${FILES_SUBST_SED} > ${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}