From 18c53676a353f1f63df58545ba6bea8b373b4494 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Sat, 13 Jul 2019 19:06:05 -0500 Subject: [PATCH] First working installable version? --- joeylib/build-IIgs.sh | 7 +- joeylib/build-PC.sh | 14 +- joeylib/src/jIIgs.asm | 523 ++++++++++++++++++++++++++++++++++- joeylib/src/joey.c | 4 +- joeylib/src/joey.h | 2 + joeylib/src/test.c | 14 +- scripts/build-IIgs.helper.sh | 11 +- scripts/build-PC.helper.sh | 16 +- scripts/buildPCDeps.sh | 184 ------------ scripts/fixIIgsTypes.sh | 31 --- scripts/installer.sh | 231 ++++++++++------ 11 files changed, 704 insertions(+), 333 deletions(-) delete mode 100755 scripts/buildPCDeps.sh delete mode 100755 scripts/fixIIgsTypes.sh diff --git a/joeylib/build-IIgs.sh b/joeylib/build-IIgs.sh index 2f6724b..99c828b 100755 --- a/joeylib/build-IIgs.sh +++ b/joeylib/build-IIgs.sh @@ -22,17 +22,16 @@ iix -DKeepType=S16 link +L 31:/out/joey/test 31:/out/joey/joeylib keep=31:/out/j iix dumpobj +D 31:/out/joey/test &> test.dis || true -php ${JOEY}/sdks/IIgs/ntconverter.php *.mod +php ${JOEY}/sdks/IIgs/ntconverter/ntconverter.php *.mod popd mkdir -p ${JOEY}/dist/IIgs -cp -f ${JOEY}/joeylib/joeylib/lib/IIgs/Tool221#ba0000 ${JOEY}/dist/IIgs/. cp -f ${OUT}/joeylib ${JOEY}/dist/IIgs/joeylib#b20000 cp -f ${JOEY}/joeylib/joeylib/src/joey.h ${JOEY}/dist/. cp -f ${JOEY}/joeylib/scripts/build-IIgs.helper.sh ${JOEY}/dist/IIgs/. if [ ! -z $1 ]; then - CADIUS=${JOEY}/sdks/IIgs/cadius-git/bin/release/cadius + CADIUS=${JOEY}/sdks/IIgs/cadius/cadius IMPORT=/tmp/IIgs/import.po VOL=Import @@ -55,7 +54,7 @@ if [ ! -z $1 ]; then ${CADIUS} addfile ${IMPORT} ${VOL}/data ${OUT}/music.w#060000 > /dev/null pushd ${JOEY}/sdks/IIgs/gsplus - ./gsplus -resizeable -config IIgsTest.cfg || true + ./GSplus -resizeable -config IIgsTest.cfg || true popd echo "" ${CADIUS} extractfile ${IMPORT} ${VOL}/JLSTATS /tmp/IIgs/. > /dev/null diff --git a/joeylib/build-PC.sh b/joeylib/build-PC.sh index 6fda1e4..5f991f6 100755 --- a/joeylib/build-PC.sh +++ b/joeylib/build-PC.sh @@ -26,7 +26,7 @@ function doBuild() { ar x ${INSTALLED}/libSDL2.a ar x ${INSTALLED}/libSDL2_mixer.a ar x ${INSTALLED}/libmodplug.a - + ar rcs ${DIST}/libjoeylib.a *.o popd @@ -56,8 +56,8 @@ if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "linux32x" ]; then CC="gcc" CFLAGS="-m32" LDFLAGS="" - DIST="${JOEY}/dist/linux/x86" - INSTALLED="${JOEY}/SDL2/installed/linux/x86/lib" + DIST="${JOEY}/dist/linux/i386" + INSTALLED="${JOEY}/SDL2/installed/linux/i386/lib" doBuild fi @@ -74,8 +74,8 @@ if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "windows32x" ]; then CC="i686-w64-mingw32-gcc" CFLAGS="" LDFLAGS="" - DIST="${JOEY}/dist/windows/x86" - INSTALLED="${JOEY}/SDL2/installed/windows/x86/lib" + DIST="${JOEY}/dist/windows/i386" + INSTALLED="${JOEY}/SDL2/installed/windows/i386/lib" doBuild fi @@ -83,8 +83,8 @@ if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "macos32x" ]; then CC="o32-clang" CFLAGS="" LDFLAGS="" - DIST="${JOEY}/dist/macos/x86" - INSTALLED="${JOEY}/SDL2/installed/macos/x86/lib" + DIST="${JOEY}/dist/macos/i386" + INSTALLED="${JOEY}/SDL2/installed/macos/i386/lib" doBuild fi diff --git a/joeylib/src/jIIgs.asm b/joeylib/src/jIIgs.asm index ae642c2..4469156 100644 --- a/joeylib/src/jIIgs.asm +++ b/joeylib/src/jIIgs.asm @@ -422,6 +422,528 @@ drawTop phy ; Keep Y for later jreturn end +;=============================================================================================== + +; +; Arc3D line-drawing code +; By Andy McFadden +; Adapted from code by the FTA. +; +; Draws from (clpx0,clpy0) to (clpx1,clpy1) (output of a clipping routine). +; +asmDrawLine start + +x0 equ 1 +y0 equ 3 +x1 equ 5 +y1 equ 7 +offset equ 9 +deltax equ 11 +deltay equ 13 +diff equ 15 +even_c equ 17 +odd_c equ 19 + + jsubroutine (4:p,2:penColor,2:clpx0,2:clpy0,2:clpx1,2:clpy1),20 + +; Say p = $012000... + + lda #

p ; Should be $0120 + pha ; switch to bank we're pointing into + plb ; B is now $20 - bad! + plb ; B is now $01 - good! + +DoDrawLine anop + lda 0) { + } else { x--; dx += 2; err += dx - (radius << 1); diff --git a/joeylib/src/joey.h b/joeylib/src/joey.h index 8ab7f00..5d61b3d 100644 --- a/joeylib/src/joey.h +++ b/joeylib/src/joey.h @@ -284,6 +284,7 @@ bool _jlVecLoad(jlVecT **vec, char *filename); extern void asmB88(byte *p, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2); extern void asmB88a(byte *p, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2, byte alpha); extern void asmDrawBM(jint16 startX, jint16 startY, jint16 width, jint16 height, byte *mapData, juint16 stride, byte *sta); +//extern void asmDrawLine(byte *p, jint16 color, jint16 x1, jint16 y1, jint16 x2, jint16 y2); extern jint16 asmGetPoint(jint16 x, jint16 y); extern juint16 asmGetVbl(void); extern void asmNSwap(byte *mem, jint16 count, jint16 old, jint16 new); @@ -295,6 +296,7 @@ extern void asmPoint(jint16 color, jint16 x, jint16 y); #define jlDrawBlitMap(startX, startY, width, height, mapData, stride, sta) asmDrawBM(startX, startY, width, height, (byte *)mapData, stride, (byte *)sta->pixels) #define jlDrawGetPixel(x, y) asmGetPoint(x, y) #define jlDrawPoint(x, y) asmPoint(_jlDrawColorNibbles, x, y) +//#define jlDrawLine(x1, y1, x2, y2) asmDrawLine((byte *)0x012000L, _jlDrawColor, x1, y1, x2, y2) #define jlUtilNibbleSwap(mem, count, old, new) asmNSwap(mem, count, (jint16)old, (jint16)new) #define jlUtilTimer asmGetVbl diff --git a/joeylib/src/test.c b/joeylib/src/test.c index 7257f85..6590266 100644 --- a/joeylib/src/test.c +++ b/joeylib/src/test.c @@ -60,6 +60,8 @@ int main(void) { jlStaT *kanga = NULL; jlStaT *font = NULL; jint16 y; + jint16 y2 = 0; + jint16 dy = 1; jint16 color = 15; jint16 nextColor = 1; @@ -70,9 +72,9 @@ int main(void) { jlStaDisplay(kanga); jlDrawColor(1); - jlDrawBox(0, 0, 319, 199); + //jlDrawBox(0, 0, 319, 199); - jlSoundMusicPlay("music"); + //jlSoundMusicPlay("music"); jlPaletteSet(15, 15, 15, 15); printAt(font, 1, 16, "X"); @@ -81,8 +83,14 @@ int main(void) { printAt(font, 1, y++, "X = %d ", jlGameGetAxis(0)); printAt(font, 1, y++, "Y = %d ", jlGameGetAxis(1)); printAt(font, 1, y++, "T = %d ", jlUtilTimer()); + jlDrawColor((byte)color); + _jlDebugBorder(BORDER_GREEN); + jlDrawLine(0, y2, 319, 199-y2); + _jlDebugBorder(BORDER_BROWN); + y2 += dy; + if (y2 == 199 || y2 == 0) dy = -dy; jlDisplayPresent(); - jlUtilNibbleSwap((byte *)font->pixels, 32000, (byte)(color), (byte)(nextColor)); + //jlUtilNibbleSwap((byte *)font->pixels, 32000, (byte)(color), (byte)(nextColor)); color = nextColor; nextColor++; if (nextColor > 15) nextColor = 1; diff --git a/scripts/build-IIgs.helper.sh b/scripts/build-IIgs.helper.sh index 4b1fdb1..f8ef852 100644 --- a/scripts/build-IIgs.helper.sh +++ b/scripts/build-IIgs.helper.sh @@ -3,7 +3,7 @@ function buildIIgs() { TARGET=${JOEY}/sdks/IIgs/ORCA/out/${PROJECT} GSTARGET=31:/out/${PROJECT} - CADIUS=${JOEY}/sdks/IIgs/cadius-git/bin/release/cadius + CADIUS=${JOEY}/sdks/IIgs/cadius/cadius VOL=Import WORK=/tmp/IIgs IMPORT=${WORK}/import.po @@ -53,11 +53,12 @@ function buildIIgs() { # 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}#b30000 > /dev/null + ${CADIUS} addfile ${IMPORT} ${VOL} ${TARGET}/${PROJECT}#b30000 > /dev/null + ${CADIUS} addfile ${IMPORT} ${VOL} ${JOEY}/dist/IIgs/Tool221#ba0000 > /dev/null for F in "${DATA[@]}"; do N=${WORK}/data/`basename ${F}`#060000 cp -f ${F} ${N} @@ -81,9 +82,9 @@ function buildIIgs() { if [ ! -z $1 ]; then # Launch GSPlus pushd ${JOEY}/sdks/IIgs/gsplus - ./gsplus -resizeable -config IIgsTest.cfg || true + ./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 diff --git a/scripts/build-PC.helper.sh b/scripts/build-PC.helper.sh index e6b7013..cb6bbcc 100644 --- a/scripts/build-PC.helper.sh +++ b/scripts/build-PC.helper.sh @@ -16,7 +16,7 @@ function doPCBuild() { echo '-------------------------------------------------------------------------------' echo "Building ${OSNAME} ${OSARCH}" echo '-------------------------------------------------------------------------------' - + # Clean up target and working directories if [ -d ${DEST} ]; then rm -rf ${DEST} @@ -26,7 +26,7 @@ function doPCBuild() { rm -rf ${WORK} fi mkdir -p ${WORK} - + # Make a list of files to compile, iterate over them CFILES=($(ls -1 *.c)) OFILES="" @@ -36,10 +36,10 @@ function doPCBuild() { echo "Compiling ${F}..." ${CC} ${CFLAGS} ${G_CFLAGS} -c ${F} -o ${WORK}/${O}.o done - + # Link source & JoeyLib - ${CC} -o ${DEST}/${PROJECT}${EXT} ${OFILES} ${JOEY}/dist/${OSNAME}/${OSARCH}/libjoeylib.a ${LDFLAGS} - + ${CC} -o ${DEST}/${PROJECT}${EXT} ${OFILES} ${JOEY}/dist/${OSNAME}/${OSARCH}/libjoeylib.a ${LDFLAGS} + # Copy game data mkdir -p ${DEST}/data for F in "${DATA[@]}"; do @@ -52,7 +52,7 @@ function buildLinux32() { CC="gcc" CFLAGS="-m32" LDFLAGS="-m32 -lstdc++ -lm -ldl -lpthread" - doPCBuild linux x86 '' + doPCBuild linux i386 '' } @@ -68,7 +68,7 @@ function buildWindows32() { CC="i686-w64-mingw32-gcc" CFLAGS="" LDFLAGS="-lgdi32 -lwinmm -limm32 -lversion -lole32 -loleaut32 -lsetupapi -static -lstdc++" - doPCBuild windows x86 '.exe' + doPCBuild windows i386 '.exe' } @@ -84,7 +84,7 @@ function buildmacOS32() { CC="o32-clang" CFLAGS="" LDFLAGS="" - doPCBuild macos x86 '' + doPCBuild macos i386 '' } diff --git a/scripts/buildPCDeps.sh b/scripts/buildPCDeps.sh deleted file mode 100755 index f2e9e6d..0000000 --- a/scripts/buildPCDeps.sh +++ /dev/null @@ -1,184 +0,0 @@ -#!/bin/bash -e - -function clearBuild() { - if [ -d ${JOEY}/SDL2/build ]; then - rm -rf ${JOEY}/SDL2/build - fi - mkdir -p ${JOEY}/SDL2/build -} - - -function clearInstalled() { - if [ -d ${JOEY}/SDL2/installed ]; then - rm -rf ${JOEY}/SDL2/installed - fi - mkdir -p ${JOEY}/SDL2/installed -} - - -function checkFiles() { - if [ ! -d SDL ]; then - hg clone http://hg.libsdl.org/SDL - cd SDL - #hg up release-2.0.9 - cd .. - fi - if [ ! -d libmodplug ]; then - git clone https://github.com/Konstanty/libmodplug.git - cd libmodplug - libtoolize --force - aclocal - autoheader - automake --force-missing --add-missing - autoconf - cd .. - fi - if [ ! -d SDL_mixer ]; then - hg clone http://hg.libsdl.org/SDL_mixer - cd SDL_mixer - #hg up release-2.0.4 - cd .. - fi -} - - -function doBuild() { - clearBuild - cd build - ../SDL/configure \ - --target="${CROSS}" \ - --host="${CROSS}" \ - --build=x86_64-linux \ - --enable-static \ - --disable-shared \ - --prefix=${PREFIX} - make - make install - cd .. - - clearBuild - cd build - ../libmodplug/configure \ - --target="${CROSS}" \ - --host="${CROSS}" \ - --build=x86_64-linux \ - --enable-static \ - --disable-shared \ - --prefix=${PREFIX} - make - make install - cd .. - - clearBuild - cd build - MODPLUG_CFLAGS="-I${PREFIX}/include -DMODPLUG_STATIC" \ - MODPLUG_LIBS="-L${PREFIX}/lib -lmodplug -lstdc++ -lm" \ - ../SDL_mixer/configure \ - --target="${CROSS}" \ - --host="${CROSS}" \ - --build=x86_64-linux \ - --enable-static \ - --disable-shared \ - --prefix=${PREFIX} \ - --with-sdl-prefix=${PREFIX} \ - --disable-music-cmd \ - --disable-music-wave \ - --enable-music-mod-modplug \ - --disable-music-mod-modplug-shared \ - --disable-music-mod-mikmod \ - --disable-music-midi \ - --disable-music-ogg \ - --disable-music-flac \ - --disable-music-opus \ - --disable-music-mp3 \ - --disable-music-mp3-mpg123 - make - make install - cd .. -} - - -ARCH=$1 - -if [ "${ARCH}x" == "x" ]; then - echo "$0 [arch | \"all\"] | [reset]" - echo '(Where "arch" is linux32, linux64, windows32, windows64, macos32, or macos64.)' - exit 0 -fi - -set -x - -mkdir -p ${JOEY}/SDL2 -pushd ${JOEY}/SDL2 - -checkFiles - -if [ "${ARCH}x" == "resetx" ]; then - clearInstalled -fi - -if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "linux64x" ]; then - TARGET=${JOEY}/joeylib/joeylib/lib/linux/x64 - PREFIX=${JOEY}/SDL2/installed/linux/x64 - CROSS=x86_64-linux-gnu - export CC="${CROSS}-gcc" - export CXX="${CROSS}-g++" - doBuild -fi - -if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "linux32x" ]; then - TARGET=${JOEY}/joeylib/joeylib/lib/linux/x86 - PREFIX=${JOEY}/SDL2/installed/linux/x86 - CROSS=x86_64-linux-gnu - export CC="${CROSS}-gcc -m32" - export CXX="${CROSS}-g++ -m32" - doBuild -fi - -if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "windows64x" ]; then - TARGET=${JOEY}/joeylib/joeylib/lib/windows/x64 - PREFIX=${JOEY}/SDL2/installed/windows/x64 - CROSS=x86_64-w64-mingw32 - export CC="${CROSS}-gcc -static-libgcc" - export CXX="${CROSS}-g++ -static-libstdc++" - doBuild -fi - -if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "windows32x" ]; then - TARGET=${JOEY}/joeylib/joeylib/lib/windows/x86 - PREFIX=${JOEY}/SDL2/installed/windows/x86 - CROSS=i686-w64-mingw32 - export CC="${CROSS}-gcc -static-libgcc" - doBuild -fi - -if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "macos64x" ]; then - TARGET=${JOEY}/joeylib/joeylib/lib/macos/x64 - PREFIX=${JOEY}/SDL2/installed/macos/x64 - CROSS=x86_64-apple-darwin15 - export CC="o64-clang" - doBuild -fi - -if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "macos32x" ]; then - TARGET=${JOEY}/joeylib/joeylib/lib/macos/x86 - PREFIX=${JOEY}/SDL2/installed/macos/x86 - CROSS=i386-apple-darwin15 - export CC="o32-clang" - doBuild -fi - -#if [ "${ARCH}x" == "allx" ] || [ "${ARCH}x" == "raspbian" ]; then - #***FIX*** - #TARGET=${JOEY}/joeylib/joeylib/pi/raspbian - #PREFIX=${JOEY}/SDL2/installed/pi/raspbian - #CROSS=arm-linux-gnueabihf - #export CC="${CROSS}-gcc -static-libgcc --sysroot=${JOEY}/sdks/pi/raspbian -I${PREFIX}/include -L${PREFIX}/lib" - #doBuild -#fi - -export CXX="" -export CC="" -rm -rf build -popd -set +x diff --git a/scripts/fixIIgsTypes.sh b/scripts/fixIIgsTypes.sh deleted file mode 100755 index 5d5711a..0000000 --- a/scripts/fixIIgsTypes.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -e - -pushd ${GOLDEN_GATE} - -#find . -type d -exec chmod 755 {} \; -#find . -type f -exec chmod 644 {} \; - -for x in etc/* ; do iix chtyp -t txt "$x" ; done -for x in lib/* ; do if [ -f "$x" ] ; then iix chtyp -t lib "$x" ; fi ; done -for x in usr/lib/lib* ; do iix chtyp -t lib "$x" ; done -for x in usr/lib/tmac/* ; do iix chtyp -t txt "$x" ; done -for x in bin/* ; do iix chtyp -t exe "$x" ; done -for x in usr/bin/* ; do iix chtyp -t exe "$x" ; done -for x in usr/local/bin/* ; do iix chtyp -t exe "$x" ; done - -for f in Languages/* ; do if [ -f "$f" ] ; then iix chtyp -t exe "$f" ; fi ; done ; -for f in Utilities/Help/* ; do if [ -f "$f" ] ; then iix chtyp -t txt "$f" ; fi ; done ; -for f in Utilities/* ; do if [ -f "$f" ] ; then iix chtyp -t exe "$f" ; fi ; done ; -for f in Libraries/* ; do if [ -f "$f" ] ; then iix chtyp -t lib "$f" ; fi ; done ; -for f in Libraries/AInclude/* ; do if [ -f "$f" ] ; then iix chtyp -t txt "$f" ; fi ; done ; -for f in Libraries/APWCInclude/* ; do if [ -f "$f" ] ; then iix chtyp -t txt "$f" ; fi ; done ; -for f in Libraries/AppleUtil/* ; do if [ -f "$f" ] ; then iix chtyp -t txt "$f" ; fi ; done ; -for f in Libraries/ORCACDefs/* ; do if [ -f "$f" ] ; then iix chtyp -l cc "$f" ; fi ; done ; -for f in Libraries/ORCAInclude/* ; do if [ -f "$f" ] ; then iix chtyp -l asm "$f" ; fi ; done ; -for f in Libraries/RInclude/* ; do if [ -f "$f" ] ; then iix chtyp -l rez "$f" ; fi ; done ; -for f in Libraries/Tool.Interface/* ; do if [ -f "$f" ] ; then iix chtyp -l pascal "$f" ; fi ; done ; -for f in Libraries/GSoftDefs/* ; do if [ -f "$f" ] ; then iix chtyp -t 0x5e -a 0x8007 "$f" ; fi ; done ; -for f in Libraries/ORCAPascalDefs/* ; do if [ -f "$f" ] ; then iix chtyp -t 0x5e -a 0x8009 "$f" ; fi ; done ; -for f in Libraries/m2defs/* ; do if [ -f "$f" ] ; then iix chtyp -t 0x5e -a 0x8006 "$f" ; fi ; done ; - -popd \ No newline at end of file diff --git a/scripts/installer.sh b/scripts/installer.sh index ea45b31..57f7fd6 100755 --- a/scripts/installer.sh +++ b/scripts/installer.sh @@ -29,6 +29,19 @@ G_TITLE="JoeyLib Installer" G_PARENT= G_UID=$(id -ru) G_GID=$(id -rg) +G_IS_INSTALLED=() +G_IIGS=0 +#G_AMIGA=1 +#G_ATARIST=2 +G_LINUX32=1 +G_LINUX64=2 +G_WIN32=3 +G_WIN64=4 +#G_MAC32=7 +#G_MAC64=8 +#G_ANDROID=9 +#G_IOS=10 + G_HAS_IIGS=0 @@ -41,15 +54,11 @@ function buildPCDeps() { local CC_OLD=$CC local CXX_OLD=$CXX local SRC="${G_PARENT}/joeylib/joeylib/src" - local G_CFLAGS="-Wall -D_REENTRANT_ -I${SRC} -c" + local G_CFLAGS="-Wall -D_REENTRANT_ -I${SRC} -I${PREFIX}/include -c" echo "" tBoldBox tCYAN "NOTE: If an error is encountered, installer will exit!" - # Clear any existing built libraries - if [[ -d ${PREFIX} ]]; then - rm -rf ${PREFIX} - fi mkdir -p ${PREFIX} pushd deps &> /dev/null @@ -195,7 +204,7 @@ function configWrite() { echo "fi" >> "${O}" echo "export PATH=\"\${JOEYPATH}\"" >> "${O}" echo "export JOEY=\"${G_PARENT}\"" >> "${O}" - if [[ ${G_HAS_IIGS} == 1 ]]; then + if [[ ${G_IS_INSTALLED[$G_IIGS]} == 1 ]]; then # IIgs Runtime & ORCA Compilers echo "export GOLDEN_GATE=\"\${JOEY}/sdks/IIgs/ORCA\"" >> "${O}" echo "export PATH=\"\${JOEY}/sdks/IIgs:\${PATH}\"" >> "${O}" @@ -231,7 +240,7 @@ function installIIgs() { local GGATE= local IIGS="${G_PARENT}/sdks/IIgs" - G_HAS_IIGS=1 + G_IS_INSTALLED[$G_IIGS] = 1 configWrite configRead @@ -518,30 +527,75 @@ function installWin64() { function mainMenu() { local ITEMS=( "IIgs" -# "Amiga" "ST" - "Linux32" "Linux64" - "Win32" "Win64" -# "macOS32" "macOS64" -# "Android" "iOS" +# "Amiga" +# "ST" + "Linux32" + "Linux64" + "Win32" + "Win64" +# "macOS32" +# "macOS64" +# "Android" +# "iOS" ) local DESC=( "Apple IIgs 16" -# "Commodore Amiga 16" "Atari ST 16" - "Linux 32" "Linux 64" - "Windows 32" "Windows 64" -# "macOS 32" "macOS 64" -# "Android 32" "iOS 64" +# "Commodore Amiga 16" +# "Atari ST 16" + "Linux 32" + "Linux 64" + "Windows 32" + "Windows 64" +# "macOS 32" +# "macOS 64" +# "Android 32" +# "iOS 64" + ) + local CHECK=( + "IIgs/joeylib#b20000" +# "Amiga" +# "ST" + "linux/i386/libjoeylib.a" + "linux/x64/libjoeylib.a" + "windows/i386/libjoeylib.a" + "windows/x64/libjoeylib.a" +# "macOS32" +# "macOS64" +# "Android" +# "iOS" ) local TOTAL=${#ITEMS[*]} local MENU=() local X= + local WHAT= local CHOICE="x" + G_IS_INSTALLED=( + 0 +# 0 +# 0 + 0 + 0 + 0 + 0 +# 0 +# 0 +# 0 +# 0 + ) + while [[ "${CHOICE}" != "" ]]; do MENU=() for (( X=0; X<=$(( ${TOTAL}-1 )); X++ )); do MENU+=( "${ITEMS[$X]}" ) - MENU+=( "Install ${DESC[$X]} Bit JoeyLib Library" ) + if [[ -e "${G_PARENT}/dist/${CHECK[$X]}" ]]; then + WHAT="Rebuild" + G_IS_INSTALLED[$X]=1 + else + WHAT="Install" + G_IS_INSTALLED[$X]=0 + fi + MENU+=( "${WHAT} ${DESC[$X]} Bit JoeyLib Library" ) done CHOICE=$( set e+ @@ -558,79 +612,82 @@ function mainMenu() { # --- START - -mkdir -p installerWork - -# Do we have Towel yet? -if [[ ! -f installerWork/towel/towel.sh ]]; then - # Do we have GIT? - if [[ "$(which git || true)" == "" ]]; then - echo "Installing git..." - sudo apt-get -y install git &> /dev/null - fi - echo "Downloading towel.sh support library..." - git clone https://skunkworks.kangaroopunch.com/skunkworks/towel.git installerWork/towel &> /dev/null -fi - -# Load Towel -source installerWork/towel/towel.sh - -# Remember where we live. -G_PARENT=$(pwd) - -# Don't change directories until Towel is loaded. -pushd installerWork &> /dev/null - -:<<'SKIP' -# See if all the packages we need are installed -echo "" -tBoldBox tBLUE "Examining system..." -tCheckPackages MISSING cmake ragel hfsplus hfsutils hfsprogs libreadline-dev libedit-dev \ - build-essential git mercurial texinfo libtool autoconf automake re2c \ - gcc-multilib g++-multilib mingw-w64 gdb-mingw-w64 clang llvm-dev libxml2-dev \ - uuid-dev libssl-dev bash patch make tar xz-utils bzip2 gzip sed cpio \ - libpulse-dev{,:i386} libasound-dev{,:i386} \ - libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libfreetype6-dev libpcap0.8-dev \ - php-cli msitools - -if [[ "${MISSING}" != "" ]]; then +function start() { sudo -v - if (whiptail --title "${G_TITLE}" --yesno "Some required packages are missing.\n\nInstall them now?" 9 40); then - TEMP=" ${MISSING//[^ ]}" - TOTAL=${#TEMP} - COUNT=0 - { - for PACKAGE in ${MISSING}; do - PERCENT=$(( 100*(++COUNT)/TOTAL )) - echo ${PERCENT} - sudo apt-get -y install ${PACKAGE} &> /dev/null - done - } | whiptail --title "${G_TITLE}" --gauge "\nInstalling packages..." 7 50 0 - else - tBoldBox tRED "Canceled!" - echo "" - echo "Installation cannot continue without the following pacakges:" - echo "" - echo ${MISSING} - echo "" - exit 1 + + mkdir -p installerWork + + # Do we have Towel yet? + if [[ ! -f installerWork/towel/towel.sh ]]; then + # Do we have GIT? + if [[ "$(which git || true)" == "" ]]; then + echo "Installing git..." + sudo apt-get -y install git &> /dev/null + fi + echo "Downloading towel.sh support library..." + git clone https://skunkworks.kangaroopunch.com/skunkworks/towel.git installerWork/towel &> /dev/null fi -fi -SKIP -# Do we have JoeyLib yet? -if [[ ! -f ${G_PARENT}/joeylib/LICENSE ]]; then + # Load Towel + source installerWork/towel/towel.sh + + # Remember where we live. + G_PARENT=$(pwd) + + # Don't change directories until Towel is loaded. + pushd installerWork &> /dev/null + + # See if all the packages we need are installed echo "" - tBoldBox tBLUE "Downloading JoeyLib source..." - git clone https://skunkworks.kangaroopunch.com/skunkworks/joeylib.git ${G_PARENT}/joeylib &> /dev/null -fi + tBoldBox tBLUE "Examining system..." + tCheckPackages MISSING cmake ragel hfsplus hfsutils hfsprogs libreadline-dev libedit-dev \ + build-essential git mercurial texinfo libtool autoconf automake re2c \ + gcc-multilib g++-multilib mingw-w64 gdb-mingw-w64 clang llvm-dev libxml2-dev \ + uuid-dev libssl-dev bash patch make tar xz-utils bzip2 gzip sed cpio \ + libpulse-dev{,:i386} libasound2-dev{,:i386} \ + libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libfreetype6-dev libpcap0.8-dev \ + php-cli msitools -mainMenu -configWrite + if [[ "${MISSING}" != "" ]]; then + if (whiptail --title "${G_TITLE}" --yesno "Some required packages are missing.\n\nInstall them now?" 9 40); then + TEMP=" ${MISSING//[^ ]}" + TOTAL=${#TEMP} + COUNT=0 + { + for PACKAGE in ${MISSING}; do + PERCENT=$(( 100*(++COUNT)/TOTAL )) + echo ${PERCENT} + sudo apt-get -y install ${PACKAGE} &> /dev/null + done + } | whiptail --title "${G_TITLE}" --gauge "\nInstalling packages..." 7 50 0 + else + tBoldBox tRED "Canceled!" + echo "" + echo "Installation cannot continue without the following pacakges:" + echo "" + echo ${MISSING} + echo "" + exit 1 + fi + fi -clear -tBoldBox tBLUE "Goodbye!" -echo "" + # Do we have JoeyLib yet? + if [[ ! -f ${G_PARENT}/joeylib/LICENSE ]]; then + echo "" + tBoldBox tBLUE "Downloading JoeyLib source..." + git clone https://skunkworks.kangaroopunch.com/skunkworks/joeylib.git ${G_PARENT}/joeylib &> /dev/null + fi -# --- EXIT -popd &> /dev/null + mainMenu + configWrite + + clear + tBoldBox tBLUE "Goodbye!" + echo "" + + # --- EXIT + popd &> /dev/null +} + +# At the very end so we can stream this script from a web server. +start