# --- HERE BE DRAGONS --- function buildIIgs() { TARGET=${JOEY}/sdks/IIgs/ORCA/out/${PROJECT} GSTARGET=31:/out/${PROJECT} CADIUS=${JOEY}/sdks/IIgs/cadius/cadius VOL=Import WORK=/tmp/IIgs IMPORT=${WORK}/import.po # Clean up target and working directories if [ -d ${TARGET} ]; then rm -rf ${TARGET} fi mkdir -p ${TARGET} if [ -d ${WORK} ]; then rm -rf ${WORK} fi mkdir -p ${WORK} #***TODO*** Add image and music conversion. # Automatically copy converted images, stencils, and audio so they # no longer need to be specified in the build script. # We temporarily need a local copy of the joey header cp -f ${JOEY}/dist/joey.h . # Make a list of files to compile, iterate over them CFILES=($(ls -1 *.c)) OFILES="" for F in "${CFILES[@]}"; do O=${F%.*} # If this file is named 'main' we don't add it to the link list until later if [ "${O}" != "main" ]; then OFILES="${OFILES} ${GSTARGET}/${O}" fi echo "Compiling ${F}..." iix compile ${F} keep=${GSTARGET}/${O} done # Be sure 'main' is first in the link list OFILES="${GSTARGET}/main ${OFILES} ${GSTARGET}/joeylib" # Clean up rm joey.h # We need a local copy of joeylib to link cp -f ${JOEY}/dist/IIgs/joeylib#b20000 ${TARGET}/joeylib iix chtyp -t lib ${GSTARGET}/joeylib # Link our program and create a map file iix -DKeepType=S16 link +L ${OFILES} keep=${GSTARGET}/${PROJECT}#b3db03 > ${PROJECT}.map # Create a disassembly and linker input listing iix dumpobj +D ${GSTARGET}/${PROJECT}#b3db03 &> ${PROJECT}.dis || true echo ${OFILES} > ${PROJECT}.lnk # Be sure our work directories exists mkdir -p ${WORK}/{data,source} # Create disk image, setting known file types ${CADIUS} createvolume ${IMPORT} ${VOL} 32MB > /dev/null ${CADIUS} createfolder ${IMPORT} ${VOL}/data > /dev/null ${CADIUS} addfile ${IMPORT} ${VOL} ${TARGET}/${PROJECT}#b3db03 > /dev/null ${CADIUS} addfile ${IMPORT} ${VOL}/data ${JOEY}/dist/IIgs/Tool222#ba0000 > /dev/null for F in "${DATA[@]}"; do N=${WORK}/data/`basename ${F}`#060000 cp -f ${F} ${N} ${CADIUS} addfile ${IMPORT} ${VOL}/data ${N} > /dev/null rm ${N} done # If they asked for source to be copied to the image, copy it and set the type for S in "${SOURCE[@]}"; do for F in `ls -1 ${S}`; do tr "\n" "\r" < ${F} > ${WORK}/source/${F}#040000 ${CADIUS} addfile ${IMPORT} ${VOL} ${F}#040000 > /dev/null rm ${WORK}/source/${F}#040000 done done mkdir -p ${JOEY}/builds/${PROJECT}/IIgs/ cp ${IMPORT} ${JOEY}/builds/${PROJECT}/IIgs/${PROJECT}.po # Did they ask for GSPlus to be executed? if [ ! -z $1 ]; then # Launch GSPlus pushd ${JOEY}/sdks/IIgs/gsplus ./GSplus -resizeable -config IIgsTest.cfg || true popd # Extract and display the results of the run ${CADIUS} extractfile ${IMPORT} ${VOL}/JLSTATS ${WORK}/. > /dev/null if [ -e ${WORK}/JLSTATS#040000 ]; then echo "" cat ${WORK}/JLSTATS#040000 | tr "\r" "\n" 2> /dev/null echo "" fi fi }