changeset 352: |
cee930bed936 |
parent: |
e2b8d0be0d24
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Sun, 28 Jul 2024 21:39:56 -0400 |
permissions: |
-rwxr-xr-x |
description: |
bump lisp version |
19 export INFRA_HOST_CONFIG=$(cat
/proc/sys/kernel/hostname
).sxp
20 rm
-f
$INFRA_HOST_CONFIG 22 local _mem_total="$RETVAL" 26 get_architecture
|| return 1 28 assert_nz
"$_arch" "arch" 29 _write
";;; $INFRA_HOST_CONFIG -*- mode:skel -*-" 30 _write
":arch \"$_arch\"" 32 local _kernel_version="$RETVAL" 33 _write
":kernel \"$_kernel_version\"" 35 local _num_cpus="$RETVAL" 36 _write
":cpus $_num_cpus" 37 _write
":mem $_mem_total" 45 say
$INFRA_HOST_CONFIG 53 say
"$1=$(eval echo "\$$1" 2>
/dev/null
)" 57 say
"$1" >>
$INFRA_HOST_CONFIG 66 if [ -z
"$1" ]; then err
"assert_nz $2"; fi 70 command -v
"$1" >
/dev/null
2>
&1 74 if !
check_cmd
"$1"; then 75 err
"need '$1' (command not found)" 80 if !
"$@"; then err
"command failed: $*"; fi 84 # Check for /proc by looking for the /proc/self/exe link 85 # This is only run on Linux 86 if !
test -L
/proc/self/exe
; then 87 err
"fatal: Unable to find /proc/self/exe. Is /proc mounted? Installation cannot proceed without /proc." 92 # Architecture detection without dependencies beyond coreutils. 93 # ELF files start out "\x7fELF", and the following byte is 96 # The printf builtin on some shells like dash only supports octal 97 # escape sequences, so we use those. 98 local _current_exe_head
99 _current_exe_head=$(head
-c
5 /proc/self/exe
) 100 if [ "$_current_exe_head" = "$(printf '\177ELF\001')" ]; then 102 elif [ "$_current_exe_head" = "$(printf '\177ELF\002')" ]; then 105 err
"unknown platform bitness" 109 is_host_amd64_elf
() { 110 # ELF e_machine detection without dependencies beyond coreutils. 111 # Two-byte field at offset 0x12 indicates the CPU, 112 # but we're interested in it being 0x3E to indicate amd64, or not that. 113 local _current_exe_machine
114 _current_exe_machine=$(head
-c
19 /proc/self/exe
| tail
-c
1) 115 [ "$_current_exe_machine" = "$(printf '\076')" ] 123 # detect endianness without od/hexdump, like get_bitness() does. 124 local _current_exe_endianness
125 _current_exe_endianness="$(head
-c
6 /proc/self/exe
| tail
-c
1)" 126 if [ "$_current_exe_endianness" = "$(printf '\001')" ]; then 127 echo "${cputype}${suffix_el}" 128 elif [ "$_current_exe_endianness" = "$(printf '\002')" ]; then 129 echo "${cputype}${suffix_eb}" 131 err
"unknown platform endianness" 136 local _ostype
_cputype
_bitness
_arch
_clibtype
137 _ostype="$(uname
-s
)" 138 _cputype="$(uname
-m
)" 141 if [ "$_ostype" = Linux
]; then 142 if [ "$(uname
-o
)" = Android
]; then 145 if ldd
--version
2>
&1 | grep
-q
'musl'; then 150 if [ "$_ostype" = Darwin
] && [ "$_cputype" = i386
]; then 151 # Darwin `uname -m` lies 152 if sysctl
hw.optional.x86_64
| grep
-q
': 1'; then 157 if [ "$_ostype" = SunOS
]; then 158 # Both Solaris and illumos presently announce as "SunOS" in "uname -s" 159 # so use "uname -o" to disambiguate. We use the full path to the 160 # system uname in case the user has coreutils uname first in PATH, 161 # which has historically sometimes printed the wrong value here. 162 if [ "$(/usr/bin/uname
-o
)" = illumos
]; then 166 # illumos systems have multi-arch userlands, and "uname -m" reports the 167 # machine hardware name; e.g., "i86pc" on both 32- and 64-bit x86 168 # systems. Check for the native (widest) instruction set on the 170 if [ "$_cputype" = i86pc
]; then 171 _cputype="$(isainfo
-n
)" 178 _ostype=linux-android
183 _ostype=unknown-linux-
$_clibtype 184 _bitness=$(get_bitness
) 188 _ostype=unknown-freebsd
192 _ostype=unknown-netbsd
196 _ostype=unknown-dragonfly
204 _ostype=unknown-illumos
207 MINGW*
| MSYS*
| CYGWIN*
| Windows_NT
) 208 _ostype=pc-windows-gnu
212 err
"unrecognized OS type: $_ostype" 219 i386
| i486
| i686
| i786
| x86
) 225 if [ "$_ostype" = "linux-android" ]; then 226 _ostype=linux-androideabi
232 if [ "$_ostype" = "linux-android" ]; then 233 _ostype=linux-androideabi
235 _ostype="${_ostype}eabihf" 241 if [ "$_ostype" = "linux-android" ]; then 242 _ostype=linux-androideabi
244 _ostype="${_ostype}eabihf" 252 x86_64
| x86-64
| x64
| amd64
) 257 _cputype=$(get_endianness
mips
'' el
) 261 if [ "$_bitness" -eq
64 ]; then 262 # only n64 ABI is supported for now 263 _ostype="${_ostype}abi64" 264 _cputype=$(get_endianness
mips64
'' el
) 290 err
"unknown CPU type: $_cputype" 294 # Detect 64-bit linux with 32-bit userland 295 if [ "${_ostype}" = unknown-linux-gnu
] && [ "${_bitness}" -eq
32 ]; then 298 if [ -n
"${CPUTYPE:-}" ]; then 301 # 32-bit executable for amd64 = x32 302 if is_host_amd64_elf
; then { 303 echo "This host is running an x32 userland; as it stands, x32 support is poor," 1>
&2 304 echo "and there isn't a native toolchain -- you will have to install" 1>
&2 305 echo "multiarch compatibility with i686 and/or amd64, then select one" 1>
&2 306 echo "by re-running this script with the CPUTYPE environment variable" 1>
&2 307 echo "set to i686 or x86_64, respectively." 1>
&2 315 _cputype=$(get_endianness
mips
'' el
) 322 if [ "$_ostype" = "linux-android" ]; then 323 _ostype=linux-androideabi
325 _ostype="${_ostype}eabihf" 329 err
"riscv64 with 32-bit userland unsupported" 334 if [ "$_ostype" = "unknown-linux-gnueabihf" ] && [ "$_cputype" = armv7
]; then 335 if ensure
grep
'^Features' /proc/cpuinfo
| grep
-q
-v
neon
; then 336 # At least one processor does not have NEON. 341 _arch="${_cputype}-${_ostype}" 348 _mem_total=$(awk
'/MemTotal/ {print $2}' /proc/meminfo
) 354 local _mem_total="$RETVAL" 355 local _mem_min=8388608 # 8Gb in kB 356 if [ "$_mem_total" -lt
"$_mem_min" ]; then 357 err
"not enough memory: $_mem_total < $_mem_min"; 363 _disk_free=$(df
.
| tail
-n1
| awk
'{print $4}') 364 RETVAL="${_disk_free}" 369 local _disk_free="$RETVAL" 370 local _disk_min=33554432 # in bytes 371 if [ "$_disk_free" -lt
"$_disk_min" ]; then 372 err
"not enough disk space: $_disk_free < $_disk_min" 377 local _kernel_version
378 _kernel_version=$(uname
-r
) 379 RETVAL="$_kernel_version" 383 if !
lsmod
| grep
-wq
"$1"; then 384 err
"kernel module $1 isn't loaded" 390 _num_cpus=$(grep
-c
'^processor' /proc/cpuinfo
2>/dev/null
) 392 # sysctl -n hw.ncpu # nproc --all 397 local _num_cpus="$RETVAL" 399 if [ "$_num_cpus" -lt
"$_min_cpus" ]; then 400 err
"not enough cpu threads ($_num_cpus < $_min_cpus)" 410 say_var
INSTALL_PREFIX