65 lines
1.9 KiB
Bash
Executable file
65 lines
1.9 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.
|
|
#
|
|
|
|
|
|
INSTALL=$(pwd)/llvm-mos
|
|
|
|
if [[ "${1,,}" == "all" ]]; then
|
|
sudo apt-get install -y cmake ninja-build
|
|
if [[ ! -d llvm-mos-source ]]; then
|
|
git clone https://github.com/llvm-mos/llvm-mos.git llvm-mos-source
|
|
fi
|
|
|
|
pushd llvm-mos-source
|
|
cmake \
|
|
-C clang/cmake/caches/MOS.cmake \
|
|
-G Ninja \
|
|
-S llvm \
|
|
-B build \
|
|
-DCMAKE_INSTALL_PREFIX=${INSTALL}
|
|
cmake --build build
|
|
cmake --install build
|
|
popd
|
|
fi
|
|
|
|
if [[ ! -d llvm-mos-sdk-source ]]; then
|
|
git clone https://github.com/llvm-mos/llvm-mos-sdk.git llvm-mos-sdk-source
|
|
fi
|
|
|
|
cp -Rf llvm-mos-sdk-patches/* llvm-mos-sdk-source/.
|
|
|
|
pushd llvm-mos-sdk-source
|
|
if [[ -d .builddir ]]; then
|
|
rm -rf .builddir
|
|
fi
|
|
mkdir -p .builddir
|
|
pushd .builddir
|
|
cmake \
|
|
-G Ninja \
|
|
-DCMAKE_INSTALL_PREFIX=${INSTALL} \
|
|
..
|
|
ninja install
|
|
popd
|
|
popd
|
|
|