pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk/install



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Wed Nov 23 11:26:51 UTC 2022

Modified Files:
        pkgsrc/mk/install: bsd.install.mk install.mk

Log Message:
mk: install performance improvements.

Inline ${RUN} calls where appropriate.  Only call mkdir and rm when
necessary.  Remove useless use of cat(1).

Saves at least 12 execs per build, but often a lot more depending on the
number of files that were not stripped or had CTF conversion applied.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 pkgsrc/mk/install/bsd.install.mk
cvs rdiff -u -r1.82 -r1.83 pkgsrc/mk/install/install.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/install/bsd.install.mk
diff -u pkgsrc/mk/install/bsd.install.mk:1.17 pkgsrc/mk/install/bsd.install.mk:1.18
--- pkgsrc/mk/install/bsd.install.mk:1.17       Tue May  7 19:36:44 2019
+++ pkgsrc/mk/install/bsd.install.mk    Wed Nov 23 11:26:51 2022
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.install.mk,v 1.17 2019/05/07 19:36:44 rillig Exp $
+# $NetBSD: bsd.install.mk,v 1.18 2022/11/23 11:26:51 jperkin Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and provides all
 # variables and targets related to installing packages.
@@ -58,6 +58,7 @@ stage-install: barrier
 ###
 .PHONY: install-cookie
 install-cookie:
-       ${RUN} [ ! -f ${_COOKIE.install} ]
-       ${RUN} ${MKDIR} ${_COOKIE.install:H}
-       ${RUN} ${ECHO} ${PKGNAME} > ${_COOKIE.install}
+       ${RUN}                                                          \
+       [ ! -f ${_COOKIE.install} ];                                    \
+       ${TEST} -d ${_COOKIE.install:H} || ${MKDIR} ${_COOKIE.install:H}; \
+       ${ECHO} ${PKGNAME} > ${_COOKIE.install}

Index: pkgsrc/mk/install/install.mk
diff -u pkgsrc/mk/install/install.mk:1.82 pkgsrc/mk/install/install.mk:1.83
--- pkgsrc/mk/install/install.mk:1.82   Thu Nov  3 08:29:32 2022
+++ pkgsrc/mk/install/install.mk        Wed Nov 23 11:26:51 2022
@@ -1,4 +1,4 @@
-# $NetBSD: install.mk,v 1.82 2022/11/03 08:29:32 jperkin Exp $
+# $NetBSD: install.mk,v 1.83 2022/11/23 11:26:51 jperkin Exp $
 #
 # This file provides the code for the "install" phase.
 #
@@ -127,10 +127,11 @@ install-message:
 ###
 install-check-interactive: .PHONY
 .if !empty(INTERACTIVE_STAGE:Minstall) && defined(BATCH)
-       @${ERROR_MSG} "The installation stage of this package requires user interaction"
-       @${ERROR_MSG} "Please install manually with:"
-       @${ERROR_MSG} " \"cd ${.CURDIR} && ${MAKE} install\""
-       ${RUN} ${FALSE}
+       ${RUN}                                                          \
+       ${ERROR_MSG} "The installation stage of this package requires user interaction"; \
+       ${ERROR_MSG} "Please install manually with:";                   \
+       ${ERROR_MSG} "  \"cd ${.CURDIR} && ${MAKE} install\"";          \
+       ${FALSE}
 .else
        @${DO_NADA}
 .endif
@@ -287,10 +288,9 @@ install-makedirs:
 #
 .PHONY: install-dirs-from-PLIST
 install-dirs-from-PLIST:
-       @${STEP_MSG} "Creating installation directories from PLIST files"
        ${RUN}                                                          \
-       ${CAT} ${PLIST_SRC}                                             \
-       | sed -n                                                        \
+       ${STEP_MSG} "Creating installation directories from PLIST files"; \
+       ${SED} -n                                                       \
                -e 's,\\,\\\\,'                                         \
                -e 's,^gnu/man/,${PKGGNUDIR}${PKGMANDIR}/,'             \
                -e 's,^gnu/,${PKGGNUDIR},'                              \
@@ -298,6 +298,7 @@ install-dirs-from-PLIST:
                -e 's,^info/,${PKGINFODIR}/,'                           \
                -e 's,^share/locale/,${PKGLOCALEDIR}/locale/,'          \
                -e 's,^\([^$$@]*\)/[^/]*$$,\1,p'                        \
+               < ${PLIST_SRC}                                          \
        | ${TOOLS_PLATFORM.uniq:Uuniq}                                  \
        | while read dir; do                                            \
                ${_INSTALL_ONE_DIR_CMD};                                \
@@ -359,9 +360,10 @@ _DEBUG_SKIP_PATTERNS+=     *.a *.c *.h *.hpp
 ###
 .PHONY: install-ctf
 install-ctf: plist
-       @${STEP_MSG} "Generating CTF data"
-       ${RUN}cd ${DESTDIR:Q}${PREFIX:Q};                               \
-       ${CAT} ${_PLIST_NOKEYWORDS} | while read f; do                  \
+       ${RUN}                                                          \
+       ${STEP_MSG} "Generating CTF data";                              \
+       cd ${DESTDIR:Q}${PREFIX:Q};                                     \
+       while read f; do                                                \
                case "$${f}" in                                         \
                ${_DEBUG_SKIP_PATTERNS:@p@${p}) continue ;;@}           \
                ${CTF_FILES_SKIP:@p@${p}) continue ;;@}                 \
@@ -374,8 +376,10 @@ install-ctf: plist
                                ${MV} "$${tmp_f}" "$${f}";              \
                        fi;                                             \
                fi;                                                     \
-               ${RM} -f "$${tmp_f}";                                   \
-       done
+               if [ -f "$${tmp_f}" ]; then                             \
+                       ${RM} -f "$${tmp_f}";                           \
+               fi;                                                     \
+       done < ${_PLIST_NOKEYWORDS}
 
 ######################################################################
 ### install-strip-debug (PRIVATE)
@@ -385,9 +389,10 @@ install-ctf: plist
 ###
 .PHONY: install-strip-debug
 install-strip-debug: plist
-       @${STEP_MSG} "Automatic stripping of debug information"
-       ${RUN}cd ${DESTDIR:Q}${PREFIX:Q};                               \
-       ${CAT} ${_PLIST_NOKEYWORDS} | while read f; do                  \
+       ${RUN}                                                          \
+       ${STEP_MSG} "Automatic stripping of debug information";         \
+       cd ${DESTDIR:Q}${PREFIX:Q};                                     \
+       while read f; do                                                \
                case "$${f}" in                                         \
                ${_DEBUG_SKIP_PATTERNS:@p@${p}) continue ;;@}           \
                ${STRIP_FILES_SKIP:@p@${p}) continue;;@}                \
@@ -400,8 +405,10 @@ install-strip-debug: plist
                                ${MV} "$${tmp_f}" "$${f}";              \
                        fi;                                             \
                fi;                                                     \
-               ${RM} -f "$${tmp_f}";                                   \
-       done
+               if [ -f "$${tmp_f}" ]; then                             \
+                       ${RM} -f "$${tmp_f}";                           \
+               fi;                                                     \
+       done < ${_PLIST_NOKEYWORDS}
 
 ######################################################################
 ### install-doc-handling (PRIVATE)
@@ -423,10 +430,9 @@ _DOC_COMPRESS=                                                             \
 
 .PHONY: install-doc-handling
 install-doc-handling: plist
-       @${STEP_MSG} "Automatic manual page handling"
-       ${RUN} \
-       ${CAT} ${_PLIST_NOKEYWORDS} \
-       | ${EGREP} ${_PLIST_REGEXP.man:Q} \
+       ${RUN}                                                          \
+       ${STEP_MSG} "Automatic manual page handling";                   \
+       ${EGREP} ${_PLIST_REGEXP.man:Q} ${_PLIST_NOKEYWORDS}            \
        | ${_DOC_COMPRESS}
 
 privileged-install-hook: .PHONY



Home | Main Index | Thread Index | Old Index