pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk mk: Improve cwrapper generation performance.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3db0c7b1fc85
branches:  trunk
changeset: 388583:3db0c7b1fc85
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Wed Nov 23 10:44:16 2022 +0000

description:
mk: Improve cwrapper generation performance.

Use bmake loop expansion and inline commands to handle wrapper generation
in just a single shell per-wrapper.

Saves at least around 100 execs per package, with some packages and platforms
saving even more depending on the number of transformations performed.

diffstat:

 mk/cwrappers.mk |  50 +++++++++++++++++++++++++++++---------------------
 1 files changed, 29 insertions(+), 21 deletions(-)

diffs (64 lines):

diff -r 56ca5a534497 -r 3db0c7b1fc85 mk/cwrappers.mk
--- a/mk/cwrappers.mk   Wed Nov 23 10:42:50 2022 +0000
+++ b/mk/cwrappers.mk   Wed Nov 23 10:44:16 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cwrappers.mk,v 1.36 2022/04/10 19:54:02 riastradh Exp $
+# $NetBSD: cwrappers.mk,v 1.37 2022/11/23 10:44:16 jperkin Exp $
 #
 # This Makefile fragment implements integration of pkgtools/cwrappers.
 
@@ -71,26 +71,34 @@
 
 generate-cwrappers:
 .for wrappee in as cxx cc cpp f77 imake ld libtool shlibtool
-       ${RUN}echo worklog=${WRKLOG:Q} > ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
-       ${RUN}echo wrksrc=${WRKSRC:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
-       ${RUN}case ${wrappee} in *libtool) ;; *) echo path=${_PATH_COMPONENTS:N${WRAPPER_BINDIR}:ts::Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}};; esac
-       ${RUN}echo exec_path=${WRAPPER_BINDIR}/${CWRAPPERS_ALIASES.${wrappee}:[1]} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
-       ${RUN}echo exec=${CWRAPPERS_WRAPPEE.${wrappee}:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
-.  for cmd in ${WRAPPER_REORDER_CMDS}
-       ${RUN}echo reorder=${cmd:S/^reorder://:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
-.  endfor
-.  for cmd in ${CWRAPPERS_TRANSFORM.${wrappee}} ${_CWRAPPERS_TRANSFORM}
-       ${RUN}echo transform=${cmd:u:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
-.  endfor
-.  for cmd in ${CWRAPPERS_APPEND.${wrappee}:U}
-       ${RUN}echo append=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
-.  endfor
-.  for cmd in ${CWRAPPERS_PREPEND.${wrappee}:U}
-       ${RUN}echo prepend=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
-.  endfor
-.  for cmd in ${_CWRAPPERS_UNWRAP}
-       ${RUN}echo unwrap=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
-.  endfor
+       ${RUN} { \
+               echo worklog=${WRKLOG:Q}; \
+               echo wrksrc=${WRKSRC:Q}; \
+               case ${wrappee} in \
+               *libtool) ;; \
+               *) echo path=${_PATH_COMPONENTS:N${WRAPPER_BINDIR}:ts::Q}; \
+               esac; \
+               echo exec_path=${WRAPPER_BINDIR}/${CWRAPPERS_ALIASES.${wrappee}:[1]}; \
+               echo exec=${CWRAPPERS_WRAPPEE.${wrappee}:Q}; \
+               ${WRAPPER_REORDER_CMDS:@cmd@ \
+                       echo reorder=${cmd:S/^reorder://:Q}; \
+               @} \
+               ${CWRAPPERS_TRANSFORM.${wrappee}:@cmd@ \
+                       echo transform=${cmd:u:Q}; \
+               @} \
+               ${_CWRAPPERS_TRANSFORM:@cmd@ \
+                       echo transform=${cmd:u:Q}; \
+               @} \
+               ${CWRAPPERS_APPEND.${wrappee}:U:@cmd@ \
+                       echo append=${cmd:Q}; \
+               @} \
+               ${CWRAPPERS_PREPEND.${wrappee}:U:@cmd@ \
+                       echo prepend=${cmd:Q}; \
+               @} \
+               ${_CWRAPPERS_UNWRAP:@cmd@ \
+                       echo unwrap=${cmd:Q}; \
+               @} \
+       } > ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
 .  for alias in ${CWRAPPERS_ALIASES.${wrappee}}
        ${RUN}ln -s ${CWRAPPERS_SRC_DIR}/${CWRAPPERS_CONFIG.${wrappee}}-wrapper ${WRAPPER_BINDIR}/${alias}
 .  endfor



Home | Main Index | Thread Index | Old Index