pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/bootstrap bootstrap: Switch to native awk/sed on illumos.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d43e0348ab12
branches:  trunk
changeset: 387996:d43e0348ab12
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Fri Nov 11 17:22:14 2022 +0000

description:
bootstrap: Switch to native awk/sed on illumos.

diffstat:

 bootstrap/bootstrap |  37 ++++++++++++++++++++++++++++++++++---
 1 files changed, 34 insertions(+), 3 deletions(-)

diffs (84 lines):

diff -r 6acc1ed5274c -r d43e0348ab12 bootstrap/bootstrap
--- a/bootstrap/bootstrap       Fri Nov 11 16:24:16 2022 +0000
+++ b/bootstrap/bootstrap       Fri Nov 11 17:22:14 2022 +0000
@@ -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@localhost>
 # All rights reserved.
@@ -390,6 +390,14 @@
        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 @@
        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 @@
        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 @@
        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



Home | Main Index | Thread Index | Old Index