Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
1.9 kB ยท 73 lines
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374#!/usr/bin/env fish
# Build script for Game Boy ROMs# Automatically detects if source needs CGB (Color Game Boy) or DMG (original Game Boy)# based on includes and BUILD_TARGET comment
if test (count $argv) -lt 1 echo "Usage: build.fish <source.c> [output_name]" echo "Example: build.fish src/melody.c" echo "Example: build.fish src/scrub.c scrub" exit 1end
set source_file $argv[1]set gbdk_path (dirname (status -f))"/gbdk"set lcc "$gbdk_path/bin/lcc"
# Get base name for outputif test (count $argv) -ge 2 set output_name $argv[2]else set output_name (basename $source_file .c)end
# Detect if this needs CGB supportset is_cgb 0
# Check for BUILD_TARGET commentif grep -q "BUILD_TARGET: CGB" $source_file set is_cgb 1 echo "๐ Detected BUILD_TARGET: CGB"else if grep -q "#include <gb/cgb.h>" $source_file set is_cgb 1 echo "๐ Detected CGB include"else if grep -q "BCPS_REG\|BCPD_REG\|set_sprite_palette\|set_bkg_palette" $source_file set is_cgb 1 echo "๐ Detected CGB API usage"end
# Build commandif test $is_cgb -eq 1 set extension "gbc" set flags "-Wm-yc" echo "๐จ Building as Game Boy Color ROM..."else set extension "gb" set flags "" echo "๐ฎ Building as original Game Boy ROM..."end
set output_file "$output_name.$extension"
# Compileecho "๐จ Compiling: $source_file -> $output_file"if test -n "$flags" $lcc $flags -o $output_file $source_fileelse $lcc -o $output_file $source_fileend
if test $status -eq 0 echo "โ
Build successful: $output_file" # Copy to assets directory if it exists set assets_dir (dirname (status -f))"/../system/public/assets/gameboy" if test -d $assets_dir cp $output_file $assets_dir/ echo "๐ฆ Copied to: $assets_dir/$output_file" endelse echo "โ Build failed" exit 1end