Files
VCCPlusOSS/tools/toolchain/build-coco-letters.py
T
Brian Holman 5534005799 Sync VCC Plus 3.7.1 build 67 source
Refresh reviewed MCP output export, four-drive owned playtests, bounded BASIC readiness, and pinned CMOC 0.1.101 source/patches. Preserve independent source-edition identity, empty libraries, notices and privacy boundaries.

Validated 74 export/privacy checks, pinned dependency sources, and an independent unsigned universal Release build. A subsequent documentation-only correction removes an excluded qualification link; all build inputs remain identical.
2026-11-17 08:42:27 -07:00

38 lines
2.0 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
"""Build the reviewed CoCo Letters source and a DOS-bootable DSK without downloading."""
import argparse
import json
import os
from pathlib import Path
import shutil
import subprocess
ROOT=Path(__file__).resolve().parents[2]
def main():
parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument('--toolchain', type=Path, required=True)
parser.add_argument('--output', type=Path, default=ROOT/'.build/coco-letters')
args=parser.parse_args()
prefix=args.toolchain.resolve();out=args.output.resolve()
features=json.loads((prefix/'VCC-toolchain.json').read_text())
if not features['standaloneDisk']:
raise SystemExit('CoCo Letters requires the optional private standalone disk source; see docs/development/TOOLCHAIN.md')
if out.exists(): raise SystemExit('Choose a fresh --output directory')
out.mkdir(parents=True)
env=dict(os.environ, PATH=str(prefix/'bin')+os.pathsep+os.environ['PATH'])
env.setdefault('DEVELOPER_DIR','/Applications/Xcode.app/Contents/Developer')
for name in ('decbfile','bcontrol','bsound'):
shutil.copytree(ROOT/'third_party/cmoc-libraries'/name,out/name)
subprocess.run(['make','-j4',f'lib{name}.a'],cwd=out/name,env=env,check=True)
game=out/'game';shutil.copytree(ROOT/'third_party/examples/coco-letters',game)
# Preserve the old ascending layout, using the new explicit spelling.
recipe=game/'Makefile'
recipe.write_text(recipe.read_text().replace('--allocate-before-dir','--allocate-forward'))
# Upstream generates two outputs in one rule; serial make avoids duplicate writes.
subprocess.run(['make','DECBFILE_LIB_DIR=../decbfile','BCONTROL_LIB_DIR=../bcontrol','BSOUND_LIB_DIR=../bsound'],cwd=game,env=env,check=True)
disk=game/'coco-letters-0.1.0.dsk'
if disk.stat().st_size!=35*18*256: raise SystemExit('Unexpected disk geometry')
print(f'Built disk: {disk}\nMount in FD0, select RGB, then type DOS. Requires CoCo 3, 128 KB or more.')
if __name__=='__main__': main()