pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/install When a package sets INSTALLATION_DIRS_FROM_...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/1134fd96e889
branches:  trunk
changeset: 521053:1134fd96e889
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Nov 04 07:42:51 2006 +0000

description:
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:

 mk/install/bsd.install-vars.mk |  15 ++++++++++++++-
 mk/install/install.mk          |  32 +++++++++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 2 deletions(-)

diffs (87 lines):

diff -r f071009cef7a -r 1134fd96e889 mk/install/bsd.install-vars.mk
--- a/mk/install/bsd.install-vars.mk    Sat Nov 04 00:42:30 2006 +0000
+++ b/mk/install/bsd.install-vars.mk    Sat Nov 04 07:42:51 2006 +0000
@@ -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 -r f071009cef7a -r 1134fd96e889 mk/install/install.mk
--- a/mk/install/install.mk     Sat Nov 04 00:42:30 2006 +0000
+++ b/mk/install/install.mk     Sat Nov 04 07:42:51 2006 +0000
@@ -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+=         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 @@
        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)
 ######################################################################



Home | Main Index | Thread Index | Old Index