Build server now generates binary distribution of JoeyLib with debug and release versions.

This commit is contained in:
Scott Duensing 2022-09-28 17:51:51 -05:00
parent 608cd8c1df
commit 6d9d2fa4d9
5 changed files with 87 additions and 69 deletions

View file

@ -11,6 +11,8 @@ CONFIG -= \
app_bundle \ app_bundle \
qt qt
DEFINES += JOEY_DEBUG
# Determine which libraries to link against. # Determine which libraries to link against.
defined(BREW,var) { defined(BREW,var) {
# Use Homebrew libraries. # Use Homebrew libraries.

View file

@ -224,6 +224,7 @@ static void _jlAudioCallback(void *userdata, Uint8 *buffer, int bytes) {
// Combine channels into a mono sample. // Combine channels into a mono sample.
work = (data[i] + data[i + 1]) * 0.5; work = (data[i] + data[i + 1]) * 0.5;
// Determine channel. // Determine channel.
// ***TODO*** These should be channel bits that can be ORed together!
isRight = (sound->channel & 0x01); isRight = (sound->channel & 0x01);
if (_jlSwapChannels) isRight = !isRight; if (_jlSwapChannels) isRight = !isRight;
if (isRight) { if (isRight) {

View file

@ -227,6 +227,7 @@ static void _jlAudioCallback(void *userdata, Uint8 *buffer, int bytes) {
// Combine channels into a mono sample. // Combine channels into a mono sample.
work = (data[i] + data[i + 1]) * 0.5; work = (data[i] + data[i + 1]) * 0.5;
// Determine channel. // Determine channel.
// ***TODO*** These should be channel bits that can be ORed together!
isRight = (sound->channel & 0x01); isRight = (sound->channel & 0x01);
if (_jlSwapChannels) isRight = !isRight; if (_jlSwapChannels) isRight = !isRight;
if (isRight) { if (isRight) {

View file

@ -28,11 +28,6 @@ extern "C" {
#endif #endif
#ifndef BUILD_SERVER
//#define JOEY_DEBUG
#endif
#include <stdlib.h> #include <stdlib.h>
#include <setjmp.h> #include <setjmp.h>
@ -302,14 +297,14 @@ extern jmp_buf _jlJumpBuffer;
enum _jlSoundChannelE { enum _jlSoundChannelE {
CHANNEL_FRONT_LEFT = 0, CHANNEL_FRONT_LEFT = 0,
CHANNEL_FRONT_RIGHT = 1, CHANNEL_FRONT_RIGHT = 1,
CHANNEL_SURROUND_LEFT = 2, CHANNEL_SURROUND_LEFT = 2,
CHANNEL_SURROUND_RIGHT = 3, CHANNEL_SURROUND_RIGHT = 4,
CHANNEL_FRONT_HIGH_LEFT = 4, CHANNEL_FRONT_HIGH_LEFT = 8,
CHANNEL_FRONT_HIGH_RIGHT = 5, CHANNEL_FRONT_HIGH_RIGHT = 16,
CHANNEL_SURROUND_BACK_LEFT = 6, CHANNEL_SURROUND_BACK_LEFT = 32,
CHANNEL_SURROUND_BACK_RIGHT = 7 CHANNEL_SURROUND_BACK_RIGHT = 64
}; };
typedef enum _jlSoundChannelE jlSoundChannelE; typedef enum _jlSoundChannelE jlSoundChannelE;
@ -399,7 +394,7 @@ void *_jlRealloc(void *pointer, size_t size);
#else #else
#define jlFree(p) free(p); p = 0 #define jlFree(p) {free(p); p = 0;}
#define jlMalloc malloc #define jlMalloc malloc
#define jlMallocEx(s, l, f) malloc(s) #define jlMallocEx(s, l, f) malloc(s)

View file

@ -1,4 +1,4 @@
#!/bin/bash -e #!/bin/bash -ex
# #
# JoeyLib # JoeyLib
@ -206,6 +206,7 @@ function buildIIgsSDK() {
function buildJoeyLib() { function buildJoeyLib() {
local OUT= local OUT=
local PASS=
local OLD_CFLAGS=${CFLAGS} local OLD_CFLAGS=${CFLAGS}
if [[ ! -d joeylib ]]; then if [[ ! -d joeylib ]]; then
@ -213,51 +214,65 @@ function buildJoeyLib() {
fi fi
rm -rf dist/${NAME}-${ARCH} || true rm -rf dist/${NAME}-${ARCH} || true
mkdir -p dist/${NAME}-${ARCH}
pushd dist/${NAME}-${ARCH} for PASS in "debug" "release"; do
case ${BACKEND} in
orca) mkdir -p dist/${NAME}-${ARCH}/${PASS}
OUT=${GOLDEN_GATE}/out/joey
rm -rf ${OUT} || true pushd dist/${NAME}-${ARCH}/${PASS}
mkdir -p ${OUT}/out/joey case ${BACKEND} in
pushd ${SRC} orca)
# Add BUILD_SERVER flag. OUT=${GOLDEN_GATE}/out/joey
cp joey.h joey.h.original rm -rf ${OUT} || true
sed -i "1i #define BUILD_SERVER" joey.h mkdir -p ${OUT}/out/joey
iix assemble jIIgs.asm keep=31:/out/joey/jIIgsasm pushd ${SRC}
iix compile jIIgs.c keep=31:/out/joey/jIIgsc if [[ "${PASS}" == "debug" ]]; then
iix compile joey.c keep=31:/out/joey/joey # Add JOEY_DEBUG flag.
# Remove BUILD_SERVER. cp joey.h joey.h.original
rm joey.h sed -i "1i #define JOEY_DEBUG" joey.h
mv joey.h.original joey.h fi
popd iix assemble jIIgs.asm keep=31:/out/joey/jIIgsasm
cp -f "${OUT}/jIIgsc.root" "jIIgsc.root#b10000" iix compile jIIgs.c keep=31:/out/joey/jIIgsc
cp -f "${OUT}/jIIgsc.a" "jIIgsc.a#b10000" iix compile joey.c keep=31:/out/joey/joey
cp -f "${OUT}/jIIgsasm.root" "jIIgsasm.root#b10000" if [[ "${PASS}" == "debug" ]]; then
cp -f "${OUT}/jIIgsasm.a" "jIIgsasm.a#b10000" # Remove JOEY_DEBUG.
cp -f "${OUT}/joey.a" "joey.a#b10000" rm joey.h
cp -f "${IIGS}/Tool222#ba0000" . mv joey.h.original joey.h
;; fi
popd
SDL2) cp -f "${OUT}/jIIgsc.root" "jIIgsc.root#b10000"
export CFLAGS="${CFLAGS} -I${SRC} -I${INSTALLED}/include -c" cp -f "${OUT}/jIIgsc.a" "jIIgsc.a#b10000"
${CC} ${CFLAGS} -o jPixBuf.o ${SRC}/jPixBuf.c cp -f "${OUT}/jIIgsasm.root" "jIIgsasm.root#b10000"
${CC} ${CFLAGS} -o jSDL2.o ${SRC}/jSDL2.c cp -f "${OUT}/jIIgsasm.a" "jIIgsasm.a#b10000"
${CC} ${CFLAGS} -o joey.o ${SRC}/joey.c cp -f "${OUT}/joey.a" "joey.a#b10000"
${AR} x ${INSTALLED}/lib/libSDL2.a cp -f "${IIGS}/Tool222#ba0000" .
${AR} x ${INSTALLED}/lib/libSDL2main.a ;;
${AR} rcs libjoeylib.a *.o
rm *.o SDL2)
rm __.SYMDEF* || true export CFLAGS="${CFLAGS} -I${SRC} -I${INSTALLED}/include -c"
;; if [[ "${PASS}" == "debug" ]]; then
export CFLAGS="-DJOEY_DEBUG ${CFLAGS}"
esac fi
${CC} ${CFLAGS} -o jPixBuf.o ${SRC}/jPixBuf.c
${CC} ${CFLAGS} -o jSDL2.o ${SRC}/jSDL2.c
${CC} ${CFLAGS} -o joey.o ${SRC}/joey.c
${AR} x ${INSTALLED}/lib/libSDL2.a
${AR} x ${INSTALLED}/lib/libSDL2main.a
${AR} rcs libjoeylib.a *.o
rm *.o
rm __.SYMDEF* || true
;;
esac
cp -f ${SRC}/joey.h ../. cp -f ${SRC}/joey.h ../../.
popd mkdir -p ../../3rdparty/memwatch
cp -f ${SRC}/3rdparty/memwatch/* ../../3rdparty/memwatch/.
export CFLAGS=${OLD_CFLAGS} popd
export CFLAGS=${OLD_CFLAGS}
done
} }
@ -451,7 +466,7 @@ function doBuild() {
BUILD_PLATFORMS="${BUILD_PLATFORMS}${LINE,,} " BUILD_PLATFORMS="${BUILD_PLATFORMS}${LINE,,} "
LOG="${BUILD_RESULTS}/build.${LINE,,}" LOG="${BUILD_RESULTS}/build.${LINE,,}"
LIB="${DIST}/${NAME}-${ARCH}" LIB="${DIST}/${NAME}-${ARCH}/release"
[[ -d "${TARGET}" ]] && rm -rf "${TARGET}" [[ -d "${TARGET}" ]] && rm -rf "${TARGET}"
mkdir -p "${TARGET}" mkdir -p "${TARGET}"
@ -463,8 +478,6 @@ function doBuild() {
case ${BACKEND} in case ${BACKEND} in
orca) orca)
# Pass in -DBUILD_SERVER
sed -i "1i #define BUILD_SERVER" "${SOURCE}/joey.h"
# Compile C files and generate object list. # Compile C files and generate object list.
OFILES="" OFILES=""
for FILE in "${CFILES[@]}"; do for FILE in "${CFILES[@]}"; do
@ -587,7 +600,7 @@ function doInstall() {
if [[ ! -f /etc/rc.local ]]; then if [[ ! -f /etc/rc.local ]]; then
echo "#!/bin/bash" | sudo tee /etc/rc.local echo "#!/bin/bash" | sudo tee /etc/rc.local
echo "${EHOME}/buildVm.sh server ${EHOME}/dist &> /dev/null &" | sudo tee -a /etc/rc.local echo "${EHOME}/buildVm.sh server ${EHOME}/dist ${EHOME}/builds.log &> /dev/null &" | sudo tee -a /etc/rc.local
echo "exit 0" | sudo tee -a /etc/rc.local echo "exit 0" | sudo tee -a /etc/rc.local
fi fi
} }
@ -651,6 +664,9 @@ function rebuildJoeyLib() {
setCompiler windows x86_64 setCompiler windows x86_64
buildJoeyLib buildJoeyLib
rm -f dist.tar.bz2 || true
tar cJf dist.tar.bz2 dist
} }
@ -678,7 +694,7 @@ function setCompiler() {
NAME="linux-intel" NAME="linux-intel"
ARCH=i386 ARCH=i386
TRIPLE="x86_64-linux-gnu" TRIPLE="x86_64-linux-gnu"
export CFLAGS="-m32 -DBUILD_SERVER -Wall -D_REENTRANT_" export CFLAGS="-m32 -Wall -D_REENTRANT_"
export LDFLAGS="-lm -ldl -lpthread" export LDFLAGS="-lm -ldl -lpthread"
;; ;;
@ -686,7 +702,7 @@ function setCompiler() {
NAME="linux-intel" NAME="linux-intel"
ARCH=x86_64 ARCH=x86_64
TRIPLE="${ARCH}-linux-gnu" TRIPLE="${ARCH}-linux-gnu"
export CFLAGS="-DBUILD_SERVER -Wall -D_REENTRANT_" export CFLAGS="-Wall -D_REENTRANT_"
export LDFLAGS="-lm -ldl -lpthread" export LDFLAGS="-lm -ldl -lpthread"
;; ;;
@ -725,7 +741,7 @@ function setCompiler() {
esac esac
BACKEND=SDL2 BACKEND=SDL2
LDFIRST= LDFIRST=
export CFLAGS="-DBUILD_SERVER -Wall -D_THREAD_SAFE" export CFLAGS="-Wall -D_THREAD_SAFE"
export PATH=${EHOME}/cross/${NAME}/bin:${OLD_PATH} export PATH=${EHOME}/cross/${NAME}/bin:${OLD_PATH}
export LD_LIBRARY_PATH=${EHOME}/cross/${NAME}/lib export LD_LIBRARY_PATH=${EHOME}/cross/${NAME}/lib
export CC=${TRIPLE}-clang export CC=${TRIPLE}-clang
@ -753,7 +769,7 @@ function setCompiler() {
LDFIRST="-lmingw32" LDFIRST="-lmingw32"
export PATH=${OLD_PATH} export PATH=${OLD_PATH}
export LD_LIBRARY_PATH= export LD_LIBRARY_PATH=
export CFLAGS="-DBUILD_SERVER -Dmain=SDL_main -Wall -static-libgcc" export CFLAGS="-Dmain=SDL_main -Wall -static-libgcc"
export LDFLAGS="-mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" export LDFLAGS="-mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid"
export CC=${TRIPLE}-gcc export CC=${TRIPLE}-gcc
export AR=${TRIPLE}-ar export AR=${TRIPLE}-ar
@ -791,16 +807,19 @@ function scriptIsDownloaded() {
;; ;;
server) server)
startBuildServer "${2}" startBuildServer "${2}" "${3}"
;; ;;
*) *)
set +x
echo ""
echo "${0} add USER PASS" echo "${0} add USER PASS"
echo "${0} build DIST SRC" echo "${0} build DIST SRC"
echo "${0} del USER" echo "${0} del USER"
echo "${0} install GGUSER GGPASS" echo "${0} install GGUSER GGPASS"
echo "${0} rebuild" echo "${0} rebuild"
echo "${0} server DIST" echo "${0} server DIST LOG"
set -x
;; ;;
esac esac
} }
@ -808,7 +827,7 @@ function scriptIsDownloaded() {
function startBuildServer() { function startBuildServer() {
local DIST=$1 local DIST=$1
local LOG=${0}.log local LOG=$2
local USERNAME= local USERNAME=
local FILE= local FILE=