abse/gameboy-advance

A tscircuit package created by abse.

Version
0.0.45
License
unset
Stars
0

web/build.py

#!/usr/bin/env python3
"""Build the same Doom translation units used by the Pico CMake target."""
import os, pathlib, re, shutil, subprocess
root = pathlib.Path(__file__).resolve().parents[1]
web = root / 'web'
out = web / 'dist'
out.mkdir(exist_ok=True)
emcc = os.environ.get('EMCC', 'emcc')
common = [emcc, '-O2', '-I'+str(root/'games/platform'), '-sASYNCIFY',
          '-sASYNCIFY_STACK_SIZE=65536', '-sSTACK_SIZE=1048576',
          '-sINITIAL_MEMORY=33554432', '-sALLOW_MEMORY_GROWTH',
          '-sMAXIMUM_MEMORY=134217728', '-sMODULARIZE', '-sEXPORT_NAME=createGame',
          '-sENVIRONMENT=worker,node', '-sFORCE_FILESYSTEM',
          '-sEXPORTED_RUNTIME_METHODS=FS,callMain', '-sEXIT_RUNTIME=1',
          str(web/'src/platform_web.c')]
engine = root / 'firmware/game-console'
sources = re.findall(r'^\s+(doomgeneric/\w+\.c)\s*$', (engine/'CMakeLists.txt').read_text(), re.M)
assert len(sources)>70, 'Doom source manifest could not be read'
subprocess.run(common + ['-DCMAP256', '-DDOOMGENERIC_RESX=320', '-DDOOMGENERIC_RESY=200',
    '-DNORMALUNIX', '-DUSE_PRINTF', '-DUSE_DBG_PRINTF', '-Wno-incompatible-pointer-types',
    '-I'+str(engine/'doomgeneric'), str(web/'src/doom_web.c'),
    *[str(engine/s) for s in sources], '-lm', '-o', str(out/'doom.js')], check=True)
subprocess.run(common + [str(root/'games/platform/web_main.c'), str(root/'games/star-test/game.c'),
                        '-o', str(out/'star-test.js')], check=True)
for name in ['index.html','app.js','worker.js','style.css']:
    shutil.copyfile(web/name,out/name)
print('Web build ready:',out)

shutil.copyfile(engine/'LICENSE',out/'LICENSE-doom.txt')
shutil.copyfile(engine/'THIRD_PARTY.md',out/'THIRD_PARTY.md')
, (engine/'CMakeLists.txt').read_text(), re.M)\nassert len(sources)\u003e70, 'Doom source manifest could not be read'\nsubprocess.run(common + ['-DCMAP256', '-DDOOMGENERIC_RESX=320', '-DDOOMGENERIC_RESY=200',\n '-DNORMALUNIX', '-DUSE_PRINTF', '-DUSE_DBG_PRINTF', '-Wno-incompatible-pointer-types',\n '-I'+str(engine/'doomgeneric'), str(web/'src/doom_web.c'),\n *[str(engine/s) for s in sources], '-lm', '-o', str(out/'doom.js')], check=True)\nsubprocess.run(common + [str(root/'games/platform/web_main.c'), str(root/'games/star-test/game.c'),\n '-o', str(out/'star-test.js')], check=True)\nfor name in ['index.html','app.js','worker.js','style.css']:\n shutil.copyfile(web/name,out/name)\nprint('Web build ready:',out)\n\nshutil.copyfile(engine/'LICENSE',out/'LICENSE-doom.txt')\nshutil.copyfile(engine/'THIRD_PARTY.md',out/'THIRD_PARTY.md')\n","content_mimetype":"application/octet-stream","created_at":"2026-11-05T18:50:32.352Z"}; window.SSR_PACKAGE_BUILDS = []; window.SSR_RELATED_PACKAGES = [{"package_id":"1bb71080-c9d9-4806-8dad-9546e8b9913b","creator_account_id":"03854e77-22c2-44a0-9cfc-2d4ed6741105","latest_package_release_id":"92d10956-aa95-4eba-8e98-42e66c16f463","last_built_release_id":"92d10956-aa95-4eba-8e98-42e66c16f463","latest_package_release_fs_sha":"md5-73c7349eef4667e7cbc7beecb7e35036","latest_pcb_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=92d10956-aa95-4eba-8e98-42e66c16f463\u0026file_path=dist%2Findex%2Fpcb.svg","latest_sch_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=92d10956-aa95-4eba-8e98-42e66c16f463\u0026file_path=dist%2Findex%2Fschematic.svg","latest_cad_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=92d10956-aa95-4eba-8e98-42e66c16f463\u0026file_path=dist%2Findex%2F3d.png","latest_version":"1.0.5","license":"unset","owner_org_id":"7978967e-b956-4ac2-b813-667a08f6310a","org_owner_tscircuit_handle":"abse","owner_github_username":null,"github_repo_full_name":null,"is_source_from_github":false,"description":null,"name":"abse/boostxl-uln2003","unscoped_name":"boostxl-uln2003","star_count":0,"created_at":"2026-08-12T10:10:06.978Z","updated_at":"2026-08-12T22:29:23.783Z","ai_description":"This code defines a React component that models a through-hole or surface-mount LED with specified pin labels, footprint, silkscreen, and 3D CAD model for PCB layout.","ai_usage_instructions":null,"is_private":false,"is_unlisted":false,"is_public":true,"public_dist_enabled":false,"has_public_dist":true,"starred_at":null,"default_view":"files","website":null,"github_installation_id":null,"allow_pr_previews":false,"related_type":"same_author","thumbnail_url":"https://api.tscircuit.com/package_files/view?package_release_id=92d10956-aa95-4eba-8e98-42e66c16f463\u0026file_path=dist%2Findex%2Fpcb.svg"},{"package_id":"1a688437-24fc-4e9f-921c-1ddc4fc53cf5","creator_account_id":"84198f66-bb86-4dc1-97f0-cdf2cf2c843a","latest_package_release_id":"37e98b52-0b1d-4f91-8f06-8e5e321f5e45","last_built_release_id":"37e98b52-0b1d-4f91-8f06-8e5e321f5e45","latest_package_release_fs_sha":"md5-a234ce80dacb6ff214fc7c28c619fd53","latest_pcb_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=37e98b52-0b1d-4f91-8f06-8e5e321f5e45\u0026file_path=dist%2Fassembly%2Fpcb.svg","latest_sch_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=37e98b52-0b1d-4f91-8f06-8e5e321f5e45\u0026file_path=dist%2Fassembly%2Fschematic.svg","latest_cad_preview_image_url":"https://api.tscircuit.com/package_files/view?package_release_id=37e98b52-0b1d-4f91-8f06-8e5e321f5e45\u0026file_path=dist%2Fassembly%2F3d.png","latest_version":"1.12.2","license":"ISC","owner_org_id":"07e44f25-c5d3-4583-9c34-2c7bb568f85b","org_owner_tscircuit_handle":"AnasSarkiz","owner_github_username":"AnasSarkiz","github_repo_full_name":null,"is_source_from_github":false,"description":null,"name":"AnasSarkiz/NEMA14_CH32X035G8U6","unscoped_name":"NEMA14_CH32X035G8U6","star_count":0,"created_at":"2026-10-07T17:53:37.598Z","updated_at":"2026-10-16T19:05:31.590Z","ai_description":"A NEMA stepper motor is shown with proposed M3 screws/spacers, four wired motor leads and splices, and a JST SHR-04V-S connector.","ai_usage_instructions":null,"is_private":false,"is_unlisted":false,"is_public":true,"public_dist_enabled":true,"has_public_dist":true,"starred_at":null,"default_view":"files","website":null,"github_installation_id":null,"allow_pr_previews":false,"related_type":"random","thumbnail_url":"https://api.tscircuit.com/package_files/view?package_release_id=37e98b52-0b1d-4f91-8f06-8e5e321f5e45\u0026file_path=dist%2Fassembly%2Fpcb.svg"}]; window.SSR_PACKAGE_ROUTE = {"author":"abse","packageName":"gameboy-advance","packageNameWithScope":"abse/gameboy-advance","version":null,"isLegacyRoute":false,"kind":"file","filePath":"web/build.py"};