Publish VCC Plus OSS source distribution for 3.6.2 build 60

This commit is contained in:
Brian Holman committed 2026-11-13 00:14:03 -07:00
commit c652a5276d
1192 files changed
+272368

No files matched your search

+71
View File
@@ -0,0 +1,71 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
"""Compile the pinned libraries and a CoCo program; optionally execute it in VCC."""
import argparse
import os
import json
from pathlib import Path
import shutil
import subprocess
ROOT = Path(__file__).resolve().parents[2]
def main():
p = argparse.ArgumentParser(description=__doc__)
p.add_argument('--toolchain', type=Path, default=ROOT / '.build/toolchain/install')
p.add_argument('--output', type=Path, default=ROOT / '.build/toolchain-check')
p.add_argument('--rom', type=Path, help='Optional private 32 KiB CoCo 3 ROM; read only')
p.add_argument('--disk-rom', type=Path, help='Private Disk BASIC ROM for the optional game check')
p.add_argument('--game-disk', type=Path, help='Source-built CoCo Letters DSK; read only')
args = p.parse_args()
if (args.disk_rom or args.game_disk) and not (args.rom and args.disk_rom and args.game_disk):
p.error('The game check needs --rom, --disk-rom and --game-disk together')
out=args.output.resolve();out.mkdir(parents=True,exist_ok=True)
prefix=args.toolchain.resolve()
env=dict(os.environ, PATH=str(prefix/'bin')+os.pathsep+os.environ['PATH'])
env.setdefault('DEVELOPER_DIR','/Applications/Xcode.app/Contents/Developer')
def run(*command, cwd=out, **kw):
print('+', ' '.join(map(str,command)),flush=True)
return subprocess.run(list(map(str,command)),cwd=cwd,env=env,check=True,**kw)
run('python3',ROOT/'tools/toolchain/verify-sources.py')
for source in sorted((ROOT/'third_party/cmoc-libraries').iterdir()):
if not source.is_dir(): continue
dest=out/source.name
if dest.exists(): raise SystemExit(f'{dest} already exists; use a fresh --output')
shutil.copytree(source,dest)
run('make','-j4',f'lib{source.name}.a',cwd=dest)
assert (dest/f'lib{source.name}.a').stat().st_size > 0
run(prefix/'bin/cmoc','--coco','--intermediate','-o',out/'HELLO.BIN',ROOT/'tests/toolchain/hello.c')
data=(out/'HELLO.BIN').read_bytes()
offset=0;blocks=0
while offset<len(data) and data[offset]==0:
size=int.from_bytes(data[offset+1:offset+3],'big');offset+=5+size;blocks+=1
assert blocks and offset+5==len(data) and data[offset:offset+3]==b'\xff\0\0', 'Invalid DECB executable'
# A small known assembly result verifies the checked-in assembler independently.
(out/'known.asm').write_text(' org $4000\nstart lda #$42\n sta $0400\n rts\n end start\n')
run(prefix/'bin/lwasm','--format=raw','--output=known.bin','--list=known.lst','known.asm')
assert (out/'known.bin').read_bytes()==bytes.fromhex('8642b7040039')
features=json.loads((prefix/'VCC-toolchain.json').read_text())
if features['mc6839']:
run(prefix/'bin/cmoc','--coco','--mc6839','-o',out/'FLOAT.BIN',ROOT/'tests/toolchain/float.c')
if args.rom:
build=out/'xcode'
run('xcodebuild','-project',ROOT/'platforms/macos/VCC.xcodeproj','-scheme','VCCCoreChecks','-configuration','Release','-derivedDataPath',build,'build')
run('xcrun','clang++','-std=c++17','-O2','-mmacosx-version-min=14.0',ROOT/'tests/toolchain/run-compiled.cpp',build/'Build/Products/Release/libVCCCore.a','-o',out/'run-compiled')
run(out/'run-compiled',args.rom.resolve(),out/'HELLO.BIN')
for optimization in ('-O0', '-O2'):
binary = out / f'logical-negation{optimization}.bin'
run(prefix/'bin/cmoc', '--coco', '--org=2800', optimization, '-Werror', '-o', binary,
ROOT/'tests/toolchain/logical-negation.c')
run(out/'run-compiled', args.rom.resolve(), binary, 'NOT 010 1000 END')
run('python3', ROOT/'tests/toolchain/indexed-subtraction/check.py', prefix,
build/'Build/Products/Release/libVCCCore.a', args.rom.resolve())
run('python3', ROOT/'tests/toolchain/indexed-arguments/check.py', prefix,
build/'Build/Products/Release/libVCCCore.a', args.rom.resolve())
if features['mc6839']:
run(out/'run-compiled',args.rom.resolve(),out/'FLOAT.BIN','MC6839 MATH OK')
if args.game_disk:
run('xcrun','clang++','-std=c++17','-O2','-mmacosx-version-min=14.0',ROOT/'tests/toolchain/run-coco-letters.cpp',build/'Build/Products/Release/libVCCCore.a','-o',out/'run-coco-letters')
run(out/'run-coco-letters',args.rom.resolve(),args.disk_rom.resolve(),args.game_disk.resolve(),out/'captures')
print('PASS: nine library archives, CMOC compile/link, DECB format, assembler bytes; optional MC6839 arithmetic')
if __name__=='__main__': main()