summaryrefslogtreecommitdiff
path: root/mk/install/install.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/install/install.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/install/install.mk')
-rw-r--r--mk/install/install.mk32
1 files changed, 31 insertions, 1 deletions
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)
######################################################################