Build server builds non-debug versions of JoeyLib and apps.

This commit is contained in:
Scott Duensing 2022-09-26 16:47:34 -05:00
parent 862bfc5f71
commit 99b1ac8e6d
4 changed files with 104 additions and 31 deletions

View file

@ -151,6 +151,9 @@ void jlDrawSurfaceSet(jlSurfaceT target) {
jbool _jlImgCreate(jlImgT **img, jint16 line, char *file) { jbool _jlImgCreate(jlImgT **img, jint16 line, char *file) {
jlImgT *t = NULL; jlImgT *t = NULL;
(void)line;
(void)file;
// Are we loading into a new image? // Are we loading into a new image?
if (*img == NULL) { if (*img == NULL) {
t = (jlImgT *)jlMallocEx(sizeof(jlImgT), line, file); t = (jlImgT *)jlMallocEx(sizeof(jlImgT), line, file);

View file

@ -639,6 +639,10 @@ jbool jlGameGetButton(jbyte which) {
#ifndef JL_HAS_IMGCOPY #ifndef JL_HAS_IMGCOPY
jbool _jlImgCopy(jlImgT **target, jlImgT *source, jint16 line, char *file) { jbool _jlImgCopy(jlImgT **target, jlImgT *source, jint16 line, char *file) {
jlImgT *t = NULL; jlImgT *t = NULL;
(void)line;
(void)file;
// Are we copying into a new image? // Are we copying into a new image?
if (*target == NULL) { if (*target == NULL) {
t = (jlImgT *)jlMallocEx(sizeof(jlImgT), line, file); t = (jlImgT *)jlMallocEx(sizeof(jlImgT), line, file);
@ -685,6 +689,9 @@ jbool _jlImgLoad(jlImgT **img, char *filename, jint16 line, char *file) {
jlImgT *s = NULL; jlImgT *s = NULL;
FILE *f = NULL; FILE *f = NULL;
(void)line;
(void)file;
// Are we loading into a new image? // Are we loading into a new image?
if (*img == NULL) { if (*img == NULL) {
s = (jlImgT *)jlMallocEx(sizeof(jlImgT), line, file); s = (jlImgT *)jlMallocEx(sizeof(jlImgT), line, file);
@ -915,6 +922,9 @@ jbool _jlStnLoad(jlStnT **stn, char *filename, jint16 line, char *file) {
jlStnT *s = NULL; jlStnT *s = NULL;
FILE *f = NULL; FILE *f = NULL;
(void)line;
(void)file;
// Are we loading into a new stencil? // Are we loading into a new stencil?
if (*stn == NULL) { if (*stn == NULL) {
s = (jlStnT *)jlMallocEx(sizeof(jlStnT), line, file); s = (jlStnT *)jlMallocEx(sizeof(jlStnT), line, file);
@ -943,10 +953,12 @@ jbool _jlStnLoad(jlStnT **stn, char *filename, jint16 line, char *file) {
#ifndef JL_HAS_UTILDIE #ifndef JL_HAS_UTILDIE
__attribute__((__format__ (__printf__, 1, 0))) __attribute__((__format__ (__printf__, 1, 0)))
void jlUtilDie(const char *why, ...) { void jlUtilDie(const char *why, ...) {
jint16 i;
char msg[2048]; char msg[2048];
va_list va; va_list va;
static jbool alreadyDead = jfalse; static jbool alreadyDead = jfalse;
#ifdef JOEY_DEBUG
jint16 i;
#endif
if (!alreadyDead) { if (!alreadyDead) {
alreadyDead = jtrue; alreadyDead = jtrue;
@ -955,6 +967,7 @@ void jlUtilDie(const char *why, ...) {
vsprintf(msg, why, va); vsprintf(msg, why, va);
va_end(va); va_end(va);
#ifdef JOEY_DEBUG
jlUtilSay("JoeyLib Statistics"); jlUtilSay("JoeyLib Statistics");
jlUtilSay(""); jlUtilSay("");
jlUtilSay(" Allocations: %ld", _jlTotalAllocations); jlUtilSay(" Allocations: %ld", _jlTotalAllocations);
@ -969,6 +982,8 @@ void jlUtilDie(const char *why, ...) {
} }
} }
jlUtilSay(""); jlUtilSay("");
#endif
jlUtilSay("%s", msg); jlUtilSay("%s", msg);
#ifndef JL_HAS_UTILMUSTEXIT #ifndef JL_HAS_UTILMUSTEXIT
@ -1240,6 +1255,10 @@ void *_jlUtilStackPop(jlStackT **stack) {
#ifndef JL_HAS_UTILSTACKPUSH #ifndef JL_HAS_UTILSTACKPUSH
void _jlUtilStackPush(jlStackT **stack, void *data, jint16 line, char *file) { void _jlUtilStackPush(jlStackT **stack, void *data, jint16 line, char *file) {
jlStackT *s = NULL; jlStackT *s = NULL;
(void)line;
(void)file;
s = (jlStackT *)jlMallocEx(sizeof(jlStackT), line, file); s = (jlStackT *)jlMallocEx(sizeof(jlStackT), line, file);
s->previous = *stack; s->previous = *stack;
s->data = data; s->data = data;
@ -1408,6 +1427,9 @@ jbool _jlVecLoad(jlVecT **vec, char *filename, jint16 line, char *file) {
FILE *f = NULL; FILE *f = NULL;
long size; long size;
(void)line;
(void)file;
// Are we loading into a new image? // Are we loading into a new image?
if (*vec != NULL) { if (*vec != NULL) {
jlVecFree(*vec); jlVecFree(*vec);

View file

@ -28,7 +28,9 @@ extern "C" {
#endif #endif
#define JOEY_DEBUG #ifndef BUILD_SERVER
//#define JOEY_DEBUG
#endif
#include <stdlib.h> #include <stdlib.h>
@ -397,8 +399,9 @@ 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)
#endif #endif

View file

@ -22,13 +22,28 @@
# #
SRC=${HOME}/joeylib/joeylib/src NAME=
IIGS=${HOME}/cross/gsos-wdc-orca ARCH=
BACKEND=
INSTALLED=
TRIPLE=
BUILD_PROJECT=
BUILD_PLATFORMS=
BUILD_RESULTS=
EHOME=$(getent passwd $(logname) | cut -d: -f6)
SRC=${EHOME}/joeylib/joeylib/src
IIGS=${EHOME}/cross/gsos-wdc-orca
CADIUS=${IIGS}/cadius/cadius CADIUS=${IIGS}/cadius/cadius
SDL2_OLD=25f9ed87ff6947d9576fc9d79dee0784e638ac58 SDL2_OLD=25f9ed87ff6947d9576fc9d79dee0784e638ac58
SDL2_NEW=97a5e744497ff7cc93edc5119d67cad3ee86dd57 SDL2_NEW=97a5e744497ff7cc93edc5119d67cad3ee86dd57
OLD_PATH=${PATH} OLD_PATH=${PATH}
export CC=
export AR=
export CFLAGS=
export LD_LIBRARY_PATH=
export GOLDEN_GATE=${IIGS}/ORCA export GOLDEN_GATE=${IIGS}/ORCA
@ -186,8 +201,7 @@ function buildIIgsSDK() {
function buildJoeyLib() { function buildJoeyLib() {
local OUT= local OUT=
local OLD_CFLAGS=${CFLAGS}
OLD_CFLAGS=${CFLAGS}
if [[ ! -d joeylib ]]; then if [[ ! -d joeylib ]]; then
git clone https://skunkworks.kangaroopunch.com/skunkworks/joeylib.git git clone https://skunkworks.kangaroopunch.com/skunkworks/joeylib.git
@ -216,7 +230,7 @@ function buildJoeyLib() {
;; ;;
SDL2) SDL2)
export CFLAGS="${CFLAGS} -Wall -D_REENTRANT_ -I${SRC} -I${INSTALLED}/include -c" export CFLAGS="${CFLAGS} -DBUILD_SERVER -Wall -D_REENTRANT_ -I${SRC} -I${INSTALLED}/include -c"
${CC} ${CFLAGS} -o jPixBuf.o ${SRC}/jPixBuf.c ${CC} ${CFLAGS} -o jPixBuf.o ${SRC}/jPixBuf.c
${CC} ${CFLAGS} -o jSDL2.o ${SRC}/jSDL2.c ${CC} ${CFLAGS} -o jSDL2.o ${SRC}/jSDL2.c
${CC} ${CFLAGS} -o joey.o ${SRC}/joey.c ${CC} ${CFLAGS} -o joey.o ${SRC}/joey.c
@ -238,7 +252,7 @@ function buildJoeyLib() {
function buildMacOSSDK() { function buildMacOSSDK() {
local SDK=$1 local SDK=$1
local NAME=$2 local PLATFORM=$2
if [[ ! -d osxcross ]]; then if [[ ! -d osxcross ]]; then
git clone https://skunkworks.kangaroopunch.com/mirrors/osxcross.git git clone https://skunkworks.kangaroopunch.com/mirrors/osxcross.git
@ -248,9 +262,9 @@ function buildMacOSSDK() {
cp -f ../"${SDK}" tarballs/. cp -f ../"${SDK}" tarballs/.
UNATTENDED=1 ./build.sh UNATTENDED=1 ./build.sh
sudo ENABLE_COMPILER_RT_INSTALL=1 ./build_compiler_rt.sh sudo ENABLE_COMPILER_RT_INSTALL=1 ./build_compiler_rt.sh
mkdir -p ../cross/${NAME} mkdir -p ../cross/${PLATFORM}
mv -f target/* ../cross/${NAME} mv -f target/* ../cross/${PLATFORM}
sudo mv -f /usr/lib/llvm-10/lib/clang/10.0.0/lib/darwin ../cross/${NAME}/. sudo mv -f /usr/lib/llvm-10/lib/clang/10.0.0/lib/darwin ../cross/${PLATFORM}/.
./cleanup.sh ./cleanup.sh
popd popd
} }
@ -312,7 +326,7 @@ function delBuildUser() {
function doBuild() { function doBuild() {
local DIST=$1 local DIST=$1
local SRC=$2 local SOURCE=$2
local LINE= local LINE=
local DATA=() local DATA=()
local CFILES=() local CFILES=()
@ -325,8 +339,10 @@ function doBuild() {
local LIB= local LIB=
local O= local O=
local DISK= local DISK=
local EXT=
local OLD_CFLAGS=${CFLAGS}
pushd "${SRC}" pushd "${SOURCE}"
# Are there old reults to clean up? # Are there old reults to clean up?
if [[ -f build.finished ]]; then if [[ -f build.finished ]]; then
@ -336,7 +352,7 @@ function doBuild() {
rm -rf results rm -rf results
fi fi
mkdir -p results mkdir -p results
BUILD_RESULTS=${SRC}/results BUILD_RESULTS=${SOURCE}/results
# Read project information. # Read project information.
BUILD_PLATFORMS="[" BUILD_PLATFORMS="["
@ -362,41 +378,49 @@ function doBuild() {
setCompiler gsos 816 setCompiler gsos 816
TARGET="${GOLDEN_GATE}/out/build" TARGET="${GOLDEN_GATE}/out/build"
GSTARGET="31:/out/build" GSTARGET="31:/out/build"
EXT=
;; ;;
linux32) linux32)
setCompiler linux i386 setCompiler linux i386
TARGET="${SRC}/temp" TARGET="${SOURCE}/temp"
EXT=
;; ;;
linux64) linux64)
setCompiler linux x86_64 setCompiler linux x86_64
TARGET="${SRC}/temp" TARGET="${SOURCE}/temp"
EXT=
;; ;;
macosx32) macosx32)
setCompiler macos i386 setCompiler macos i386
TARGET="${SRC}/temp" TARGET="${SOURCE}/temp"
EXT=
;; ;;
macosx64) macosx64)
setCompiler macos x86_64 setCompiler macos x86_64
TARGET="${SRC}/temp" TARGET="${SOURCE}/temp"
EXT=
;; ;;
macosa64) macosa64)
setCompiler macos arm setCompiler macos arm
TARGET="${SRC}/temp" TARGET="${SOURCE}/temp"
EXT=
;; ;;
win32) win32)
setCompiler windows i386 setCompiler windows i386
TARGET="${SRC}/temp" TARGET="${SOURCE}/temp"
EXT=.exe
;; ;;
win64) win64)
setCompiler windows x86_64 setCompiler windows x86_64
TARGET="${SRC}/temp" TARGET="${SOURCE}/temp"
EXT=.exe
;; ;;
esac esac
@ -407,11 +431,14 @@ function doBuild() {
[[ -d "${TARGET}" ]] && rm -rf "${TARGET}" [[ -d "${TARGET}" ]] && rm -rf "${TARGET}"
mkdir -p "${TARGET}" mkdir -p "${TARGET}"
mkdir -p ${BUILD_RESULTS}/${LINE,,}
# Make sure we have the official JoeyLib header. # Make sure we have the official JoeyLib header.
cp -f "${DIST}/joey.h" "${TARGET}/." cp -f "${DIST}/joey.h" "${SOURCE}/."
case ${BACKEND} in case ${BACKEND} in
orca) orca)
#***TODO*** Somehow pass in -DBUILD_SERVER
# 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
@ -436,20 +463,36 @@ function doBuild() {
iix -DKeepType=S16 link ${OFILES} keep=${GSTARGET}/${BUILD_PROJECT}#b3db03 iix -DKeepType=S16 link ${OFILES} keep=${GSTARGET}/${BUILD_PROJECT}#b3db03
# Create disk image, setting known file types # Create disk image, setting known file types
DISK=${BUILD_RESULTS}/${LINE,,}/build.po DISK=${BUILD_RESULTS}/${LINE,,}/build.po
${CADIUS} createvolume ${DISK} ${BUILD_PROJECT} 32MB > /dev/null ${CADIUS} createvolume ${DISK} ${BUILD_PROJECT} 32MB
${CADIUS} createfolder ${DISK} ${BUILD_PROJECT}/data > /dev/null ${CADIUS} createfolder ${DISK} ${BUILD_PROJECT}/data
${CADIUS} addfile ${DISK} ${BUILD_PROJECT} ${TARGET}/${BUILD_PROJECT}#b3db03 > /dev/null ${CADIUS} addfile ${DISK} ${BUILD_PROJECT} ${TARGET}/${BUILD_PROJECT}#b3db03
${CADIUS} addfile ${DISK} ${BUILD_PROJECT}/data ${LIB}/Tool222#ba0000 > /dev/null ${CADIUS} addfile ${DISK} ${BUILD_PROJECT}/data ${LIB}/Tool222#ba0000
# Copy game data.
for FILE in "${DATA[@]}"; do for FILE in "${DATA[@]}"; do
#***TODO*** Data conversion here! #***TODO*** Data conversion here!
O=`basename ${FILE}`#060000 O=`basename ${FILE}`#060000
cp -f ${FILE} ${O} cp -f ${FILE} ${O}
${CADIUS} addfile ${DISK} ${BUILD_PROJECT}/data ${O} > /dev/null ${CADIUS} addfile ${DISK} ${BUILD_PROJECT}/data ${O}
rm ${O} rm ${O}
done done
;; ;;
SDL2) SDL2)
export CFLAGS="${CFLAGS} -DBUILD_SERVER -Wall -D_REENTRANT_ -I${DIST}"
# Compile C files and generate object list.
OFILES=""
for FILE in "${CFILES[@]}"; do
O=${FILE%.*}.o
OFILES="${OFILES} ${TARGET}/${O}"
${CC} ${CFLAGS} -c ${FILE} -o ${TARGET}/${O}
done
# Link.
${CC} ${CFLAGS} -o ${BUILD_RESULTS}/${LINE,,}/${BUILD_PROJECT}${EXT} ${OFILES} ${LIB}/libjoeylib.a -lm -ldl -lpthread
# Copy game data.
for FILE in "${DATA[@]}"; do
#***TODO*** Data conversion here!
cp -f ${FILE} ${BUILD_RESULTS}/${LINE,,}/.
done
;; ;;
esac esac
fi fi
@ -458,6 +501,8 @@ function doBuild() {
BUILD_PLATFORMS="${BUILD_PLATFORMS}]" BUILD_PLATFORMS="${BUILD_PLATFORMS}]"
popd popd
export CFLAGS=${OLD_CFLAGS}
} }
@ -702,7 +747,7 @@ function startBuildServer() {
doBuild "${DIST}" "${USERNAME}/build" doBuild "${DIST}" "${USERNAME}/build"
pushd "${USERNAME}/build" &> /dev/null pushd "${USERNAME}/build"
# Compress the results. # Compress the results.
tar cJf build.temp results tar cJf build.temp results
@ -722,7 +767,7 @@ function startBuildServer() {
# Log it. # Log it.
echo "$(date) - Compiled ${BUILD_PROJECT} for ${USERNAME} on ${BUILD_PLATFORMS}" >> ${LOG} echo "$(date) - Compiled ${BUILD_PROJECT} for ${USERNAME} on ${BUILD_PLATFORMS}" >> ${LOG}
popd &> /dev/null popd
fi fi
done done