Skip to content

Commit

Permalink
mk: Add mktool support to distinfo.
Browse files Browse the repository at this point in the history
mktool is an optional external tool, available from pkgtools/mktool or
"cargo install mktool", that provides significant performance improvements
compared to distinfo.awk, while being 100% compatible.

After installing, set TOOLS_PLATFORM.mktool=/path/to/mktool to enable it.

Comparing the time taken to run "bmake distinfo" on a SmartOS host inside
www/grafana, distinfo.awk takes:

  real	3m37.603s
  user	1m16.887s
  sys	1m53.369s

while mktool takes:

  real	0m12.516s
  user	0m10.314s
  sys	0m8.485s

It should be noted that the vast majority of that time is in the generation
of the distinfo input file.  mktool itself takes around 2 seconds.  Patches
to improve input file generation are available, but are dependent on bmake
with temporary file support due to argmax limits on NetBSD.
  • Loading branch information
jperkin committed Oct 11, 2024
1 parent 67d2a36 commit b1ad5d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mk/checksum/checksum.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: checksum.mk,v 1.31 2024/10/11 11:20:23 jperkin Exp $
# $NetBSD: checksum.mk,v 1.32 2024/10/11 11:40:29 jperkin Exp $
#
# See bsd.checksum.mk for helpful comments.
#
Expand Down Expand Up @@ -53,9 +53,13 @@ checksum checksum-phase:
fi
.endif

.if !empty(TOOLS_PLATFORM.mktool)
_DISTINFO_CMD= ${TOOLS_PLATFORM.mktool} distinfo
.else
_DISTINFO_CMD= ${PKGSRC_SETENV} DIGEST=${TOOLS_DIGEST:Q} SED=${TOOLS_SED:Q} \
TEST=${TOOLS_TEST:Q} WC=${TOOLS_WC:Q} \
${AWK} -f ${PKGSRCDIR}/mk/checksum/distinfo.awk --
.endif

.if exists(${DISTDIR})
_DISTINFO_ARGS_COMMON+= -d ${DISTDIR}
Expand Down

0 comments on commit b1ad5d6

Please sign in to comment.