pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk/buildlink3



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Wed Nov 23 11:04:42 UTC 2022

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

Log Message:
mk: buildlink3 performance improvements.

Inline commands into the same ${RUN} where appropriate.  Use a single mkdir
for multiple directories rather than a command per directory.  Test for the
directory before calling mkdir where it may already exist to avoid an
unnecessary exec. Remove useless use of cat(1).

Saves around 20 execs per build.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 pkgsrc/mk/buildlink3/bsd.buildlink3.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/buildlink3/bsd.buildlink3.mk
diff -u pkgsrc/mk/buildlink3/bsd.buildlink3.mk:1.251 pkgsrc/mk/buildlink3/bsd.buildlink3.mk:1.252
--- pkgsrc/mk/buildlink3/bsd.buildlink3.mk:1.251        Wed Nov 23 10:57:59 2022
+++ pkgsrc/mk/buildlink3/bsd.buildlink3.mk      Wed Nov 23 11:04:42 2022
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.251 2022/11/23 10:57:59 jperkin Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.252 2022/11/23 11:04:42 jperkin Exp $
 #
 # Copyright (c) 2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -575,14 +575,14 @@ LIBS+=            ${_flag_}
 .PHONY: buildlink-directories
 do-buildlink: buildlink-directories
 buildlink-directories:
-       ${RUN}${MKDIR} ${BUILDLINK_DIR}
-       ${RUN}${MKDIR} ${BUILDLINK_BINDIR}
+       ${RUN}                                                          \
+       ${MKDIR} ${BUILDLINK_DIR} ${BUILDLINK_BINDIR}                   \
+                ${BUILDLINK_DIR}/include ${BUILDLINK_DIR}/lib
 .if defined(USE_X11) && ${X11_TYPE} != "modular"
-       ${RUN}${RM} -f ${BUILDLINK_X11_DIR}
-       ${RUN}${LN} -sf ${BUILDLINK_DIR} ${BUILDLINK_X11_DIR}
+       ${RUN}                                                          \
+       ${RM} -f ${BUILDLINK_X11_DIR};                                  \
+       ${LN} -sf ${BUILDLINK_DIR} ${BUILDLINK_X11_DIR}
 .endif
-       ${RUN}${MKDIR} ${BUILDLINK_DIR}/include
-       ${RUN}${MKDIR} ${BUILDLINK_DIR}/lib
 
 # The following variables are all optionally defined and control which
 # package files are symlinked into ${BUILDLINK_DIR} and how their names
@@ -627,8 +627,7 @@ buildlink-${_pkg_}-message:
 
 .PHONY: buildlink-${_pkg_}-cookie
 buildlink-${_pkg_}-cookie:
-       ${RUN}                                  \
-       ${TOUCH} ${TOUCH_FLAGS} ${_BLNK_COOKIE.${_pkg_}}
+       ${RUN} ${TOUCH} ${TOUCH_FLAGS} ${_BLNK_COOKIE.${_pkg_}}
 
 BUILDLINK_CONTENTS_FILTER.${_pkg_}?=                                   \
        ${EGREP} '(include.*/|\.h$$|\.idl$$|\.pc$$|/lib[^/]*\.[^/]*$$|lib/cmake/|share/cmake/)'
@@ -636,7 +635,7 @@ BUILDLINK_CONTENTS_FILTER.${_pkg_}?=                                
 BUILDLINK_FILES_CMD.${_pkg_}?=                                         \
        ${_BLNK_PKG_INFO.${_pkg_}} -f ${BUILDLINK_PKGNAME.${_pkg_}} |   \
        ${SED} -n '/File:/s/^[  ]*File:[        ]*//p' |                \
-       ${BUILDLINK_CONTENTS_FILTER.${_pkg_}} | ${CAT}
+       ${BUILDLINK_CONTENTS_FILTER.${_pkg_}}
 
 # _BLNK_FILES_CMD.<pkg> combines BUILDLINK_FILES_CMD.<pkg> and
 # BUILDLINK_FILES.<pkg> into one command that outputs all of the files
@@ -657,8 +656,8 @@ ${_BLNK_COOKIE.${_pkg_}}:
                ${ERROR_MSG} "${BUILDLINK_API_DEPENDS.${_pkg_}} is not installed; can't buildlink files."; \
                exit 1;                                                 \
                ;;                                                      \
-       esac
-       ${RUN} [ ${X11BASE:Q}"" ] || {                                  \
+       esac;                                                           \
+       [ ${X11BASE:Q}"" ] || {                                         \
                ${ERROR_MSG} "[bsd.buildlink3.mk] X11BASE is not set correctly."; \
                exit 1;                                                 \
        }
@@ -1175,8 +1174,9 @@ _WRAP_EXTRA_ARGS.LIBTOOL+=        ${_BLNK_LDFLA
 _WRAP_EXTRA_ARGS.SHLIBTOOL+=   ${_BLNK_LDFLAGS}
 
 ${WRAPPER_TMPDIR}/libtool-fix-la: ${BUILDLINK_SRCDIR}/libtool-fix-la
-       ${RUN}${MKDIR} ${.TARGET:H}
-       ${RUN}${CAT} ${.ALLSRC}                 \
+       ${RUN}                                                          \
+       ${TEST} -d ${.TARGET:H} || ${MKDIR} ${.TARGET:H};               \
+       ${CAT} ${.ALLSRC}                                               \
                | ${SED} -e "s|@_BLNK_WRAP_LT_UNTRANSFORM_SED@|"${_BLNK_WRAP_LT_UNTRANSFORM_SED:Q}"|g" \
                         -e "s|@BUILDLINK_DIR@|${BUILDLINK_DIR}|g"      \
                         -e "s|@LOCALBASE@|${LOCALBASE}|g"              \
@@ -1190,32 +1190,33 @@ ${WRAPPER_TMPDIR}/libtool-fix-la: ${BUIL
                | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
 
 ${WRAPPER_TMPDIR}/buildcmd-libtool: ${BUILDLINK_SRCDIR}/buildcmd-libtool
-       ${RUN}${MKDIR} ${.TARGET:H}
-       ${RUN}${CAT} ${.ALLSRC}                 \
-               | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
+       ${RUN}                                                          \
+       ${TEST} -d ${.TARGET:H} || ${MKDIR} ${.TARGET:H};               \
+       ${CAT} ${.ALLSRC} | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
 
 ${WRAPPER_TMPDIR}/cleanup-libtool:                                     \
                ${BUILDLINK_SRCDIR}/cleanup-libtool                     \
                ${_BLNK_LIBTOOL_FIX_LA}
-       ${RUN}${MKDIR} ${.TARGET:H}
-       ${RUN}                                  \
+       ${RUN}                                                          \
+       ${TEST} -d ${.TARGET:H} || ${MKDIR} ${.TARGET:H};               \
        ${CAT} ${BUILDLINK_SRCDIR}/cleanup-libtool                      \
                | ${SED} -e "s|@_BLNK_LIBTOOL_FIX_LA@|"${_BLNK_LIBTOOL_FIX_LA:Q}"|g" \
                | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
 
 ${WRAPPER_TMPDIR}/cmd-sink-libtool: ${BUILDLINK_SRCDIR}/cmd-sink-libtool
-       ${RUN}${MKDIR} ${.TARGET:H}
-       ${RUN}${CAT} ${.ALLSRC}                 \
-               | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
+       ${RUN}                                                          \
+       ${TEST} -d ${.TARGET:H} || ${MKDIR} ${.TARGET:H};               \
+       ${CAT} ${.ALLSRC} | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
 
 ${WRAPPER_TMPDIR}/scan-libtool: ${BUILDLINK_SRCDIR}/scan-libtool
-       ${RUN}${MKDIR} ${.TARGET:H}
-       ${RUN}${CAT} ${.ALLSRC}                 \
-               | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
+       ${RUN}                                                          \
+       ${TEST} -d ${.TARGET:H} || ${MKDIR} ${.TARGET:H};               \
+       ${CAT} ${.ALLSRC} | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
 
 ${WRAPPER_TMPDIR}/transform-libtool: ${BUILDLINK_SRCDIR}/transform-libtool
-       ${RUN}${MKDIR} ${.TARGET:H}
-       ${RUN}${CAT} ${.ALLSRC}                 \
+       ${RUN}                                                          \
+       ${TEST} -d ${.TARGET:H} || ${MKDIR} ${.TARGET:H};               \
+       ${CAT} ${.ALLSRC}                                               \
                | ${SED} -e "s|@BUILDLINK_DIR@|${BUILDLINK_DIR}|g"      \
                         -e "s|@WRKSRC@|${WRKSRC}|g"                    \
                         -e "s|@BASENAME@|"${BASENAME:Q}"|g"            \



Home | Main Index | Thread Index | Old Index