Accidentally used J instead of j with tar.
This commit is contained in:
parent
8b860ab407
commit
139f1d8fe3
1 changed files with 130 additions and 111 deletions
241
joeybuild.sh
241
joeybuild.sh
|
@ -112,120 +112,129 @@ function doBuild() {
|
||||||
|
|
||||||
pushd "${SOURCE}"
|
pushd "${SOURCE}"
|
||||||
|
|
||||||
# Are there old results to clean up?
|
# Are there old results to clean up?
|
||||||
if [[ -f build.finished ]]; then
|
if [[ -f build.finished ]]; then
|
||||||
rm build.finished
|
rm build.finished
|
||||||
|
fi
|
||||||
|
if [[ -d results ]]; then
|
||||||
|
rm -rf results
|
||||||
|
fi
|
||||||
|
mkdir -p results
|
||||||
|
G_BUILD_RESULTS=${SOURCE}/results
|
||||||
|
|
||||||
|
G_BUILD_PLATFORMS="["
|
||||||
|
G_BUILD_PROJECT=
|
||||||
|
PROJECT_TYPE=
|
||||||
|
|
||||||
|
# Sample project file:
|
||||||
|
#
|
||||||
|
# application
|
||||||
|
# Warehouse
|
||||||
|
# IIgs 65816
|
||||||
|
# Linux i386 x86_64
|
||||||
|
# Windows i686 x86_64
|
||||||
|
# MacOS i386 x86_64 aarch64
|
||||||
|
|
||||||
|
# Read project information.
|
||||||
|
while IFS= read -r LINE; do
|
||||||
|
# If we don't have a project type, grab it from the first line of the project file and set things up.
|
||||||
|
if [[ -z ${PROJECT_TYPE} ]]; then
|
||||||
|
PROJECT_TYPE=${LINE}
|
||||||
|
# Skip to next loop pass.
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
if [[ -d results ]]; then
|
|
||||||
rm -rf results
|
|
||||||
fi
|
|
||||||
mkdir -p results
|
|
||||||
G_BUILD_RESULTS=${SOURCE}/results
|
|
||||||
|
|
||||||
G_BUILD_PLATFORMS="["
|
# If we don't have a project name, grab it from the second line of the project file and set things up.
|
||||||
G_BUILD_PROJECT=
|
if [[ -z ${G_BUILD_PROJECT} ]]; then
|
||||||
PROJECT_TYPE=
|
G_BUILD_PROJECT=${LINE}
|
||||||
|
# Generate a list of non-source files.
|
||||||
# Read project information.
|
for FILE in $(ls -1B); do
|
||||||
while IFS= read -r LINE; do
|
if [[ -f "${FILE}" ]]; then
|
||||||
# If we don't have a project type, grab it from the first line of the project file and set things up.
|
if [[ "${FILE}" != "build.start" && "${FILE}" != "build.temp" && "${FILE}" != "build.tar.bz2" ]]; then
|
||||||
if [[ -z ${PROJECT_TYPE} ]]; then
|
EXTENSION="${FILE##*.}"
|
||||||
PROJECT_TYPE=${LINE}
|
if [[ "${EXTENSION}" != "c" && "${EXTENSION}" != "h" && "${EXTENSION}" != "asm" && "${EXTENSION}" != "macro" && "${EXTENSION}" != "inc" ]]; then
|
||||||
# Skip to next loop pass.
|
DFILES+=(${FILE})
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If we don't have a project name, grab it from the second line of the project file and set things up.
|
|
||||||
if [[ -z ${G_BUILD_PROJECT} ]]; then
|
|
||||||
G_BUILD_PROJECT=${LINE}
|
|
||||||
# Generate a list of non-source files.
|
|
||||||
for FILE in $(ls -1B); do
|
|
||||||
if [[ -f "${FILE}" ]]; then
|
|
||||||
if [[ "${FILE}" != "build.start" && "${FILE}" != "build.temp" && "${FILE}" != "build.tar.bz2" ]]; then
|
|
||||||
EXTENSION="${FILE##*.}"
|
|
||||||
if [[ "${EXTENSION}" != "c" && "${EXTENSION}" != "h" && "${EXTENSION}" != "asm" && "${EXTENSION}" != "macro" && "${EXTENSION}" != "inc" ]]; then
|
|
||||||
DFILES+=(${FILE})
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
# Generate a list of C files to compile.
|
|
||||||
TEMP=$(ls -1 *.c 2>/dev/null | wc -l)
|
|
||||||
if [[ ${TEMP} -ne 0 ]]; then
|
|
||||||
CFILES=($(ls -1 *.c))
|
|
||||||
fi
|
|
||||||
# Generate a list of ASM files to assemble.
|
|
||||||
TEMP=$(ls -1 *.asm 2>/dev/null | wc -l)
|
|
||||||
if [[ ${TEMP} -ne 0 ]]; then
|
|
||||||
AFILES=($(ls -1 *.asm))
|
|
||||||
fi
|
|
||||||
# Skip to next loop pass.
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This is for the 3rd and later lines of the project that list which targets to build.
|
|
||||||
TARGET=
|
|
||||||
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})..."
|
|
||||||
G_DIST=dist/${TARGET}-${TEMP}/${PASS}
|
|
||||||
# We at least tried to build this target.
|
|
||||||
G_BUILD_PLATFORMS="${G_BUILD_PLATFORMS}${TARGET}.${TEMP}.${PASS} "
|
|
||||||
# Make sure we have the official JoeyLib header.
|
|
||||||
cp -f "${G_EHOME}/dist/joey.h" .
|
|
||||||
# Log file.
|
|
||||||
LOG="${G_BUILD_RESULTS}/build.${TARGET}.${TEMP}.${PASS}"
|
|
||||||
# Compile C files and generate object list.
|
|
||||||
if [[ "${#CFILES[@]}" != "0" ]]; then
|
|
||||||
call RESULT ${TARGET} compile ${TEMP} ${PASS} ${LOG} "${CFILES[@]}"
|
|
||||||
OFILES=(${RESULT})
|
|
||||||
fi
|
|
||||||
# Assemble ASM files and generate object list.
|
|
||||||
if [[ "${#AFILES[@]}" != "0" ]]; then
|
|
||||||
call RESULT ${TARGET} assemble ${TEMP} ${PASS} ${LOG} "${AFILES[@]}"
|
|
||||||
OFILES+=(${RESULT})
|
|
||||||
fi
|
|
||||||
# Link with JoeyLib.
|
|
||||||
call RESULT ${TARGET} link ${TEMP} ${PASS} ${LOG} "${OFILES[@]}"
|
|
||||||
# Process game data files.
|
|
||||||
if [[ "${#DFILES[@]}" != "0" ]]; then
|
|
||||||
call RESULT ${TARGET} package ${TEMP} ${PASS} ${LOG} "${DFILES[@]}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
# Generate a list of C files to compile.
|
||||||
|
TEMP=$(ls -1 *.c 2>/dev/null | wc -l)
|
||||||
|
if [[ ${TEMP} -ne 0 ]]; then
|
||||||
|
CFILES=($(ls -1 *.c))
|
||||||
|
fi
|
||||||
|
# Generate a list of ASM files to assemble.
|
||||||
|
TEMP=$(ls -1 *.asm 2>/dev/null | wc -l)
|
||||||
|
if [[ ${TEMP} -ne 0 ]]; then
|
||||||
|
AFILES=($(ls -1 *.asm))
|
||||||
|
fi
|
||||||
|
# Skip to next loop pass.
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
done < build.start
|
# This is for the 3rd and later lines of the project that list which targets to build.
|
||||||
|
TARGET=
|
||||||
# Compress the results.
|
for TEMP in ${LINE}; do
|
||||||
tBoldBox tPURPLE "Packaging \"${G_BUILD_PROJECT}\"..."
|
if [[ -z ${TARGET} ]]; then
|
||||||
tar cJf build.temp results
|
TARGET=${TEMP}
|
||||||
tSudo chown ${USERNAME}:${USERNAME} build.temp
|
call RESULT ${TARGET} enabled
|
||||||
|
if [[ ${RESULT} -ne 1 ]]; then
|
||||||
# Erase everything except the temp file.
|
# Target is not enabled, stop.
|
||||||
rm -rf "${G_BUILD_RESULTS}"
|
break
|
||||||
for FILE in $(ls -1); do
|
|
||||||
if [[ -f "${FILE}" ]]; then
|
|
||||||
if [[ "${FILE}" != "build.temp" ]]; then
|
|
||||||
rm "${FILE}"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ -d "${FILE}" ]]; then
|
for PASS in "debug" "release"; do
|
||||||
rm -r "${FILE}"
|
tBoldBox tPURPLE "Building \"${G_BUILD_PROJECT}\" ${TARGET} ${TEMP} (${PASS})..."
|
||||||
fi
|
G_DIST=dist/${TARGET}-${TEMP}/${PASS}
|
||||||
|
# We at least tried to build this target.
|
||||||
|
G_BUILD_PLATFORMS="${G_BUILD_PLATFORMS}${TARGET}.${TEMP}.${PASS} "
|
||||||
|
# Make sure we have the official JoeyLib header.
|
||||||
|
cp -f "${G_EHOME}/dist/joey.h" .
|
||||||
|
# Log file.
|
||||||
|
LOG="${G_BUILD_RESULTS}/build.${TARGET}.${TEMP}.${PASS}"
|
||||||
|
# Compile C files and generate object list.
|
||||||
|
if [[ "${#CFILES[@]}" != "0" ]]; then
|
||||||
|
call RESULT ${TARGET} compile ${TEMP} ${PASS} ${LOG} "${CFILES[@]}"
|
||||||
|
OFILES=(${RESULT})
|
||||||
|
fi
|
||||||
|
# Assemble ASM files and generate object list.
|
||||||
|
if [[ "${#AFILES[@]}" != "0" ]]; then
|
||||||
|
call RESULT ${TARGET} assemble ${TEMP} ${PASS} ${LOG} "${AFILES[@]}"
|
||||||
|
OFILES+=(${RESULT})
|
||||||
|
fi
|
||||||
|
# Link with JoeyLib.
|
||||||
|
call RESULT ${TARGET} link ${TEMP} ${PASS} ${LOG} "${OFILES[@]}"
|
||||||
|
# Process game data files.
|
||||||
|
if [[ "${#DFILES[@]}" != "0" ]]; then
|
||||||
|
call RESULT ${TARGET} package ${TEMP} ${PASS} ${LOG} "${DFILES[@]}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Signal JoeyDev we're done.
|
done <build.start
|
||||||
mv build.temp build.tar.bz2
|
|
||||||
|
# Compress the results.
|
||||||
|
tBoldBox tPURPLE "Packaging \"${G_BUILD_PROJECT}\"..."
|
||||||
|
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
|
popd
|
||||||
|
|
||||||
|
@ -382,28 +391,38 @@ function startBuildServer() {
|
||||||
cd ${G_EHOME}
|
cd ${G_EHOME}
|
||||||
|
|
||||||
# Log startup.
|
# Log startup.
|
||||||
echo "$(date) - Startup ${0}" >> ${LOG}
|
echo "$(date) - Startup ${0}" >>${LOG}
|
||||||
|
|
||||||
|
# Sample info file:
|
||||||
|
#
|
||||||
|
# 1.0
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# project application "JoeyLib Application"
|
||||||
|
# target IIgs "Apple IIgs" 65816
|
||||||
|
# target Linux "Linux" i386 x86_64
|
||||||
|
# target MacOS "Modern MacOS" i386 x86_64 aarch64
|
||||||
|
# target Windows "Windows XP+" i686 x86_64
|
||||||
|
|
||||||
# Build supported project types and target details for JoeyDev.
|
# Build supported project types and target details for JoeyDev.
|
||||||
echo "1.0" > dist/joeydev.info
|
echo "1.0" >dist/joeydev.info
|
||||||
echo "------------------------------------------------------------------------------" >> dist/joeydev.info
|
echo "------------------------------------------------------------------------------" >>dist/joeydev.info
|
||||||
echo "project application \"JoeyLib Application\"" >> dist/joeydev.info
|
echo "project application \"JoeyLib Application\"" >>dist/joeydev.info
|
||||||
# echo "project joeylib \"JoeyLib Itself\"" >> http/joeydev.info
|
# echo "project joeylib \"JoeyLib Itself\"" >> http/joeydev.info
|
||||||
for TARGET in ${G_EHOME}/targets/*.target; do
|
for TARGET in ${G_EHOME}/targets/*.target; do
|
||||||
NAME=$(basename -s .target ${TARGET})
|
NAME=$(basename -s .target ${TARGET})
|
||||||
call RESULT ${NAME} enabled
|
call RESULT ${NAME} enabled
|
||||||
if [[ ${RESULT} -eq 1 ]]; then
|
if [[ ${RESULT} -eq 1 ]]; then
|
||||||
call ARCHS ${NAME} architectures
|
call ARCHS ${NAME} architectures
|
||||||
call DESCRIPTION ${NAME} friendlyName
|
call DESCRIPTION ${NAME} friendlyName
|
||||||
echo "target ${NAME} \"${DESCRIPTION}\" ${ARCHS}" >> dist/joeydev.info
|
echo "target ${NAME} \"${DESCRIPTION}\" ${ARCHS}" >>dist/joeydev.info
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Identify ourselves.
|
# Identify ourselves.
|
||||||
echo "<html><head><title>JoeyBuild Server</title></head><body>This is a <a href=\"https://joeylib.com\">JoeyLib</a> Build Server.</body></html>" > dist/index.html
|
echo "<html><head><title>JoeyBuild Server</title></head><body>This is a <a href=\"https://joeylib.com\">JoeyLib</a> Build Server.</body></html>" >dist/index.html
|
||||||
|
|
||||||
# Start the PHP web server if it's not already running.
|
# Start the PHP web server if it's not already running.
|
||||||
php -S 0.0.0.0:${G_HTTP_PORT} -t dist >> ${LOG} 2>&1 &
|
php -S 0.0.0.0:${G_HTTP_PORT} -t dist >>${LOG} 2>&1 &
|
||||||
|
|
||||||
# Start the actual build server.
|
# Start the actual build server.
|
||||||
cd /home
|
cd /home
|
||||||
|
@ -428,7 +447,7 @@ function startBuildServer() {
|
||||||
doBuild ${USERNAME}
|
doBuild ${USERNAME}
|
||||||
|
|
||||||
# Log it.
|
# Log it.
|
||||||
echo "$(date) - Compiled ${G_BUILD_PROJECT} for ${USERNAME} on ${G_BUILD_PLATFORMS}" >> ${LOG}
|
echo "$(date) - Compiled ${G_BUILD_PROJECT} for ${USERNAME} on ${G_BUILD_PLATFORMS}" >>${LOG}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue