Revisiting NetBSD's Build System: A Powerful, Yet Arcane Tool

2024-12-31

This blog post revisits NetBSD's build system, a powerful yet somewhat arcane system based on a combination of BSD make and shell scripts. It allows building a complete NetBSD system from scratch on virtually any POSIX platform, without root privileges, and supports cross-compilation to various architectures. The author details the build process, including toolchain generation, build structure, the destdir mechanism, unprivileged builds, and distribution media creation. While acknowledging shortcomings like inefficient incremental builds and imperfect dependency management, the author highlights the system's strengths and design philosophy. The author concludes by mentioning a current embedded project utilizing NetBSD and explores the possibility of migrating the build system to Bazel for enhanced efficiency.

Development build system