- build_dos.sh: Linux-friendly cross-compile to DOS via OpenWatcom V2.
OpenWatcom's wmake on Linux can't apply the .c.obj implicit rule for
subdirectory paths, and Makefile.dos / Makefile.dos16 rely on DOS-
only commands like 'del'. Script invokes wcc / wcc386 directly,
tracks 16-bit vs 32-bit mode via a stamp file (auto-cleans on
switch), generates a wlink directive file (the brace-delimited file
list wouldn't survive shell quoting), and supports clean. The DOS
Makefiles still work on Windows / DOS hosts.
- tests/run_compiler_tests.sh: AOT compiler harness. For each .bas
in tests/programs/, compiles via gwbasic-compile -c, runs the
resulting executable, normalizes output and diffs against the
golden file from tests/expected/. Skip list covers chain/common
multi-file flows, hardware/timing-dependent programs, unnumbered
direct-mode programs (compiler requires line numbers), and
misc_stmts/run_file (interpreter-vs-compiler ON ERROR divergence).
Result: 56/56 pass.
- tests/run_dos_smoke.sh + dos_smoke.bas + expected: runs gwbasic16.exe
under DOSBox-X (flatpak) with a program that exercises arithmetic,
strings, control flow, GOSUB, FOR/NEXT, DATA/READ, DEF FN, OPEN/
PRINT#/CLOSE, and diffs against the interpreter's golden output.
Uses $HOME for the staging dir (DOSBox-X flatpak doesn't see /tmp).
- pkg/GWBASIC.LSM + pkg/build_pkg.sh: FreeDOS submission package.
Produces dist/gwbasic-<VERSION>.zip with the standard FreeDOS
layout (APPINFO/GWBASIC.LSM, BIN/GWBASIC.EXE, DOC/GWBASIC/{README,
CHANGES,LICENSE} with CRLF, SOURCE/GWBASIC/<full source>). Source
tree is filtered through git ls-files to exclude build artifacts.
- docs/Makefile: standard Sphinx Makefile so 'cd docs && make html'
works as documented in README.md.
- .github/workflows/ci.yml: split into two jobs. build-and-test now
also runs the compiler harness. New dos-cross-compile job caches
~/openwatcom-v2, downloads the OpenWatcom V2 snapshot if not
cached, builds both 16-bit and 32-bit DOS binaries, asserts size
bounds, and uploads them as artifacts.
- .gitignore: ignore .dos_build_mode (script's stamp), .link_dir/
(transient wlink directive dir), dist/ (package output).
67 lines
2.1 KiB
Bash
Executable File
67 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build a FreeDOS-ready package for GW-BASIC 2026.
|
|
#
|
|
# Produces dist/gwbasic-<VERSION>.zip with the layout FreeDOS expects:
|
|
# APPINFO/GWBASIC.LSM (Linux Software Map metadata)
|
|
# BIN/GWBASIC.EXE (16-bit real-mode interpreter)
|
|
# DOC/GWBASIC/README (project README, CRLF)
|
|
# DOC/GWBASIC/CHANGES (version history, CRLF)
|
|
# DOC/GWBASIC/LICENSE (MIT, CRLF)
|
|
# SOURCE/GWBASIC/<...> (full source tree, optional)
|
|
#
|
|
# Run from the project root: ./pkg/build_pkg.sh
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
cd "$PROJECT_DIR"
|
|
|
|
VERSION=$(grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' include/gwbasic.h | tr -d '"')
|
|
[ -n "$VERSION" ] || { echo "Cannot determine version from include/gwbasic.h" >&2; exit 1; }
|
|
|
|
echo "==> Packaging GW-BASIC 2026 v$VERSION"
|
|
|
|
if [ ! -f gwbasic16.exe ] || [ src/main.c -nt gwbasic16.exe ]; then
|
|
echo "==> Building gwbasic16.exe"
|
|
./build_dos.sh clean
|
|
./build_dos.sh 16
|
|
fi
|
|
|
|
STAGE=$(mktemp -d --tmpdir="$HOME" gw_pkg.XXXXXX)
|
|
trap 'rm -rf "$STAGE"' EXIT
|
|
|
|
mkdir -p "$STAGE/APPINFO" "$STAGE/BIN" "$STAGE/DOC/GWBASIC" "$STAGE/SOURCE/GWBASIC"
|
|
|
|
# Metadata
|
|
cp pkg/GWBASIC.LSM "$STAGE/APPINFO/GWBASIC.LSM"
|
|
unix2dos -q "$STAGE/APPINFO/GWBASIC.LSM" 2>/dev/null \
|
|
|| sed -i 's/$/\r/' "$STAGE/APPINFO/GWBASIC.LSM"
|
|
|
|
# Binary
|
|
cp gwbasic16.exe "$STAGE/BIN/GWBASIC.EXE"
|
|
|
|
# Documentation (DOS line endings, 8.3-friendly names)
|
|
cp README.md "$STAGE/DOC/GWBASIC/README"
|
|
cp CHANGES.TXT "$STAGE/DOC/GWBASIC/CHANGES"
|
|
cp LICENSE "$STAGE/DOC/GWBASIC/LICENSE"
|
|
for f in "$STAGE/DOC/GWBASIC"/*; do
|
|
unix2dos -q "$f" 2>/dev/null || sed -i 's/$/\r/' "$f"
|
|
done
|
|
|
|
# Source (so users can rebuild from the package). Follow git's tracked-files
|
|
# list to avoid bundling build/, _build/, *.obj, etc.
|
|
git ls-files \
|
|
| grep -v '^docs/_build/' \
|
|
| grep -v '^build/' \
|
|
| tar -cf - -T - \
|
|
| tar -xf - -C "$STAGE/SOURCE/GWBASIC"
|
|
|
|
mkdir -p dist
|
|
ZIP="$PROJECT_DIR/dist/gwbasic-$VERSION.zip"
|
|
rm -f "$ZIP"
|
|
( cd "$STAGE" && zip -rq "$ZIP" APPINFO BIN DOC SOURCE )
|
|
|
|
echo
|
|
echo "==> Wrote $ZIP"
|
|
unzip -l "$ZIP" | tail -8
|