Having
```nix
host_toolchain = "//build/toolchain/linux/unbundle:host";
v8_snapshot_toolchain = "//build/toolchain/linux/unbundle:host";
```
on native, non-cross-compilation builds roughly doubles the build steps
and, by proxy, compute and time needed to build.
So to resolve this, we conditionally change those values depending on
whether we are cross-compiling or not.
Co-authored-by: Adam Joseph <adam@westernsemico.com>
Also update default.nix to match the default.nix in
MetaCoq/metacoq:.nix/coq-overlays/metacoq/default.nix
Because some files have changed names, some version-dependent
building is required to keep building older versions.
And Metacoq's default.nix had older version checksums.
We use the more recent versions from nixpkgs for coq 8.14-8.16
Co-authored-by: Lars Rasmusson <Lars.Rasmusson@rise>
Without this patch, the following build error occurs for me on NixOS:
```
$ nix-build -A clisp --check
<snipped>
Running phase: buildPhase
build flags: SHELL=/nix/store/q8qq40xg2grfh9ry1d9x4g7lq4ra7n81-bash-5.2-p21/bin/bash
ln -s ../src/.gdbinit .gdbinit
rm -f build-aux
ln -s ../src/build-aux build-aux
mkdir -p gllib
test -f gllib/Makefile || sh config.status gllib/Makefile depfiles
cd gllib && make CFLAGS="-g -O2 -no-integrated-cpp -W -Wswitch -Wcomment -Wpointer-arith -Wreturn-type -Wmissing-declarations -Wimplicit -Wno-sign-compare -Wno-format-nonliteral -Wno-shift-negative-value -O -fwrapv -pthread -fno-strict-aliasing -DNO_ASM -DENABLE_UNICODE -DMULTITHREAD -DPOSIX_THREADS -DDYNAMIC_FFI -DDYNAMIC_MODULES -fPIC -DPIC " top_srcdir="/build/source/src"
make[1]: Entering directory '/build/source/builddir/gllib'
cd /build/source/src && /nix/store/q8qq40xg2grfh9ry1d9x4g7lq4ra7n81-bash-5.2-p21/bin/bash /build/source/src/build-aux/missing automake-1.16 --gnits gllib/Makefile
/build/source/src/build-aux/missing: line 81: automake-1.16: command not found
WARNING: 'automake-1.16' is missing on your system.
You should only need it if you modified 'Makefile.am' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'automake' program is part of the GNU Automake package:
<https://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<https://www.gnu.org/software/autoconf>
<https://www.gnu.org/software/m4/>
<https://www.perl.org/>
make[1]: *** [Makefile:1333: ../../src/gllib/Makefile.in] Error 127
make[1]: Leaving directory '/build/source/builddir/gllib'
make: *** [Makefile:648: gllib/libgnu.a] Error 2
```
This message was also reproduced by @2xsaiko on their NAS machine.
I don't know why this error sometimes occurs and sometimes does not.
On my Ubuntu machines, this error does not occur, and instead it does this:
```
Running phase: buildPhase
build flags: SHELL=/nix/store/q8qq40xg2grfh9ry1d9x4g7lq4ra7n81-bash-5.2-p21/bin/bash
ln -s ../src/.gdbinit .gdbinit
rm -f build-aux
ln -s ../src/build-aux build-aux
mkdir -p gllib
test -f gllib/Makefile || sh config.status gllib/Makefile depfiles
cd gllib && make CFLAGS="-g -O2 -no-integrated-cpp -W -Wswitch -Wcomment -Wpointer-arith -Wreturn-type -Wmissing-declarations -Wimplicit -Wno-sign-compare -Wno-format-nonliteral -Wno-shift-negative-value -O -fwrapv -pthread -fno-strict-aliasing -DNO_ASM -DENABLE_UNICODE -DMULTITHREAD -DPOSIX_THREADS -DDYNAMIC_FFI -DDYNAMIC_MODULES -fPIC -DPIC " top_srcdir="/build/source/src"
make[1]: Entering directory '/build/source/builddir/gllib'
make[2]: Entering directory '/build/source/builddir'
make[2]: Nothing to be done for 'am--refresh'.
make[2]: Leaving directory '/build/source/builddir'
cd .. && make am--refresh
make[2]: Entering directory '/build/source/builddir'
make[2]: Nothing to be done for 'am--refresh'.
make[2]: Leaving directory '/build/source/builddir'
<snipped>
```
In any case, these changes work successfully on all platforms I've tested them on:
1. NixOS
2. Ubuntu 22.04
3. MacOS x86_64
4. MacOS aarch64