From 7565c30b2a53791a5f351d8721aece1aac725ef4 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Thu, 24 Oct 2019 20:13:45 -0500 Subject: [PATCH] Beginning ST development. --- joeylib/build.sh | 7 +-- joeylib/joeylib.pro | 62 +++++++++++++---------- joeylib/src/{jST.c => jSDL12.c} | 0 joeylib/src/{jPC.c => jSDL2.c} | 0 scripts/installer.sh | 87 +++++++++++++++++++++++++++++++-- 5 files changed, 122 insertions(+), 34 deletions(-) rename joeylib/src/{jST.c => jSDL12.c} (100%) rename joeylib/src/{jPC.c => jSDL2.c} (100%) diff --git a/joeylib/build.sh b/joeylib/build.sh index a8ae4cc..6baad07 100755 --- a/joeylib/build.sh +++ b/joeylib/build.sh @@ -1,7 +1,5 @@ #!/bin/bash -e -#***TODO*** Move "installed" into SDKs folders - # Amiga # https://github.com/bebbo/amiga-gcc # m68k-amigaos-gcc -idirafter /home/scott/joey/sdks/amiga/m68k-amigaos/sys-include/machine -c ../src/joey.c @@ -137,7 +135,7 @@ function doPCBuild() { createBuildAndDist pushd "${BUILD}" - "${CC}" ${CFLAGS} ${G_CFLAGS} -o jPC.o "${SRC}/jPC.c" + "${CC}" ${CFLAGS} ${G_CFLAGS} -o jSDL2.o "${SRC}/jSDL2.c" "${CC}" ${CFLAGS} ${G_CFLAGS} -o joey.o "${SRC}/joey.c" ar x "${INSTALLED}/lib/libSDL2.a" ar x "${INSTALLED}/lib/libSDL2_mixer.a" @@ -228,6 +226,9 @@ if [[ "${ARCH}x" == "allx" || "${ARCH}x" == "stx" ]]; then pushd "${BUILD}" m68k-atari-mint-gcc -c "${SRC}/joey.c" m68k-atari-mint-gcc -c "${SRC}/jST.c" + m68k-atari-mint-ar x "${DEPS}/st/lib/libSDL.a" + m68k-atari-mint-ar x "${DEPS}/st/lib/libSDL_mixer.a" + m68k-atari-mint-ar x "${DEPS}/st/lib/libmikmod.a" m68k-atari-mint-ar rcs "${DIST}/libjoeylib.a" *.o popd clearBuild diff --git a/joeylib/joeylib.pro b/joeylib/joeylib.pro index bc58f09..46b884e 100644 --- a/joeylib/joeylib.pro +++ b/joeylib/joeylib.pro @@ -1,11 +1,14 @@ +JOEY = /home/scott/joey +CONFIG += SDL12 +#CONFIG += SDL2 + + TEMPLATE = app CONFIG += console CONFIG -= \ app_bundle \ qt -JOEY = /home/scott/joey - QMAKE_CFLAGS += \ -I$$PWD/src \ -D_REENTRANT @@ -16,34 +19,41 @@ HEADERS += \ SOURCES += \ src/joey.c \ - src/jPC.c \ src/test.c +SDL12 { + SOURCES += src/jSDL12.c + + LIBS += \ + -L$$JOEY/sdks/linux/x64/lib \ + -lSDL \ + -lSDL_mixer \ + -lmikmod \ + -lm \ + -ldl \ + -lsndio +} + +SDL2 { + SOURCES += src/jSDL2.c + + LIBS += \ + -L$$JOEY/sdks/linux/x64/lib \ + -Wl,--enable-new-dtags \ + -lSDL2 \ + -lSDL2_mixer \ + -lmodplug \ + -Wl,--no-undefined \ + -lm \ + -ldl \ + -lpthread \ + -lrt +} + OTHER_FILES += \ - src/jBlank.c \ - src/jST.c \ + src/jBlankcd ..c \ src/jAmiga.c \ src/jIIgs.c \ src/jIIgs.asm \ src/jIIgs.macro \ - build-IIgs.sh \ - build-IIgs.helper.sh \ - build-PC.sh - -SDL_LIBS = \ - -L$$JOEY/SDL2/installed/linux/x64/lib \ - -Wl,--enable-new-dtags \ - -lSDL2 \ - -lSDL2_mixer \ - -lmodplug \ - -Wl,--no-undefined \ - -lm \ - -ldl \ - -lpthread \ - -lrt - -LIBS += \ - $$SDL_LIBS - -DISTFILES += \ - joey.pri + joey.pri diff --git a/joeylib/src/jST.c b/joeylib/src/jSDL12.c similarity index 100% rename from joeylib/src/jST.c rename to joeylib/src/jSDL12.c diff --git a/joeylib/src/jPC.c b/joeylib/src/jSDL2.c similarity index 100% rename from joeylib/src/jPC.c rename to joeylib/src/jSDL2.c diff --git a/scripts/installer.sh b/scripts/installer.sh index 8ae5fb5..ff2c943 100755 --- a/scripts/installer.sh +++ b/scripts/installer.sh @@ -116,7 +116,7 @@ function buildPCDeps() { hg clone http://hg.libsdl.org/SDL fi if [[ ! -e "${PREFIX}/lib/libSDL2.a" ]]; then - clearPCDepsBuild + clearDepsBuild pushd build &> /dev/null ../SDL/configure \ --target="${CROSS}" \ @@ -145,7 +145,7 @@ function buildPCDeps() { popd &> /dev/null fi if [[ ! -e "${PREFIX}/lib/libmodplug.a" ]]; then - clearPCDepsBuild + clearDepsBuild pushd build &> /dev/null ../libmodplug/configure \ --target="${CROSS}" \ @@ -165,7 +165,7 @@ function buildPCDeps() { hg clone http://hg.libsdl.org/SDL_mixer fi if [[ ! -e "${PREFIX}/lib/libSDL2_mixer.a" ]]; then - clearPCDepsBuild + clearDepsBuild pushd build &> /dev/null MODPLUG_CFLAGS="-I${PREFIX}/include -DMODPLUG_STATIC" \ MODPLUG_LIBS="-L${PREFIX}/lib -lmodplug -lstdc++ -lm" \ @@ -204,7 +204,80 @@ function buildPCDeps() { } -function clearPCDepsBuild() { +function buildSDL12() { + local CROSS=$1 + local PREFIX=$2 + + mkdir -p deps + pushd deps &> /dev/null + + purple "Building SDL" + if [[ ! -d SDL-1.2 ]]; then + hg clone http://hg.libsdl.org/SDL SDL-1.2 -r SDL-1.2 + fi + if [[ ! -e "${PREFIX}/lib/libSDL.a" ]]; then + clearDepsBuild + pushd build &> /dev/null + CC="${CROSS}-gcc" \ + ../SDL-1.2/configure \ + --target="${CROSS}" \ + --host="${CROSS}" \ + --build=x86_64-linux \ + --enable-static \ + --disable-shared \ + --disable-threads \ + --disable-video-opengl \ + --prefix="${PREFIX}" + make + make install + popd &> /dev/null # build + fi + + purple "Building SDL_mixer and libMikMod" + if [[ ! -d SDL_mixer-1.2 ]]; then + hg clone http://hg.libsdl.org/SDL_mixer SDL_mixer-1.2 -r SDL-1.2 + fi + if [[ ! -e "${PREFIX}/lib/libmikmod.a" ]]; then + clearDepsBuild + pushd build &> /dev/null + unzip ../SDL_mixer-1.2/libmikmod-*.zip + mv libmikmod-* libmikmod + CC="${CROSS}-gcc" \ + libmikmod/configure \ + --target="${CROSS}" \ + --host="${CROSS}" \ + --build=x86_64-linux \ + --enable-static \ + --disable-shared \ + --prefix="${PREFIX}" + make + make install + popd &> /dev/null # build + fi + if [[ ! -e "${PREFIX}/lib/libSDL_mixer.a" ]]; then + clearDepsBuild + pushd build &> /dev/null + SDL_CONFIG="${PREFIX}/bin/sdl-config" \ + LIBMIKMOD_CONFIG="${PREFIX}/bin/libmikmod-config" \ + CC="${CROSS}-gcc" \ + ../SDL_mixer-1.2/configure \ + --target="${CROSS}" \ + --host="${CROSS}" \ + --build=x86_64-linux \ + --enable-static \ + --disable-shared \ + --disable-music-midi \ + --enable-music-mod \ + --disable-music-mod-shared \ + --prefix="${PREFIX}" + make + make install + popd &> /dev/null # build + fi +} + + +function clearDepsBuild() { if [[ -d $(pwd)/build ]]; then rm -rf $(pwd)/build fi @@ -573,6 +646,7 @@ function installLinux64() { "x86_64-linux-gnu-gcc" \ "x86_64-linux-gnu-g++" \ "" + buildSDL12 "x86_64-linux-gnu" "${JOEY}/sdks/linux/x64" } @@ -680,7 +754,7 @@ function installST() { popd &> /dev/null fi - #***TODO*** SDL & Friends + buildSDL12 "m68k-atari-mint" "${ST}" purple "Building JoeyLib" "${G_PARENT}/joeylib/joeylib/build.sh" st &> /dev/null @@ -898,6 +972,7 @@ function start() { sed \ tar \ texinfo \ + unzip \ uuid-dev \ wget \ xcftools \ @@ -936,6 +1011,7 @@ function start() { echo "" tBoldBox tBLUE "Downloading JoeyLib source..." git clone https://skunkworks.kangaroopunch.com/skunkworks/joeylib.git ${G_PARENT}/joeylib &> /dev/null + #***TODO*** Swap the manually downloaded install script for the one in the archive with a symlink. fi mainMenu @@ -954,6 +1030,7 @@ function start() { G_PARENT=$(pwd) G_SCRIPT=$(basename -- "$0") +# Set this in case we don't have a config file yet. export JOEY=${G_PARENT} # Is SUDO after us?