summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-11-04 07:42:51 +0000
committerrillig <rillig@pkgsrc.org>2006-11-04 07:42:51 +0000
commit9dfb6ae2ac264a21a122f942ee5038263839d7be (patch)
tree505e64ab3d291ebaab20bc76b03c0c32378b99e1 /mk
parent1590cb2b7a482851cac299762d8bc943293b0f4d (diff)
downloadpkgsrc-9dfb6ae2ac264a21a122f942ee5038263839d7be.tar.gz
When a package sets INSTALLATION_DIRS_FROM_PLIST to "yes", it does not
need to specify INSTALLATION_DIRS itself. Instead, the list is generated from the static PLIST files. Like for INSTALLATION_DIRS, mtree is disabled when this variable is set.
Diffstat (limited to 'mk')
-rw-r--r--mk/install/bsd.install-vars.mk15
-rw-r--r--mk/install/install.mk32
2 files changed, 45 insertions, 2 deletions
diff --git a/mk/install/bsd.install-vars.mk b/mk/install/bsd.install-vars.mk
index e95c317775d..9131382ec78 100644
--- a/mk/install/bsd.install-vars.mk
+++ b/mk/install/bsd.install-vars.mk
@@ -1,9 +1,16 @@
-# $NetBSD: bsd.install-vars.mk,v 1.3 2006/07/13 14:02:34 jlam Exp $
+# $NetBSD: bsd.install-vars.mk,v 1.4 2006/11/04 07:42:51 rillig Exp $
#
# This Makefile fragment is included separately by bsd.pkg.mk and
# defines some variables which must be defined earlier than where
# bsd.install.mk is included.
#
+# Package-settable variables:
+#
+# INSTALLATION_DIRS_FROM_PLIST
+# If set to "yes", the static PLIST files of the package will
+# be used to determine which directories need to be created before
+# the "real" installation should start.
+#
# If a package sets INSTALLATION_DIRS, then it's known to pre-create
# all of the directories that it needs at install-time, so we don't need
@@ -12,6 +19,12 @@
.if defined(INSTALLATION_DIRS) && !empty(INSTALLATION_DIRS)
NO_MTREE= yes
.endif
+
+INSTALLATION_DIRS_FROM_PLIST?= no
+.if !empty(INSTALLATION_DIRS_FROM_PLIST:M[Yy][Ee][Ss])
+NO_MTREE= yes
+.endif
+
#
# Certain classes of packages never need to run mtree during installation
# because they manage the creation of their own directories.
diff --git a/mk/install/install.mk b/mk/install/install.mk
index c7dbc571b8c..5184f74efb7 100644
--- a/mk/install/install.mk
+++ b/mk/install/install.mk
@@ -1,4 +1,4 @@
-# $NetBSD: install.mk,v 1.25 2006/11/03 15:48:48 joerg Exp $
+# $NetBSD: install.mk,v 1.26 2006/11/04 07:42:51 rillig Exp $
######################################################################
### install (PUBLIC)
@@ -133,6 +133,9 @@ _INSTALL_ALL_TARGETS+= install-check-umask
_INSTALL_ALL_TARGETS+= check-files-pre
.endif
_INSTALL_ALL_TARGETS+= install-makedirs
+.if !empty(INSTALLATION_DIRS_FROM_PLIST:M[Yy][Ee][Ss])
+_INSTALL_ALL_TARGETS+= install-dirs-from-PLIST
+.endif
.if ${_USE_DESTDIR} == "no"
_INSTALL_ALL_TARGETS+= pre-install-script
.endif
@@ -265,6 +268,33 @@ install-makedirs:
done
.endif # INSTALLATION_DIRS
+# Creates the directories for all files that are mentioned in the static
+# PLIST files of the package, to make the declaration of
+# INSTALLATION_DIRS redundant in some cases.
+#
+# To enable this, the variable INSTALLATION_DIRS_FROM_PLIST must be set
+# to "yes".
+#
+.PHONY: install-dirs-from-PLIST
+install-dirs-from-PLIST:
+ @${STEP_MSG} "Creating installation directories from PLIST files"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${CAT} ${PLIST_SRC} | sed -n -e 's,\\,\\\\,' -e 's,^man,${PKGMANDIR},' -e 's,^\([^$$@]*\)/[^/]*$$,\1,p' \
+ | while read dir; do \
+ if [ -f "${DESTDIR}/${PREFIX}/$$dir" ]; then \
+ ${ERROR_MSG} "[install.mk] $$dir should be a directory, but is a file."; \
+ exit 1; \
+ fi; \
+ case "$$dir" in \
+ *bin|*bin/*|*libexec|*libexec/*) \
+ ${INSTALL_PROGRAM_DIR} "${DESTDIR}${PREFIX}/$$dir";; \
+ ${PKGMANDIR}/*) \
+ ${INSTALL_MAN_DIR} "${DESTDIR}${PREFIX}/$$dir";; \
+ *) \
+ ${INSTALL_DATA_DIR} "${DESTDIR}${PREFIX}/$$dir";; \
+ esac; \
+ done
+
######################################################################
### pre-install, do-install, post-install (PUBLIC, override)
######################################################################