#!/bin/bash # # JoeyBuild # Copyright (C) 2018-2023 Scott Duensing # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of this software. # # Permission is granted to anyone to use this software for any purpose, # including commercial applications, and to alter it and redistribute it # freely, subject to the following restrictions: # # 1. The origin of this software must not be misrepresented; you must not # claim that you wrote the original software. If you use this software # in a product, an acknowledgment in the product documentation would be # appreciated but is not required. # 2. Altered source versions must be plainly marked as such, and must not be # misrepresented as being the original software. # 3. This notice may not be removed or altered from any source distribution. # M_IIGS=${G_EHOME}/cross/gsos-wdc-orca M_CADIUS=${M_IIGS}/cadius/cadius export GOLDEN_GATE=${M_IIGS}/ORCA function architectures() { echo "65816" } function buildApplication() { local ARCH=$1 local PASS=$2 true } function buildJoeyLib() { local ARCH=$1 local PASS=$2 local OUT=${GOLDEN_GATE}/out/joey rm -rf ${G_DIST} mkdir -p ${G_DIST} pushd ${G_DIST} export PATH=${G_ORIGINAL_PATH}:${M_IIGS} "${M_IIGS}/mountORCA.sh" rm -rf ${OUT} || true mkdir -p ${OUT} pushd ${G_SRC} if [[ "${PASS}" == "debug" ]]; then # Add JOEY_DEBUG flag. cp joey.h joey.h.original sed -i "1i #define JOEY_DEBUG" joey.h fi iix assemble jIIgs.asm keep=31:/out/joey/jIIgsasm 1>&2 iix compile jIIgs.c keep=31:/out/joey/jIIgsc 1>&2 iix compile joey.c keep=31:/out/joey/joey 1>&2 if [[ "${PASS}" == "debug" ]]; then # Remove JOEY_DEBUG. rm joey.h mv joey.h.original joey.h fi popd cp -f "${OUT}/jIIgsc.root" "jIIgsc.root#b10000" cp -f "${OUT}/jIIgsc.a" "jIIgsc.a#b10000" cp -f "${OUT}/jIIgsasm.root" "jIIgsasm.root#b10000" cp -f "${OUT}/jIIgsasm.a" "jIIgsasm.a#b10000" cp -f "${OUT}/joey.a" "joey.a#b10000" cp -f "${M_IIGS}/Tool222#ba0000" . "${M_IIGS}/unmountORCA.sh" export PATH=${G_ORIGINAL_PATH} popd } function enabled() { echo 0 } function install() { local ARCH=$1 local PASS=$2 local RESULT= local O= # We only need to do this once, so we ignore the debug pass. if [[ "${PASS}" == "debug" ]]; then return fi mkdir -p "${M_IIGS}/ORCA" chmod 777 "${M_IIGS}/ORCA" mkdir -p ${G_EHOME}/.ssh cp -f "${AUTOMATED_GOLDEN_GATE_PUBLIC_KEY}" ${G_EHOME}/.ssh/id_rsa.pub cp -f "${AUTOMATED_GOLDEN_GATE_PRIVATE_KEY}" ${G_EHOME}/.ssh/id_rsa touch ${G_EHOME}/.ssh/authorized_keys touch ${G_EHOME}/.ssh/known_hosts touch ${G_EHOME}/.ssh/config chmod go-w ${G_EHOME} chmod 700 ${G_EHOME}/.ssh chmod 600 ${G_EHOME}/.ssh/id_rsa chmod 644 ${G_EHOME}/.ssh/id_rsa.pub chmod 644 ${G_EHOME}/.ssh/authorized_keys chmod 644 ${G_EHOME}/.ssh/known_hosts chmod 644 ${G_EHOME}/.ssh/config if [[ ! -e "${M_IIGS}/jfsDrive.img" ]]; then O=${M_IIGS}/mountORCA.sh echo "#!/bin/bash" > "${O}" echo "IIGS=${M_IIGS}" >> "${O}" echo "if ! mount | grep \${IIGS}/ORCA | grep -q jfs; then" >> "${O}" echo -e "\tfsck.jfs -a \${IIGS}/jfsDrive.img" >> "${O}" echo -e "\tsudo mount -t jfs \${IIGS}/jfsDrive.img \${IIGS}/ORCA" >> "${O}" echo -e "\techo MOUNT=\${IIGS}/ORCA >> \${IIGS}/lastMount.cfg" >> "${O}" echo "fi" >> "${O}" chmod +x "${O}" O=${M_IIGS}/unmountORCA.sh echo "#!/bin/bash" > "${O}" echo "IIGS=${M_IIGS}" >> "${O}" echo "if [[ -e \${IIGS}/lastMount.cfg ]]; then" >> "${O}" echo -e "\tsource \${IIGS}/lastMount.cfg" >> "${O}" echo -e "\tsudo umount \${MOUNT}" >> "${O}" echo -e "\trm \${IIGS}/lastMount.cfg" >> "${O}" echo "fi" >> "${O}" chmod +x "${O}" fallocate -l 32M "${M_IIGS}/jfsDrive.img" mkfs.jfs -O -q -L IIgs "${M_IIGS}/jfsDrive.img" fi "${M_IIGS}/mountORCA.sh" tSudo chown $(id -ru):$(id -rg) "${M_IIGS}/ORCA/." if [[ ! -d GoldenGate ]]; then ssh-keygen -F gitlab.com || ssh-keyscan gitlab.com > ${G_EHOME}/.ssh/known_hosts git config --global credential.helper cache git clone https://${AUTOMATED_GOLDEN_GATE_USER_NAME}:${AUTOMATED_GOLDEN_GATE_PASSWORD}@gitlab.com/GoldenGate/GoldenGate.git fi if [[ ! -f "${M_IIGS}/iix" ]]; then pushd GoldenGate git submodule init git submodule update mkdir -p build cd build cmake -DCMAKE_INSTALL_PREFIX=$(pwd)/installed .. 1>&2 make 1>&2 make install 1>&2 mkdir -p ${M_IIGS} cp -f bin/{iix,dumpobj,opus-extractor} "${M_IIGS}/." cd installed msiextract "${G_EHOME}/${AUTOMATED_GOLDEN_GATE_MSI}" find -name ".*" -delete cp -rf GoldenGate/* "${M_IIGS}/ORCA/." popd fi isoinfo -i "${AUTOMATED_OPUS_SOFTWARE_ISO}" -x /FOR_EMUL/BYTEWORK.S\;1 > BYTEWORKS "${M_IIGS}/opus-extractor" -v BYTEWORKS "${M_IIGS}/ORCA" rm BYTEWORKS tFetchGitHubRelease RESULT byteworksinc ORCA-C 2mg "${M_IIGS}/opus-extractor" -v -s / ${RESULT} "${M_IIGS}/ORCA" export PATH=${G_ORIGINAL_PATH}:${M_IIGS} pushd ${GOLDEN_GATE} for O in etc/* ; do iix chtyp -t txt "${O}" ; done for O in lib/* ; do if [ -f "${O}" ] ; then iix chtyp -t lib "${O}" ; fi ; done for O in usr/lib/lib* ; do iix chtyp -t lib "${O}" ; done for O in usr/lib/tmac/* ; do iix chtyp -t txt "${O}" ; done for O in bin/* ; do iix chtyp -t exe "${O}" ; done for O in usr/bin/* ; do iix chtyp -t exe "${O}" ; done for O in usr/local/bin/* ; do iix chtyp -t exe "${O}" ; done for O in Languages/* ; do if [ -f "${O}" ] ; then iix chtyp -t exe "${O}" ; fi ; done ; for O in Utilities/Help/* ; do if [ -f "${O}" ] ; then iix chtyp -t txt "${O}" ; fi ; done ; for O in Utilities/* ; do if [ -f "${O}" ] ; then iix chtyp -t exe "${O}" ; fi ; done ; for O in Libraries/* ; do if [ -f "${O}" ] ; then iix chtyp -t lib "${O}" ; fi ; done ; for O in Libraries/AInclude/* ; do if [ -f "${O}" ] ; then iix chtyp -t txt "${O}" ; fi ; done ; for O in Libraries/APWCInclude/* ; do if [ -f "${O}" ] ; then iix chtyp -t txt "${O}" ; fi ; done ; for O in Libraries/AppleUtil/* ; do if [ -f "${O}" ] ; then iix chtyp -t txt "${O}" ; fi ; done ; for O in Libraries/ORCACDefs/* ; do if [ -f "${O}" ] ; then iix chtyp -l cc "${O}" ; fi ; done ; for O in Libraries/ORCAInclude/* ; do if [ -f "${O}" ] ; then iix chtyp -l asm "${O}" ; fi ; done ; for O in Libraries/RInclude/* ; do if [ -f "${O}" ] ; then iix chtyp -l rez "${O}" ; fi ; done ; for O in Libraries/Tool.Interface/* ; do if [ -f "${O}" ] ; then iix chtyp -l pascal "${O}" ; fi ; done ; for O in Libraries/GSoftDefs/* ; do if [ -f "${O}" ] ; then iix chtyp -t 0x5e -a 0x8007 "${O}" ; fi ; done ; for O in Libraries/ORCAPascalDefs/* ; do if [ -f "${O}" ] ; then iix chtyp -t 0x5e -a 0x8009 "${O}" ; fi ; done ; for O in Libraries/m2defs/* ; do if [ -f "${O}" ] ; then iix chtyp -t 0x5e -a 0x8006 "${O}" ; fi ; done ; popd export PATH=${G_ORIGINAL_PATH} if [[ ! -d cadius ]]; then git clone https://skunkworks.kangaroopunch.com/mirrors/cadius.git pushd cadius make 1>&2 mkdir -p "${M_IIGS}/cadius" cp -f bin/release/cadius "${M_IIGS}/cadius/." popd fi if [[ ! -e "${M_IIGS}/ntpconverter/ntpconverter.php" ]]; then tDownload http://ninjaforce.com/downloads/ntpsources.zip unzip ntpsources.zip ntpconverter* mkdir -p "${M_IIGS}/ntpconverter" mv -f ntpconverter*.php "${M_IIGS}/ntpconverter/." fi if [[ ! -e "${M_IIGS}/Tool222#ba0000" ]]; then tDownload http://www.ninjaforce.com/downloads/ninjatrackerplus_tool222_v1.4.2mg "${M_CADIUS}" extractfile ninjatrackerplus_tool222_v1.4.2mg NTP.TOOL222V1.4/SYSTEM/TOOLS/TOOL222 . cp -f "TOOL222#BA0000" "${M_IIGS}/Tool222#ba0000" fi "${M_IIGS}/unmountORCA.sh" if [[ ! -e "${M_IIGS}/jfsDrive.img.backup.tar.bz2" ]]; then tar cjf "${M_IIGS}/jfsDrive.img.backup.tar.bz2" "${M_IIGS}/jfsDrive.img" fi }