summaryrefslogtreecommitdiff
path: root/bootstrap/bootstrap
diff options
context:
space:
mode:
authorjperkin <jperkin@pkgsrc.org>2022-11-11 17:22:14 +0000
committerjperkin <jperkin@pkgsrc.org>2022-11-11 17:22:14 +0000
commit6e0af1434c6eb28e146d98f5d77850e038e9ebc6 (patch)
treee87882e2ba9f1c47df7211bb77d545cbfc7b7a89 /bootstrap/bootstrap
parente0701fea3d3b396a507a899b2d770fbb1f25e22f (diff)
downloadpkgsrc-6e0af1434c6eb28e146d98f5d77850e038e9ebc6.tar.gz
bootstrap: Switch to native awk/sed on illumos.
Diffstat (limited to 'bootstrap/bootstrap')
-rwxr-xr-xbootstrap/bootstrap37
1 files changed, 34 insertions, 3 deletions
diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap
index 48a5ab4c6eb..ed930b4dc84 100755
--- a/bootstrap/bootstrap
+++ b/bootstrap/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
-# $NetBSD: bootstrap,v 1.317 2022/10/04 11:47:45 jperkin Exp $
+# $NetBSD: bootstrap,v 1.318 2022/11/11 17:22:14 jperkin Exp $
#
# Copyright (c) 2001-2011 Alistair Crooks <agc@NetBSD.org>
# All rights reserved.
@@ -390,6 +390,14 @@ checkarg_sane_relative_path() {
esac
}
+#
+# If we determine that a native version is good enough to use then it is saved
+# and we later write the appropriate TOOLS_PLATFORM variable to mk.conf to
+# override any further processing from mk/tools.
+#
+bootstrap_awk=
+bootstrap_sed=
+
bootstrap_sh=${SH-/bin/sh}
bootstrap_sh_set=${SH+set}
@@ -825,18 +833,29 @@ SunOS)
root_group=root
need_bsd_install=yes
use_bsdinstall=yes
- if [ ! -x "/usr/gnu/bin/awk" ]; then
+
+ # Use native nawk and sed if available on newer illumos.
+ /usr/bin/nawk --version 2>/dev/null | grep "awk version " >/dev/null
+ if [ $? -eq 0 ]; then
+ bootstrap_awk="/usr/bin/nawk"
+ elif [ ! -x "/usr/gnu/bin/awk" ]; then
need_awk=yes
fi
- if [ ! -x "/usr/gnu/bin/sed" ]; then
+
+ /usr/bin/sed -h 2>&1 | grep -- "-i extension" >/dev/null
+ if [ $? -eq 0 ]; then
+ bootstrap_sed="/usr/bin/sed"
+ elif [ ! -x "/usr/gnu/bin/sed" ]; then
need_sed=yes
fi
+
if [ -x "/usr/bin/bash" ]; then
bootstrap_sh=${SH:-/usr/bin/bash}
bootstrap_sh_set=set
else
need_mksh=yes
fi
+
idprog="/usr/xpg4/bin/id"
groupsprog="${idprog} -gn"
whoamiprog="${idprog} -un"
@@ -1297,6 +1316,12 @@ yes) echo_msg "Bootstrapping awk"
echo "TOOLS_PLATFORM.awk?= $prefix/bin/nawk" >> ${TARGET_MKCONF}
echo "TOOLS_PLATFORM.awk?= $wrkdir/bin/nawk" >> ${BOOTSTRAP_MKCONF}
;;
+*)
+ if [ -n "${bootstrap_awk}" ]; then
+ echo "TOOLS_PLATFORM.awk?= ${bootstrap_awk}" >> ${TARGET_MKCONF}
+ echo "TOOLS_PLATFORM.awk?= ${bootstrap_awk}" >> ${BOOTSTRAP_MKCONF}
+ fi
+ ;;
esac
# bootstrap sed if necessary
@@ -1308,6 +1333,12 @@ yes) echo_msg "Bootstrapping sed"
echo "TOOLS_PLATFORM.sed?= $prefix/bin/nbsed" >> ${TARGET_MKCONF}
echo "TOOLS_PLATFORM.sed?= $wrkdir/bin/sed" >> ${BOOTSTRAP_MKCONF}
;;
+*)
+ if [ -n "${bootstrap_sed}" ]; then
+ echo "TOOLS_PLATFORM.sed?= ${bootstrap_sed}" >> ${TARGET_MKCONF}
+ echo "TOOLS_PLATFORM.sed?= ${bootstrap_sed}" >> ${BOOTSTRAP_MKCONF}
+ fi
+ ;;
esac
# bootstrap pkg_install