pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Wed Nov 23 10:16:44 UTC 2022

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

Log Message:
mk: Improve makevars generation performance.

Ironically, for something that was designed to improve performance, the way
the previous version of this worked actually made builds slower!

Use bmake loop expansions, remove useless use of cat, and reduce ${RUN}
calls to not only simplify the code but make it significantly faster.


To generate a diff of this commit:
cvs rdiff -u -r1.2042 -r1.2043 pkgsrc/mk/bsd.pkg.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/bsd.pkg.mk
diff -u pkgsrc/mk/bsd.pkg.mk:1.2042 pkgsrc/mk/bsd.pkg.mk:1.2043
--- pkgsrc/mk/bsd.pkg.mk:1.2042 Thu Nov  3 08:26:10 2022
+++ pkgsrc/mk/bsd.pkg.mk        Wed Nov 23 10:16:44 2022
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.2042 2022/11/03 08:26:10 jperkin Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.2043 2022/11/23 10:16:44 jperkin Exp $
 #
 # This file is in the public domain.
 #
@@ -812,25 +812,16 @@ PKG_ERROR_HANDLER.${_class_}?= \
 #
 .for _phase_ in ${_ALL_PHASES}
 ${_MAKEVARS_MK.${_phase_}}: ${WRKDIR}
-       ${RUN}${RM} -f ${.TARGET}.tmp
-.  for _var_ in ${MAKEVARS:O:u}
-.    if defined(${_var_})
-       ${RUN}                                  \
-       ${ECHO} ${_var_}"=      "${${_var_}:Q} >> ${.TARGET}.tmp
-.    endif
-.  endfor
-       ${RUN}                                  \
-       if ${TEST} -f ${.TARGET}.tmp; then                              \
-               ( ${ECHO} ".if !defined(_MAKEVARS_MK)";                 \
-                 ${ECHO} "_MAKEVARS_MK=        defined";               \
-                 ${ECHO} "";                                           \
-                 ${CAT} ${.TARGET}.tmp;                                \
-                 ${ECHO} "";                                           \
-                 ${ECHO} ".endif # _MAKEVARS_MK";                      \
-               ) > ${.TARGET};                                         \
-               ${RM} -f ${.TARGET}.tmp;                                \
-       fi
-       ${RUN}${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
+       ${RUN} {                                                        \
+               ${ECHO} ".if !defined(_MAKEVARS_MK)";                   \
+               ${ECHO} "_MAKEVARS_MK=  defined";                       \
+               ${ECHO} "";                                             \
+               ${MAKEVARS:O:u:@_v_@                                    \
+                       ${${_v_}:D${ECHO} ${_v_}"=      "${${_v_}:Q};}  \
+               @}                                                      \
+               ${ECHO} "";                                             \
+               ${ECHO} ".endif # _MAKEVARS_MK";                        \
+       } > ${.TARGET}
 .endfor
 
 .if make(pbulk-index) || make(pbulk-index-item) || make(pbulk-save-wrkdir)



Home | Main Index | Thread Index | Old Index