1190 lines
31 KiB
Bash
Executable file
1190 lines
31 KiB
Bash
Executable file
#!/bin/bash -ex
|
|
|
|
#
|
|
# JoeyLib
|
|
# Copyright (C) 2018-2021 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.
|
|
#
|
|
|
|
|
|
# All these unset variables are just documenting what global variables and
|
|
# exports are used by the rest of the script.
|
|
|
|
NAME=
|
|
ARCH=
|
|
BACKEND=
|
|
INSTALLED=
|
|
TRIPLE=
|
|
BUILD_PROJECT=
|
|
BUILD_PLATFORMS=
|
|
BUILD_RESULTS=
|
|
LDFIRST=
|
|
|
|
EHOME=$(getent passwd $(logname) | cut -d: -f6)
|
|
SRC=${EHOME}/joeylib/joeylib/src
|
|
IIGS=${EHOME}/cross/gsos-wdc-orca
|
|
CADIUS=${IIGS}/cadius/cadius
|
|
SDL2_OLD=25f9ed87ff6947d9576fc9d79dee0784e638ac58
|
|
SDL2_NEW=97a5e744497ff7cc93edc5119d67cad3ee86dd57
|
|
OLD_PATH=${PATH}
|
|
|
|
#export CC=
|
|
#export AR=
|
|
#export CFLAGS=
|
|
#export LD_LIBRARY_PATH=
|
|
#export LDFLAGS=
|
|
#export WATCOM=
|
|
#export EDPATH=
|
|
#export INCLUDE=
|
|
|
|
export GOLDEN_GATE=${IIGS}/ORCA
|
|
|
|
|
|
function addBuildUser() {
|
|
local USER=$1
|
|
local PASS=$2
|
|
local SALT=$(LC_ALL=C tr -cd "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" < /dev/urandom | head -c 8)
|
|
local CRYPT=$(perl -e 'print crypt($ARGV[0], $ARGV[1])' ${PASS} ${SALT})
|
|
|
|
sudo useradd -m -G sftponly -s /sbin/false -p "${CRYPT}" "${USER}"
|
|
sudo chown root:root /home/${USER}
|
|
sudo chmod 755 /home/${USER}
|
|
sudo mkdir -p /home/${USER}/build
|
|
sudo chown ${USER}:${USER} /home/${USER}/build
|
|
sudo chmod u+rwX /home/${USER}/build
|
|
sudo chmod go-rwx /home/${USER}/build
|
|
}
|
|
|
|
|
|
function buildBeOSToolchain() {
|
|
|
|
[[ ! -d cross-compiler ]] && git clone --depth 1 https://github.com/jessicah/cross-compiler.git
|
|
|
|
# Build BeOS and Haiku cross-compilers.
|
|
pushd cross-compiler
|
|
./build-rootfs.sh x86_gcc2h --rootfsdir ${EHOME}/cross/beos
|
|
./build-rootfs.sh x86_gcc2h --rootfsdir ${EHOME}/cross/haiku32
|
|
./build-rootfs.sh x86_64 --rootfsdir ${EHOME}/cross/haiku64
|
|
popd
|
|
|
|
# ***TODO*** Need to download beos.tgz
|
|
|
|
# Add BeOS headers and libraries to BeOS toolchain folders.
|
|
pushd ${EHOME}/cross/beos
|
|
pushd generated/cross-tools-x86_gcc2/i586-pc-haiku
|
|
tar xzf ${EHOME}/beos.tgz
|
|
mv beos/headers/* include/.
|
|
mv beos/lib/x86/* lib/.
|
|
rm -rf beos
|
|
popd
|
|
rm -rf boot
|
|
rm -f fetch_packages.sh
|
|
rm -f package_extract.sh
|
|
popd
|
|
|
|
# Add Haiku 32 bit headers and libraries to Haiku toolchain folders.
|
|
pushd ${EHOME}/cross/haiku32
|
|
cp -LRf boot/system/develop/headers/* generated/cross-tools-x86_gcc2/i586-pc-haiku/include/. || true
|
|
cp -LRf boot/system/develop/lib/* generated/cross-tools-x86_gcc2/i586-pc-haiku/lib/. || true
|
|
rm -rf boot
|
|
rm -f fetch_packages.sh
|
|
rm -f package_extract.sh
|
|
popd
|
|
|
|
# Add Haiku 64 bit headers and libraries to Haiku toolchain folders.
|
|
pushd ${EHOME}/cross/haiku64
|
|
cp -LRf boot/system/develop/headers/* generated/cross-tools-x86_64/x86_64-unknown-haiku/include/. || true
|
|
cp -LRf boot/system/develop/lib/* generated/cross-tools-x86_64/x86_64-unknown-haiku/lib/. || true
|
|
rm -rf boot
|
|
rm -f fetch_packages.sh
|
|
rm -f package_extract.sh
|
|
popd
|
|
}
|
|
|
|
|
|
function buildIIgsToolchain() {
|
|
local GGATE=$1
|
|
local ORCA=$2
|
|
local PUBLIC=$3
|
|
local PRIVATE=$4
|
|
local GGUSER=$5
|
|
local GGPASS=$6
|
|
local RESULT=
|
|
local O=
|
|
|
|
mkdir -p "${IIGS}/ORCA"
|
|
chmod 777 "${IIGS}/ORCA"
|
|
|
|
mkdir -p ${EHOME}/.ssh
|
|
cp -f "${PUBLIC}" ${EHOME}/.ssh/id_rsa.pub
|
|
cp -f "${PRIVATE}" ${EHOME}/.ssh/id_rsa
|
|
touch ${EHOME}/.ssh/authorized_keys
|
|
touch ${EHOME}/.ssh/known_hosts
|
|
touch ${EHOME}/.ssh/config
|
|
chmod go-w ${EHOME}
|
|
chmod 700 ${EHOME}/.ssh
|
|
chmod 600 ${EHOME}/.ssh/id_rsa
|
|
chmod 644 ${EHOME}/.ssh/id_rsa.pub
|
|
chmod 644 ${EHOME}/.ssh/authorized_keys
|
|
chmod 644 ${EHOME}/.ssh/known_hosts
|
|
chmod 644 ${EHOME}/.ssh/config
|
|
|
|
if [[ ! -e "${IIGS}/jfsDrive.img" ]]; then
|
|
O=${IIGS}/mountORCA.sh
|
|
echo "#!/bin/bash" > "${O}"
|
|
echo "IIGS=${IIGS}" >> "${O}"
|
|
echo "if ! mount | grep \${IIGS}/ORCA | grep -q jfs; then" >> "${O}"
|
|
echo -e "\tfsck.jfs -a \${IIGS}/jfsDrive.img" >> "${O}"
|
|
echo -e "\tsudo mount -t jfs \${IIGS}/jfsDrive.img \${IIGS}/ORCA" >> "${O}"
|
|
echo -e "\techo MOUNT=\${IIGS}/ORCA >> \${IIGS}/lastMount.cfg" >> "${O}"
|
|
echo "fi" >> "${O}"
|
|
chmod +x "${O}"
|
|
O=${IIGS}/unmountORCA.sh
|
|
echo "#!/bin/bash" > "${O}"
|
|
echo "IIGS=${IIGS}" >> "${O}"
|
|
echo "if [[ -e \${IIGS}/lastMount.cfg ]]; then" >> "${O}"
|
|
echo -e "\tsource \${IIGS}/lastMount.cfg" >> "${O}"
|
|
echo -e "\tsudo umount \${MOUNT}" >> "${O}"
|
|
echo -e "\trm \${IIGS}/lastMount.cfg" >> "${O}"
|
|
echo "fi" >> "${O}"
|
|
chmod +x "${O}"
|
|
fallocate -l 32M "${IIGS}/jfsDrive.img"
|
|
mkfs.jfs -O -q -L IIgs "${IIGS}/jfsDrive.img"
|
|
fi
|
|
|
|
"${IIGS}/mountORCA.sh"
|
|
sudo chown $(id -ru):$(id -rg) "${IIGS}/ORCA/."
|
|
|
|
if [[ ! -d GoldenGate ]]; then
|
|
ssh-keygen -F gitlab.com || ssh-keyscan gitlab.com > ${EHOME}/.ssh/known_hosts
|
|
git config --global credential.helper cache
|
|
git clone https://${GGUSER}:${GGPASS}@gitlab.com/GoldenGate/GoldenGate.git
|
|
fi
|
|
|
|
pushd GoldenGate
|
|
git submodule init
|
|
git submodule update
|
|
mkdir -p build
|
|
cd build
|
|
cmake -DCMAKE_INSTALL_PREFIX=$(pwd)/installed ..
|
|
make
|
|
make install
|
|
mkdir -p ${IIGS}
|
|
cp -f bin/{iix,dumpobj,opus-extractor} "${IIGS}/."
|
|
cd installed
|
|
msiextract "${EHOME}/${GGATE}"
|
|
find -name ".*" -delete
|
|
cp -rf GoldenGate/* "${IIGS}/ORCA/."
|
|
popd
|
|
|
|
isoinfo -i "${ORCA}" -x /FOR_EMUL/BYTEWORK.S\;1 > BYTEWORKS
|
|
"${IIGS}/opus-extractor" -v BYTEWORKS "${IIGS}/ORCA"
|
|
rm BYTEWORKS
|
|
|
|
fetchGitHubRelease RESULT byteworksinc ORCA-C 2mg
|
|
"${IIGS}/opus-extractor" -v -s / ${RESULT} "${IIGS}/ORCA"
|
|
|
|
export PATH=${OLD_PATH}:${IIGS}
|
|
pushd ${GOLDEN_GATE}
|
|
for O in etc/* ; do iix chtyp -t txt "${O}" ; done
|
|
for O in lib/* ; do if [ -f "${O}" ] ; then iix chtyp -t lib "${O}" ; fi ; done
|
|
for O in usr/lib/lib* ; do iix chtyp -t lib "${O}" ; done
|
|
for O in usr/lib/tmac/* ; do iix chtyp -t txt "${O}" ; done
|
|
for O in bin/* ; do iix chtyp -t exe "${O}" ; done
|
|
for O in usr/bin/* ; do iix chtyp -t exe "${O}" ; done
|
|
for O in usr/local/bin/* ; do iix chtyp -t exe "${O}" ; done
|
|
for O in Languages/* ; do if [ -f "${O}" ] ; then iix chtyp -t exe "${O}" ; fi ; done ;
|
|
for O in Utilities/Help/* ; do if [ -f "${O}" ] ; then iix chtyp -t txt "${O}" ; fi ; done ;
|
|
for O in Utilities/* ; do if [ -f "${O}" ] ; then iix chtyp -t exe "${O}" ; fi ; done ;
|
|
for O in Libraries/* ; do if [ -f "${O}" ] ; then iix chtyp -t lib "${O}" ; fi ; done ;
|
|
for O in Libraries/AInclude/* ; do if [ -f "${O}" ] ; then iix chtyp -t txt "${O}" ; fi ; done ;
|
|
for O in Libraries/APWCInclude/* ; do if [ -f "${O}" ] ; then iix chtyp -t txt "${O}" ; fi ; done ;
|
|
for O in Libraries/AppleUtil/* ; do if [ -f "${O}" ] ; then iix chtyp -t txt "${O}" ; fi ; done ;
|
|
for O in Libraries/ORCACDefs/* ; do if [ -f "${O}" ] ; then iix chtyp -l cc "${O}" ; fi ; done ;
|
|
for O in Libraries/ORCAInclude/* ; do if [ -f "${O}" ] ; then iix chtyp -l asm "${O}" ; fi ; done ;
|
|
for O in Libraries/RInclude/* ; do if [ -f "${O}" ] ; then iix chtyp -l rez "${O}" ; fi ; done ;
|
|
for O in Libraries/Tool.Interface/* ; do if [ -f "${O}" ] ; then iix chtyp -l pascal "${O}" ; fi ; done ;
|
|
for O in Libraries/GSoftDefs/* ; do if [ -f "${O}" ] ; then iix chtyp -t 0x5e -a 0x8007 "${O}" ; fi ; done ;
|
|
for O in Libraries/ORCAPascalDefs/* ; do if [ -f "${O}" ] ; then iix chtyp -t 0x5e -a 0x8009 "${O}" ; fi ; done ;
|
|
for O in Libraries/m2defs/* ; do if [ -f "${O}" ] ; then iix chtyp -t 0x5e -a 0x8006 "${O}" ; fi ; done ;
|
|
popd
|
|
export PATH=${OLD_PATH}
|
|
|
|
if [[ ! -d cadius ]]; then
|
|
git clone https://skunkworks.kangaroopunch.com/mirrors/cadius.git
|
|
pushd cadius
|
|
make
|
|
mkdir -p "${IIGS}/cadius"
|
|
cp -f bin/release/cadius "${IIGS}/cadius/."
|
|
popd
|
|
fi
|
|
|
|
if [[ ! -e "${IIGS}/ntpconverter/ntpconverter.php" ]]; then
|
|
download http://ninjaforce.com/downloads/ntpsources.zip
|
|
unzip ntpsources.zip ntpconverter*
|
|
mkdir -p "${IIGS}/ntpconverter"
|
|
mv -f ntpconverter*.php "${IIGS}/ntpconverter/."
|
|
fi
|
|
|
|
if [[ ! -e "${IIGS}/Tool222#ba0000" ]]; then
|
|
download http://www.ninjaforce.com/downloads/ninjatrackerplus_tool222_v1.4.2mg
|
|
"${IIGS}/cadius/cadius" extractfile ninjatrackerplus_tool222_v1.4.2mg NTP.TOOL222V1.4/SYSTEM/TOOLS/TOOL222 .
|
|
cp -f "TOOL222#BA0000" "${IIGS}/Tool222#ba0000"
|
|
fi
|
|
|
|
"${IIGS}/unmountORCA.sh"
|
|
|
|
if [[ ! -e "${IIGS}/jfsDrive.img.backup.tar.bz2" ]]; then
|
|
tar cjf "${IIGS}/jfsDrive.img.backup.tar.bz2" "${IIGS}/jfsDrive.img"
|
|
fi
|
|
}
|
|
|
|
|
|
function buildJoeyLib() {
|
|
local OUT=
|
|
local PASS=
|
|
local OLD_CFLAGS=${CFLAGS}
|
|
|
|
if [[ ! -d joeylib ]]; then
|
|
git clone https://skunkworks.kangaroopunch.com/skunkworks/joeylib.git
|
|
fi
|
|
|
|
rm -rf dist/${NAME}-${ARCH} || true
|
|
|
|
for PASS in "debug" "release"; do
|
|
|
|
mkdir -p dist/${NAME}-${ARCH}/${PASS}
|
|
|
|
pushd dist/${NAME}-${ARCH}/${PASS}
|
|
case ${BACKEND} in
|
|
orca)
|
|
OUT=${GOLDEN_GATE}/out/joey
|
|
rm -rf ${OUT} || true
|
|
mkdir -p ${OUT}/out/joey
|
|
pushd ${SRC}
|
|
if [[ "${PASS}" == "debug" ]]; then
|
|
# Add JOEY_DEBUG flag.
|
|
cp joey.h joey.h.original
|
|
sed -i "1i #define JOEY_DEBUG" joey.h
|
|
fi
|
|
iix assemble jIIgs.asm keep=31:/out/joey/jIIgsasm
|
|
iix compile jIIgs.c keep=31:/out/joey/jIIgsc
|
|
iix compile joey.c keep=31:/out/joey/joey
|
|
if [[ "${PASS}" == "debug" ]]; then
|
|
# Remove JOEY_DEBUG.
|
|
rm joey.h
|
|
mv joey.h.original joey.h
|
|
fi
|
|
popd
|
|
cp -f "${OUT}/jIIgsc.root" "jIIgsc.root#b10000"
|
|
cp -f "${OUT}/jIIgsc.a" "jIIgsc.a#b10000"
|
|
cp -f "${OUT}/jIIgsasm.root" "jIIgsasm.root#b10000"
|
|
cp -f "${OUT}/jIIgsasm.a" "jIIgsasm.a#b10000"
|
|
cp -f "${OUT}/joey.a" "joey.a#b10000"
|
|
cp -f "${IIGS}/Tool222#ba0000" .
|
|
;;
|
|
|
|
SDL12)
|
|
export CFLAGS="${CFLAGS} -I${SRC} -I${INSTALLED}/include -c"
|
|
if [[ "${PASS}" == "debug" ]]; then
|
|
export CFLAGS="-DJOEY_DEBUG ${CFLAGS}"
|
|
fi
|
|
${CC} ${CFLAGS} -o jPixBuf.o ${SRC}/jPixBuf.c
|
|
${CC} ${CFLAGS} -o jSDL12.o ${SRC}/jSDL12.c
|
|
${CC} ${CFLAGS} -o joey.o ${SRC}/joey.c
|
|
${AR} x ${INSTALLED}/lib/libSDL.a
|
|
${AR} x ${INSTALLED}/lib/libSDLmain.a
|
|
${AR} rcs libjoeylib.a *.o
|
|
rm *.o
|
|
rm __.SYMDEF* || true
|
|
;;
|
|
|
|
SDL2)
|
|
export CFLAGS="${CFLAGS} -I${SRC} -I${INSTALLED}/include -c"
|
|
if [[ "${PASS}" == "debug" ]]; then
|
|
export CFLAGS="-DJOEY_DEBUG ${CFLAGS}"
|
|
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 ../../.
|
|
mkdir -p ../../3rdparty/memwatch
|
|
cp -f ${SRC}/3rdparty/memwatch/* ../../3rdparty/memwatch/.
|
|
popd
|
|
|
|
export CFLAGS=${OLD_CFLAGS}
|
|
|
|
done
|
|
}
|
|
|
|
|
|
function buildMacOSXToolchain() {
|
|
local SDK=$1
|
|
local XCODE=$2
|
|
local PLATFORM=$3
|
|
|
|
if [[ ! -d osxcross ]]; then
|
|
git clone https://skunkworks.kangaroopunch.com/mirrors/osxcross.git
|
|
fi
|
|
|
|
pushd osxcross
|
|
# Do we have an existing SDK tarball?
|
|
if [[ ! -f "../${SDK}" ]]; then
|
|
# Nope. Build tarball and keep for later.
|
|
./tools/gen_sdk_package_pbzx.sh "../${XCODE}"
|
|
mv -f MacOSX* ../.
|
|
fi
|
|
cp -f "../${SDK}" tarballs/.
|
|
UNATTENDED=1 ./build.sh
|
|
sudo ENABLE_COMPILER_RT_INSTALL=1 ./build_compiler_rt.sh
|
|
mkdir -p ../cross/${PLATFORM}
|
|
mv -f target/* ../cross/${PLATFORM}
|
|
sudo mv -f /usr/lib/llvm-10/lib/clang/10.0.0/lib/darwin ../cross/${PLATFORM}/.
|
|
./cleanup.sh
|
|
popd
|
|
}
|
|
|
|
|
|
function buildSDL12() {
|
|
if [[ ! -d SDL-1.2 ]]; then
|
|
git clone https://skunkworks.kangaroopunch.com/mirrors/SDL-1.2.git
|
|
pushd SDL-1.2/include
|
|
cp SDL_config.h.default SDL_config.h
|
|
popd
|
|
fi
|
|
|
|
if [[ "watcom" == *"${NAME}"* ]]; then
|
|
# ***TODO*** This does not work.
|
|
pushd SDL-1.2/watcom
|
|
wmake sdl tgt=static
|
|
mkdir -p ${INSTALLED}/lib
|
|
mkdir -p ${INSTALLED}/include
|
|
cp -f Release/SDL.lib ${INSTALLED}/lib/.
|
|
cp -f Release/SDLmain.lib ${INSTALLED}/lib/.
|
|
cp -f ../include/* ${INSTALLED}/include/.
|
|
popd
|
|
else
|
|
rm -rf build || true
|
|
mkdir -p build
|
|
pushd build
|
|
../SDL-1.2/configure \
|
|
--target=${TRIPLE} \
|
|
--host=${TRIPLE} \
|
|
--build=x86_64-linux \
|
|
--enable-static \
|
|
--disable-shared \
|
|
--disable-loadso \
|
|
--prefix=${INSTALLED}
|
|
make
|
|
make install
|
|
popd
|
|
fi
|
|
}
|
|
|
|
|
|
function buildSDL2() {
|
|
local TAG=$1
|
|
|
|
if [[ ! -d SDL ]]; then
|
|
git clone https://skunkworks.kangaroopunch.com/mirrors/SDL.git
|
|
fi
|
|
|
|
pushd SDL
|
|
git checkout ${TAG}
|
|
popd
|
|
|
|
rm -rf build || true
|
|
mkdir -p build
|
|
|
|
pushd build
|
|
../SDL/configure \
|
|
--target=${TRIPLE} \
|
|
--host=${TRIPLE} \
|
|
--build=x86_64-linux \
|
|
--enable-static \
|
|
--disable-shared \
|
|
--disable-video-wayland \
|
|
--disable-render-metal \
|
|
--disable-video-metal \
|
|
--prefix=${INSTALLED}
|
|
make
|
|
make install
|
|
popd
|
|
}
|
|
|
|
|
|
function buildWatcomToolchain() {
|
|
local RESULT=
|
|
|
|
fetchGitHubRelease RESULT open-watcom open-watcom-v2 tar.xz
|
|
mkdir -p cross/watcom
|
|
pushd cross/watcom
|
|
tar xf ../../${RESULT}
|
|
#unzip Watcom-Win32.zip
|
|
popd
|
|
}
|
|
|
|
|
|
function configureSFTP() {
|
|
if [[ ! -f /etc/ssh/sftponly_ready ]]; then
|
|
sudo addgroup sftponly || true
|
|
sudo sed -i 's/^Subsystem/#Subsystem/g' /etc/ssh/sshd_config
|
|
echo "Subsystem sftp internal-sftp -f AUTH -l VERBOSE" | sudo tee -a /etc/ssh/sshd_config
|
|
echo "Match Group sftponly" | sudo tee -a /etc/ssh/sshd_config
|
|
echo -e "\tChrootDirectory %h" | sudo tee -a /etc/ssh/sshd_config
|
|
echo -e "\tForceCommand internal-sftp" | sudo tee -a /etc/ssh/sshd_config
|
|
echo -e "\tAllowTcpForwarding no" | sudo tee -a /etc/ssh/sshd_config
|
|
echo -e "\tX11Forwarding no" | sudo tee -a /etc/ssh/sshd_config
|
|
sudo systemctl restart sshd
|
|
sudo touch /etc/ssh/sftponly_ready
|
|
fi
|
|
}
|
|
|
|
|
|
function delBuildUser() {
|
|
local USER=$1
|
|
|
|
sudo userdel -f -r ${USER}
|
|
}
|
|
|
|
|
|
function doBuild() {
|
|
local DIST=$1
|
|
local SOURCE=$2
|
|
local LINE=
|
|
local DATA=()
|
|
local CFILES=()
|
|
local OFILES=
|
|
local FILE=
|
|
local EXTENSION=
|
|
local LOG=
|
|
local TARGET=
|
|
local GSTARGET=
|
|
local LIB=
|
|
local O=
|
|
local DISK=
|
|
local EXT=
|
|
local OLD_CFLAGS=${CFLAGS}
|
|
|
|
pushd "${SOURCE}"
|
|
|
|
# Are there old reults to clean up?
|
|
if [[ -f build.finished ]]; then
|
|
rm build.finished
|
|
fi
|
|
if [[ -d results ]]; then
|
|
rm -rf results
|
|
fi
|
|
mkdir -p results
|
|
BUILD_RESULTS=${SOURCE}/results
|
|
|
|
# Read project information.
|
|
BUILD_PLATFORMS="["
|
|
BUILD_PROJECT=
|
|
while IFS= read -r LINE; do
|
|
if [[ -z ${BUILD_PROJECT} ]]; then
|
|
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
|
|
DATA+=(${FILE})
|
|
fi
|
|
fi
|
|
fi
|
|
done
|
|
# Generate a list of C files to compile.
|
|
CFILES=($(ls -1 *.c))
|
|
else
|
|
case ${LINE,,} in
|
|
beos)
|
|
setCompiler beos i386
|
|
TARGET="${SOURCE}/temp"
|
|
EXT=
|
|
export CFLAGS="${CFLAGS} -Wall -D_GNU_SOURCE=1"
|
|
export LDFLAGS="-lGL -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
|
|
;;
|
|
|
|
haiku32)
|
|
setCompiler haiku i386
|
|
TARGET="${SOURCE}/temp"
|
|
EXT=
|
|
export CFLAGS="${CFLAGS} -Wall -D_GNU_SOURCE=1"
|
|
export LDFLAGS="-lm -lGL -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
|
|
;;
|
|
|
|
|
|
haiku64)
|
|
setCompiler haiku x86_64
|
|
TARGET="${SOURCE}/temp"
|
|
EXT=
|
|
export CFLAGS="${CFLAGS} -Wall -D_REENTRANT"
|
|
export LDFLAGS="-lsupc++ -lm -lGL -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
|
|
;;
|
|
|
|
iigs)
|
|
setCompiler gsos 816
|
|
TARGET="${GOLDEN_GATE}/out/build"
|
|
GSTARGET="31:/out/build"
|
|
EXT=
|
|
;;
|
|
|
|
linux32)
|
|
setCompiler linux i386
|
|
TARGET="${SOURCE}/temp"
|
|
EXT=
|
|
export CFLAGS="-m32 -Wall -D_REENTRANT_"
|
|
export LDFLAGS="-lm -ldl -lpthread"
|
|
;;
|
|
|
|
linux64)
|
|
setCompiler linux x86_64
|
|
TARGET="${SOURCE}/temp"
|
|
EXT=
|
|
export CFLAGS="-Wall -D_REENTRANT_"
|
|
export LDFLAGS="-lm -ldl -lpthread"
|
|
;;
|
|
|
|
macosx32)
|
|
setCompiler macos i386
|
|
TARGET="${SOURCE}/temp"
|
|
EXT=
|
|
export CFLAGS="-Wall -D_THREAD_SAFE"
|
|
export LDFLAGS="-lm -liconv -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,ForceFeedback -lobjc -Wl,-framework,CoreVideo -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,IOKit -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
|
|
;;
|
|
|
|
macosx64)
|
|
setCompiler macos x86_64
|
|
TARGET="${SOURCE}/temp"
|
|
EXT=
|
|
export CFLAGS="-Wall -D_THREAD_SAFE"
|
|
export LDFLAGS="-lm -liconv -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,ForceFeedback -lobjc -Wl,-framework,CoreVideo -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,IOKit -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
|
|
;;
|
|
|
|
macosa64)
|
|
setCompiler macos arm
|
|
TARGET="${SOURCE}/temp"
|
|
EXT=
|
|
export CFLAGS="-Wall -D_THREAD_SAFE"
|
|
export LDFLAGS="-lm -liconv -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController -Wl,-framework,ForceFeedback -lobjc -Wl,-framework,CoreVideo -Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,IOKit -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
|
|
;;
|
|
|
|
win32)
|
|
setCompiler windows i386
|
|
TARGET="${SOURCE}/temp"
|
|
EXT=.exe
|
|
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"
|
|
;;
|
|
|
|
win64)
|
|
setCompiler windows x86_64
|
|
TARGET="${SOURCE}/temp"
|
|
EXT=.exe
|
|
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"
|
|
;;
|
|
|
|
*)
|
|
TARGET=
|
|
|
|
esac
|
|
|
|
if [[ ! -z "${TARGET}" ]]; then
|
|
|
|
BUILD_PLATFORMS="${BUILD_PLATFORMS}${LINE,,} "
|
|
LOG="${BUILD_RESULTS}/build.${LINE,,}"
|
|
LIB="${DIST}/${NAME}-${ARCH}/release"
|
|
|
|
[[ -d "${TARGET}" ]] && rm -rf "${TARGET}"
|
|
mkdir -p "${TARGET}"
|
|
|
|
mkdir -p ${BUILD_RESULTS}/${LINE,,}
|
|
|
|
# Make sure we have the official JoeyLib header.
|
|
cp -f "${DIST}/joey.h" "${SOURCE}/."
|
|
|
|
case ${BACKEND} in
|
|
orca)
|
|
# Compile C files and generate object list.
|
|
OFILES=""
|
|
for FILE in "${CFILES[@]}"; do
|
|
O=${FILE%.*}
|
|
OFILES="${OFILES} ${GSTARGET}/${O}"
|
|
iix compile ${FILE} keep=${GSTARGET}/${O}
|
|
done
|
|
# We need a local copy of JoeyLib to link.
|
|
cp -f "${LIB}/jIIgsc.a#b10000" "${TARGET}/jIIgsc.a"
|
|
cp -f "${LIB}/jIIgsc.root#b10000" "${TARGET}/jIIgsc.root"
|
|
cp -f "${LIB}/jIIgsasm.a#b10000" "${TARGET}/jIIgsasm.a"
|
|
cp -f "${LIB}/jIIgsasm.root#b10000" "${TARGET}/jIIgsasm.root"
|
|
cp -f "${LIB}/joey.a#b10000" "${TARGET}/joey.a"
|
|
iix chtyp -t obj ${GSTARGET}/jIIgsc.a
|
|
iix chtyp -t obj ${GSTARGET}/jIIgsc.root
|
|
iix chtyp -t obj ${GSTARGET}/jIIgsasm.a
|
|
iix chtyp -t obj ${GSTARGET}/jIIgsasm.root
|
|
iix chtyp -t obj ${GSTARGET}/joey.a
|
|
# Add our library files to OFILES
|
|
OFILES="${GSTARGET}/jIIgsc ${GSTARGET}/joey ${GSTARGET}/jIIgsasm ${OFILES}"
|
|
# Link.
|
|
iix -DKeepType=S16 link ${OFILES} keep=${GSTARGET}/${BUILD_PROJECT}#b3db03
|
|
rm -f *.sym || true
|
|
# Create disk image, setting known file types
|
|
DISK=${BUILD_RESULTS}/${LINE,,}/${BUILD_PROJECT}.po
|
|
${CADIUS} createvolume ${DISK} ${BUILD_PROJECT} 32MB
|
|
${CADIUS} createfolder ${DISK} ${BUILD_PROJECT}/data
|
|
${CADIUS} addfile ${DISK} ${BUILD_PROJECT} ${TARGET}/${BUILD_PROJECT}#b3db03
|
|
${CADIUS} addfile ${DISK} ${BUILD_PROJECT}/data ${LIB}/Tool222#ba0000
|
|
# Copy game data.
|
|
for FILE in "${DATA[@]}"; do
|
|
# Data conversion here!
|
|
EXTENSION="${FILE##*.}"
|
|
case ${EXTENSION,,} in
|
|
mod)
|
|
php "${IIGS}/ntpconverter/ntpconverter.php" "${FILE}"
|
|
O=`basename -s .mod ${FILE}`.ntp#060000
|
|
mv -f ${FILE} ${O}
|
|
${CADIUS} addfile ${DISK} ${BUILD_PROJECT}/data ${O}
|
|
rm ${O}
|
|
;;
|
|
|
|
*)
|
|
O=`basename ${FILE}`#060000
|
|
cp -f ${FILE} ${O}
|
|
${CADIUS} addfile ${DISK} ${BUILD_PROJECT}/data ${O}
|
|
rm ${O}
|
|
;;
|
|
esac
|
|
done
|
|
;;
|
|
|
|
SDL12 | SDL2)
|
|
export CFLAGS="${CFLAGS} -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} ${LDFIRST} ${OFILES} ${LIB}/libjoeylib.a ${LDFLAGS}
|
|
# Copy game data.
|
|
mkdir -p ${BUILD_RESULTS}/${LINE,,}/data
|
|
for FILE in "${DATA[@]}"; do
|
|
# Data conversion here!
|
|
cp -f ${FILE} ${BUILD_RESULTS}/${LINE,,}/data/.
|
|
done
|
|
;;
|
|
esac
|
|
|
|
export CFLAGS=${OLD_CFLAGS}
|
|
|
|
fi
|
|
|
|
fi
|
|
done < build.start
|
|
|
|
trim O "${BUILD_PLATFORMS}"
|
|
BUILD_PLATFORMS="${O}]"
|
|
|
|
popd
|
|
}
|
|
|
|
|
|
function doInstall() {
|
|
local GGUSER=$1
|
|
local GGPASS=$2
|
|
|
|
updateSystem
|
|
configureSFTP
|
|
|
|
git config --global user.email "no-reply@kangaroopunch.com"
|
|
git config --global user.name "JoeyBuild VM Installer"
|
|
|
|
buildIIgsToolchain "Golden Gate.msi" "Opus ][ The Software.iso" id_rsa id_rsa.pub "${GGUSER}" "${GGPASS}"
|
|
buildMacOSXToolchain MacOSX10.13.sdk.tar.xz Xcode_9.4.1.xip macos-intel
|
|
buildMacOSXToolchain MacOSX11.3.sdk.tar.xz Xcode_12.5.1.xip macos-apple
|
|
buildWatcomToolchain
|
|
buildBeOSToolchain
|
|
|
|
setCompiler linux i386
|
|
buildSDL2 ${SDL2_NEW}
|
|
|
|
setCompiler linux x86_64
|
|
buildSDL2 ${SDL2_NEW}
|
|
|
|
setCompiler macos i386
|
|
buildSDL2 ${SDL2_OLD}
|
|
|
|
setCompiler macos x86_64
|
|
buildSDL2 ${SDL2_OLD}
|
|
|
|
setCompiler macos arm
|
|
buildSDL2 ${SDL2_NEW}
|
|
|
|
setCompiler windows i386
|
|
buildSDL2 ${SDL2_NEW}
|
|
|
|
setCompiler windows x86_64
|
|
buildSDL2 ${SDL2_NEW}
|
|
|
|
setCompiler beos i386
|
|
buildSDL12
|
|
|
|
setCompiler haiku i386
|
|
buildSDL12
|
|
|
|
setCompiler haiku x86_64
|
|
buildSDL2 ${SDL2_NEW}
|
|
|
|
rebuildJoeyLib
|
|
|
|
if [[ ! -f /etc/rc.local ]]; then
|
|
echo "#!/bin/bash" | sudo tee /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
|
|
fi
|
|
}
|
|
|
|
|
|
function download() {
|
|
local URL=$1
|
|
local FILE=
|
|
|
|
trim FILE "$2"
|
|
|
|
if [[ -z ${FILE} ]]; then
|
|
FILE=${URL##*/}
|
|
fi
|
|
|
|
if [[ -e "${FILE}" ]]; then
|
|
rm -f "${FILE}"
|
|
fi
|
|
|
|
wget -O "${FILE}" ${URL}
|
|
}
|
|
|
|
|
|
function fetchGitHubRelease() {
|
|
local __RESULT=$1
|
|
local DEVELOPER=$2
|
|
local COMPONENT=$3
|
|
local EXTENSION=$4
|
|
local URL=$(curl -s https://api.github.com/repos/${DEVELOPER}/${COMPONENT}/releases \
|
|
| grep "browser_download_url.*${EXTENSION}" \
|
|
| cut -d : -f 2,3 \
|
|
| tr -d \" \
|
|
| head -n 1)
|
|
local FILE=${URL##*/}
|
|
download ${URL}
|
|
eval $__RESULT=\${FILE}
|
|
}
|
|
|
|
|
|
function rebuildJoeyLib() {
|
|
setCompiler gsos 816
|
|
buildJoeyLib
|
|
|
|
setCompiler linux i386
|
|
buildJoeyLib
|
|
|
|
setCompiler linux x86_64
|
|
buildJoeyLib
|
|
|
|
setCompiler macos i386
|
|
buildJoeyLib
|
|
|
|
setCompiler macos x86_64
|
|
buildJoeyLib
|
|
|
|
setCompiler macos arm
|
|
buildJoeyLib
|
|
|
|
setCompiler windows i386
|
|
buildJoeyLib
|
|
|
|
setCompiler windows x86_64
|
|
buildJoeyLib
|
|
|
|
setCompiler beos i386
|
|
buildJoeyLib
|
|
|
|
setCompiler haiku i386
|
|
buildJoeyLib
|
|
|
|
setCompiler haiku x86_64
|
|
buildJoeyLib
|
|
|
|
rm -f dist.tar.bz2 || true
|
|
tar cJf dist.tar.bz2 dist
|
|
}
|
|
|
|
|
|
function setCompiler() {
|
|
local OS=$1
|
|
local CPU=$2
|
|
local DIR=
|
|
local HEADERS=
|
|
|
|
case ${OS} in
|
|
beos)
|
|
case ${CPU} in
|
|
i386)
|
|
NAME="beos-intel"
|
|
ARCH=i386
|
|
TRIPLE="i586-pc-haiku"
|
|
DIR=${EHOME}/cross/beos/generated/cross-tools-x86_gcc2/bin
|
|
HEADERS=${EHOME}/cross/beos/generated/cross-tools-x86_gcc2/i586-pc-haiku/include
|
|
;;
|
|
esac
|
|
BACKEND=SDL12
|
|
export CFLAGS="-I${HEADERS} -I${HEADERS}/be -I${HEADERS}/be/app -I${HEADERS}/be/kernel -I${HEADERS}/be/interface -I${HEADERS}/be/support -I${HEADERS}/be/storage -I${HEADERS}/be/game -I${HEADERS}/be/media -I${HEADERS}/be/device -I${HEADERS}/be/drivers -I${HEADERS}/be/opengl -I${HEADERS}/be/add-ons/graphics -I${HEADERS}/posix" \
|
|
export LDFLAGS=
|
|
export PATH=${DIR}:${OLD_PATH}
|
|
export LD_LIBRARY_PATH=
|
|
export CC=${TRIPLE}-gcc
|
|
export AR=${TRIPLE}-ar
|
|
;;
|
|
|
|
gsos)
|
|
case ${CPU} in
|
|
816)
|
|
NAME="gsos-wdc"
|
|
ARCH=816
|
|
;;
|
|
|
|
esac
|
|
BACKEND=orca
|
|
export PATH=${OLD_PATH}:${IIGS}
|
|
"${IIGS}/mountORCA.sh"
|
|
;;
|
|
|
|
haiku)
|
|
case ${CPU} in
|
|
i386)
|
|
NAME="haiku-intel"
|
|
ARCH=i386
|
|
TRIPLE="i586-pc-haiku"
|
|
DIR=${EHOME}/cross/haiku32/generated/cross-tools-x86_gcc2/bin
|
|
HEADERS=${EHOME}/cross/haiku32/generated/cross-tools-x86_gcc2/i586-pc-haiku/include
|
|
export CFLAGS="-I${HEADERS}/c++/2.95.3"
|
|
BACKEND=SDL12
|
|
;;
|
|
|
|
x86_64)
|
|
NAME="haiku-intel"
|
|
ARCH=x86_64
|
|
TRIPLE="x86_64-unknown-haiku"
|
|
DIR=${EHOME}/cross/haiku64/generated/cross-tools-x86_64/bin
|
|
HEADERS=${EHOME}/cross/haiku64/generated/cross-tools-x86_64/x86_64-unknown-haiku/include
|
|
export CFLAGS="-I${HEADERS}/c++/11.3.0 -I${HEADERS}/c++"
|
|
BACKEND=SDL2
|
|
;;
|
|
esac
|
|
export CFLAGS="${CFLAGS} -I${HEADERS} -I${HEADERS}/glibc -I${HEADERS}/be -I${HEADERS}/be/app -I${HEADERS}/be/locale -I${HEADERS}/be/kernel -I${HEADERS}/be/interface -I${HEADERS}/be/support -I${HEADERS}/be/storage -I${HEADERS}/be/game -I${HEADERS}/be/media -I${HEADERS}/be/device -I${HEADERS}/be/drivers -I${HEADERS}/be/opengl -I${HEADERS}/be/add-ons/graphics -I${HEADERS}/posix" \
|
|
export LDFLAGS=
|
|
export PATH=${DIR}:${OLD_PATH}
|
|
export LD_LIBRARY_PATH=
|
|
export CC=${TRIPLE}-gcc
|
|
export AR=${TRIPLE}-ar
|
|
;;
|
|
|
|
linux)
|
|
case ${CPU} in
|
|
i386)
|
|
NAME="linux-intel"
|
|
ARCH=i386
|
|
TRIPLE="x86_64-linux-gnu"
|
|
export CFLAGS="-m32"
|
|
;;
|
|
|
|
x86_64)
|
|
NAME="linux-intel"
|
|
ARCH=x86_64
|
|
TRIPLE="${ARCH}-linux-gnu"
|
|
export CFLAGS=
|
|
;;
|
|
|
|
esac
|
|
BACKEND=SDL2
|
|
LDFIRST=
|
|
export LDFLAGS=
|
|
export PATH=${OLD_PATH}
|
|
export LD_LIBRARY_PATH=
|
|
export CC=${TRIPLE}-gcc
|
|
export AR=${TRIPLE}-ar
|
|
;;
|
|
|
|
macos)
|
|
case ${CPU} in
|
|
i386)
|
|
NAME="macos-intel"
|
|
ARCH=i386
|
|
TRIPLE="${ARCH}-apple-darwin17"
|
|
;;
|
|
|
|
x86_64)
|
|
NAME="macos-intel"
|
|
ARCH=x86_64
|
|
TRIPLE="${ARCH}-apple-darwin17"
|
|
;;
|
|
|
|
arm)
|
|
NAME="macos-apple"
|
|
ARCH=aarch64
|
|
TRIPLE="${ARCH}-apple-darwin20.4"
|
|
;;
|
|
|
|
esac
|
|
BACKEND=SDL2
|
|
LDFIRST=
|
|
export CFLAGS=
|
|
export LDFLAGS=
|
|
export PATH=${EHOME}/cross/${NAME}/bin:${OLD_PATH}
|
|
export LD_LIBRARY_PATH=${EHOME}/cross/${NAME}/lib
|
|
export CC=${TRIPLE}-clang
|
|
export AR=${TRIPLE}-ar
|
|
sudo rm -f /usr/lib/llvm-10/lib/clang/10.0.0/lib/darwin || true
|
|
sudo ln -s ${EHOME}/cross/${NAME}/darwin /usr/lib/llvm-10/lib/clang/10.0.0/lib/.
|
|
;;
|
|
|
|
win32)
|
|
case ${CPU} in
|
|
i386)
|
|
NAME="win32-watcom"
|
|
ARCH="i386"
|
|
TRIPLE="win32-watcom-i386"
|
|
BACKEND=SDL12
|
|
export WATCOM=${EHOME}/cross/watcom
|
|
export PATH=${WATCOM}/binl64:${WATCOM}/binl:${OLD_PATH}
|
|
export EDPATH=${WATCOM}/eddat
|
|
export INCLUDE=${WATCOM}/lh
|
|
;;
|
|
esac
|
|
;;
|
|
|
|
windows)
|
|
case ${CPU} in
|
|
i386)
|
|
NAME="windows-intel"
|
|
ARCH=i686
|
|
TRIPLE="${ARCH}-w64-mingw32"
|
|
;;
|
|
|
|
x86_64)
|
|
NAME="windows-intel"
|
|
ARCH=x86_64
|
|
TRIPLE="${ARCH}-w64-mingw32"
|
|
;;
|
|
|
|
esac
|
|
BACKEND=SDL2
|
|
LDFIRST="-lmingw32"
|
|
export PATH=${OLD_PATH}
|
|
export LD_LIBRARY_PATH=
|
|
export CFLAGS=
|
|
export LDFLAGS=
|
|
export CC=${TRIPLE}-gcc
|
|
export AR=${TRIPLE}-ar
|
|
;;
|
|
|
|
esac
|
|
|
|
INSTALLED=${EHOME}/installed/${NAME}-${ARCH}
|
|
mkdir -p ${INSTALLED}
|
|
}
|
|
|
|
|
|
function scriptIsDownloaded() {
|
|
local ACTION=$1
|
|
|
|
case ${ACTION} in
|
|
add)
|
|
addBuildUser "${2}" "${3}"
|
|
;;
|
|
|
|
build)
|
|
doBuild "${2}" "${3}"
|
|
;;
|
|
|
|
del)
|
|
delBuildUser "${2}"
|
|
;;
|
|
|
|
install)
|
|
doInstall "${2}" "${3}"
|
|
;;
|
|
|
|
rebuild)
|
|
rebuildJoeyLib
|
|
;;
|
|
|
|
server)
|
|
startBuildServer "${2}" "${3}"
|
|
;;
|
|
|
|
*)
|
|
set +x
|
|
echo ""
|
|
echo "${0} add USER PASS"
|
|
echo "${0} build DIST SRC"
|
|
echo "${0} del USER"
|
|
echo "${0} install GGUSER GGPASS"
|
|
echo "${0} rebuild"
|
|
echo "${0} server DIST LOG"
|
|
set -x
|
|
;;
|
|
esac
|
|
}
|
|
|
|
|
|
function startBuildServer() {
|
|
local DIST=$1
|
|
local LOG=$2
|
|
local USERNAME=
|
|
local FILE=
|
|
|
|
# Log startup.
|
|
echo "$(date) - Startup ${0}" >> ${LOG}
|
|
|
|
cd /home
|
|
|
|
while true; do
|
|
|
|
# Find users with a "build.start" file.
|
|
for USERNAME in $(ls -1); do
|
|
|
|
mkdir -p "${USERNAME}/build"
|
|
chown -R ${USERNAME}:${USERNAME} "${USERNAME}/build"
|
|
chmod u+rwX "${USERNAME}/build"
|
|
chmod go-rwx "${USERNAME}/build"
|
|
|
|
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 "${DIST}" /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 "${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
|
|
|
|
# Log it.
|
|
echo "$(date) - Compiled ${BUILD_PROJECT} for ${USERNAME} on ${BUILD_PLATFORMS}" >> ${LOG}
|
|
|
|
popd
|
|
fi
|
|
done
|
|
|
|
sleep 1
|
|
|
|
done
|
|
}
|
|
|
|
|
|
function trim() {
|
|
local __RESULT=$1
|
|
local __VAR="${*:2}"
|
|
|
|
# remove leading whitespace characters
|
|
__VAR="${__VAR#"${__VAR%%[![:space:]]*}"}"
|
|
# remove trailing whitespace characters
|
|
__VAR="${__VAR%"${__VAR##*[![:space:]]}"}"
|
|
|
|
eval $__RESULT=\${__VAR}
|
|
}
|
|
|
|
|
|
function updateSystem() {
|
|
sudo apt update
|
|
sudo apt -y upgrade
|
|
sudo apt -y dist-upgrade
|
|
sudo dpkg --add-architecture i386
|
|
sudo apt -y install \
|
|
attr \
|
|
autoconf \
|
|
bison \
|
|
build-essential \
|
|
bzip2 \
|
|
clang \
|
|
cmake \
|
|
cpio \
|
|
flex \
|
|
gawk \
|
|
gcc-multilib \
|
|
gzip \
|
|
libbz2-dev \
|
|
liblzma-dev \
|
|
libssl-dev \
|
|
libxml2-dev \
|
|
libzstd-dev \
|
|
llvm \
|
|
mingw-w64 \
|
|
mtools \
|
|
nasm \
|
|
patch \
|
|
php-cli \
|
|
sed \
|
|
unzip \
|
|
uuid-dev \
|
|
xz-utils \
|
|
zlib1g-dev
|
|
# ORCA / GoldenGate Stuff
|
|
sudo apt -y install \
|
|
genisoimage \
|
|
jfsutils \
|
|
msitools \
|
|
ragel
|
|
}
|
|
|
|
|
|
scriptIsDownloaded "$1" "$2" "$3"
|