Skip to content
This repository was archived by the owner on May 24, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e -u -o pipefail

readonly MRUSTC_VER='b5b7089'
readonly MRUSTC_VER='master'
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't change this to master. Instead, use the hash of the commit that is currently HEAD of master.

readonly SDK_VER='2.4.1'

readonly INSTALL_DIR="${HOME}/.esp-rs"
Expand All @@ -11,6 +11,15 @@ readonly SDK_ROOT="${INSTALL_DIR}/esp8266-arduino"
readonly TOOLCHAIN_ROOT="${HOME}/.platformio/packages/toolchain-xtensa"
readonly PROJECT_DIR="${PWD}"

function processor_count() {
OSTYPE=`uname`
if [[ "$OSTYPE" == "Darwin" ]]; then
return `sysctl -n hw.physicalcpu`
else
return `nproc`
fi
}

function main() {
if [[ "${1:-}" == '--install' ]]; then
install_toolchain
Expand Down Expand Up @@ -65,7 +74,7 @@ function install_toolchain() {

checkout_git_revision 'https://github.com/thepowersgang/mrustc.git' "${MRUSTC_VER}" "${MRUSTC_DIR}" 'mrustc'
echo "Building mrustc/minicargo@${MRUSTC_VER}"
( cd "${MRUSTC_DIR}" && make RUSTCSRC && make -f minicargo.mk PARLEVEL=$(nproc) LIBS )
( cd "${MRUSTC_DIR}" && make -j $(processor_count) RUSTCSRC && make -f minicargo.mk PARLEVEL=$(processor_count) LIBS )
checkout_git_revision 'https://github.com/esp8266/Arduino.git' "${SDK_VER}" "${SDK_ROOT}" 'ESP8266 Arduino SDK'
if ! [[ -d "${TOOLCHAIN_ROOT}" ]]; then
echo 'Installing PlatformIO ESP8266 Arduino SDK...'
Expand Down