Linux builds working.

This commit is contained in:
Scott Duensing 2023-01-12 21:31:03 -06:00
parent b26b44fdbd
commit 2605c7e82e
9 changed files with 202 additions and 48 deletions

View file

@ -14,4 +14,4 @@ tSudo chown -R test:test /home/test/build
tSudo chmod ugo+rwx /home/test/build
tSudo chmod ugo+rw /home/test/build/*
./joeybuild.sh build /home/test/build
./joeybuild.sh build test

111
helpers/GCC.helper Normal file
View file

@ -0,0 +1,111 @@
#!/bin/bash
#
# JoeyBuild
# Copyright (C) 2018-2023 Scott Duensing <scott@kangaroopunch.com>
#
# 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.
#
function assembleGCC() {
local ARCH=$1
local PASS=$2
local LOG=$3
local AFILES=(${*:4})
local OFILES=""
local FILE=
local O=
# Assemble ASM files and generate object list.
for FILE in "${AFILES[@]}"; do
O=${G_TEMP}/${FILE%.*}
OFILES="${OFILES} ${O}"
# as
#gcc -static -nostdlib -nostartfiles ${FILE} -o ${O}
done
echo ${OFILES}
}
function compileGCC() {
local ARCH=$1
local PASS=$2
local LOG=$3
local CFILES=(${*:4})
local OFILES=""
local FILE=
local O=
rm -rf "${G_TEMP}" || true
mkdir -p "${G_TEMP}"
# Compile C files and generate object list.
for FILE in "${CFILES[@]}"; do
O=${G_TEMP}/$(basename ${FILE%.*}).o
OFILES="${OFILES} ${O}"
${CC} ${CFLAGS} -c ${FILE} -o ${O}
done
echo ${OFILES}
}
function linkGCC() {
local OS=$1
local ARCH=$2
local PASS=$3
local EXT=$4
local LOG=$5
local OFILES=(${*:6})
local LIB="${G_EHOME}/dist/${OS}-${ARCH}/${PASS}"
local DIR=${G_BUILD_RESULTS}/${OS}-${ARCH}/${PASS}
mkdir -p ${DIR}
${LD} ${CFLAGS} -o ${DIR}/${G_BUILD_PROJECT}${EXT} ${OFILES[@]} ${LIB}/libjoeylib.a ${LDFLAGS}
}
function packageGCC() {
local OS=$1
local ARCH=$2
local PASS=$3
local LOG=$4
local DFILES=(${*:5})
local DIR=${G_BUILD_RESULTS}/${OS}-${ARCH}/${PASS}/data
local FILE=
local O=
local EXTENSION=
#***TODO*** Maybe copy source code for everything to the disk in DEBUG so there are symbols to view?
mkdir -p ${DIR}
# Copy game data.
for FILE in "${DFILES[@]}"; do
# Data conversion.
EXTENSION="${FILE##*.}"
case ${EXTENSION,,} in
*)
O=${DIR}/$(basename ${FILE})
cp -f ${FILE} ${O}
;;
esac
done
}

View file

@ -23,10 +23,15 @@
function buildJoeyLibSDL2() {
local PASS=$1
rm -rf ${G_DIST}
mkdir -p ${G_DIST}
pushd ${G_DIST}
if [[ "${PASS}" == "debug" ]]; then
${CC} ${CFLAGS} -I${G_SRC}/3rdparty/memwatch -o memwatch.o ${G_SRC}/3rdparty/memwatch/memwatch.c
fi
${CC} ${CFLAGS} -o jPixBuf.o ${G_SRC}/jPixBuf.c
${CC} ${CFLAGS} -o jSDL2.o ${G_SRC}/jSDL2.c
${CC} ${CFLAGS} -o joey.o ${G_SRC}/joey.c

View file

@ -94,7 +94,8 @@ function delBuildUser() {
function doBuild() {
local SOURCE=$1
local USERNAME=$1
local SOURCE=/home/"${USERNAME}/build"
local LINE=
local FILE=
local EXTENSION=
@ -109,8 +110,6 @@ function doBuild() {
local PASS=
local PROJECT_TYPE=
set -x
pushd "${SOURCE}"
# Are there old results to clean up?
@ -169,6 +168,11 @@ function doBuild() {
for TEMP in ${LINE}; do
if [[ -z ${TARGET} ]]; then
TARGET=${TEMP}
call RESULT ${TARGET} enabled
if [[ ${RESULT} -ne 1 ]]; then
# Target is not enabled, stop.
break
fi
else
for PASS in "debug" "release"; do
tBoldBox tPURPLE "Building \"${G_BUILD_PROJECT}\" ${TARGET} ${TEMP} (${PASS})..."
@ -201,6 +205,27 @@ function doBuild() {
done < build.start
# Compress the results.
tar cJf build.temp results
tSudo chown ${USERNAME}:${USERNAME} build.temp
# Erase everything except the temp file.
rm -rf "${G_BUILD_RESULTS}"
for FILE in $(ls -1); do
if [[ -f "${FILE}" ]]; then
if [[ "${FILE}" != "build.temp" ]]; then
rm "${FILE}"
fi
else
if [[ -d "${FILE}" ]]; then
rm -r "${FILE}"
fi
fi
done
# Signal JoeyDev we're done.
mv build.temp build.tar.bz2
popd
tTrim TEMP "${G_BUILD_PLATFORMS}"
@ -225,7 +250,7 @@ function doInstall() {
# Start build server on reboot.
if [[ ! -f /etc/rc.local ]]; then
echo "#!/bin/bash" | tSudo tee /etc/rc.local > /dev/null
echo "cd ${G_HOME}" | tSudo tee -a /etc/rc.local > /dev/null
echo "cd ${G_EHOME}" | tSudo tee -a /etc/rc.local > /dev/null
echo "sudo -u $(logname) ${BASH_SOURCE[0]} server &> /dev/null &" | tSudo tee -a /etc/rc.local > /dev/null
echo "exit 0" | tSudo tee -a /etc/rc.local > /dev/null
fi
@ -318,7 +343,7 @@ function startup() {
#set +x
tBoldBox tGREEN "${G_TITLE} Options"
echo "${NAME} add USER PASS"
echo "${NAME} build SRC"
echo "${NAME} build USER"
echo "${NAME} del USER"
echo "${NAME} install"
echo "${NAME} rebuild"
@ -338,7 +363,7 @@ function startBuildServer() {
local USERNAME=
local FILE=
cd ${G_HOME}
cd ${G_EHOME}
# Log startup.
echo "$(date) - Startup ${0}" >> "${LOG}"
@ -376,42 +401,18 @@ function startBuildServer() {
chmod go-rwx "${USERNAME}/build"
# Handle building JoeyLib Applications.
if [[ -f "${USERNAME}/build/build.application" ]]; then
if [[ -f "${USERNAME}/build/build.start" ]]; then
# Are there old reults to clean up?
if [[ -f build.tar.bz2 ]]; then
rm build.tar.bz2
fi
doBuild /home/"${USERNAME}/build"
pushd "${USERNAME}/build"
# Compress the results.
tar cJf build.temp results
chown ${USERNAME}:${USERNAME} build.temp
# Erase everything except the temp file.
rm -rf "${G_BUILD_RESULTS}"
for FILE in $(ls -1); do
if [[ -f "${FILE}" ]]; then
if [[ "${FILE}" != "build.temp" ]]; then
rm "${FILE}"
fi
else
if [[ -d "${FILE}" ]]; then
rm -r "${FILE}"
fi
fi
done
# Signal JoeyDev we're done.
mv build.temp build.tar.bz2
doBuild ${USERNAME}
# Log it.
echo "$(date) - Compiled ${G_BUILD_PROJECT} for ${USERNAME} on ${G_BUILD_PLATFORMS}" >> joeybuild.log
popd
fi
done

View file

@ -1,3 +1,6 @@
application
Warehouse
IIgs 65816
Linux i386 x86_64
Windows i686 x86_64
MacOS i386 x86_64 aarch64

View file

@ -133,7 +133,7 @@ function compile() {
function enabled() {
echo 1
echo 0
}

View file

@ -26,7 +26,8 @@ M_SDL2_TAG=97a5e744497ff7cc93edc5119d67cad3ee86dd57
M_TRIPLE="x86_64-linux-gnu"
source helpers/SDL2.helper
source ${G_EHOME}/helpers/SDL2.helper
source ${G_EHOME}/helpers/GCC.helper
function architectures() {
@ -35,10 +36,14 @@ function architectures() {
function assemble() {
local -n AFILES=$1
local ARCH=$1
local PASS=$2
local LOG=$3
local AFILES=(${*:4})
setCompiler ${ARCH} ${PASS}
assembleGCC ${ARCH} ${PASS} ${LOG} "${AFILES[@]}"
unSetCompiler
}
@ -58,18 +63,33 @@ function buildJoeyLib() {
fi
setCompiler ${ARCH} ${PASS}
buildJoeyLibSDL2
buildJoeyLibSDL2 ${PASS}
unSetCompiler
}
function compile() {
local -n CFILES=$1
local ARCH=$1
local PASS=$2
local LOG=$3
local CFILES=(${*:4})
setCompiler ${ARCH} ${PASS}
if [[ "${ARCH}" == "i386" ]]; then
export CFLAGS="-m32 -Wall -D_REENTRANT_"
else
export CFLAGS="-Wall -D_REENTRANT_"
fi
setCompiler ${ARCH} ${PASS}
compileGCC ${ARCH} ${PASS} ${LOG} "${CFILES[@]}"
unSetCompiler
unSetCompiler
}
function enabled() {
echo 1
}
@ -94,18 +114,32 @@ function install() {
function link() {
local -n OFILES=$1
local ARCH=$1
local PASS=$2
local LOG=$3
local OFILES=(${*:4})
if [[ "${ARCH}" == "i386" ]]; then
export CFLAGS="-m32"
else
export CFLAGS=
fi
export LDFLAGS="-lm -ldl -lpthread"
setCompiler ${ARCH} ${PASS}
linkGCC Linux ${ARCH} ${PASS} "" ${LOG} "${OFILES[@]}"
unSetCompiler
}
function package() {
local -n DFILES=$1
local ARCH=$1
local PASS=$2
local LOG=$3
local DFILES=(${*:4})
packageGCC Linux ${ARCH} ${PASS} ${LOG} "${DFILES[@]}"
}

View file

@ -25,7 +25,7 @@
M_TRIPLE=
source helpers/SDL2.helper
source ${G_EHOME}/helpers/SDL2.helper
function architectures() {
@ -53,7 +53,7 @@ function buildJoeyLib() {
fi
setCompiler ${ARCH} ${PASS}
buildJoeyLibSDL2
buildJoeyLibSDL2 ${PASS}
unSetCompiler
}
@ -95,7 +95,7 @@ function compile() {
}
function enabled() {
echo 1
echo 0
}

View file

@ -26,7 +26,7 @@ M_SDL2_TAG=97a5e744497ff7cc93edc5119d67cad3ee86dd57
M_TRIPLE=
source helpers/SDL2.helper
source ${G_EHOME}/helpers/SDL2.helper
function architectures() {
@ -54,7 +54,7 @@ function buildJoeyLib() {
fi
setCompiler ${ARCH} ${PASS}
buildJoeyLibSDL2 ${M_TRIPLE}
buildJoeyLibSDL2 ${PASS}
unSetCompiler
}
@ -67,7 +67,7 @@ function compile() {
}
function enabled() {
echo 1
echo 0
}