pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/tools mk: Revert override-tools performance change.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4040507631f3
branches:  trunk
changeset: 388644:4040507631f3
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Thu Nov 24 11:09:34 2022 +0000

description:
mk: Revert override-tools performance change.

Unfortunately Linux appears to have a much smaller limit on the number
of arguments allowed, so while this change was absolutely fine on many
other platforms, on Linux it fails with:

  bmake[1]: exec(/bin/bash) failed (Argument list too long)

It will hopefully be possible to rearchitect the change in a different
way to avoid this, while still retaining most of the performance win.

diffstat:

 mk/tools/create.mk |  53 ++++++++++++++++++++++++-----------------------------
 1 files changed, 24 insertions(+), 29 deletions(-)

diffs (91 lines):

diff -r 5fb167024f56 -r 4040507631f3 mk/tools/create.mk
--- a/mk/tools/create.mk        Thu Nov 24 08:56:36 2022 +0000
+++ b/mk/tools/create.mk        Thu Nov 24 11:09:34 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: create.mk,v 1.16 2022/11/23 16:01:36 jperkin Exp $
+# $NetBSD: create.mk,v 1.17 2022/11/24 11:09:34 jperkin Exp $
 #
 # Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -101,11 +101,9 @@
 .endfor
 
 .for _t_ in ${TOOLS_FAIL}
-# Ensure the warning file is named correctly for each tool.
-DELAYED_WARNING_MSG.${_t_}?=   ${ECHO} >> ${WARNING_DIR}/${_t_:Q}
 TOOLS_CREATE+=         ${_t_}
 TOOLS_SCRIPT.${_t_}?=  \
-       ${DELAYED_WARNING_MSG.${_t_}} "Please add USE_TOOLS+=${_t_} to the package Makefile."; \
+       ${DELAYED_WARNING_MSG} "Please add USE_TOOLS+=${_t_} to the package Makefile."; \
        ${FAIL_MSG} "To use this tool, add USE_TOOLS+=${_t_} to the package Makefile."
 .endfor
 
@@ -147,16 +145,15 @@
 TOOLS_PATH.${_t_}?=            ${FALSE}
 TOOLS_SCRIPT_DFLT.${_t_}=      \
        ${TOOLS_PATH.${_t_}} ${TOOLS_ARGS.${_t_}} "$$@"
-.endfor
+
+override-tools: ${TOOLS_CMD.${_t_}}
 
 # Note: if you get a warning about a doubly-defined target here, you are
 # probably adding a program to USE_TOOLS that is not a valid tool name.
 # For instance, "split" is handled outside of the tools framework.
-override-tools: ${WRKDIR}/.override_tools_done
-${WRKDIR}/.override_tools_done:
+${TOOLS_CMD.${_t_}}:
        ${RUN}                                                          \
-       ${TOOLS_CREATE:@_t_@                                            \
-       ${TEST} -d ${TOOLS_CMD.${_t_}:H:Q} || ${MKDIR} ${TOOLS_CMD.${_t_}:H:Q}; \
+       ${TEST} -d ${.TARGET:H:Q} || ${MKDIR} ${.TARGET:H:Q};           \
        if ${TEST} -n ${TOOLS_SCRIPT.${_t_}:Q}""; then                  \
                create=wrapper;                                         \
                script=${TOOLS_SCRIPT.${_t_}:Q};                        \
@@ -189,29 +186,27 @@
                  ${ECHO} 'tools_wrapper_sed='${SED:Q:Q};               \
                  ${SED} -e '/^$$/d' -e '/^     *#/d' ${PKGSRCDIR}/mk/tools/shquote.sh; \
                  ${ECHO} 'wrapperlog="$${TOOLS_WRAPPER_LOG-'${_TOOLS_WRAP_LOG:Q}'}"'; \
-                 ${ECHO} 'shquote_args "$$\@"';                        \
-                 ${ECHO} '${ECHO} "[*] "'${TOOLS_CMD.${_t_}:Q}'"$$shquoted_args" >> $$wrapperlog'; \
+                 ${ECHO} 'shquote_args "$$@"';                         \
+                 ${ECHO} '${ECHO} "[*] "'${.TARGET:Q}'"$$shquoted_args" >> $$wrapperlog'; \
                  ${ECHO} 'logprefix='$$logprefix;                      \
                  ${ECHO} 'logmain='$$logmain;                          \
-                 ${ECHO} "${ECHO} '<.>' "'"$$logprefix$$logmain'$$logsuffix'" >> $$wrapperlog'; \
+                 ${ECHO} "${ECHO} '<.>' \"\$$logprefix\$$logmain$$logsuffix\" >> \$$wrapperlog"; \
                  ${ECHO} "$$script";                                   \
-               } > ${TOOLS_CMD.${_t_}:Q};                              \
-               ${CHMOD} +x ${TOOLS_CMD.${_t_}:Q};                      \
+               } > ${.TARGET:Q};                                       \
+               ${CHMOD} +x ${.TARGET:Q};                               \
                ;;                                                      \
        *)                                                              \
-               ${LN} -fs ${TOOLS_PATH.${_t_}:Q} ${TOOLS_CMD.${_t_}:Q}; \
+               ${LN} -fs ${TOOLS_PATH.${_t_}:Q} ${.TARGET:Q};  \
                ;;                                                      \
-       esac;                                                           \
-       @}                                                              \
-       ${TOOLS_CREATE:@_t_@                                            \
-       for a in ${TOOLS_ALIASES.${_t_}}; do                            \
-               ${TEST} ${TOOLS_CMD.${_t_}:Q} = ${TOOLS_CMD.${_t_}:H:Q}/$$a || \
-                       ${LN} -fs ${TOOLS_CMD.${_t_}:T:Q} ${TOOLS_CMD.${_t_}:H:Q}/$$a; \
-       done;                                                           \
-       ${_OPSYS_EXE_SUFFIX:D                                           \
-               ${TEST} ${TOOLS_CMD.${_t_}:E:Q} = ${_OPSYS_EXE_SUFFIX:E:Q} || \
-                       ${LN} -fs ${TOOLS_CMD.${_t_}:T:Q}               \
-                               ${TOOLS_CMD.${_t_}:Q}${_OPSYS_EXE_SUFFIX}; \
-       }                                                               \
-       @}                                                              \
-       ${TOUCH} ${.TARGET}
+       esac
+.  for _a_ in ${TOOLS_ALIASES.${_t_}}
+       ${RUN}                                                          \
+       ${TEST} ${.TARGET:Q} = ${.TARGET:H:Q}/${_a_} ||                 \
+               ${LN} -fs ${.TARGET:T:Q} ${.TARGET:H:Q}/${_a_}
+.  endfor
+.  if defined(_OPSYS_EXE_SUFFIX) && !empty(_OPSYS_EXE_SUFFIX)
+       ${RUN}                                                          \
+       ${TEST} ${.TARGET:E:Q} = ${_OPSYS_EXE_SUFFIX:E:Q} ||            \
+               ${LN} -fs ${.TARGET:T:Q} ${.TARGET:Q}${_OPSYS_EXE_SUFFIX}
+.  endif
+.endfor



Home | Main Index | Thread Index | Old Index