diff --git a/README.md b/README.md index e8b8f1bd..12dd4dd2 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,12 @@ -# ESP32 Arduino Lib Builder [![ESP32 Arduino Libs CI](https://github.com/espressif/esp32-arduino-lib-builder/actions/workflows/push.yml/badge.svg)](https://github.com/espressif/esp32-arduino-lib-builder/actions/workflows/push.yml) +# ESP32 Arduino Lib Builder This repository contains the scripts that produce the libraries included with esp32-arduino. Tested on Ubuntu (32 and 64 bit), Raspberry Pi and MacOS. ### Build on Ubuntu and Raspberry Pi -```bash -git clone -b release/v2.0.13 https://github.com/esp-arduino-libs/esp32-arduino-lib-builder.git -cd esp32-arduino-lib-builder +```bash // Build all targets ./build.sh diff --git a/build.sh b/build.sh index 580e7fed..e09a62ea 100755 --- a/build.sh +++ b/build.sh @@ -14,6 +14,7 @@ TARGET="all" BUILD_TYPE="all" SKIP_ENV=0 COPY_OUT=0 +ARCHIVE_OUT=0 if [ -z $DEPLOY_OUT ]; then DEPLOY_OUT=0 fi @@ -24,6 +25,7 @@ function print_help() { echo " -A Set which branch of arduino-esp32 to be used for compilation" echo " -I Set which branch of ESP-IDF to be used for compilation" echo " -i Set which commit of ESP-IDF to be used for compilation" + echo " -e Archive the build to dist" echo " -d Deploy the build to github arduino-esp32" echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME/Arduino/hardware/espressif/esp32'" echo " -t Set the build target(chip). ex. 'esp32s3'" @@ -32,7 +34,7 @@ function print_help() { exit 1 } -while getopts ":A:I:i:c:t:b:sd" opt; do +while getopts ":A:I:i:c:t:b:sde" opt; do case ${opt} in s ) SKIP_ENV=1 @@ -40,6 +42,9 @@ while getopts ":A:I:i:c:t:b:sd" opt; do d ) DEPLOY_OUT=1 ;; + e ) + ARCHIVE_OUT=1 + ;; c ) export ESP32_ARDUINO="$OPTARG" COPY_OUT=1 @@ -58,10 +63,10 @@ while getopts ":A:I:i:c:t:b:sd" opt; do ;; b ) b=$OPTARG - if [ "$b" != "build" ] && - [ "$b" != "menuconfig" ] && - [ "$b" != "idf_libs" ] && - [ "$b" != "copy_bootloader" ] && + if [ "$b" != "build" ] && + [ "$b" != "menuconfig" ] && + [ "$b" != "idf_libs" ] && + [ "$b" != "copy_bootloader" ] && [ "$b" != "mem_variant" ]; then print_help fi @@ -80,6 +85,8 @@ done shift $((OPTIND -1)) CONFIGS=$@ +source ./tools/config.sh + if [ $SKIP_ENV -eq 0 ]; then echo "* Installing/Updating ESP-IDF and all components..." # update components from git @@ -89,8 +96,6 @@ if [ $SKIP_ENV -eq 0 ]; then # install esp-idf source ./tools/install-esp-idf.sh if [ $? -ne 0 ]; then exit 1; fi -else - source ./tools/config.sh fi if [ "$BUILD_TYPE" != "all" ]; then @@ -99,7 +104,7 @@ if [ "$BUILD_TYPE" != "all" ]; then print_help fi configs="configs/defconfig.common;configs/defconfig.$TARGET" - + # Target Features Configs for target_json in `jq -c '.targets[]' configs/builds.json`; do target=$(echo "$target_json" | jq -c '.target' | tr -d '"') @@ -196,16 +201,7 @@ if [ "$BUILD_TYPE" = "all" ]; then fi # archive the build -if [ "$BUILD_TYPE" = "all" ]; then - ./tools/archive-build.sh +if [ $ARCHIVE_OUT -eq 1 ]; then + ./tools/archive-build.sh "$TARGET" if [ $? -ne 0 ]; then exit 1; fi fi - -# copy everything to arduino-esp32 installation -if [ $COPY_OUT -eq 1 ] && [ -d "$ESP32_ARDUINO" ]; then - ./tools/copy-to-arduino.sh -fi - -if [ $DEPLOY_OUT -eq 1 ]; then - ./tools/push-to-arduino.sh -fi diff --git a/tools/archive-build.sh b/tools/archive-build.sh index 432f6903..2f95a787 100755 --- a/tools/archive-build.sh +++ b/tools/archive-build.sh @@ -1,16 +1,12 @@ #!/bin/bash -IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "") -IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD || echo "") +source ./tools/config.sh idf_version_string=${IDF_BRANCH//\//_}"-$IDF_COMMIT" -archive_path="dist/arduino-esp32-libs-$idf_version_string.tar.gz" -build_archive_path="dist/arduino-esp32-build-$idf_version_string.tar.gz" -mkdir -p dist && rm -rf "$archive_path" "$build_archive_path" +archive_path="dist/arduino-esp32-libs-$1-$idf_version_string.tar.gz" + +mkdir -p dist && rm -rf "$archive_path" if [ -d "out" ]; then cd out && tar zcf "../$archive_path" * && cd .. fi -if [ -d "build" ]; then - cd build && tar zcf "../$build_archive_path" * && cd .. -fi diff --git a/tools/config.sh b/tools/config.sh index e3f73980..f92384ca 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -1,14 +1,12 @@ #!/bin/bash +export IDF_BRANCH="release/v4.4" +export IDF_COMMIT="ac5d805d0e" if [ -z $IDF_PATH ]; then export IDF_PATH="$PWD/esp-idf" fi -if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="release/v4.4" -fi - if [ -z $AR_PR_TARGET_BRANCH ]; then AR_PR_TARGET_BRANCH="release/v2.x" fi diff --git a/tools/current_commit.sh b/tools/current_commit.sh index 8d890dc5..b7d2a9b0 100755 --- a/tools/current_commit.sh +++ b/tools/current_commit.sh @@ -1,2 +1,3 @@ -IDF_COMMIT=$(wget -q -O- "https://github.com/espressif/arduino-esp32/search?q=update+idf&type=Commits" | grep -i "update idf" | grep -e "to [0-9a-f]*" | sed "s/^.*to \([0-9a-f]*\).*/\1/" | head -1) +source ./tools/config.sh + echo Current commit is $IDF_COMMIT diff --git a/tools/install-esp-idf.sh b/tools/install-esp-idf.sh index b9d0d7c6..12186d2f 100755 --- a/tools/install-esp-idf.sh +++ b/tools/install-esp-idf.sh @@ -2,8 +2,6 @@ source ./tools/config.sh -IDF_COMMIT="ac5d805d0e" - if ! [ -x "$(command -v $SED)" ]; then echo "ERROR: $SED is not installed! Please install $SED first." exit 1 @@ -39,8 +37,6 @@ fi # source $IDF_PATH/export.sh -export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD) -export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD) # # SETUP ARDUINO DEPLOY