112 lines
2.8 KiB
Bash
Executable file
112 lines
2.8 KiB
Bash
Executable file
#!/bin/bash -e
|
|
|
|
#
|
|
# Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
# in the Software without restriction, including without limitation the rights
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
# SOFTWARE.
|
|
#
|
|
|
|
|
|
#
|
|
# NOTE: This script depends on "Toolchains" bein installed in a parallel
|
|
# directory to the directory that contains this script.
|
|
#
|
|
# https://skunkworks.kangaroopunch.com/skunkworks/toolchains
|
|
#
|
|
|
|
|
|
ROOT=$(pwd)
|
|
INSTALL=${ROOT}/llvm-mos
|
|
|
|
|
|
function buildOverlayTool() {
|
|
local OS=$1
|
|
local ARCH=$2
|
|
local TARGET=$3
|
|
|
|
source <(${ROOT}/../toolchains/toolchains.sh use ${ARCH} ${OS})
|
|
|
|
pushd tools/shared
|
|
${CC} -c util.c
|
|
popd
|
|
pushd tools/overlay
|
|
${CC} overlay.c ../shared/util.o -o ${TARGET} -lm
|
|
popd
|
|
|
|
rm tools/shared/util.o
|
|
}
|
|
|
|
|
|
if [[ "${1,,}" == "all" ]]; then
|
|
./build-llvm-mos.sh
|
|
./update-defines.sh
|
|
./build-merlin.sh
|
|
fi
|
|
|
|
./build-f256lib.sh
|
|
|
|
pushd distro
|
|
if [[ -d .builddir ]]; then
|
|
rm -rf .builddir
|
|
fi
|
|
mkdir -p .builddir
|
|
pushd .builddir
|
|
mkdir -p f256dev/llvm-mos/mos-platform/f256
|
|
mkdir -p f256dev/llvm-mos/bin
|
|
|
|
pushd f256dev
|
|
|
|
cp -Rf ${INSTALL}/mos-platform/f256/* llvm-mos/mos-platform/f256/.
|
|
cp -f ${INSTALL}/bin/mos-f256.cfg llvm-mos/bin/.
|
|
|
|
cp -Rf ${ROOT}/tools .
|
|
cp -Rf ${ROOT}/examples .
|
|
cp -Rf ${ROOT}/f256lib .
|
|
cp -Rf ${ROOT}/include .
|
|
cp -f ${ROOT}/f256lib.h .
|
|
cp -f ${ROOT}/pgz-thunk.py .
|
|
|
|
cp -f ../../README .
|
|
cp -f ../../f256build.bat .
|
|
cp -f ../../f256run.bat .
|
|
cp -f ../../f256build.sh .
|
|
cp -f ../../f256run.sh .
|
|
|
|
buildOverlayTool linux x86_64 $(pwd)/overlay.linux
|
|
buildOverlayTool macos aarch64 $(pwd)/overlay.macos
|
|
buildOverlayTool windows x86_64 $(pwd)/overlay.windows
|
|
|
|
cp -f ../../f256lib.adoc .
|
|
asciidoctor-pdf -o f256lib.pdf f256lib.adoc
|
|
|
|
popd
|
|
|
|
if [[ -f ../f256dev.7z ]]; then
|
|
rm ../f256dev.7z
|
|
fi
|
|
7z a ../f256dev.7z .
|
|
|
|
if [[ -f ../f256dev.tar.xz ]]; then
|
|
rm ../f256dev.tar.xz
|
|
fi
|
|
tar cf ../f256dev.tar .
|
|
xz -z9e ../f256dev.tar
|
|
|
|
popd
|
|
popd
|