Tue Jul 21 15:53:10 2020 UTC ()
bootstrap: Fix machine_arch detection on Apple Sillicon

machine_arch was empty on Apple Sillicon. We could also use `uname -m` but that
returns arm64 which is not accepted by mk/gnu-config/config.sub.


(sjmulder)
diff -r1.288 -r1.289 pkgsrc/bootstrap/bootstrap

cvs diff -r1.288 -r1.289 pkgsrc/bootstrap/bootstrap (expand / switch to unified diff)

--- pkgsrc/bootstrap/bootstrap 2020/07/15 10:32:12 1.288
+++ pkgsrc/bootstrap/bootstrap 2020/07/21 15:53:10 1.289
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1#! /bin/sh 1#! /bin/sh
2 2
3# $NetBSD: bootstrap,v 1.288 2020/07/15 10:32:12 jperkin Exp $ 3# $NetBSD: bootstrap,v 1.289 2020/07/21 15:53:10 sjmulder Exp $
4# 4#
5# Copyright (c) 2001-2011 Alistair Crooks <agc@NetBSD.org> 5# Copyright (c) 2001-2011 Alistair Crooks <agc@NetBSD.org>
6# All rights reserved. 6# All rights reserved.
7# 7#
8# Redistribution and use in source and binary forms, with or without 8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions 9# modification, are permitted provided that the following conditions
10# are met: 10# are met:
11# 1. Redistributions of source code must retain the above copyright 11# 1. Redistributions of source code must retain the above copyright
12# notice, this list of conditions and the following disclaimer. 12# notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright 13# 2. Redistributions in binary form must reproduce the above copyright
14# notice, this list of conditions and the following disclaimer in the 14# notice, this list of conditions and the following disclaimer in the
15# documentation and/or other materials provided with the distribution. 15# documentation and/or other materials provided with the distribution.
16# 16#
@@ -209,26 +209,29 @@ get_abi() @@ -209,26 +209,29 @@ get_abi()
209get_machine_arch_aix() 209get_machine_arch_aix()
210{ 210{
211 _cpuid=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` 211 _cpuid=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
212 if /usr/sbin/lsattr -El $_cpuid | grep ' POWER' >/dev/null 2>&1; then 212 if /usr/sbin/lsattr -El $_cpuid | grep ' POWER' >/dev/null 2>&1; then
213 echo rs6000 213 echo rs6000
214 else 214 else
215 echo powerpc 215 echo powerpc
216 fi 216 fi
217} 217}
218 218
219get_machine_arch_darwin() 219get_machine_arch_darwin()
220{ 220{
221 case `uname -p` in 221 case `uname -p` in
 222 arm)
 223 echo "aarch64"
 224 ;;
222 i386) 225 i386)
223 # Returns "i386" or "x86_64" depending on CPU 226 # Returns "i386" or "x86_64" depending on CPU
224 echo `uname -m` 227 echo `uname -m`
225 ;; 228 ;;
226 powerpc) 229 powerpc)
227 echo "powerpc" 230 echo "powerpc"
228 ;; 231 ;;
229 esac 232 esac
230} 233}
231 234
232check_prog() 235check_prog()
233{ 236{
234 _var="$1"; _name="$2" 237 _var="$1"; _name="$2"