compile_vergen.sh¶
Generates compile-time version constants and release badges.
Overview¶
compile_vergen.sh extracts version metadata from Git tags (using semantic versioning), gathers build statistics (line counts, file counts, tool versions), and writes them into a Pascal unit (core.version.pas). It also downloads shields.io SVG badges summarizing the release information.
Prerequisites¶
git,wget,fpc,make,nasm,awk,find,md5sum, anddatemust be available.- The repository must have at least one semver-compatible Git tag reachable from HEAD.
compile_checksum.shmust be present in the toolchain directory (called to generatechecksums.md5first).loc.shmust be present in the toolchain directory.- The
bin/,release/, andsrc/core/directories must exist.
Inputs¶
| Source | Description |
|---|---|
| Git tags | Parsed via git describe --tags to extract semver components. |
checksums.md5 |
Generated by compile_checksum.sh; its own MD5 is used as a build fingerprint. |
Source tree (src/) |
Scanned to count total files and driver files. |
| Tool versions | Queried from fpc -h, make -v, and nasm -v. |
Outputs¶
| File | Description |
|---|---|
src/core/core.version.pas |
Pascal unit exposing version constants to the kernel at compile time. |
release/*.svg |
Shields.io badges for version, revision, release, line count, file count, driver count, tool versions, date, and fingerprint. |
Behavior¶
- Runs
compile_checksum.shto producechecksums.md5. - Downloads the
semvershell tool from GitHub intobin/and adds it toPATH. - Extracts the following from
git describe --tags: - Major, minor, and patch version numbers.
- Pre-release label (if any).
- Build metadata.
- Short commit revision (8 characters).
- Counts total lines of Pascal source (via
loc.sh), total source files, and driver-specific files. - Queries the installed versions of FPC, Make, and NASM.
- Records the current date and time.
- Computes an MD5 fingerprint of
checksums.md5. - Writes all values into
src/core/core.version.pasas Pascalconstdeclarations. - Downloads SVG badges from shields.io into
release/for each metric. Badge download failures are non-fatal (set +e).
Notes¶
- The
set -eat the top causes the script to abort on any error during the critical version-extraction phase. It is relaxed (set +e) before badge downloads, since those are cosmetic and may fail in offline or branch builds. - If a pre-release label is present in the tag, it is appended to the version string (e.g.,
1.0.0-alpha). - The generated
core.version.pasis compiled into the kernel bycompile_sources.sh, making all version metadata available at runtime.