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}"
|
||||
|
||||
# Are there old results to clean up?
|
||||
if [[ -f build.finished ]]; then
|
||||
rm build.finished
|
||||
# Are there old results to clean up?
|
||||
if [[ -f build.finished ]]; then
|
||||
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
|
||||
if [[ -d results ]]; then
|
||||
rm -rf results
|
||||
fi
|
||||
mkdir -p results
|
||||
G_BUILD_RESULTS=${SOURCE}/results
|
||||
|
||||
G_BUILD_PLATFORMS="["
|
||||
G_BUILD_PROJECT=
|
||||
PROJECT_TYPE=
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
# 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
|
||||
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
|
||||
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
|
||||
|
||||
# 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}"
|
||||
# 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
|
||||
if [[ -d "${FILE}" ]]; then
|
||||
rm -r "${FILE}"
|
||||
fi
|
||||
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
|
||||
done
|
||||
|
||||
# Signal JoeyDev we're done.
|
||||
mv build.temp build.tar.bz2
|
||||
done <build.start
|
||||
|
||||
# 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
|
||||
|
||||
|
@ -382,28 +391,38 @@ function startBuildServer() {
|
|||
cd ${G_EHOME}
|
||||
|
||||
# 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.
|
||||
echo "1.0" > dist/joeydev.info
|
||||
echo "------------------------------------------------------------------------------" >> dist/joeydev.info
|
||||
echo "project application \"JoeyLib Application\"" >> dist/joeydev.info
|
||||
# echo "project joeylib \"JoeyLib Itself\"" >> http/joeydev.info
|
||||
echo "1.0" >dist/joeydev.info
|
||||
echo "------------------------------------------------------------------------------" >>dist/joeydev.info
|
||||
echo "project application \"JoeyLib Application\"" >>dist/joeydev.info
|
||||
# echo "project joeylib \"JoeyLib Itself\"" >> http/joeydev.info
|
||||
for TARGET in ${G_EHOME}/targets/*.target; do
|
||||
NAME=$(basename -s .target ${TARGET})
|
||||
call RESULT ${NAME} enabled
|
||||
if [[ ${RESULT} -eq 1 ]]; then
|
||||
call ARCHS ${NAME} architectures
|
||||
call DESCRIPTION ${NAME} friendlyName
|
||||
echo "target ${NAME} \"${DESCRIPTION}\" ${ARCHS}" >> dist/joeydev.info
|
||||
echo "target ${NAME} \"${DESCRIPTION}\" ${ARCHS}" >>dist/joeydev.info
|
||||
fi
|
||||
done
|
||||
|
||||
# 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.
|
||||
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.
|
||||
cd /home
|
||||
|
@ -428,7 +447,7 @@ function startBuildServer() {
|
|||
doBuild ${USERNAME}
|
||||
|
||||
# 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
|
||||
done
|
||||
|
|
Loading…
Add table
Reference in a new issue