Files
mars_nwe_pcab/cross/package-retrobrowser.py

31 lines
2.5 KiB
Python

#!/usr/bin/env python3
from pathlib import Path
import zipfile,hashlib,json
root=Path(__file__).resolve().parents[1];out=root/'releases/browser';out.mkdir(parents=True,exist_ok=True)
readme='''MARS RetroBrowser 0.9.1 - built client, runtime not validated.
Enable browser in the MARS web frontend, create a token and configure a LAN bind address.
Windows: SET RBP_TOKEN=<64-character-token>, then RETROB.EXE IPv4 port
Linux: RBP_TOKEN=<token> ./mars-retrobrowser-x11 IPv4 port https://example.org
The browser engine runs on the Linux server, not on the retro computer.
Tokens are private. RBP is unencrypted: use an isolated trusted network.
Windows executable: PE32 GUI 4.0, Winsock 1.1; OS runtime testing still required.
'''
for name,src,filename in [('linux-x11','clients/retro-browser/mars-retrobrowser-x11','mars-retrobrowser-x11'),('windows-x86','clients/retro-browser/win32/retrobrowser.exe','RETROB.EXE')]:
with zipfile.ZipFile(out/(name+'.zip'),'w',zipfile.ZIP_DEFLATED) as z:
z.write(root/src,filename);z.writestr('README.TXT',readme);z.write(root/'BROWSER.md','BROWSER.md')
with zipfile.ZipFile(out/'browser-client-source.zip','w',zipfile.ZIP_DEFLATED) as z:
for p in (root/'clients/retro-browser').rglob('*'):
if p.is_file() and (p.suffix in ('.c','.h','.md','.example') or p.name=='Makefile'):z.write(p,p.relative_to(root/'clients'))
for os in ['WIN95','WIN98','WINME','WINNT40','WIN2000','WINXP']:
d=root/'build/cross/packages'/os
(d/'RETROB.EXE').write_bytes((root/'clients/retro-browser/win32/retrobrowser.exe').read_bytes())
(d/'RETROB.TXT').write_text(readme)
status={'linux-x11':'built, runtime untested','windows-x86':'built PE32 GUI4.0; included in all six Windows ZIPs; runtime untested','amiga500':'not built: m68k-amigaos toolchain absent','amiga-sdl':'not built: Amiga compiler and SDL libraries absent','atari':'not built: MiNT compiler and SDL libraries absent','macosx':'not built: target SDK and SDL libraries absent','macclassic':'not built: target SDK, OpenTransport and SDL libraries absent','dos':'no native DOS browser client in supplied sources'}
(out/'STATUS.json').write_text(json.dumps(status,indent=2)+'\n')
(out/'SHA256SUMS').write_text(''.join(hashlib.sha256(p.read_bytes()).hexdigest()+' '+p.name+'\n' for p in sorted(out.glob('*.zip'))))
# Preserve/rebuild the separately compiled Classic PPC package when available.
if (root/'build/macclassic/ppc/RetroBrowser.bin').exists():
import subprocess
subprocess.run(['python3',str(root/'cross/package-macclassic.py')],check=True)