Like this:
# Use absolute paths, since relative paths like ~/Projects won't be expanded.
# - deps ------------------------------------------------------------------
sudo port install ninja # or brew install ninja
cargo install xargo
# - build llvm ------------------------------------------------------------
cd /mnt/flowdsp/deps/versions/rust-xtensa
git clone https://github.com/espressif/llvm-xtensa.git llvm-xtensa.git
git clone https://github.com/espressif/clang-xtensa.git llvm-xtensa.git/tools/clang
mkdir llvm_build
cd llvm_build
CGLAGS=-O2 cmake ../llvm-xtensa.git -DLLVM_TARGETS_TO_BUILD="Xtensa;X86" -DCMAKE_BUILD_TYPE=Release -G "Ninja"
cmake --build .
# - build rustc -----------------------------------------------------------
cd /mnt/flowdsp/deps/versions/rust-xtensa
git clone https://github.com/MabezDev/rust-xtensa.git rust-xtensa.git
cd rust-xtensa.git
mkdir ../rustc_build
CGLAGS=-O2 ./configure --llvm-root="/mnt/flowdsp/deps/versions/rust-xtensa/llvm_build" --prefix="/mnt/flowdsp/deps/versions/rust-xtensa/rustc_build"
python ./x.py --help # this fetches things from git.
python ./x.py build
python ./x.py install
# - link to rustup --------------------------------------------------------
rustup toolchain link xtensa "/mnt/flowdsp/deps/versions/rust-xtensa/rustc_build"
rustup run xtensa rustc --print target-list | grep xtensa
# - hello world ----------------------------------------------------------
export IDF_PATH=/mnt/flowdsp/deps/esp-idf
cd $IDF_PATH
. ./export.sh
cd /mnt/flowdsp/deps/versions/rust-xtensa/xtensa-blinky.git # where is this?
source setenv
cd components/rust
rustup run xtensa xargo build --target xtensa-esp32-none-elf --release
ulimit -n 1024 && idf.py build
ulimit -n 1024 && idf.py -p /dev/cu.SLAB_USBtoUART flash && idf.py -p /dev/cu.SLAB_USBtoUART monitor
https://gist.github.com/antoinevg/a4070a29005b8096efbfe1a6c610bbbe