description.md
1 This is a system of building and caching dependencies necessary for building Bitcoin. 2 There are several features that make it different from most similar systems: 3 4 ### It is designed to be builder and host agnostic 5 6 In theory, binaries for any target OS/architecture can be created, from a 7 builder running any OS/architecture. In practice, build-side tools must be 8 specified when the defaults don't fit, and packages must be amended to work 9 on new hosts. 10 11 ### No reliance on timestamps 12 13 File presence is used to determine what needs to be built. This makes the 14 results distributable and easily digestable by automated builders. 15 16 ### Each build only has its specified dependencies available at build-time. 17 18 For each build, the sysroot is wiped and the (recursive) dependencies are 19 installed. This makes each build deterministic, since there will never be any 20 unknown files available to cause side-effects. 21 22 ### Each package is cached and only rebuilt as needed. 23 24 Before building, a unique build-id is generated for each package. This id 25 consists of a hash of all files used to build the package (Makefiles, packages, 26 etc), and as well as a hash of the same data for each recursive dependency. If 27 any portion of a package's build recipe changes, it will be rebuilt as well as 28 any other package that depends on it. If any of the main makefiles (Makefile, 29 funcs.mk, etc) are changed, all packages will be rebuilt. After building, the 30 results are cached into a tarball that can be reused and distributed. 31 32 ### Package build results are (relatively) deterministic. 33 34 Each package is configured and patched so that it will yield the same 35 build-results with each consequent build, within a reasonable set of 36 constraints. Some things like timestamp insertion are unavoidable, and are 37 beyond the scope of this system. Additionally, the toolchain itself must be 38 capable of deterministic results. When revisions are properly bumped, a cached 39 build should represent an exact single payload. 40 41 ### Sources are fetched and verified automatically 42 43 Each package must define its source location and checksum. The build will fail 44 if the fetched source does not match. Sources may be pre-seeded and/or cached 45 as desired. 46 47 ### Self-cleaning 48 49 Build and staging dirs are wiped after use, and any previous version of a 50 cached result is removed following a successful build. Automated builders 51 should be able to build each revision and store the results with no further 52 intervention.