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:44:16 UTC 2022

Modified Files:
        pkgsrc/mk: cwrappers.mk

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 pkgsrc/mk/cwrappers.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/cwrappers.mk
diff -u pkgsrc/mk/cwrappers.mk:1.36 pkgsrc/mk/cwrappers.mk:1.37
--- pkgsrc/mk/cwrappers.mk:1.36 Sun Apr 10 19:54:02 2022
+++ pkgsrc/mk/cwrappers.mk      Wed Nov 23 10:44:16 2022
@@ -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: ${_target_}
 
 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