Skip to content

Instantly share code, notes, and snippets.

@itssoap
Last active May 30, 2023 07:18
Show Gist options
  • Save itssoap/4e81fbb665e49a268d6ca13e79c430ba to your computer and use it in GitHub Desktop.
Save itssoap/4e81fbb665e49a268d6ca13e79c430ba to your computer and use it in GitHub Desktop.
Convenience script to build Codon
#!/bin/bash
sudo apt install -y ninja-build cmake unzip
git clone --depth 1 -b codon https://github.com/exaloop/llvm-project
cmake -S llvm-project/llvm -B llvm-project/build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_TARGETS_TO_BUILD=all \
-DLLVM_ENABLE_PROJECTS=clang
cmake --build llvm-project/build
cmake --install llvm-project/build --prefix=llvm-project/install
export PATH=${PATH}:$(pwd)/llvm-project/build/bin/
curl -s https://api.github.com/repos/exaloop/codon/releases/latest | grep "zipball" | cut -d : -f 2,3 | tr -d \" | sed "s/,//g" | sed "s/ //g" | wget -O codon-latest.zip -qi -
unzip -d codon-latest codon-latest.zip
cd codon-latest
cd $(ls)
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_DIR=$(llvm-config --cmakedir) \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
cmake --build build --config Release
cmake --install build --prefix=install
echo "Run \"export PATH=\${PATH}:\$(pwd)/build\" from current directory to add CODON in your PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment