86 lines
3.9 KiB
Bash
86 lines
3.9 KiB
Bash
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
# Optional source-built or private development ROMs; packaging owns its inputs.
|
|
set -eu
|
|
resources="${TARGET_BUILD_DIR:?}/${UNLOCALIZED_RESOURCES_FOLDER_PATH:?}"
|
|
case "$resources" in
|
|
/*.app/Contents/Resources) ;;
|
|
*) echo 'error: Expected an app Resources destination' >&2; exit 1 ;;
|
|
esac
|
|
kit="$resources/StarterKit"
|
|
case "${VCC_BUILD_CONTENT_PROFILE:-normal}" in
|
|
normal) ;;
|
|
source)
|
|
# Source builds select only their explicit source-built bundle or its
|
|
# dedicated default. The helper omits bundles entirely for the isolated
|
|
# UI app; neither path inspects normal maintainer ROMs/media.
|
|
python3 "$SRCROOT/../../tools/roms/stage.py" --srcroot "$SRCROOT" --resources "$resources"
|
|
exit 0 ;;
|
|
*) echo 'error: Unsupported VCC_BUILD_CONTENT_PROFILE' >&2; exit 1 ;;
|
|
esac
|
|
# Always remove a previous build's payload, including when local ROMs are removed
|
|
# or the configuration changes. Never leave private inputs in a source Release.
|
|
rm -rf "$kit"
|
|
mkdir -p "$resources"
|
|
cp "$SRCROOT/Resources/StarterMedia/Blank OS9 Header.bin" "$resources/"
|
|
[ "${CONFIGURATION:?}" = Debug ] || exit 0
|
|
source="${SRCROOT:?}/LocalResources/ROMs"
|
|
boot_source="$source"
|
|
assembled="$SRCROOT/LocalResources/SourceROMBundle"
|
|
if [ -e "$assembled" ] || [ -L "$assembled" ]; then
|
|
python3 "$SRCROOT/../../tools/roms/core_inputs.py" validate "$assembled"
|
|
boot_source="$assembled"
|
|
elif [ ! -d "$source" ]; then
|
|
exit 0
|
|
fi
|
|
for specification in coco3.rom:32768 disk11.rom:8192; do
|
|
name=${specification%:*}; size=${specification#*:}
|
|
if [ ! -f "$boot_source/$name" ] || [ "$(wc -c < "$boot_source/$name" | tr -d ' ')" != "$size" ]; then
|
|
echo "error: Selected development $name must be $size bytes." >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
for name in rgbdos.rom orch90.rom; do
|
|
if [ -f "$source/$name" ] && [ "$(wc -c < "$source/$name" | tr -d ' ')" != 8192 ]; then
|
|
echo "error: LocalResources/ROMs/$name must be 8192 bytes." >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
if [ -f "$source/sdcdos.rom" ]; then
|
|
size=$(wc -c < "$source/sdcdos.rom" | tr -d ' ')
|
|
if [ "$size" != 8192 ] && [ "$size" != 16384 ]; then
|
|
echo 'error: LocalResources/ROMs/sdcdos.rom must be 8192 or 16384 bytes.' >&2; exit 1
|
|
fi
|
|
fi
|
|
if [ -f "$source/pic-7040-510.bin" ] || [ -f "$source/sp0256-al2.bin" ]; then
|
|
for specification in pic-7040-510.bin:4096 sp0256-al2.bin:2048; do
|
|
name=${specification%:*}; size=${specification#*:}
|
|
if [ ! -f "$source/$name" ] || [ "$(wc -c < "$source/$name" | tr -d ' ')" != "$size" ]; then
|
|
echo "error: Speech/Sound needs both internal ROMs; $name must be $size bytes." >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
fi
|
|
mkdir -p "$resources"
|
|
staging=$(mktemp -d "$resources/.starter-build.XXXXXX")
|
|
trap 'rm -rf "$staging"' EXIT HUP INT TERM
|
|
cp "$boot_source/coco3.rom" "$boot_source/disk11.rom" "$staging/"
|
|
if [ "$boot_source" = "$assembled" ]; then
|
|
cp "$assembled/ROMBuild.json" "$assembled/ROM_SOURCE_NOTICE.txt" "$staging/"
|
|
fi
|
|
cp "$SRCROOT/Resources/StarterMedia/Hello World.dsk" "$SRCROOT/Resources/StarterMedia/Hello World.cas" "$staging/"
|
|
cp "$SRCROOT/Resources/StarterMedia/Blank Disk.dsk" "$SRCROOT/Resources/StarterMedia/Hello Hard Disk.dsk" "$staging/"
|
|
cp "$SRCROOT/Resources/StarterMedia/Blank OS9 Header.bin" "$staging/"
|
|
media="$SRCROOT/LocalResources/Media/NitrOS-9 L2 V3.3.0.vhd"
|
|
if [ -f "$media" ]; then
|
|
if [ "$(wc -c < "$media" | tr -d ' ')" != 135659520 ]; then
|
|
echo 'error: NitrOS-9 starter image must be the 135659520-byte archive image.' >&2; exit 1
|
|
fi
|
|
python3 "$SRCROOT/Tools/prepare-nitros9.py" "$media" "$staging/NitrOS-9 L2 V3.3.0.vhd"
|
|
fi
|
|
for name in rgbdos.rom orch90.rom sdcdos.rom pic-7040-510.bin sp0256-al2.bin; do
|
|
if [ -f "$source/$name" ]; then cp "$source/$name" "$staging/"; fi
|
|
done
|
|
mv "$staging" "$kit"
|
|
echo 'Included selected boot ROMs, existing cartridge inputs and authored starter media.'
|