NetBSD C++ playground project
#!/bin/bashset -euo pipefail# lspp is a submodule; initialize it without moving an existing checkout.if git rev-parse --git-dir >/dev/null 2>&1 && git submodule status | grep -q '^-'then git submodule update --init --recursivefiQCOW=netbsd.qcow2INSTALLER_ISO=netbsd-installer.isoif [ ! -f "$QCOW" ]then qemu-img create -f qcow2 "$QCOW" 16Gfiif [ ! -f "$INSTALLER_ISO" ]then wget -O "$INSTALLER_ISO" 'https://cdn.netbsd.org/pub/NetBSD/NetBSD-11.0/images/NetBSD-11.0-amd64-dvd.iso'fiif [ ! -f "src.tgz" ]then wget -r -np -nd -A '*.tgz' \ ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-11.0/source/sets/fi# netbsd is the build toolchain etc.if [ ! -d "netbsd" ]then mkdir -p netbsd for file in *.tgz; do tar xvf "$file" netbsd/ doneficd netbsd/usr/srcif [ ! -d "./netbsd/tools" ]then # patch for GCC 16 sed -i \ 's/void g(){}/void g(int,t1 const*,t1,t2,t1 const*,int){}/g' \ external/lgpl3/gmp/dist/configure \ external/lgpl3/gmp/dist/acinclude.m4 ./build.sh \ -U -u -j10 \ -m amd64 \ -x \ -O "../../obj" \ -T "../../tools" \ -D "../../sysroot" \ -R "../../release" \ -V MKCXX=yes \ -V HOST_CFLAGS="-O2 -std=gnu17" \ distributionfi