#!/bin/bash set -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 --recursive fi QCOW=netbsd.qcow2 INSTALLER_ISO=netbsd-installer.iso if [ ! -f "$QCOW" ] then qemu-img create -f qcow2 "$QCOW" 16G fi if [ ! -f "$INSTALLER_ISO" ] then wget -O "$INSTALLER_ISO" 'https://cdn.netbsd.org/pub/NetBSD/NetBSD-11.0/images/NetBSD-11.0-amd64-dvd.iso' fi if [ ! -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/ done fi cd netbsd/usr/src if [ ! -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" \ distribution fi