#!/usr/bin/env bash # Vendor the third-party sources the desktop build needs, from ESP-IDF (espressif/idf:v6.1) and the cJSON # managed component, then patch the two spots that use mbedTLS/PSA (see patch_vendor.py). # Run from the repository root after changing the IDF version: desktop/tools/vendor.sh set -euo pipefail cd "$(dirname "$0")/../.." IDF_IMAGE=${IDF_IMAGE:-espressif/idf:v6.1} OUT=desktop/third_party rm -rf "$OUT/esp_http_server" "$OUT/http_parser" "$OUT/cjson" mkdir -p "$OUT/esp_http_server/src/util" "$OUT/esp_http_server/include" "$OUT/http_parser" "$OUT/cjson" docker run --rm -v "$PWD/$OUT:/out" "$IDF_IMAGE" bash -c ' set -e; S=/opt/esp/idf/components cp $S/esp_http_server/src/*.c $S/esp_http_server/src/esp_httpd_priv.h /out/esp_http_server/src/ cp $S/esp_http_server/src/util/* /out/esp_http_server/src/util/ cp $S/esp_http_server/include/esp_http_server.h /out/esp_http_server/include/ cp $S/http_parser/http_parser.c $S/http_parser/http_parser.h $S/http_parser/LICENSE.txt /out/http_parser/ cp $S/esp_http_server/LICENSE /out/esp_http_server/ 2>/dev/null || true chown -R 0:0 /out ' # cJSON: the managed component the board and the sim already use (version pinned in dependencies.lock) CJSON=sim-controller/managed_components/espressif__cjson/cJSON cp "$CJSON/cJSON.c" "$CJSON/cJSON.h" "$CJSON/LICENSE" "$OUT/cjson/" python3 desktop/tools/patch_vendor.py "$OUT" # sdkconfig.h: the config the sim's ESP-IDF linux build generated (the same CONFIG_* values the firmware reads) if [ -f sim-controller/build/config/sdkconfig.h ]; then cp sim-controller/build/config/sdkconfig.h desktop/port/include/sdkconfig.h fi echo "vendored into $OUT"