80 lines
2.2 KiB
Bash
Executable file
80 lines
2.2 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.
|
|
#
|
|
|
|
|
|
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
|
|
}
|
|
|
|
|
|
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 llvm-mos/mos-platform/f256
|
|
mkdir -p llvm-mos/bin
|
|
|
|
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 .
|
|
|
|
buildOverlayTool linux x86_64 $(pwd)/overlay.linux
|
|
buildOverlayTool macos aarch64 $(pwd)/overlay.macos
|
|
buildOverlayTool windows x86_64 $(pwd)/overlay.windows
|
|
|
|
tar cJf ../llvm-mos-f256.tar.xz .
|
|
7z a ../llvm-mos-f256.7z .
|
|
|
|
popd
|
|
popd
|