c71e249a4e
First substantive commit: the entire Sprinter C compiler tree on top of
the bare README+gitignore initial commit.
What's in here:
bin/sprinter-cc — driver script invoking SDCC + linker + mkexe
libc/ — Sprinter-specific libc layer over ESTEX/BIOS
(conio, gfx, io, mem, stdio + headers)
runtime/ — crt0 variants (default/small/banked/minimal)
+ heap + bank trampolines
toolchain/ — mkexe (SprintEXE packer, C + tests)
examples/ — 30 demo programs (gfx, file I/O, env, time, …)
lib/Makefile — builds the libc archive (sprinter.lib)
docs/ — converted Sprinter manuals + asm reference samples
third_party/ — solid-c reference compiler dump + sdcc setup script
release_docs/ — packaging / release notes
gitignore overhaul:
• Drop dangerous blanket patterns: *.asm (would hide docs/samples/*.asm)
and *.exe (case-insensitive match was hiding third_party/solid-c/*.EXE
on macOS APFS). Replaced with examples/*/*.{asm,exe,…} and lib/*.lib.
• Restore tracking of toolchain/mkexe/tests/{one,big}.bin — those are
INPUT fixtures, not build outputs.
• Collapse the duplicated SDCC/C/Sdcc sections into one section per
concern (build outputs / vendored / OS-junk).
• Add .sprinter-cc-*/, build/ (catches lib/build/ too), .claude/.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
109 lines
4.3 KiB
Bash
Executable File
109 lines
4.3 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# make_release.sh — pack a redistributable Sprinter C Compiler release tarball.
|
|
#
|
|
# Whitelist-based: only files explicitly listed below go into the tarball.
|
|
# Anything else (internal dev tools, research docs, build artefacts, mac
|
|
# xattr sidecars, .git, .claude memory, etc.) is excluded by construction.
|
|
#
|
|
# Output: build/sprinter-c-v<VERSION>-<host>.tar.gz with:
|
|
# - bin/sprinter-cc : compiler driver
|
|
# - toolchain/mkexe/ : .ihx → .exe utility (prebuilt for host)
|
|
# - toolchain/check_banks.py : bank size checker used by sprinter-cc
|
|
# - runtime/ : crt0 + bank/heap support
|
|
# - libc/include/ : public headers
|
|
# - libc/{io,stdio,mem,gfx}/ : libc sources (assembled into sprinter.lib)
|
|
# - lib/Makefile + lib/sprinter.lib : prebuilt library + recipe to rebuild
|
|
# - examples/ : 27 ready-to-build programs
|
|
# - third_party/sdcc/ : vendored SDCC 4.5
|
|
# - release_docs/ → docs/ : user-facing documentation
|
|
# - examples.mk-style root Makefile, README, RELEASE_NOTES, LICENSE
|
|
#
|
|
# NOT included (developer-only):
|
|
# - docs/ (research notes, original PetersPlus reference material)
|
|
# - third_party/solid-c/ (reference for Solid-C compat target)
|
|
# - mame/ (large emulator + Sprinter HDD/CD images)
|
|
# - .git/, .claude/, .DS_Store, ._* (macOS xattrs)
|
|
# - this script itself (toolchain/make_release.sh)
|
|
# - any build artefacts (.sprinter-cc-*, *.rel, *.ihx, *.lk, *.map, ...)
|
|
#
|
|
# Usage: ./toolchain/make_release.sh [VERSION]
|
|
|
|
set -euo pipefail
|
|
|
|
VERSION="${1:-1.0}"
|
|
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
|
|
HOST_ARCH="$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)"
|
|
NAME="sprinter-c-v${VERSION}-${HOST_ARCH}"
|
|
STAGE="$ROOT/build/$NAME"
|
|
TARBALL="$ROOT/build/$NAME.tar.gz"
|
|
|
|
cd "$ROOT"
|
|
|
|
echo ">> verifying build is clean and current"
|
|
make all >/dev/null 2>&1
|
|
|
|
echo ">> staging $STAGE"
|
|
rm -rf "$STAGE"
|
|
mkdir -p "$STAGE"
|
|
|
|
# --- WHITELIST: only these directories/files end up in the tarball ---
|
|
|
|
# Top-level metadata
|
|
cp README.md RELEASE_NOTES.md LICENSE Makefile "$STAGE/"
|
|
|
|
# Toolchain
|
|
cp -R bin runtime libc examples "$STAGE/"
|
|
# toolchain/ — only mkexe (prebuilt + sources) and check_banks.py
|
|
mkdir -p "$STAGE/toolchain/mkexe"
|
|
cp toolchain/mkexe/mkexe "$STAGE/toolchain/mkexe/"
|
|
cp toolchain/mkexe/mkexe.c "$STAGE/toolchain/mkexe/"
|
|
cp toolchain/mkexe/Makefile "$STAGE/toolchain/mkexe/"
|
|
[[ -f toolchain/mkexe/check.sh ]] && cp toolchain/mkexe/check.sh "$STAGE/toolchain/mkexe/"
|
|
cp toolchain/check_banks.py "$STAGE/toolchain/"
|
|
|
|
# Lib — keep Makefile and the prebuilt archive only; sources are in libc/
|
|
mkdir -p "$STAGE/lib"
|
|
cp lib/Makefile "$STAGE/lib/"
|
|
cp lib/sprinter.lib "$STAGE/lib/"
|
|
|
|
# Vendored SDCC — follow symlinks so the real content lands in the tarball
|
|
mkdir -p "$STAGE/third_party"
|
|
[[ -d third_party/sdcc ]] && cp -RL third_party/sdcc "$STAGE/third_party/"
|
|
[[ -f third_party/setup-sdcc.sh ]] && cp third_party/setup-sdcc.sh "$STAGE/third_party/"
|
|
|
|
# User-facing docs. Source: release_docs/{en,ru}/ → docs/{en,ru}/ in tarball.
|
|
# The internal docs/ tree (research notes, original Peters Plus material) is
|
|
# NOT shipped.
|
|
[[ -d release_docs ]] && cp -R release_docs "$STAGE/docs"
|
|
|
|
# --- Strip build artefacts that crept in via examples/ ---
|
|
echo ">> stripping build artefacts and macOS metadata"
|
|
find "$STAGE" \( \
|
|
-name '.sprinter-cc-*' -o \
|
|
-name '*.rel' -o -name '*.lst' -o -name '*.sym' -o -name '*.asm' -o \
|
|
-name '*.ihx' -o -name '*.lk' -o -name '*.map' -o -name '*.noi' -o \
|
|
-name '*.exe' -o \
|
|
-name '.DS_Store' -o -name '._*' \
|
|
\) -print0 | xargs -0 rm -rf
|
|
|
|
# Bonus: clean any *_test or scratch files I might have left in libc dirs
|
|
find "$STAGE/libc" -name 'build' -type d -exec rm -rf {} + 2>/dev/null || true
|
|
|
|
# --- Tarball ---
|
|
echo ">> packaging $TARBALL"
|
|
cd "$ROOT/build"
|
|
COPYFILE_DISABLE=1 tar --no-mac-metadata -czf "$TARBALL" "$NAME" 2>/dev/null || \
|
|
COPYFILE_DISABLE=1 tar -czf "$TARBALL" "$NAME"
|
|
rm -rf "$NAME"
|
|
|
|
ls -lh "$TARBALL"
|
|
echo
|
|
echo "Release ready: $TARBALL"
|
|
echo
|
|
echo "Try it:"
|
|
echo " tar xzf $(basename "$TARBALL")"
|
|
echo " cd $NAME"
|
|
echo " make all"
|
|
echo " bin/sprinter-cc -o hello.exe examples/hello/hello.c"
|