pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/tools mk/tools: Avoid print(1) when using bash on S...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/71db87cc3702
branches:  trunk
changeset: 388526:71db87cc3702
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Tue Nov 22 09:15:51 2022 +0000

description:
mk/tools: Avoid print(1) when using bash on SunOS.

bash does not have a print builtin, and on SunOS there is a /usr/bin/print
which is found by the libtool configure script (which has also made its way
into lots of third-party packages) and used for printing strings.

Create a broken print wrapper so that this is not found and the printf builtin
is used instead, significantly improving performance.

diffstat:

 mk/tools/tools.SunOS.mk |  17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r e66ae3c918e0 -r 71db87cc3702 mk/tools/tools.SunOS.mk
--- a/mk/tools/tools.SunOS.mk   Tue Nov 22 09:09:19 2022 +0000
+++ b/mk/tools/tools.SunOS.mk   Tue Nov 22 09:15:51 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: tools.SunOS.mk,v 1.54 2022/11/22 09:09:19 jperkin Exp $
+# $NetBSD: tools.SunOS.mk,v 1.55 2022/11/22 09:15:51 jperkin Exp $
 #
 # System-supplied tools for the Solaris and illumos operating systems.
 #
@@ -229,3 +229,18 @@
 TOOLS_PLATFORM.zipnote?=       /usr/bin/zipnote
 TOOLS_PLATFORM.zipsplit?=      /usr/bin/zipsplit
 .endif
+
+#
+# If we've bootstrapped with bash as the default shell then ensure print is a
+# broken wrapper to work around a bug in the libtool configure script that
+# assumes print, if available, is always a builtin.  bash does not have print
+# builtin and /usr/bin/print gets called instead, affecting performance.
+#
+# Also ensure we do use any bash builtins instead of separate commands.
+#
+.if ${TOOLS_PLATFORM.sh:M*bash}
+TOOLS_CREATE+=         print
+TOOLS_PATH.print=      ${FALSE}
+
+TOOLS_PLATFORM.printf= printf
+.endif



Home | Main Index | Thread Index | Old Index